- Small AI improvement for PreventDamage

- Small tweaks to Downhill Charge and Keeper of the Mind
This commit is contained in:
Sol
2012-04-21 20:55:24 +00:00
parent 2e1e94b84b
commit 2611c9cd70
3 changed files with 11 additions and 7 deletions

View File

@@ -3,7 +3,7 @@ ManaCost:2 R
Types:Instant
Text:no text
A:SP$ Pump | Cost$ 2 R | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +X | SpellDescription$ Target creature gets +X/+0 until end of turn, where X is the number of Mountains you control.
A:SP$ Pump | Cost$ Sac<1/Mountain> | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumAtt$ +X | SpellDescription$ You may sacrifice a Mountain rather than pay CARDNAME's mana cost.
SVar:AltCost:Cost$ Sac<1/Mountain> | Description$ You may sacrifice a Mountain rather than pay CARDNAME's mana cost.
SVar:X:Count$TypeYouCtrl.Mountain
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/downhill_charge.jpg

View File

@@ -3,8 +3,7 @@ ManaCost:U U
Types:Creature Human Wizard
Text:no text
PT:1/2
A:AB$ Pump | Cost$ U T | ValidTgts$ Opponent | TgtPrompt$ Choose target opponent with at least two more cards in hand than you | CheckSVar$ X | SVarCompare$ GEY | SubAbility$ MindKeepersDraw | StackDescription$ None | SpellDescription$ Choose target opponent who had at least two more cards in hand than you did as you activated this ability. Draw a card.
SVar:MindKeepersDraw:DB$ Draw | Defined$ You | NumCards$ 1
A:AB$ Draw | Cost$ U T | ValidTgts$ Opponent | TgtPrompt$ Choose target opponent with at least two more cards in hand than you | CheckSVar$ X | SVarCompare$ GEY | Defined$ You | NumCards$ 1 | SpellDescription$ Choose target opponent who had at least two more cards in hand than you did as you activated this ability. Draw a card.
SVar:X:Count$InOppHandCount
SVar:Y:Count$InYourHand/Plus.2
SVar:Rarity:Uncommon

View File

@@ -36,6 +36,7 @@ import forge.card.spellability.Spell;
import forge.card.spellability.SpellAbility;
import forge.card.spellability.Target;
import forge.game.phase.CombatUtil;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.ComputerUtil;
import forge.game.player.Player;
@@ -285,22 +286,26 @@ public class AbilityFactoryPreventDamage {
}
}
} else {
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
PhaseHandler handler = Singletons.getModel().getGameState().getPhaseHandler();
if (handler.is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
boolean flag = false;
for (final Object o : objects) {
if (o instanceof Card) {
final Card c = (Card) o;
flag |= CombatUtil.combatantWouldBeDestroyed(c);
} else if (o instanceof Player) {
// Don't need to worry about Combat Damage during AI's turn
final Player p = (Player) o;
flag |= (p.isComputer() && ((CombatUtil.wouldLoseLife(AllZone.getCombat()) && sa
.isAbility()) || CombatUtil.lifeInDanger(AllZone.getCombat())));
if (!handler.isPlayerTurn(p)) {
flag |= (p.isComputer() && ((CombatUtil.wouldLoseLife(AllZone.getCombat()) && sa
.isAbility()) || CombatUtil.lifeInDanger(AllZone.getCombat())));
}
}
}
chance = flag;
} else { // if nothing on the stack, and it's not declare
// blockers. no need to regen
// blockers. no need to prevent
return false;
}
}