mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- 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:
@@ -103,11 +103,11 @@ public class CountersPutAi extends SpellAbilityAi {
|
|||||||
List<Card> aiCreatures = ai.getCreaturesInPlay();
|
List<Card> aiCreatures = ai.getCreaturesInPlay();
|
||||||
aiCreatures = CardLists.getTargetableCards(aiCreatures, sa);
|
aiCreatures = CardLists.getTargetableCards(aiCreatures, sa);
|
||||||
aiCreatures = ComputerUtil.getSafeTargets(ai, sa, aiCreatures);
|
aiCreatures = ComputerUtil.getSafeTargets(ai, sa, aiCreatures);
|
||||||
CardLists.sortByPowerDesc(aiCreatures);
|
ComputerUtilCard.sortByEvaluateCreature(aiCreatures);
|
||||||
|
|
||||||
List<Card> humCreatures = ai.getOpponent().getCreaturesInPlay();
|
List<Card> humCreatures = ai.getOpponent().getCreaturesInPlay();
|
||||||
humCreatures = CardLists.getTargetableCards(humCreatures, tgtFight);
|
humCreatures = CardLists.getTargetableCards(humCreatures, tgtFight);
|
||||||
CardLists.sortByCmcDesc(humCreatures);
|
ComputerUtilCard.sortByEvaluateCreature(humCreatures);
|
||||||
if (humCreatures.isEmpty() || aiCreatures.isEmpty()) {
|
if (humCreatures.isEmpty() || aiCreatures.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,6 +238,13 @@ public class DamageDealAi extends DamageAiBase {
|
|||||||
final boolean divided = sa.hasParam("DividedAsYouChoose");
|
final boolean divided = sa.hasParam("DividedAsYouChoose");
|
||||||
final boolean oppTargetsChoice = sa.hasParam("TargetingPlayer");
|
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
|
// target loop
|
||||||
sa.resetTargets();
|
sa.resetTargets();
|
||||||
TargetChoices tcs = sa.getTargets();
|
TargetChoices tcs = sa.getTargets();
|
||||||
|
|||||||
@@ -126,13 +126,13 @@ public class EffectAi extends SpellAbilityAi {
|
|||||||
} else if (logic.equals("Fight")) {
|
} else if (logic.equals("Fight")) {
|
||||||
List<Card> humCreatures = ai.getOpponent().getCreaturesInPlay();
|
List<Card> humCreatures = ai.getOpponent().getCreaturesInPlay();
|
||||||
humCreatures = CardLists.getTargetableCards(humCreatures, sa);
|
humCreatures = CardLists.getTargetableCards(humCreatures, sa);
|
||||||
CardLists.sortByCmcDesc(humCreatures);
|
ComputerUtilCard.sortByEvaluateCreature(humCreatures);
|
||||||
|
|
||||||
final AbilitySub tgtFight = sa.getSubAbility();
|
final AbilitySub tgtFight = sa.getSubAbility();
|
||||||
List<Card> aiCreatures = ai.getCreaturesInPlay();
|
List<Card> aiCreatures = ai.getCreaturesInPlay();
|
||||||
aiCreatures = CardLists.getTargetableCards(aiCreatures, tgtFight);
|
aiCreatures = CardLists.getTargetableCards(aiCreatures, tgtFight);
|
||||||
aiCreatures = ComputerUtil.getSafeTargets(ai, tgtFight, aiCreatures);
|
aiCreatures = ComputerUtil.getSafeTargets(ai, tgtFight, aiCreatures);
|
||||||
CardLists.sortByPowerDesc(aiCreatures);
|
ComputerUtilCard.sortByEvaluateCreature(aiCreatures);
|
||||||
|
|
||||||
if (humCreatures.isEmpty() || aiCreatures.isEmpty()) {
|
if (humCreatures.isEmpty() || aiCreatures.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -213,25 +213,38 @@ public class PumpAi extends PumpAiBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sa.getParam("AILogic").equals("Fight")) {
|
if (sa.getParam("AILogic").equals("Fight") || sa.getParam("AILogic").equals("PowerDmg")) {
|
||||||
final AbilitySub tgtFight = sa.getSubAbility();
|
final AbilitySub tgtFight = sa.getSubAbility();
|
||||||
List<Card> aiCreatures = ai.getCreaturesInPlay();
|
List<Card> aiCreatures = ai.getCreaturesInPlay();
|
||||||
aiCreatures = CardLists.getTargetableCards(aiCreatures, sa);
|
aiCreatures = CardLists.getTargetableCards(aiCreatures, sa);
|
||||||
aiCreatures = ComputerUtil.getSafeTargets(ai, sa, aiCreatures);
|
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();
|
List<Card> humCreatures = ai.getOpponent().getCreaturesInPlay();
|
||||||
humCreatures = CardLists.getTargetableCards(humCreatures, tgtFight);
|
humCreatures = CardLists.getTargetableCards(humCreatures, tgtFight);
|
||||||
CardLists.sortByCmcDesc(humCreatures);
|
ComputerUtilCard.sortByEvaluateCreature(humCreatures);
|
||||||
if (humCreatures.isEmpty() || aiCreatures.isEmpty()) {
|
if (humCreatures.isEmpty() || aiCreatures.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (Card humanCreature : humCreatures) {
|
for (Card humanCreature : humCreatures) {
|
||||||
for (Card aiCreature : aiCreatures) {
|
for (Card aiCreature : aiCreatures) {
|
||||||
if (FightAi.shouldFight(aiCreature, humanCreature, attack, defense)) {
|
if (sa.getParam("AILogic").equals("PowerDmg")) {
|
||||||
sa.getTargets().add(aiCreature);
|
if (FightAi.canKill(aiCreature, humanCreature, attack)) {
|
||||||
tgtFight.getTargets().add(humanCreature);
|
sa.getTargets().add(aiCreature);
|
||||||
return true;
|
tgtFight.getTargets().add(humanCreature);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (FightAi.shouldFight(aiCreature, humanCreature, attack, defense)) {
|
||||||
|
sa.getTargets().add(aiCreature);
|
||||||
|
tgtFight.getTargets().add(humanCreature);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
Name:Fall of the Hammer
|
Name:Fall of the Hammer
|
||||||
ManaCost:1 R
|
ManaCost:1 R
|
||||||
Types:Instant
|
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.
|
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 | NumDmg$ X | References$ X | DamageSource$ Remembered | SubAbility$ DBCleanup
|
SVar:SoulsDamage:DB$ DealDamage | ValidTgts$ Creature | AILogic$ PowerDmg | NumDmg$ X | References$ X | DamageSource$ ParentTarget
|
||||||
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
SVar:X:ParentTargeted$CardPower
|
||||||
SVar:X:Remembered$CardPower
|
|
||||||
SVar:RemAIDeck:True
|
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/fall_of_the_hammer.jpg
|
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.
|
Oracle:Target creature you control deals damage equal to its power to another target creature.
|
||||||
|
|||||||
@@ -1,21 +1,18 @@
|
|||||||
Name:Flesh
|
Name:Flesh
|
||||||
ManaCost:3 B G
|
ManaCost:3 B G
|
||||||
AlternateMode: Split
|
AlternateMode: Split
|
||||||
Types:Sorcery
|
Types:Sorcery
|
||||||
K:Fuse
|
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.
|
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 | Referneces$ X | SubAbility$ DBCleanup
|
SVar:DBPutCounter:DB$ PutCounter | ValidTgts$ Creature | TgtPrompt$ Select target creature to put counters | CounterType$ P1P1 | CounterNum$ X | References$ X
|
||||||
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
|
SVar:X:ParentTargeted$CardPower
|
||||||
SVar:X:Remembered$CardPower
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/flesh_blood.jpg
|
||||||
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.)
|
||||||
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
|
||||||
ALTERNATE
|
Name:Blood
|
||||||
Name:Blood
|
ManaCost:R G
|
||||||
ManaCost:R G
|
Types:Sorcery
|
||||||
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.
|
||||||
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 | AILogic$ PowerDmg | TgtPrompt$ Select target creature or player | NumDmg$ Y | References$ Y | DamageSource$ ParentTarget
|
||||||
SVar:BloodDamage:DB$ DealDamage | ValidTgts$ Creature,Player | TgtPrompt$ Select target creature or player | NumDmg$ Y | References$ Y | DamageSource$ Imprinted | SubAbility$ DBCleanup2
|
SVar:Y:ParentTargeted$CardPower
|
||||||
SVar:DBCleanup2:DB$ Cleanup | ClearImprinted$ True
|
|
||||||
SVar:Y:Imprinted$CardPower
|
|
||||||
SVar:RemAIDeck:True
|
|
||||||
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.)
|
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.)
|
||||||
@@ -3,6 +3,5 @@ ManaCost:1 RG
|
|||||||
Types:Instant
|
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.
|
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: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
|
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.)
|
Oracle:Target creature you control fights another target creature. (Each deals damage equal to its power to the other.)
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
Name:Soul's Fire
|
Name:Soul's Fire
|
||||||
ManaCost:2 R
|
ManaCost:2 R
|
||||||
Types:Instant
|
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.
|
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 | TgtPrompt$ Select target creature or player | NumDmg$ X | References$ X | ConditionDefined$ Targeted | ConditionPresent$ Creature | ConditionCompare$ EQ1 | DamageSource$ ParentTarget
|
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:X:ParentTargeted$CardPower
|
||||||
SVar:RemAIDeck:True
|
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/souls_fire.jpg
|
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.
|
Oracle:Target creature you control on the battlefield deals damage equal to its power to target creature or player.
|
||||||
Reference in New Issue
Block a user