mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 17:58:01 +00:00
Merge branch 'master' into 'master'
Add a basic AristocratCounters hook for Dreadmalkin (currently doesn't sac planeswalkers). See merge request core-developers/forge!1790
This commit is contained in:
@@ -220,6 +220,8 @@ public class CountersPutAi extends SpellAbilityAi {
|
||||
|
||||
if ("Never".equals(logic)) {
|
||||
return false;
|
||||
} else if ("AristocratCounters".equals(logic)) {
|
||||
return PumpAi.doAristocratWithCountersLogic(sa, ai);
|
||||
} else if ("PayEnergy".equals(logic)) {
|
||||
return true;
|
||||
} else if ("PayEnergyConservatively".equals(logic)) {
|
||||
|
||||
@@ -804,7 +804,7 @@ public class PumpAi extends PumpAiBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean doAristocratLogic(final SpellAbility sa, final Player ai) {
|
||||
public static boolean doAristocratLogic(final SpellAbility sa, final Player ai) {
|
||||
// A logic for cards that say "Sacrifice a creature: CARDNAME gets +X/+X until EOT"
|
||||
final Game game = ai.getGame();
|
||||
final Combat combat = game.getCombat();
|
||||
@@ -875,7 +875,7 @@ public class PumpAi extends PumpAiBase {
|
||||
lethalDmg = Integer.MAX_VALUE; // won't be able to deal poison damage to kill the opponent
|
||||
}
|
||||
|
||||
final int numCreatsToSac = indestructible ? 1 : (lethalDmg - source.getNetCombatDamage()) / powerBonus;
|
||||
final int numCreatsToSac = indestructible ? 1 : (lethalDmg - source.getNetCombatDamage()) / (powerBonus != 0 ? powerBonus : 1);
|
||||
|
||||
if (defTappedOut || numCreatsToSac < numOtherCreats / 2) {
|
||||
return source.getNetCombatDamage() < lethalDmg
|
||||
@@ -923,7 +923,7 @@ public class PumpAi extends PumpAiBase {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean doAristocratWithCountersLogic(final SpellAbility sa, final Player ai) {
|
||||
public static boolean doAristocratWithCountersLogic(final SpellAbility sa, final Player ai) {
|
||||
// A logic for cards that say "Sacrifice a creature: put X +1/+1 counters on CARDNAME" (e.g. Falkenrath Aristocrat)
|
||||
final Card source = sa.getHostCard();
|
||||
final String logic = sa.getParam("AILogic"); // should not even get here unless there's an Aristocrats logic applied
|
||||
@@ -944,9 +944,19 @@ public class PumpAi extends PumpAiBase {
|
||||
}
|
||||
|
||||
// Check if anything is to be gained from the PutCounter subability
|
||||
SpellAbility countersSa = null;
|
||||
if (sa.getSubAbility() == null || sa.getSubAbility().getApi() != ApiType.PutCounter) {
|
||||
if (sa.getApi() == ApiType.PutCounter) {
|
||||
// called directly from CountersPutAi
|
||||
countersSa = sa;
|
||||
}
|
||||
} else {
|
||||
countersSa = sa.getSubAbility();
|
||||
}
|
||||
|
||||
if (countersSa == null) {
|
||||
// Shouldn't get here if there is no PutCounter subability (wrong AI logic specified?)
|
||||
System.err.println("Warning: AILogic AristocratCounters was specified on " + source + ", but there was no PutCounter subability!");
|
||||
System.err.println("Warning: AILogic AristocratCounters was specified on " + source + ", but there was no PutCounter SA in chain!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -966,7 +976,7 @@ public class PumpAi extends PumpAiBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
int numCtrs = AbilityUtils.calculateAmount(source, sa.getSubAbility().getParam("CounterNum"), sa.getSubAbility());
|
||||
int numCtrs = AbilityUtils.calculateAmount(source, countersSa.getParam("CounterNum"), countersSa);
|
||||
|
||||
if (combat != null && combat.isAttacking(source) && isDeclareBlockers) {
|
||||
if (combat.getBlockers(source).isEmpty()) {
|
||||
|
||||
@@ -3,6 +3,7 @@ ManaCost:B
|
||||
Types:Creature Zombie Cat
|
||||
PT:1/1
|
||||
K:Menace
|
||||
A:AB$ PutCounter | Cost$ 2 B Sac<1/Creature.Other,Planeswalker.Other/another creature or planeswalker> | CounterType$ P1P1 | CounterNum$ 2 | SpellDescription$ Put two +1/+1 counters on CARDNAME.
|
||||
A:AB$ PutCounter | Cost$ 2 B Sac<1/Creature.Other,Planeswalker.Other/another creature or planeswalker> | CounterType$ P1P1 | CounterNum$ 2 | AILogic$ AristocratCounters | SpellDescription$ Put two +1/+1 counters on CARDNAME.
|
||||
DeckHas:Ability$Counters
|
||||
SVar:AIPreference:SacCost$Creature.Other
|
||||
Oracle:Menace (This creature can't be blocked except by two or more creatures.)\n{2}{B}, Sacrifice another creature or planeswalker: Put two +1/+1 counters on Dreadmalkin.
|
||||
|
||||
Reference in New Issue
Block a user