diff --git a/.gitattributes b/.gitattributes index c8eea9075ea..72cab185683 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3389,6 +3389,7 @@ res/cardsfolder/pillarfield_ox.txt -text svneol=native#text/plain res/cardsfolder/pillory_of_the_sleepless.txt -text svneol=native#text/plain res/cardsfolder/pincher_beetles.txt -text svneol=native#text/plain res/cardsfolder/pine_barrens.txt -text svneol=native#text/plain +res/cardsfolder/pinpoint_avalanche.txt -text svneol=native#text/plain res/cardsfolder/piranha_marsh.txt -text svneol=native#text/plain res/cardsfolder/pirate_ship.txt -text svneol=native#text/plain res/cardsfolder/pit_imp.txt -text svneol=native#text/plain diff --git a/res/cardsfolder/lightning_bolt.txt b/res/cardsfolder/lightning_bolt.txt index e4b37c6d672..4914a71c5eb 100644 --- a/res/cardsfolder/lightning_bolt.txt +++ b/res/cardsfolder/lightning_bolt.txt @@ -2,7 +2,7 @@ Name:Lightning Bolt ManaCost:R Types:Instant Text:no text -K:spDamageTgtCP:3 +A:SP$DealDamage | Cost$ R | Tgt$ TgtCP | NumDmg$ 3 | SpellDescription$ CARDNAME deals 3 damage to target creature or player. SVar:Rarity:Common SVar:Picture:http://resources.wizards.com/magic/cards/bd/en-us/card27255.jpg End diff --git a/res/cardsfolder/pinpoint_avalanche.txt b/res/cardsfolder/pinpoint_avalanche.txt new file mode 100644 index 00000000000..0388e370df1 --- /dev/null +++ b/res/cardsfolder/pinpoint_avalanche.txt @@ -0,0 +1,8 @@ +Name:Pinpoint Avalanche +ManaCost:3 R R +Types:Instant +Text:no text +A:SP$DealDamage | Cost$ 3 R R | Tgt$ TgtC | NumDmg$ 4 | NoPrevention$ True | SpellDescription$ Pinpoint Avalanche deals 4 damage to target creature. The damage can't be prevented. +SVar:Rarity:Common +SVar:Picture:http://www.wizards.com/global/images/magic/general/pinpoint_avalanche.jpg +End diff --git a/src/forge/AbilityFactory_DealDamage.java b/src/forge/AbilityFactory_DealDamage.java index 15ad4455930..7e4a2d1fb15 100644 --- a/src/forge/AbilityFactory_DealDamage.java +++ b/src/forge/AbilityFactory_DealDamage.java @@ -2,6 +2,7 @@ package forge; import java.util.ArrayList; +import java.util.HashMap; import java.util.Random; public class AbilityFactory_DealDamage { @@ -383,6 +384,9 @@ import java.util.Random; private void doResolve(SpellAbility saMe) { int damage = getNumDamage(saMe); + HashMap params = AF.getMapParams(); + + boolean noPrevention = params.containsKey("NoPrevention"); ArrayList tgts = findTargets(saMe); boolean targeted = (AF.getAbTgt() != null) || TgtOpp; @@ -395,13 +399,22 @@ import java.util.Random; for(Object o : tgts){ if (o instanceof Card){ Card c = (Card)o; - if(AllZone.GameAction.isCardInPlay(c) && (!targeted || CardFactoryUtil.canTarget(AF.getHostCard(), c))) - c.addDamage(damage, AF.getHostCard()); + if(AllZone.GameAction.isCardInPlay(c) && (!targeted || CardFactoryUtil.canTarget(AF.getHostCard(), c))) { + if (noPrevention) + c.addDamageWithoutPrevention(damage, AF.getHostCard()); + else + c.addDamage(damage, AF.getHostCard()); + } + } else if (o instanceof Player){ Player p = (Player) o; - if (!targeted || p.canTarget(AF.getHostCard())) - p.addDamage(damage, AF.getHostCard()); + if (!targeted || p.canTarget(AF.getHostCard())) { + if (noPrevention) + p.addDamageWithoutPrevention(damage, AF.getHostCard()); + else + p.addDamage(damage, AF.getHostCard()); + } } } diff --git a/src/forge/Card.java b/src/forge/Card.java index ea40f84b430..08281a7548c 100644 --- a/src/forge/Card.java +++ b/src/forge/Card.java @@ -2780,23 +2780,28 @@ public class Card extends MyObservable { // specific Cards reduce = reduce || (this.isCreature() && source.isCreature() && AllZoneUtil.isCardInPlay("Well-Laid Plans") && source.sharesColorWith(this)); - reduce = reduce || (isCombat && AllZoneUtil.isCardInPlay("Mark of Asylum", getController())); + reduce = reduce || (!isCombat && AllZoneUtil.isCardInPlay("Mark of Asylum", getController())); reduce = reduce || (source.getController() == getController() && AllZoneUtil.isCardInPlay("Light of Sanction", getController())); return reduce; } public void addDamage(HashMap sourcesMap) { for(Entry entry : sourcesMap.entrySet()) { - this.addDamage(entry.getValue(), entry.getKey()); + addDamageWithoutPrevention(entry.getValue(), entry.getKey()); // damage prevention is already checked! } } public void addDamage(final int damageIn, final Card source) { int damageToAdd = damageIn; - if( preventAllDamageToCard(source, false) ) { + if( preventAllDamageToCard(source, false)) { damageToAdd = 0; } + addDamageWithoutPrevention(damageToAdd,source); + } + public void addDamageWithoutPrevention(final int damageIn, final Card source) { + int damageToAdd = damageIn; + if( damageToAdd == 0 ) return; //Rule 119.8 if(this.isPlaneswalker()) { diff --git a/src/forge/Player.java b/src/forge/Player.java index 06461cfc58d..e5fd2843b48 100644 --- a/src/forge/Player.java +++ b/src/forge/Player.java @@ -187,8 +187,14 @@ public abstract class Player extends MyObservable{ public void addDamage(final int damage, final Card source) { int damageToDo = damage; - if( preventAllDamageToPlayer(source, false) ) - damageToDo = 0; + if( preventAllDamageToPlayer(source, false)) + damageToDo = 0; + + addDamageWithoutPrevention(damageToDo,source); + } + + public void addDamageWithoutPrevention(final int damage, final Card source) { + int damageToDo = damage; if( source.getKeyword().contains("Infect") ) { addPoisonCounters(damageToDo); @@ -237,11 +243,11 @@ public abstract class Player extends MyObservable{ public int getAssignedDamage() { return assignedDamage; } public void addCombatDamage(final int damage, final Card source) { + int damageToDo = damage; - if (source.getKeyword().contains("Prevent all combat damage that would be dealt to and dealt by CARDNAME.") - || source.getKeyword().contains("Prevent all combat damage that would be dealt by CARDNAME.")) - damageToDo = 0; - addDamage(damageToDo, source); + if (preventAllDamageToPlayer(source,true)) damageToDo = 0; + + addDamageWithoutPrevention(damageToDo, source); //damage prevention is already checked //GameActionUtil.executePlayerDamageEffects(player, source, damage, true); GameActionUtil.executePlayerCombatDamageEffects(source);