- Improved stack description of FlipCoinEffect.

- Added AI support for Orcish Captain.
This commit is contained in:
Sloth
2014-10-25 21:35:46 +00:00
parent 264458521a
commit 02a5997810
3 changed files with 23 additions and 4 deletions

View File

@@ -2,6 +2,8 @@ package forge.ai.ability;
import forge.ai.ComputerUtil; import forge.ai.ComputerUtil;
import forge.ai.SpellAbilityAi; import forge.ai.SpellAbilityAi;
import forge.game.card.Card;
import forge.game.phase.PhaseType;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbility;
@@ -14,12 +16,25 @@ public class FlipACoinAi extends SpellAbilityAi {
protected boolean canPlayAI(Player ai, SpellAbility sa) { protected boolean canPlayAI(Player ai, SpellAbility sa) {
if (sa.hasParam("AILogic")) { if (sa.hasParam("AILogic")) {
if (sa.getParam("AILogic").equals("Never")) { String AILogic = sa.getParam("AILogic");
if (AILogic.equals("Never")) {
return false; return false;
} else if (sa.getParam("AILogic").equals("PhaseOut")) { } else if (AILogic.equals("PhaseOut")) {
if (!ComputerUtil.predictThreatenedObjects(sa.getActivatingPlayer(), sa).contains(sa.getHostCard())) { if (!ComputerUtil.predictThreatenedObjects(sa.getActivatingPlayer(), sa).contains(sa.getHostCard())) {
return false; return false;
} }
} else if (AILogic.equals("KillOrcs")) {
if (ai.getGame().getPhaseHandler().getPhase().isBefore(PhaseType.END_OF_TURN) ) {
return false;
}
sa.resetTargets();
for (Card c : ai.getOpponent().getCreaturesInPlay()) {
if (c.canBeTargetedBy(sa)) {
sa.getTargets().add(c);
return true;
}
}
return false;
} }
} }
return true; return true;

View File

@@ -1,5 +1,6 @@
package forge.game.ability.effects; package forge.game.ability.effects;
import forge.game.GameObject;
import forge.game.ability.AbilityFactory; import forge.game.ability.AbilityFactory;
import forge.game.ability.AbilityUtils; import forge.game.ability.AbilityUtils;
import forge.game.ability.SpellAbilityEffect; import forge.game.ability.SpellAbilityEffect;
@@ -24,10 +25,14 @@ public class FlipCoinEffect extends SpellAbilityEffect {
protected String getStackDescription(SpellAbility sa) { protected String getStackDescription(SpellAbility sa) {
final Card host = sa.getHostCard(); final Card host = sa.getHostCard();
final Player player = host.getController(); final Player player = host.getController();
final List<GameObject> tgts = getTargets(sa);
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
sb.append(player).append(" flips a coin."); sb.append(player).append(" flips a coin.");
if (tgts != null && !tgts.isEmpty()) {
sb.append(" Targeting: " + tgts + ".");
}
return sb.toString(); return sb.toString();
} }

View File

@@ -2,9 +2,8 @@ Name:Orcish Captain
ManaCost:R ManaCost:R
Types:Creature Orc Warrior Types:Creature Orc Warrior
PT:1/1 PT:1/1
A:AB$ FlipACoin | Cost$ 1 | ValidTgts$ Creature.Orc | TgtPrompt$ Select target Orc creature | WinSubAbility$ DBPumpPlus | LoseSubAbility$ DBPumpMinus | SpellDescription$ Flip a coin. If you win the flip, target Orc creature gets +2/+0 until end of turn. If you lose the flip, it gets -0/-2 until end of turn. A:AB$ FlipACoin | Cost$ 1 | ValidTgts$ Creature.Orc | TgtPrompt$ Select target Orc creature | WinSubAbility$ DBPumpPlus | LoseSubAbility$ DBPumpMinus | AILogic$ KillOrcs | SpellDescription$ Flip a coin. If you win the flip, target Orc creature gets +2/+0 until end of turn. If you lose the flip, it gets -0/-2 until end of turn.
SVar:DBPumpPlus:DB$ Pump | Cost$ 0 | Defined$ Targeted | NumAtt$ 2 | NumDef$ 0 SVar:DBPumpPlus:DB$ Pump | Cost$ 0 | Defined$ Targeted | NumAtt$ 2 | NumDef$ 0
SVar:DBPumpMinus:DB$ Pump | Cost$ 0 | Defined$ Targeted | NumAtt$ 0 | NumDef$ -2 SVar:DBPumpMinus:DB$ Pump | Cost$ 0 | Defined$ Targeted | NumAtt$ 0 | NumDef$ -2
SVar:RemRandomDeck:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/orcish_captain.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/orcish_captain.jpg
Oracle:{1}: Flip a coin. If you win the flip, target Orc creature gets +2/+0 until end of turn. If you lose the flip, it gets -0/-2 until end of turn. Oracle:{1}: Flip a coin. If you win the flip, target Orc creature gets +2/+0 until end of turn. If you lose the flip, it gets -0/-2 until end of turn.