mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
ReplaceDamage: fixed "Prevent$ True" count for Prevention$ Effects too.
make AI use it in damageIfUnblocked
This commit is contained in:
@@ -196,12 +196,8 @@ public class ComputerUtilCombat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!attacked.getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noPrevention)) {
|
if (!attacked.getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noPrevention)) {
|
||||||
// ask ReplacementDamage directly -- FIXME: this actually doesn't work right now, so it's temporarily reverted to the old form (see below).
|
// ask ReplacementDamage directly
|
||||||
//if (ComputerUtilCombat.isCombatDamagePrevented(attacker, attacked, damage)) {
|
if (ComputerUtilCombat.isCombatDamagePrevented(attacker, attacked, damage)) {
|
||||||
if (attacker.hasKeyword("Prevent all damage that would be dealt by CARDNAME.")
|
|
||||||
|| attacker.hasKeyword("Prevent all damage that would be dealt to and by CARDNAME.")
|
|
||||||
|| attacker.hasKeyword("Prevent all combat damage that would be dealt by CARDNAME.")
|
|
||||||
|| attacker.hasKeyword("Prevent all combat damage that would be dealt to and dealt by CARDNAME.")) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,25 +50,25 @@ public class ReplaceDamage extends ReplacementEffect {
|
|||||||
if (!runParams.get("Event").equals("DamageDone")) {
|
if (!runParams.get("Event").equals("DamageDone")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(runParams.containsKey("Prevention") == getMapParams().containsKey("PreventionEffect"))) {
|
if (!(runParams.containsKey("Prevention") == (hasParam("PreventionEffect") || hasParam("Prevent")))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getMapParams().containsKey("ValidSource")) {
|
if (hasParam("ValidSource")) {
|
||||||
String validSource = getMapParams().get("ValidSource");
|
String validSource = getParam("ValidSource");
|
||||||
validSource = AbilityUtils.applyAbilityTextChangeEffects(validSource, this);
|
validSource = AbilityUtils.applyAbilityTextChangeEffects(validSource, this);
|
||||||
if (!matchesValid(runParams.get("DamageSource"), validSource.split(","), getHostCard())) {
|
if (!matchesValid(runParams.get("DamageSource"), validSource.split(","), getHostCard())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getMapParams().containsKey("ValidTarget")) {
|
if (hasParam("ValidTarget")) {
|
||||||
String validTarget = getMapParams().get("ValidTarget");
|
String validTarget = getParam("ValidTarget");
|
||||||
validTarget = AbilityUtils.applyAbilityTextChangeEffects(validTarget, this);
|
validTarget = AbilityUtils.applyAbilityTextChangeEffects(validTarget, this);
|
||||||
if (!matchesValid(runParams.get("Affected"), validTarget.split(","), getHostCard())) {
|
if (!matchesValid(runParams.get("Affected"), validTarget.split(","), getHostCard())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getMapParams().containsKey("DamageAmount")) {
|
if (hasParam("DamageAmount")) {
|
||||||
String full = getMapParams().get("DamageAmount");
|
String full = getParam("DamageAmount");
|
||||||
String operator = full.substring(0, 2);
|
String operator = full.substring(0, 2);
|
||||||
String operand = full.substring(2);
|
String operand = full.substring(2);
|
||||||
int intoperand = 0;
|
int intoperand = 0;
|
||||||
@@ -82,8 +82,8 @@ public class ReplaceDamage extends ReplacementEffect {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getMapParams().containsKey("IsCombat")) {
|
if (hasParam("IsCombat")) {
|
||||||
if (getMapParams().get("IsCombat").equals("True")) {
|
if (getParam("IsCombat").equals("True")) {
|
||||||
if (!((Boolean) runParams.get("IsCombat"))) {
|
if (!((Boolean) runParams.get("IsCombat"))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -93,13 +93,13 @@ public class ReplaceDamage extends ReplacementEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getMapParams().containsKey("IsEquipping") && !getHostCard().isEquipping()) {
|
if (hasParam("IsEquipping") && !getHostCard().isEquipping()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for DamageRedirection, the Thing where the damage is redirected to must be a creature or planeswalker or a player
|
// check for DamageRedirection, the Thing where the damage is redirected to must be a creature or planeswalker or a player
|
||||||
if (getMapParams().containsKey("DamageTarget")) {
|
if (hasParam("DamageTarget")) {
|
||||||
String def = getMapParams().get("DamageTarget");
|
String def = getParam("DamageTarget");
|
||||||
|
|
||||||
for (Player p : AbilityUtils.getDefinedPlayers(hostCard, def, null)) {
|
for (Player p : AbilityUtils.getDefinedPlayers(hostCard, def, null)) {
|
||||||
if (!p.getGame().getPlayers().contains(p)) {
|
if (!p.getGame().getPlayers().contains(p)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user