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