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

View File

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

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;
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<String,String> params = AF.getMapParams();
boolean noPrevention = params.containsKey("NoPrevention");
ArrayList<Object> 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());
}
}
}

View File

@@ -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<Card, Integer> sourcesMap) {
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) {
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()) {

View File

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