- AI support for "deal damage equal to power". Tweak to sort "fight" list by card efficiency instead of power/cmc.

This commit is contained in:
excessum
2014-03-23 06:56:24 +00:00
parent 6e1c19f660
commit a7b8410f25
8 changed files with 53 additions and 40 deletions

View File

@@ -103,11 +103,11 @@ public class CountersPutAi extends SpellAbilityAi {
List<Card> aiCreatures = ai.getCreaturesInPlay();
aiCreatures = CardLists.getTargetableCards(aiCreatures, sa);
aiCreatures = ComputerUtil.getSafeTargets(ai, sa, aiCreatures);
CardLists.sortByPowerDesc(aiCreatures);
ComputerUtilCard.sortByEvaluateCreature(aiCreatures);
List<Card> humCreatures = ai.getOpponent().getCreaturesInPlay();
humCreatures = CardLists.getTargetableCards(humCreatures, tgtFight);
CardLists.sortByCmcDesc(humCreatures);
ComputerUtilCard.sortByEvaluateCreature(humCreatures);
if (humCreatures.isEmpty() || aiCreatures.isEmpty()) {
return false;
}

View File

@@ -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();

View File

@@ -126,13 +126,13 @@ public class EffectAi extends SpellAbilityAi {
} else if (logic.equals("Fight")) {
List<Card> humCreatures = ai.getOpponent().getCreaturesInPlay();
humCreatures = CardLists.getTargetableCards(humCreatures, sa);
CardLists.sortByCmcDesc(humCreatures);
ComputerUtilCard.sortByEvaluateCreature(humCreatures);
final AbilitySub tgtFight = sa.getSubAbility();
List<Card> 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;

View File

@@ -213,21 +213,33 @@ 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<Card> 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<Card> 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 (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);
@@ -236,6 +248,7 @@ public class PumpAi extends PumpAiBase {
}
}
}
}
return false;
} else if (sa.isCurse()) {
if (sa.canTarget(opp)) {

View File

@@ -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.

View File

@@ -3,19 +3,16 @@ 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
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 | 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
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.)

View File

@@ -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.)

View File

@@ -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.