- CheckStyle.

This commit is contained in:
Chris
2012-11-11 15:19:52 +00:00
parent a30d637df4
commit 0bb91bb8d0

View File

@@ -24,7 +24,7 @@ import forge.game.zone.ZoneType;
*/ */
public class AnimateAi extends SpellAiLogic { public class AnimateAi extends SpellAiLogic {
/* (non-Javadoc) /* (non-Javadoc)
* @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility) * @see forge.card.abilityfactory.SpellAiLogic#canPlayAI(forge.game.player.Player, java.util.Map, forge.card.spellability.SpellAbility)
*/ */
@@ -32,50 +32,50 @@ public class AnimateAi extends SpellAiLogic {
protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) { protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) {
final Target tgt = sa.getTarget(); final Target tgt = sa.getTarget();
final Card source = sa.getSourceCard(); final Card source = sa.getSourceCard();
// TODO - add some kind of check to answer // TODO - add some kind of check to answer
// "Am I going to attack with this?" // "Am I going to attack with this?"
// TODO - add some kind of check for during human turn to answer // TODO - add some kind of check for during human turn to answer
// "Can I use this to block something?" // "Can I use this to block something?"
// don't use instant speed animate abilities outside computers // don't use instant speed animate abilities outside computers
// Combat_Begin step // Combat_Begin step
if (!Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_BEGIN) if (!Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_BEGIN)
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(aiPlayer) && Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(aiPlayer)
&& !AbilityFactory.isSorcerySpeed(sa) && !AbilityFactory.isSorcerySpeed(sa)
&& !sa.hasParam("ActivationPhases") && !sa.hasParam("Permanent")) { && !sa.hasParam("ActivationPhases") && !sa.hasParam("Permanent")) {
return false; return false;
} }
Player opponent = aiPlayer.getOpponent(); Player opponent = aiPlayer.getOpponent();
// don't animate if the AI won't attack anyway // don't animate if the AI won't attack anyway
if (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(aiPlayer) if (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(aiPlayer)
&& aiPlayer.getLife() < 6 && aiPlayer.getLife() < 6
&& opponent.getLife() > 6 && opponent.getLife() > 6
&& Iterables.any(opponent.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES)) { && Iterables.any(opponent.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES)) {
return false; return false;
} }
// don't use instant speed animate abilities outside humans // don't use instant speed animate abilities outside humans
// Combat_Declare_Attackers_InstantAbility step // Combat_Declare_Attackers_InstantAbility step
if ((!Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) if ((!Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|| (Singletons.getModel().getGame().getCombat().getAttackers().isEmpty())) || (Singletons.getModel().getGame().getCombat().getAttackers().isEmpty()))
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(opponent)) { && Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(opponent)) {
return false; return false;
} }
// don't activate during main2 unless this effect is permanent // don't activate during main2 unless this effect is permanent
if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.MAIN2) && !sa.hasParam("Permanent")) { if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.MAIN2) && !sa.hasParam("Permanent")) {
return false; return false;
} }
if (null == tgt) { if (null == tgt) {
final ArrayList<Card> defined = AbilityFactory.getDefinedCards(source, sa.getParam("Defined"), sa); final ArrayList<Card> defined = AbilityFactory.getDefinedCards(source, sa.getParam("Defined"), sa);
boolean bFlag = false; boolean bFlag = false;
for (final Card c : defined) { for (final Card c : defined) {
bFlag |= (!c.isCreature() && !c.isTapped() && !(c.getTurnInZone() == Singletons.getModel().getGame().getPhaseHandler().getTurn())); bFlag |= (!c.isCreature() && !c.isTapped() && !(c.getTurnInZone() == Singletons.getModel().getGame().getPhaseHandler().getTurn()));
// for creatures that could be improved (like Figure of Destiny) // for creatures that could be improved (like Figure of Destiny)
if (c.isCreature() && (sa.hasParam("Permanent") || (!c.isTapped() && !c.isSick()))) { if (c.isCreature() && (sa.hasParam("Permanent") || (!c.isTapped() && !c.isSick()))) {
int power = -5; int power = -5;
@@ -90,9 +90,9 @@ public class AnimateAi extends SpellAiLogic {
bFlag = true; bFlag = true;
} }
} }
} }
if (!bFlag) { // All of the defined stuff is animated, not very if (!bFlag) { // All of the defined stuff is animated, not very
// useful // useful
return false; return false;
@@ -103,13 +103,12 @@ public class AnimateAi extends SpellAiLogic {
return false; return false;
} }
} }
return true; return true;
} }
// end animateCanPlayAI() // end animateCanPlayAI()
@Override @Override
public boolean chkAIDrawback(SpellAbility sa, Player aiPlayer) { public boolean chkAIDrawback(SpellAbility sa, Player aiPlayer) {
if (sa.getTarget() != null) { if (sa.getTarget() != null) {
@@ -118,7 +117,7 @@ public class AnimateAi extends SpellAiLogic {
return false; return false;
} }
} }
return true; return true;
} }
@@ -137,18 +136,18 @@ public class AnimateAi extends SpellAiLogic {
*/ */
@Override @Override
protected boolean doTriggerAINoCost(Player aiPlayer, SpellAbility sa, boolean mandatory) { protected boolean doTriggerAINoCost(Player aiPlayer, SpellAbility sa, boolean mandatory) {
if (sa.getTarget() != null && !animateTgtAI(sa) && !mandatory) { if (sa.getTarget() != null && !animateTgtAI(sa) && !mandatory) {
return false; return false;
} }
// Improve AI for triggers. If source is a creature with: // Improve AI for triggers. If source is a creature with:
// When ETB, sacrifice a creature. Check to see if the AI has something // When ETB, sacrifice a creature. Check to see if the AI has something
// to sacrifice // to sacrifice
// Eventually, we can call the trigger of ETB abilities with // Eventually, we can call the trigger of ETB abilities with
// not mandatory as part of the checks to cast something // not mandatory as part of the checks to cast something
return true; return true;
} }
@@ -171,5 +170,5 @@ public class AnimateAi extends SpellAiLogic {
// good job of picking a good target // good job of picking a good target
return false; return false;
} }
} }