mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
Merge branch 'cleanup' into 'master'
Cleanup predictDamageTo See merge request core-developers/forge!5413
This commit is contained in:
@@ -70,7 +70,7 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
|
||||
|
||||
// This should be also usable by the AI to forecast an effect (so it must
|
||||
// not change the game state)
|
||||
public int staticDamagePrevention(final int damage, final int possiblePrevention, final Card source, final boolean isCombat) {
|
||||
public int staticDamagePrevention(int damage, final int possiblePrevention, final Card source, final boolean isCombat) {
|
||||
if (damage <= 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -88,6 +88,10 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
|
||||
(!re.hasParam("PreventionEffect") && !re.hasParam("Prevent"))) {
|
||||
continue;
|
||||
}
|
||||
// Immortal Coil prevents the damage but has a similar negative effect
|
||||
if ("Immortal Coil".equals(ca.getName())) {
|
||||
continue;
|
||||
}
|
||||
if (!re.matchesValidParam("ValidSource", source)) {
|
||||
continue;
|
||||
}
|
||||
@@ -104,10 +108,11 @@ public abstract class GameEntity extends GameObject implements IIdentifiable {
|
||||
} else if (re.getOverridingAbility() != null) {
|
||||
SpellAbility repSA = re.getOverridingAbility();
|
||||
if (repSA.getApi() == ApiType.ReplaceDamage) {
|
||||
return Math.max(0, damage - AbilityUtils.calculateAmount(ca, repSA.getParam("Amount"), repSA));
|
||||
damage = Math.max(0, damage - AbilityUtils.calculateAmount(ca, repSA.getParam("Amount"), repSA));
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5239,13 +5239,13 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
}
|
||||
} else if (c.getName().equals("Furnace of Rath")) {
|
||||
if (isCreature()) {
|
||||
restDamage += restDamage;
|
||||
restDamage *= 2;
|
||||
}
|
||||
} else if (c.getName().equals("Dictate of the Twin Gods")) {
|
||||
restDamage += restDamage;
|
||||
} else if (c.getName().equals("Gratuitous Violence")) {
|
||||
if (c.getController().equals(source.getController()) && source.isCreature() && isCreature()) {
|
||||
restDamage += restDamage;
|
||||
restDamage *= 2;
|
||||
}
|
||||
} else if (c.getName().equals("Fire Servant")) {
|
||||
if (c.getController().equals(source.getController()) && source.isRed()
|
||||
@@ -5419,7 +5419,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
return (c != null ? c.getImageKey() : "");
|
||||
}
|
||||
|
||||
|
||||
public final boolean isTributed() { return tributed; }
|
||||
|
||||
public final void setTributed(final boolean b) {
|
||||
|
||||
@@ -742,10 +742,10 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
restDamage += 2;
|
||||
}
|
||||
} else if (c.getName().equals("Furnace of Rath") || c.getName().equals("Dictate of the Twin Gods")) {
|
||||
restDamage += restDamage;
|
||||
restDamage *= 2;
|
||||
} else if (c.getName().equals("Gratuitous Violence")) {
|
||||
if (c.getController().equals(source.getController()) && source.isCreature()) {
|
||||
restDamage += restDamage;
|
||||
restDamage *= 2;
|
||||
}
|
||||
} else if (c.getName().equals("Fire Servant")) {
|
||||
if (c.getController().equals(source.getController()) && source.isRed()
|
||||
|
||||
@@ -139,7 +139,6 @@ public class ReplaceDamage extends ReplacementEffect {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.replacement.ReplacementEffect#setReplacingObjects(java.util.HashMap, forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
|
||||
@@ -66,8 +66,6 @@ public class ReplaceDraw extends ReplacementEffect {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.replacement.ReplacementEffect#setReplacingObjects(java.util.HashMap, forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
|
||||
@@ -61,8 +61,6 @@ public class ReplaceDrawCards extends ReplacementEffect {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.replacement.ReplacementEffect#setReplacingObjects(java.util.HashMap, forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
|
||||
@@ -51,8 +51,6 @@ public class ReplaceMill extends ReplacementEffect {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.replacement.ReplacementEffect#setReplacingObjects(java.util.HashMap, forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user