mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Merge branch 'master' into 'master'
Fix and improve AI for Band Together and Courage in Crisis Closes #1041 See merge request core-developers/forge!1806
This commit is contained in:
@@ -105,7 +105,11 @@ public class CountersProliferateAi extends SpellAbilityAi {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean chkAIDrawback(SpellAbility sa, Player ai) {
|
public boolean chkAIDrawback(SpellAbility sa, Player ai) {
|
||||||
return canPlayAI(ai, sa);
|
if ("Always".equals(sa.getParam("AILogic"))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return checkApiLogic(ai, sa);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -192,6 +192,28 @@ public class FightAi extends SpellAbilityAi {
|
|||||||
toughness += bonus;
|
toughness += bonus;
|
||||||
}
|
}
|
||||||
if ("PowerDmg".equals(sa.getParam("AILogic"))) {
|
if ("PowerDmg".equals(sa.getParam("AILogic"))) {
|
||||||
|
if ("2".equals(sa.getParam("TargetMax"))) {
|
||||||
|
// Band Together, uses up to two targets to deal damage to a single target
|
||||||
|
// TODO: Generalize this so that other TargetMax values can be properly accounted for
|
||||||
|
CardCollection aiCreaturesByPower = new CardCollection(aiCreatures);
|
||||||
|
CardLists.sortByPowerDesc(aiCreaturesByPower);
|
||||||
|
Card maxPower = aiCreaturesByPower.getFirst();
|
||||||
|
if (maxPower != null && maxPower != aiCreature) {
|
||||||
|
power += maxPower.getNetPower(); // potential bonus from adding a second target
|
||||||
|
}
|
||||||
|
if (FightAi.canKill(aiCreature, humanCreature, power)) {
|
||||||
|
sa.getTargets().add(aiCreature);
|
||||||
|
if (maxPower != null) {
|
||||||
|
sa.getTargets().add(maxPower);
|
||||||
|
}
|
||||||
|
if (!isChandrasIgnition) {
|
||||||
|
tgtFight.resetTargets();
|
||||||
|
tgtFight.getTargets().add(humanCreature);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Other cards that use AILogic PowerDmg and a single target
|
||||||
if (FightAi.canKill(aiCreature, humanCreature, power)) {
|
if (FightAi.canKill(aiCreature, humanCreature, power)) {
|
||||||
sa.getTargets().add(aiCreature);
|
sa.getTargets().add(aiCreature);
|
||||||
if (!isChandrasIgnition) {
|
if (!isChandrasIgnition) {
|
||||||
@@ -200,6 +222,7 @@ public class FightAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (FightAi.shouldFight(aiCreature, humanCreature, power, toughness)) {
|
if (FightAi.shouldFight(aiCreature, humanCreature, power, toughness)) {
|
||||||
if ("Time to Feed".equals(sourceName)) { // flip targets
|
if ("Time to Feed".equals(sourceName)) { // flip targets
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
Name:Band Together
|
Name:Band Together
|
||||||
ManaCost:2 G
|
ManaCost:2 G
|
||||||
Types:Instant
|
Types:Instant
|
||||||
A:SP$ Pump | Cost$ 2 G | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select up to two target creatures you control | AILogic$ PowerDamage | SubAbility$ SoulsDamage | TargetMin$ 0 | TargetMax$ 2 | StackDescription$ None | SpellDescription$ Up to two target creatures you control each deal damage equal to their power to another target creature.
|
A:SP$ Pump | Cost$ 2 G | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select up to two target creatures you control | AILogic$ PowerDmg | SubAbility$ SoulsDamage | TargetMin$ 0 | TargetMax$ 2 | StackDescription$ None | SpellDescription$ Up to two target creatures you control each deal damage equal to their power to another target creature.
|
||||||
SVar:SoulsDamage:DB$ DealDamage | ValidTgts$ Creature | TgtPrompt$ Select target creature to be dealt damage | NumDmg$ X | References$ X | TargetUnique$ True | DamageSource$ ParentTarget | AILogic$ PowerDamage
|
SVar:SoulsDamage:DB$ DealDamage | ValidTgts$ Creature | TgtPrompt$ Select target creature to be dealt damage | NumDmg$ X | References$ X | TargetUnique$ True | DamageSource$ ParentTarget
|
||||||
SVar:X:ParentTargeted$CardPower
|
SVar:X:ParentTargeted$CardPower
|
||||||
Oracle:Up to two target creatures you control each deal damage equal to their power to another target creature.
|
Oracle:Up to two target creatures you control each deal damage equal to their power to another target creature.
|
||||||
|
|||||||
Reference in New Issue
Block a user