mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Adding Damage Dealing strings to the Game Log so it's clear how much damage things are doing (with occasional extra info)
This commit is contained in:
@@ -8390,12 +8390,10 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
@Override
|
||||
public final boolean addDamageAfterPrevention(final int damageIn, final Card source, final boolean isCombat) {
|
||||
final int damageToAdd = damageIn;
|
||||
boolean wither = false;
|
||||
|
||||
if (damageToAdd == 0) {
|
||||
return false; // Rule 119.8
|
||||
}
|
||||
Log.debug("Adding " + damageToAdd + " damage to " + this.getName());
|
||||
|
||||
this.addReceivedDamageFromThisTurn(source, damageToAdd);
|
||||
source.addDealtDamageToThisTurn(this, damageToAdd);
|
||||
@@ -8410,26 +8408,30 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
runParams.put("IsCombatDamage", isCombat);
|
||||
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.DamageDone, runParams, false);
|
||||
|
||||
String additionalLog = "";
|
||||
if (this.isPlaneswalker()) {
|
||||
this.subtractCounter(CounterType.LOYALTY, damageToAdd);
|
||||
return true;
|
||||
additionalLog = String.format("(Removing %d Loyalty Counters)", damageToAdd);
|
||||
} else {
|
||||
boolean wither = (Singletons.getModel().getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.alwaysWither)
|
||||
|| source.hasKeyword("Wither") || source.hasKeyword("Infect"));
|
||||
|
||||
GameActionUtil.executeDamageToCreatureEffects(source, this, damageToAdd);
|
||||
|
||||
if (this.isInPlay() && wither) {
|
||||
this.addCounter(CounterType.M1M1, damageToAdd, true);
|
||||
additionalLog = "(As -1/-1 Counters)";
|
||||
}
|
||||
if (source.hasKeyword("Deathtouch") && this.isCreature()) {
|
||||
Singletons.getModel().getGame().getAction().destroy(this);
|
||||
additionalLog = "(Deathtouch)";
|
||||
} else if (this.isInPlay() && !wither) {
|
||||
this.damage += damageToAdd;
|
||||
}
|
||||
}
|
||||
|
||||
if (Singletons.getModel().getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.alwaysWither)
|
||||
|| source.hasKeyword("Wither") || source.hasKeyword("Infect")) {
|
||||
wither = true;
|
||||
}
|
||||
|
||||
GameActionUtil.executeDamageToCreatureEffects(source, this, damageToAdd);
|
||||
|
||||
if (this.isInPlay() && wither) {
|
||||
this.addCounter(CounterType.M1M1, damageToAdd, true);
|
||||
}
|
||||
if (source.hasKeyword("Deathtouch") && this.isCreature()) {
|
||||
Singletons.getModel().getGame().getAction().destroy(this);
|
||||
} else if (this.isInPlay() && !wither) {
|
||||
this.damage += damageToAdd;
|
||||
}
|
||||
Singletons.getModel().getGame().getGameLog().add("Damage", String.format("Dealing %d damage to %s. %s",
|
||||
damageToAdd, this.getName(), additionalLog), 3);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -608,7 +608,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
if (damageToDo == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String additionalLog = "";
|
||||
source.addDealtDamageToPlayerThisTurn(this.getName(), damageToDo);
|
||||
|
||||
boolean infect = source.hasKeyword("Infect")
|
||||
@@ -616,12 +616,14 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
|
||||
if (infect) {
|
||||
this.addPoisonCounters(damageToDo, source);
|
||||
additionalLog = "(as Poison Counters)";
|
||||
} else {
|
||||
// Worship does not reduce the damage dealt but changes the effect
|
||||
// of the damage
|
||||
if (this.hasKeyword("Damage that would reduce your life total to less than 1 reduces it to 1 instead.")
|
||||
&& this.life <= damageToDo) {
|
||||
this.loseLife(Math.min(damageToDo, this.life - 1));
|
||||
additionalLog = "(would reduce life total to less than 1, reduced to 1 instead.)";
|
||||
} else {
|
||||
// rule 118.2. Damage dealt to a player normally causes that
|
||||
// player to lose that much life.
|
||||
@@ -648,6 +650,9 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
|
||||
runParams.put("IsCombatDamage", isCombat);
|
||||
game.getTriggerHandler().runTrigger(TriggerType.DamageDone, runParams, false);
|
||||
|
||||
Singletons.getModel().getGame().getGameLog().add("Damage", String.format("Dealing %d damage to %s. %s",
|
||||
damageToDo, this.getName(), additionalLog), 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user