- Added AI support for mass -X/-0 pump spells.

This commit is contained in:
Sloth
2012-10-12 08:25:38 +00:00
parent 6d3bb46569
commit 1f74fa8669
3 changed files with 37 additions and 12 deletions

View File

@@ -2,7 +2,7 @@ Name:Hysterical Blindness
ManaCost:2 U
Types:Instant
Text:no text
A:SP$ PumpAll | Cost$ 2 U | ValidCards$ Creature.YouDontCtrl | NumAtt$ -4 | NumDef$ 0 | IsCurse$ True |SpellDescription$ Creatures your opponents control get -4/-0 until end of turn.
A:SP$ PumpAll | Cost$ 2 U | ValidCards$ Creature.YouDontCtrl | NumAtt$ -4 | NumDef$ 0 | IsCurse$ True | SpellDescription$ Creatures your opponents control get -4/-0 until end of turn.
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/hysterical_blindness.jpg
SetInfo:ISD|Common|http://magiccards.info/scans/en/isd/59.jpg

View File

@@ -2,8 +2,8 @@ Name:Lethargy Trap
ManaCost:3 U
Types:Instant Trap
Text:no text
A:SP$ PumpAll | Cost$ 3 U | ValidCards$ Creature.attacking | NumAtt$ -3 | IsPresent$ Creature.attacking | PresentCompare$ LE2 | SpellDescription$ If three or more creatures are attacking, you may pay U rather than pay CARDNAME mana cost.
A:SP$ PumpAll | Cost$ U | ValidCards$ Creature.attacking | NumAtt$ -3 | IsPresent$ Creature.attacking | PresentCompare$ GE3 | SpellDescription$ Attacking creatures get -3/-0 until end of turn.
A:SP$ PumpAll | Cost$ 3 U | ValidCards$ Creature.attacking | NumAtt$ -3 | IsCurse$ True | SpellDescription$ Attacking creatures get -3/-0 until end of turn.
A:SP$ PumpAll | Cost$ U | ValidCards$ Creature.attacking | NumAtt$ -3 | IsCurse$ True | IsPresent$ Creature.attacking | PresentCompare$ GE3 | NonBasicSpell$ True | SpellDescription$ If three or more creatures are attacking, you may pay U rather than pay CARDNAME mana cost.
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/lethargy_trap.jpg
SetInfo:ZEN|Common|http://magiccards.info/scans/en/zen/51.jpg

View File

@@ -772,7 +772,6 @@ public class AbilityFactoryPump {
list = new ArrayList<Card>();
}
}
Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_BEGIN);
} // -X/0 end
else if (!list.isEmpty()) {
final ArrayList<String> keywords = this.keywords;
@@ -1758,6 +1757,32 @@ public class AbilityFactoryPump {
}
}); // leaves all creatures that will be destroyed
} // -X/-X end
else if (power < 0) { // -X/-0
if (phase.isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
|| phase.isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|| Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer())
|| Singletons.getModel().getGameState().getPhaseHandler().isPreventCombatDamageThisTurn()) {
return false;
}
int totalPower = 0;
for (Card c : human) {
if (!c.isAttacking()) {
continue;
}
totalPower += Math.min(c.getNetAttack(), power * -1);
if (phase == PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY
&& AllZone.getCombat().getUnblockedAttackers().contains(c)) {
if (CombatUtil.lifeInDanger(sa.getActivatingPlayer(), AllZone.getCombat())) {
return true;
}
totalPower += Math.min(c.getNetAttack(), power * -1);
}
if (totalPower >= power * -2) {
return true;
}
}
return false;
} // -X/-0 end
// evaluate both lists and pass only if human creatures are more
// valuable