- Added the first global rule change: "Damage can't be prevented.".

- Converted Leyline of Punishment and Everlasting Torment.
This commit is contained in:
Sloth
2012-11-14 11:25:52 +00:00
parent 13aab262fe
commit ab68980856
6 changed files with 37 additions and 10 deletions

View File

@@ -1,8 +1,9 @@
Name:Everlasting Torment
ManaCost:2 BR
Types:Enchantment
Text:Damage can't be prevented. All damage is dealt as though it's source had wither. (A source with wither deals damage to creatures in the form of -1/-1 counters.)
Text:All damage is dealt as though it's source had wither. (A source with wither deals damage to creatures in the form of -1/-1 counters.)
S:Mode$ Continuous | Affected$ Player | AddKeyword$ You can't gain life. | Description$ Players can't gain life.
S:Mode$ Continuous | GlobalRule$ Damage can't be prevented. | Description$ Damage can't be prevented.
SVar:RemRandomDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/everlasting_torment.jpg

View File

@@ -1,8 +1,9 @@
Name:Leyline of Punishment
ManaCost:2 R R
Types:Enchantment
Text:If Leyline of Punishment is in your opening hand, you may begin the game with it on the battlefield. Damage can't be prevented.
Text:If Leyline of Punishment is in your opening hand, you may begin the game with it on the battlefield.
S:Mode$ Continuous | Affected$ Player | AddKeyword$ You can't gain life. | Description$ Players can't gain life.
S:Mode$ Continuous | GlobalRule$ Damage can't be prevented. | Description$ Damage can't be prevented.
SVar:RemRandomDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/leyline_of_punishment.jpg

View File

@@ -7931,8 +7931,7 @@ public class Card extends GameEntity implements Comparable<Card> {
public final int staticDamagePrevention(final int damage, final int possiblePrvenetion, final Card source,
final boolean isCombat) {
if (Singletons.getModel().getGame().isCardInPlay("Leyline of Punishment")
|| Singletons.getModel().getGame().isCardInPlay("Everlasting Torment")) {
if (Singletons.getModel().getGame().getStaticEffects().isNoPrevention()) {
return damage;
}
@@ -7961,8 +7960,7 @@ public class Card extends GameEntity implements Comparable<Card> {
@Override
public final int staticDamagePrevention(final int damageIn, final Card source, final boolean isCombat) {
if (Singletons.getModel().getGame().isCardInPlay("Leyline of Punishment")
|| Singletons.getModel().getGame().isCardInPlay("Everlasting Torment")) {
if (Singletons.getModel().getGame().getStaticEffects().isNoPrevention()) {
return damageIn;
}
@@ -8078,8 +8076,7 @@ public class Card extends GameEntity implements Comparable<Card> {
@Override
public final int preventDamage(final int damage, final Card source, final boolean isCombat) {
if (Singletons.getModel().getGame().isCardInPlay("Leyline of Punishment")
|| Singletons.getModel().getGame().isCardInPlay("Everlasting Torment")
if (Singletons.getModel().getGame().getStaticEffects().isNoPrevention()
|| source.hasKeyword("Damage that would be dealt by CARDNAME can't be prevented.")) {
return damage;
}

View File

@@ -46,10 +46,15 @@ public class StaticEffects {
*/
private ArrayList<StaticEffect> staticEffects;
//Global rule changes
private boolean noPrevention = false;
/**
* clearStaticEffect. TODO Write javadoc for this method.
*/
public final void clearStaticEffects() {
noPrevention = false;
// remove all static effects
for (int i = 0; i < this.staticEffects.size(); i++) {
this.removeStaticEffect(this.staticEffects.get(i));
@@ -59,6 +64,20 @@ public class StaticEffects {
Singletons.getModel().getGame().getTriggerHandler().cleanUpTemporaryTriggers();
}
/**
* @param noPrevent the noPrevention to set
*/
public void setNoPrevention(boolean noPrevent) {
this.noPrevention = noPrevent;
}
/**
* @return the noPrevention
*/
public boolean isNoPrevention() {
return noPrevention;
}
/**
* addStaticEffect. TODO Write javadoc for this method.
*

View File

@@ -28,6 +28,7 @@ import forge.Singletons;
import forge.CardLists;
import forge.CardUtil;
import forge.StaticEffect;
import forge.StaticEffects;
import forge.card.abilityfactory.AbilityFactory;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.replacement.ReplacementEffect;
@@ -90,6 +91,14 @@ public class StaticAbilityContinuous {
boolean removeSubTypes = false;
boolean removeCreatureTypes = false;
//Global rules changes
if (params.containsKey("GlobalRule")) {
final StaticEffects effects = Singletons.getModel().getGame().getStaticEffects();
if (params.get("GlobalRule").equals("Damage can't be prevented.")) {
effects.setNoPrevention(true);
}
}
if (params.containsKey("SetPower")) {
setP = params.get("SetPower");
setPower = setP.matches("[0-9][0-9]?") ? Integer.parseInt(setP)

View File

@@ -603,7 +603,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
@Override
public final int staticDamagePrevention(final int damage, final Card source, final boolean isCombat) {
if (game.isCardInPlay("Leyline of Punishment") || game.isCardInPlay("Everlasting Torment")) {
if (Singletons.getModel().getGame().getStaticEffects().isNoPrevention()) {
return damage;
}
@@ -816,7 +816,7 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
@Override
public final int preventDamage(final int damage, final Card source, final boolean isCombat) {
if (game.isCardInPlay("Leyline of Punishment") || game.isCardInPlay("Everlasting Torment")
if (Singletons.getModel().getGame().getStaticEffects().isNoPrevention()
|| source.hasKeyword("Damage that would be dealt by CARDNAME can't be prevented.")) {
return damage;
}