mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- Added the optional parameter NoPrevention to DealDamage.
- Added Pinpoint Avalanche.
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
8
res/cardsfolder/pinpoint_avalanche.txt
Normal file
8
res/cardsfolder/pinpoint_avalanche.txt
Normal 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
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user