mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Merge branch 'staticDamageToReplace' into 'master'
Replacement Effect instead of StaticDamage See merge request core-developers/forge!332
This commit is contained in:
@@ -54,5 +54,8 @@ public class CleanUpEffect extends SpellAbilityEffect {
|
||||
if (sa.hasParam("ClearChosenType")) {
|
||||
source.setChosenType("");
|
||||
}
|
||||
if (sa.hasParam("ClearChosenColor")) {
|
||||
source.setChosenColors(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,8 +775,6 @@ public class CombatUtil {
|
||||
final CardCollection attackersWithLure = new CardCollection();
|
||||
for (final Card attacker : attackers) {
|
||||
if (attacker.hasStartOfKeyword("All creatures able to block CARDNAME do so.")
|
||||
|| (attacker.hasStartOfKeyword("All Walls able to block CARDNAME do so.") && blocker.getType().hasSubtype("Wall"))
|
||||
|| (attacker.hasStartOfKeyword("All creatures with flying able to block CARDNAME do so.") && blocker.hasKeyword("Flying"))
|
||||
|| (attacker.hasStartOfKeyword("CARDNAME must be blocked if able.")
|
||||
&& combat.getBlockers(attacker).isEmpty())) {
|
||||
attackersWithLure.add(attacker);
|
||||
@@ -792,6 +790,14 @@ public class CombatUtil {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// MustBeBlockedByAll:<valid>
|
||||
if (keyword.startsWith("MustBeBlockedByAll")) {
|
||||
final String valid = keyword.split(":")[1];
|
||||
if (blocker.isValid(valid, null, null, null)) {
|
||||
attackersWithLure.add(attacker);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -905,13 +911,19 @@ public class CombatUtil {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// MustBeBlockedByAll:<valid>
|
||||
if (keyword.startsWith("MustBeBlockedByAll")) {
|
||||
final String valid = keyword.split(":")[1];
|
||||
if (blocker.isValid(valid, null, null, null)) {
|
||||
mustBeBlockedBy = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if the attacker has no lure effect, but the blocker can block another
|
||||
// attacker with lure, the blocker can't block the former
|
||||
if (!attacker.hasKeyword("All creatures able to block CARDNAME do so.")
|
||||
&& !(attacker.hasStartOfKeyword("All Walls able to block CARDNAME do so.") && blocker.getType().hasSubtype("Wall"))
|
||||
&& !(attacker.hasStartOfKeyword("All creatures with flying able to block CARDNAME do so.") && blocker.hasKeyword("Flying"))
|
||||
&& !(attacker.hasKeyword("CARDNAME must be blocked if able.") && combat.getBlockers(attacker).isEmpty())
|
||||
&& !(blocker.getMustBlockCards() != null && blocker.getMustBlockCards().contains(attacker))
|
||||
&& !mustBeBlockedBy
|
||||
|
||||
@@ -53,6 +53,10 @@ public class ReplaceDamage extends ReplacementEffect {
|
||||
if (!(runParams.containsKey("Prevention") == (hasParam("PreventionEffect") || hasParam("Prevent")))) {
|
||||
return false;
|
||||
}
|
||||
if (((Integer) runParams.get("DamageAmount")) == 0) {
|
||||
// If no actual damage is dealt, there is nothing to replace
|
||||
return false;
|
||||
}
|
||||
if (hasParam("ValidSource")) {
|
||||
String validSource = getParam("ValidSource");
|
||||
validSource = AbilityUtils.applyAbilityTextChangeEffects(validSource, this);
|
||||
@@ -83,9 +87,13 @@ public class ReplaceDamage extends ReplacementEffect {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (((Integer) runParams.get("DamageAmount")) == 0) {
|
||||
// If no actual damage is dealt, there is nothing to replace
|
||||
return false;
|
||||
if (hasParam("RelativeToSource")) {
|
||||
Card source = (Card) runParams.get("DamageSource");
|
||||
String validRelative = getParam("RelativeToSource");
|
||||
validRelative = AbilityUtils.applyAbilityTextChangeEffects(validRelative, this);
|
||||
if (!matchesValid(runParams.get("DamageTarget"), validRelative.split(","), source)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasParam("DamageAmount")) {
|
||||
String full = getParam("DamageAmount");
|
||||
|
||||
Reference in New Issue
Block a user