mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-13 09:17:59 +00:00
DamageDealEffect: support "ExcessSVar"
This commit is contained in:
@@ -255,6 +255,16 @@ public class DamageDealEffect extends DamageBaseEffect {
|
||||
protected void internalDamageDeal(SpellAbility sa, Card sourceLKI, Card c, int dmg, CardDamageMap damageMap) {
|
||||
final Card hostCard = sa.getHostCard();
|
||||
final Player activationPlayer = sa.getActivatingPlayer();
|
||||
int excess = 0;
|
||||
int dmgToTarget = 0;
|
||||
if (sa.hasParam("ExcessDamage") || (sa.hasParam("ExcessSVar"))) {
|
||||
int lethal = c.getLethalDamage();
|
||||
if (sourceLKI.hasKeyword(Keyword.DEATHTOUCH)) {
|
||||
lethal = Math.min(lethal, 1);
|
||||
}
|
||||
dmgToTarget = Math.min(lethal, dmg);
|
||||
excess = dmg - dmgToTarget;
|
||||
}
|
||||
|
||||
if (sa.hasParam("Remove")) {
|
||||
c.setDamage(0);
|
||||
@@ -263,11 +273,6 @@ public class DamageDealEffect extends DamageBaseEffect {
|
||||
} else {
|
||||
if (sa.hasParam("ExcessDamage") && (!sa.hasParam("ExcessDamageCondition") ||
|
||||
sourceLKI.isValid(sa.getParam("ExcessDamageCondition").split(","), activationPlayer, hostCard, sa))) {
|
||||
int lethal = c.getLethalDamage();
|
||||
if (sourceLKI.hasKeyword(Keyword.DEATHTOUCH)) {
|
||||
lethal = Math.min(lethal, 1);
|
||||
}
|
||||
int dmgToTarget = Math.min(lethal, dmg);
|
||||
|
||||
damageMap.put(sourceLKI, c, dmgToTarget);
|
||||
|
||||
@@ -276,10 +281,13 @@ public class DamageDealEffect extends DamageBaseEffect {
|
||||
list.addAll(AbilityUtils.getDefinedPlayers(hostCard, sa.getParam("ExcessDamage"), sa));
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
damageMap.put(sourceLKI, list.get(0), dmg - dmgToTarget);
|
||||
damageMap.put(sourceLKI, list.get(0), excess);
|
||||
}
|
||||
} else {
|
||||
damageMap.put(sourceLKI, c, dmg);
|
||||
if (sa.hasParam("ExcessSVar")) {
|
||||
hostCard.setSVar(sa.getParam("ExcessSVar"), Integer.toString(excess));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user