add Spirit of Resistance (from Invasion)

This commit is contained in:
jendave
2011-08-06 09:35:35 +00:00
parent 59c7f96169
commit 955255223b
3 changed files with 33 additions and 3 deletions

1
.gitattributes vendored
View File

@@ -3944,6 +3944,7 @@ res/cardsfolder/spiraling_embers.txt -text svneol=native#text/plain
res/cardsfolder/spire_barrage.txt -text svneol=native#text/plain
res/cardsfolder/spire_golem.txt -text svneol=native#text/plain
res/cardsfolder/spire_owl.txt -text svneol=native#text/plain
res/cardsfolder/spirit_of_resistance.txt -text svneol=native#text/plain
res/cardsfolder/spirit_of_the_night.txt -text svneol=native#text/plain
res/cardsfolder/spirit_shackle.txt -text svneol=native#text/plain
res/cardsfolder/spiritmonger.txt -text svneol=native#text/plain

View File

@@ -0,0 +1,7 @@
Name:Spirit of Resistance
ManaCost:2 W
Types:Enchantment
Text:As long as you control a permanent of each color, prevent all damage that would be dealt to you.
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/spirit_of_resistance.jpg
End

View File

@@ -127,11 +127,10 @@ public abstract class Player extends MyObservable{
public void addDamage(final int damage, final Card source) {
int damageToDo = damage;
if (source.getKeyword().contains("Prevent all damage that would be dealt to and dealt by CARDNAME.")
|| source.getKeyword().contains("Prevent all damage that would be dealt by CARDNAME."))
if( reducePlayerDamageToZero(source, false) )
damageToDo = 0;
if (source.getKeyword().contains("Infect")) {
if( source.getKeyword().contains("Infect") ) {
addPoisonCounters(damage);
}
else {
@@ -151,6 +150,27 @@ public abstract class Player extends MyObservable{
GameActionUtil.executePlayerDamageEffects(this, source, damageToDo, false);
}
private boolean reducePlayerDamageToZero(final Card source, final boolean isCombat) {
boolean reduce = false;
if(isCombat) {
//for future use
}
reduce = reduce || source.getKeyword().contains("Prevent all damage that would be dealt to and dealt by CARDNAME.");
reduce = reduce || source.getKeyword().contains("Prevent all damage that would be dealt by CARDNAME.");
//Spirit of Resistance
if(AllZoneUtil.isCardInPlay("Spirit of Resistance", this)) {
if( AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.Black).size() > 0
&& AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.Blue).size() > 0
&& AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.Green).size() > 0
&& AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.Red).size() > 0
&& AllZoneUtil.getPlayerColorInPlay(this, Constant.Color.White).size() > 0) {
reduce = true;
}
}
return reduce;
}
public void setAssignedDamage(int n) { assignedDamage = n; }
public int getAssignedDamage() { return assignedDamage; }
@@ -209,6 +229,8 @@ public abstract class Player extends MyObservable{
return new CardList();
}
////////////////////////////////
//
// generic Object overrides