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