diff --git a/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java b/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java index 8393b655f20..9e765855ffd 100644 --- a/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/CountersPutAi.java @@ -103,11 +103,11 @@ public class CountersPutAi extends SpellAbilityAi { List aiCreatures = ai.getCreaturesInPlay(); aiCreatures = CardLists.getTargetableCards(aiCreatures, sa); aiCreatures = ComputerUtil.getSafeTargets(ai, sa, aiCreatures); - CardLists.sortByPowerDesc(aiCreatures); + ComputerUtilCard.sortByEvaluateCreature(aiCreatures); List humCreatures = ai.getOpponent().getCreaturesInPlay(); humCreatures = CardLists.getTargetableCards(humCreatures, tgtFight); - CardLists.sortByCmcDesc(humCreatures); + ComputerUtilCard.sortByEvaluateCreature(humCreatures); if (humCreatures.isEmpty() || aiCreatures.isEmpty()) { return false; } diff --git a/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java b/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java index 3b72fb108be..f4da7b06dec 100644 --- a/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/DamageDealAi.java @@ -238,6 +238,13 @@ public class DamageDealAi extends DamageAiBase { final boolean divided = sa.hasParam("DividedAsYouChoose"); final boolean oppTargetsChoice = sa.hasParam("TargetingPlayer"); + if ("PowerDmg".equals(sa.getParam("AILogic"))) { + if (tgt.canTgtCreatureAndPlayer() && this.shouldTgtP(ai, sa, dmg, noPrevention)){ + sa.resetTargets(); + sa.getTargets().add(ai.getOpponent()); + } + return true; + } // target loop sa.resetTargets(); TargetChoices tcs = sa.getTargets(); diff --git a/forge-ai/src/main/java/forge/ai/ability/EffectAi.java b/forge-ai/src/main/java/forge/ai/ability/EffectAi.java index 4cb57d070ec..15bff187df2 100644 --- a/forge-ai/src/main/java/forge/ai/ability/EffectAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/EffectAi.java @@ -126,13 +126,13 @@ public class EffectAi extends SpellAbilityAi { } else if (logic.equals("Fight")) { List humCreatures = ai.getOpponent().getCreaturesInPlay(); humCreatures = CardLists.getTargetableCards(humCreatures, sa); - CardLists.sortByCmcDesc(humCreatures); + ComputerUtilCard.sortByEvaluateCreature(humCreatures); final AbilitySub tgtFight = sa.getSubAbility(); List aiCreatures = ai.getCreaturesInPlay(); aiCreatures = CardLists.getTargetableCards(aiCreatures, tgtFight); aiCreatures = ComputerUtil.getSafeTargets(ai, tgtFight, aiCreatures); - CardLists.sortByPowerDesc(aiCreatures); + ComputerUtilCard.sortByEvaluateCreature(aiCreatures); if (humCreatures.isEmpty() || aiCreatures.isEmpty()) { return false; diff --git a/forge-ai/src/main/java/forge/ai/ability/PumpAi.java b/forge-ai/src/main/java/forge/ai/ability/PumpAi.java index 971bfc7274a..d0affb8970e 100644 --- a/forge-ai/src/main/java/forge/ai/ability/PumpAi.java +++ b/forge-ai/src/main/java/forge/ai/ability/PumpAi.java @@ -213,25 +213,38 @@ public class PumpAi extends PumpAiBase { return false; } } - if (sa.getParam("AILogic").equals("Fight")) { + if (sa.getParam("AILogic").equals("Fight") || sa.getParam("AILogic").equals("PowerDmg")) { final AbilitySub tgtFight = sa.getSubAbility(); List aiCreatures = ai.getCreaturesInPlay(); aiCreatures = CardLists.getTargetableCards(aiCreatures, sa); aiCreatures = ComputerUtil.getSafeTargets(ai, sa, aiCreatures); - CardLists.sortByPowerDesc(aiCreatures); + ComputerUtilCard.sortByEvaluateCreature(aiCreatures); + //sort is suboptimal due to conflicting needs depending on game state: + // -deathtouch for deal damage + // -max power for damage to player + // -survivability for generic "fight" + // -no support for "heroic" List humCreatures = ai.getOpponent().getCreaturesInPlay(); humCreatures = CardLists.getTargetableCards(humCreatures, tgtFight); - CardLists.sortByCmcDesc(humCreatures); + ComputerUtilCard.sortByEvaluateCreature(humCreatures); if (humCreatures.isEmpty() || aiCreatures.isEmpty()) { return false; } for (Card humanCreature : humCreatures) { for (Card aiCreature : aiCreatures) { - if (FightAi.shouldFight(aiCreature, humanCreature, attack, defense)) { - sa.getTargets().add(aiCreature); - tgtFight.getTargets().add(humanCreature); - return true; + if (sa.getParam("AILogic").equals("PowerDmg")) { + if (FightAi.canKill(aiCreature, humanCreature, attack)) { + sa.getTargets().add(aiCreature); + tgtFight.getTargets().add(humanCreature); + return true; + } + } else { + if (FightAi.shouldFight(aiCreature, humanCreature, attack, defense)) { + sa.getTargets().add(aiCreature); + tgtFight.getTargets().add(humanCreature); + return true; + } } } } diff --git a/forge-gui/res/cardsfolder/f/fall_of_the_hammer.txt b/forge-gui/res/cardsfolder/f/fall_of_the_hammer.txt index 92f7c5aea07..30e6a4c84cc 100644 --- a/forge-gui/res/cardsfolder/f/fall_of_the_hammer.txt +++ b/forge-gui/res/cardsfolder/f/fall_of_the_hammer.txt @@ -1,10 +1,8 @@ Name:Fall of the Hammer ManaCost:1 R Types:Instant -A:SP$ Pump | Cost$ 1 R | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | SubAbility$ SoulsDamage | RememberObjects$ Targeted | SpellDescription$ Target creature you control deals damage equal to its power to target creature. -SVar:SoulsDamage:DB$ DealDamage | ValidTgts$ Creature | NumDmg$ X | References$ X | DamageSource$ Remembered | SubAbility$ DBCleanup -SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True -SVar:X:Remembered$CardPower -SVar:RemAIDeck:True +A:SP$ Pump | Cost$ 1 R | ValidTgts$ Creature.YouCtrl | AILogic$ PowerDmg | TgtPrompt$ Select target creature you control | SubAbility$ SoulsDamage | StackDescription$ None | SpellDescription$ Target creature you control deals damage equal to its power to target creature. +SVar:SoulsDamage:DB$ DealDamage | ValidTgts$ Creature | AILogic$ PowerDmg | NumDmg$ X | References$ X | DamageSource$ ParentTarget +SVar:X:ParentTargeted$CardPower SVar:Picture:http://www.wizards.com/global/images/magic/general/fall_of_the_hammer.jpg Oracle:Target creature you control deals damage equal to its power to another target creature. diff --git a/forge-gui/res/cardsfolder/f/flesh_blood.txt b/forge-gui/res/cardsfolder/f/flesh_blood.txt index ba112dd2a80..e17ee4869e9 100644 --- a/forge-gui/res/cardsfolder/f/flesh_blood.txt +++ b/forge-gui/res/cardsfolder/f/flesh_blood.txt @@ -1,21 +1,18 @@ -Name:Flesh -ManaCost:3 B G -AlternateMode: Split -Types:Sorcery -K:Fuse -A:SP$ ChangeZone | Cost$ 3 B G | Origin$ Graveyard | Destination$ Exile | TgtPrompt$ Choose target creature card in a graveyard | ValidTgts$ Creature | RememberChanged$ True | SubAbility$ DBPutCounter | SpellDescription$ Exile target creature card from a graveyard. Put X +1/+1 counters on target creature, where X is the power of the card you exiled. -SVar:DBPutCounter:DB$ PutCounter | ValidTgts$ Creature | TgtPrompt$ Select target creature to put counters | CounterType$ P1P1 | CounterNum$ X | Referneces$ X | SubAbility$ DBCleanup -SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True -SVar:X:Remembered$CardPower -SVar:Picture:http://www.wizards.com/global/images/magic/general/flesh_blood.jpg -Oracle:Exile target creature card from a graveyard. Put X +1/+1 counters on target creature, where X is the power of the card you exiled.\nFuse (You may cast one or both halves of this card from your hand.) -ALTERNATE -Name:Blood -ManaCost:R G -Types:Sorcery -A:SP$ Pump | Cost$ R G | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | SubAbility$ BloodDamage | ImprintCards$ Targeted | SpellDescription$ Target creature you control deals damage equal to its power to target creature or player. -SVar:BloodDamage:DB$ DealDamage | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ Y | References$ Y | DamageSource$ Imprinted | SubAbility$ DBCleanup2 -SVar:DBCleanup2:DB$ Cleanup | ClearImprinted$ True -SVar:Y:Imprinted$CardPower -SVar:RemAIDeck:True +Name:Flesh +ManaCost:3 B G +AlternateMode: Split +Types:Sorcery +K:Fuse +A:SP$ ChangeZone | Cost$ 3 B G | Origin$ Graveyard | Destination$ Exile | TgtPrompt$ Choose target creature card in a graveyard | ValidTgts$ Creature | SubAbility$ DBPutCounter | SpellDescription$ Exile target creature card from a graveyard. Put X +1/+1 counters on target creature, where X is the power of the card you exiled. +SVar:DBPutCounter:DB$ PutCounter | ValidTgts$ Creature | TgtPrompt$ Select target creature to put counters | CounterType$ P1P1 | CounterNum$ X | References$ X +SVar:X:ParentTargeted$CardPower +SVar:Picture:http://www.wizards.com/global/images/magic/general/flesh_blood.jpg +Oracle:Exile target creature card from a graveyard. Put X +1/+1 counters on target creature, where X is the power of the card you exiled.\nFuse (You may cast one or both halves of this card from your hand.) +ALTERNATE +Name:Blood +ManaCost:R G +Types:Sorcery +A:SP$ Pump | Cost$ R G | ValidTgts$ Creature.YouCtrl | AILogic$ PowerDmg | TgtPrompt$ Select target creature you control | SubAbility$ BloodDamage | StackDescription$ None | SpellDescription$ Target creature you control deals damage equal to its power to target creature or player. +SVar:BloodDamage:DB$ DealDamage | ValidTgts$ Creature,Player | AILogic$ PowerDmg | TgtPrompt$ Select target creature or player | NumDmg$ Y | References$ Y | DamageSource$ ParentTarget +SVar:Y:ParentTargeted$CardPower Oracle:Target creature you control deals damage equal to its power to target creature or player.\nFuse (You may cast one or both halves of this card from your hand.) \ No newline at end of file diff --git a/forge-gui/res/cardsfolder/p/pit_fight.txt b/forge-gui/res/cardsfolder/p/pit_fight.txt index 274eb8554d6..5c9635e4c2e 100644 --- a/forge-gui/res/cardsfolder/p/pit_fight.txt +++ b/forge-gui/res/cardsfolder/p/pit_fight.txt @@ -3,6 +3,5 @@ ManaCost:1 RG Types:Instant A:SP$ Pump | Cost$ 1 RG | AILogic$ Fight | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Choose target creature you control | SubAbility$ DBPitFight | StackDescription$ None | SpellDescription$ Target creature you control fights another target creature. SVar:DBPitFight:DB$ Fight | Defined$ ParentTarget | ValidTgts$ Creature | TargetUnique$ True | TgtPrompt$ Choose target creature to fight the first target -SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/pit_fight.jpg Oracle:Target creature you control fights another target creature. (Each deals damage equal to its power to the other.) \ No newline at end of file diff --git a/forge-gui/res/cardsfolder/s/souls_fire.txt b/forge-gui/res/cardsfolder/s/souls_fire.txt index 4d8e082ebc3..0c38f389e0e 100644 --- a/forge-gui/res/cardsfolder/s/souls_fire.txt +++ b/forge-gui/res/cardsfolder/s/souls_fire.txt @@ -1,9 +1,8 @@ Name:Soul's Fire ManaCost:2 R Types:Instant -A:SP$ Pump | Cost$ 2 R | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | SubAbility$ SoulsDamage | SpellDescription$ Target creature you control on the battlefield deals damage equal to its power to target creature or player. -SVar:SoulsDamage:DB$ DealDamage | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ X | References$ X | ConditionDefined$ Targeted | ConditionPresent$ Creature | ConditionCompare$ EQ1 | DamageSource$ ParentTarget +A:SP$ Pump | Cost$ 2 R | ValidTgts$ Creature.YouCtrl | AILogic$ PowerDmg | TgtPrompt$ Select target creature you control | SubAbility$ SoulsDamage | StackDescription$ None | SpellDescription$ Target creature you control on the battlefield deals damage equal to its power to target creature or player. +SVar:SoulsDamage:DB$ DealDamage | ValidTgts$ Creature,Player | AILogic$ PowerDmg | TgtPrompt$ Select target creature or player | NumDmg$ X | References$ X | ConditionDefined$ Targeted | ConditionPresent$ Creature | ConditionCompare$ EQ1 | DamageSource$ ParentTarget SVar:X:ParentTargeted$CardPower -SVar:RemAIDeck:True SVar:Picture:http://www.wizards.com/global/images/magic/general/souls_fire.jpg Oracle:Target creature you control on the battlefield deals damage equal to its power to target creature or player. \ No newline at end of file