- Added the optional parameter NoPrevention to DealDamage.

- Added Pinpoint Avalanche.
This commit is contained in:
jendave
2011-08-06 11:08:25 +00:00
parent ca4e347b49
commit 0ce0509df0
6 changed files with 47 additions and 14 deletions

1
.gitattributes vendored
View File

@@ -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/pillory_of_the_sleepless.txt -text svneol=native#text/plain
res/cardsfolder/pincher_beetles.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/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/piranha_marsh.txt -text svneol=native#text/plain
res/cardsfolder/pirate_ship.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 res/cardsfolder/pit_imp.txt -text svneol=native#text/plain

View File

@@ -2,7 +2,7 @@ Name:Lightning Bolt
ManaCost:R ManaCost:R
Types:Instant Types:Instant
Text:no text 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:Rarity:Common
SVar:Picture:http://resources.wizards.com/magic/cards/bd/en-us/card27255.jpg SVar:Picture:http://resources.wizards.com/magic/cards/bd/en-us/card27255.jpg
End End

View File

@@ -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

View File

@@ -2,6 +2,7 @@
package forge; package forge;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random; import java.util.Random;
public class AbilityFactory_DealDamage { public class AbilityFactory_DealDamage {
@@ -383,6 +384,9 @@ import java.util.Random;
private void doResolve(SpellAbility saMe) private void doResolve(SpellAbility saMe)
{ {
int damage = getNumDamage(saMe); int damage = getNumDamage(saMe);
HashMap<String,String> params = AF.getMapParams();
boolean noPrevention = params.containsKey("NoPrevention");
ArrayList<Object> tgts = findTargets(saMe); ArrayList<Object> tgts = findTargets(saMe);
boolean targeted = (AF.getAbTgt() != null) || TgtOpp; boolean targeted = (AF.getAbTgt() != null) || TgtOpp;
@@ -395,15 +399,24 @@ import java.util.Random;
for(Object o : tgts){ for(Object o : tgts){
if (o instanceof Card){ if (o instanceof Card){
Card c = (Card)o; Card c = (Card)o;
if(AllZone.GameAction.isCardInPlay(c) && (!targeted || CardFactoryUtil.canTarget(AF.getHostCard(), c))) if(AllZone.GameAction.isCardInPlay(c) && (!targeted || CardFactoryUtil.canTarget(AF.getHostCard(), c))) {
if (noPrevention)
c.addDamageWithoutPrevention(damage, AF.getHostCard());
else
c.addDamage(damage, AF.getHostCard()); c.addDamage(damage, AF.getHostCard());
} }
}
else if (o instanceof Player){ else if (o instanceof Player){
Player p = (Player) o; Player p = (Player) o;
if (!targeted || p.canTarget(AF.getHostCard())) if (!targeted || p.canTarget(AF.getHostCard())) {
if (noPrevention)
p.addDamageWithoutPrevention(damage, AF.getHostCard());
else
p.addDamage(damage, AF.getHostCard()); p.addDamage(damage, AF.getHostCard());
} }
} }
}
if (hasSubAbAF) { if (hasSubAbAF) {
if (subAbAF.getParent() == null) if (subAbAF.getParent() == null)

View File

@@ -2780,22 +2780,27 @@ public class Card extends MyObservable {
// specific Cards // specific Cards
reduce = reduce || (this.isCreature() && source.isCreature() && reduce = reduce || (this.isCreature() && source.isCreature() &&
AllZoneUtil.isCardInPlay("Well-Laid Plans") && source.sharesColorWith(this)); 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())); reduce = reduce || (source.getController() == getController() && AllZoneUtil.isCardInPlay("Light of Sanction", getController()));
return reduce; return reduce;
} }
public void addDamage(HashMap<Card, Integer> sourcesMap) { public void addDamage(HashMap<Card, Integer> sourcesMap) {
for(Entry<Card, Integer> entry : sourcesMap.entrySet()) { for(Entry<Card, Integer> 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) { public void addDamage(final int damageIn, final Card source) {
int damageToAdd = damageIn; int damageToAdd = damageIn;
if( preventAllDamageToCard(source, false) ) { if( preventAllDamageToCard(source, false)) {
damageToAdd = 0; 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( damageToAdd == 0 ) return; //Rule 119.8

View File

@@ -187,9 +187,15 @@ public abstract class Player extends MyObservable{
public void addDamage(final int damage, final Card source) { public void addDamage(final int damage, final Card source) {
int damageToDo = damage; int damageToDo = damage;
if( preventAllDamageToPlayer(source, false) ) if( preventAllDamageToPlayer(source, false))
damageToDo = 0; damageToDo = 0;
addDamageWithoutPrevention(damageToDo,source);
}
public void addDamageWithoutPrevention(final int damage, final Card source) {
int damageToDo = damage;
if( source.getKeyword().contains("Infect") ) { if( source.getKeyword().contains("Infect") ) {
addPoisonCounters(damageToDo); addPoisonCounters(damageToDo);
} }
@@ -237,11 +243,11 @@ public abstract class Player extends MyObservable{
public int getAssignedDamage() { return assignedDamage; } public int getAssignedDamage() { return assignedDamage; }
public void addCombatDamage(final int damage, final Card source) { public void addCombatDamage(final int damage, final Card source) {
int damageToDo = damage; int damageToDo = damage;
if (source.getKeyword().contains("Prevent all combat damage that would be dealt to and dealt by CARDNAME.") if (preventAllDamageToPlayer(source,true)) damageToDo = 0;
|| source.getKeyword().contains("Prevent all combat damage that would be dealt by CARDNAME."))
damageToDo = 0; addDamageWithoutPrevention(damageToDo, source); //damage prevention is already checked
addDamage(damageToDo, source);
//GameActionUtil.executePlayerDamageEffects(player, source, damage, true); //GameActionUtil.executePlayerDamageEffects(player, source, damage, true);
GameActionUtil.executePlayerCombatDamageEffects(source); GameActionUtil.executePlayerCombatDamageEffects(source);