mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Excess damage fix
This commit is contained in:
@@ -181,7 +181,7 @@ public class CharmAi extends SpellAbilityAi {
|
||||
} else if (ai.canGainLife() && aiLife <= 5) {
|
||||
// critical Life try to gain more
|
||||
chosenList.add(gain);
|
||||
} else if (!ai.canGainLife() && aiLife == 14 ) {
|
||||
} else if (!ai.canGainLife() && aiLife == 14) {
|
||||
// ai cant gain life, but try to avoid falling to 13
|
||||
// but if a opponent does control Tainted Remedy its irrelevant
|
||||
chosenList.add(oppTainted ? lose : gain);
|
||||
|
||||
@@ -2260,10 +2260,12 @@ public class GameAction {
|
||||
public void dealDamage(final boolean isCombat, final CardDamageMap damageMap, final CardDamageMap preventMap,
|
||||
final GameEntityCounterTable counterTable, final SpellAbility cause) {
|
||||
// Clear assigned damage if is combat
|
||||
for (Map.Entry<GameEntity, Map<Card, Integer>> et : damageMap.columnMap().entrySet()) {
|
||||
final GameEntity ge = et.getKey();
|
||||
if (isCombat && ge instanceof Card) {
|
||||
((Card) ge).clearAssignedDamage();
|
||||
if (isCombat) {
|
||||
for (Map.Entry<GameEntity, Map<Card, Integer>> et : damageMap.columnMap().entrySet()) {
|
||||
final GameEntity ge = et.getKey();
|
||||
if (ge instanceof Card) {
|
||||
((Card) ge).clearAssignedDamage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2282,7 +2284,7 @@ public class GameAction {
|
||||
sum += e.getValue();
|
||||
}
|
||||
|
||||
if (sourceLKI.hasKeyword(Keyword.LIFELINK)) {
|
||||
if (sum > 0 && sourceLKI.hasKeyword(Keyword.LIFELINK)) {
|
||||
sourceLKI.getController().gainLife(sum, sourceLKI, cause);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,11 +262,20 @@ public class DamageDealEffect extends DamageBaseEffect {
|
||||
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);
|
||||
if (sa.hasParam("ExcessDamage") || sa.hasParam("ExcessSVar")) {
|
||||
int lethalPW = 0;
|
||||
int lethalCreature = 0;
|
||||
if (c.isCreature()) {
|
||||
lethalCreature = Math.max(0, c.getLethalDamage());
|
||||
if (sourceLKI.hasKeyword(Keyword.DEATHTOUCH)) {
|
||||
lethalCreature = Math.min(lethalCreature, 1);
|
||||
}
|
||||
}
|
||||
if (c.isPlaneswalker()) {
|
||||
lethalPW = c.getCurrentLoyalty();
|
||||
}
|
||||
// 120.4a
|
||||
int lethal = Math.min(lethalPW, lethalCreature);
|
||||
dmgToTarget = Math.min(lethal, dmg);
|
||||
excess = dmg - dmgToTarget;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user