added support for mana adding counter magic protection

This commit is contained in:
ArsenalNut
2012-05-21 13:49:36 +00:00
parent 8bac6ecdf2
commit 4a5d943acc
9 changed files with 61 additions and 6 deletions

1
.gitattributes vendored
View File

@@ -1354,6 +1354,7 @@ res/cardsfolder/c/cave_sense.txt svneol=native#text/plain
res/cardsfolder/c/cave_tiger.txt svneol=native#text/plain res/cardsfolder/c/cave_tiger.txt svneol=native#text/plain
res/cardsfolder/c/cavern_crawler.txt svneol=native#text/plain res/cardsfolder/c/cavern_crawler.txt svneol=native#text/plain
res/cardsfolder/c/cavern_harpy.txt svneol=native#text/plain res/cardsfolder/c/cavern_harpy.txt svneol=native#text/plain
res/cardsfolder/c/cavern_of_souls.txt -text
res/cardsfolder/c/cavern_thoctar.txt svneol=native#text/plain res/cardsfolder/c/cavern_thoctar.txt svneol=native#text/plain
res/cardsfolder/c/caverns_of_despair.txt svneol=native#text/plain res/cardsfolder/c/caverns_of_despair.txt svneol=native#text/plain
res/cardsfolder/c/caves_of_koilos.txt svneol=native#text/plain res/cardsfolder/c/caves_of_koilos.txt svneol=native#text/plain

View File

@@ -5,4 +5,6 @@ Text:no text
A:AB$ Mana | Cost$ T | Produced$ Any | RestrictValid$ Creature | SpellDescription$ Add one mana of any color to your mana pool. Spend this mana only to cast a creature spell. A:AB$ Mana | Cost$ T | Produced$ Any | RestrictValid$ Creature | SpellDescription$ Add one mana of any color to your mana pool. Spend this mana only to cast a creature spell.
SVar:Rarity:Uncommon SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/ancient_ziggurat.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/ancient_ziggurat.jpg
SetInfo:CFX|Uncommon|http://magiccards.info/scans/en/cfx/141.jpg
Oracle:{T}: Add one mana of any color to your mana pool. Spend this mana only to cast a creature spell.
End End

View File

@@ -0,0 +1,13 @@
Name:Cavern of Souls
ManaCost:no cost
Types:Land
Text:no text
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Any | Destination$ Battlefield | Execute$ ChooseCT | Static$ True | TriggerDescription$ As CARDNAME enters the battlefield, choose a creature type.
SVar:ChooseCT:AB$ ChooseType | Cost$ 0 | Defined$ You | Type$ Creature | AILogic$ MostProminentInComputerDeck
A:AB$ Mana | Cost$ T | Produced$ 1 | SpellDescription$ Add 1 to your mana pool.
A:AB$ Mana | Cost$ T | Produced$ Any | RestrictValid$ Creature.ChosenType | AddsNoCounter$ True | SpellDescription$ Add one mana of any color to your mana pool. Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered.
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/cavern_of_souls.jpg
SetInfo:AVR|Rare|http://magiccards.info/scans/en/avr/226.jpg
Oracle:As Cavern of Souls enters the battlefield, choose a creature type.\n{T}: Add {1} to your mana pool.\n{T}: Add one mana of any color to your mana pool. Spend this mana only to cast a creature spell of the chosen type, and that spell can't be countered.
End

View File

@@ -6,4 +6,6 @@ A:AB$ Mana | Cost$ T | Produced$ 1 | Amount$ 2 | RestrictValid$ Creature.Myr,Act
A:AB$ ChangeZone | Cost$ 3 T | TgtPrompt$ Choose target Myr card in your graveyard | ValidTgts$ Card.Myr+YouCtrl | Origin$ Graveyard | Destination$ Hand | SpellDescription$ Return target Myr card from your graveyard to your hand. A:AB$ ChangeZone | Cost$ 3 T | TgtPrompt$ Choose target Myr card in your graveyard | ValidTgts$ Card.Myr+YouCtrl | Origin$ Graveyard | Destination$ Hand | SpellDescription$ Return target Myr card from your graveyard to your hand.
SVar:Rarity:Rare SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/myr_reservoir.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/myr_reservoir.jpg
SetInfo:SOM|Rare|http://magiccards.info/scans/en/som/183.jpg
Oracle:{T}: Add {2} to your mana pool. Spend this mana only to cast Myr spells or activate abilities of Myr.\n{3}, {T}: Return target Myr card from your graveyard to your hand.
End End

View File

@@ -133,6 +133,7 @@ public class Card extends GameEntity implements Comparable<Card> {
private final ArrayList<Card> mustBlockCards = new ArrayList<Card>(); private final ArrayList<Card> mustBlockCards = new ArrayList<Card>();
private boolean canMorph = false; private boolean canMorph = false;
private boolean canCounter = true;
private boolean kicked = false; private boolean kicked = false;
private boolean evoked = false; private boolean evoked = false;
@@ -3203,6 +3204,29 @@ public class Card extends GameEntity implements Comparable<Card> {
return this.curCharacteristics == CardCharactersticName.FaceDown; return this.curCharacteristics == CardCharactersticName.FaceDown;
} }
/**
* <p>
* setCanCounter.
* </p>
*
* @param b
* a boolean.
*/
public final void setCanCounter(final boolean b) {
this.canCounter = b;
}
/**
* <p>
* getCanCounter.
* </p>
*
* @return a boolean.
*/
public final boolean getCanCounter() {
return this.canCounter;
}
/** /**
* <p> * <p>
* setCanMorph. * setCanMorph.

View File

@@ -2029,7 +2029,7 @@ public class CardFactoryUtil {
* @return a boolean. * @return a boolean.
*/ */
public static boolean isCounterable(final Card c) { public static boolean isCounterable(final Card c) {
if (c.hasKeyword("CARDNAME can't be countered.")) { if (c.hasKeyword("CARDNAME can't be countered.") || !c.getCanCounter()) {
return false; return false;
} }

View File

@@ -34,8 +34,8 @@ public class Mana {
private String color; private String color;
private Card sourceCard = null; private Card sourceCard = null;
private AbilityMana sourceAbility = null; private AbilityMana sourceAbility = null;
boolean hasRestrictions = false; private boolean hasRestrictions = false;
boolean paidWithCounterable = true; private boolean pumpCounterMagic = false;
/** /**
* <p> * <p>
@@ -57,7 +57,7 @@ public class Mana {
this.hasRestrictions = true; this.hasRestrictions = true;
} }
if (manaAbility.cannotCounterPaidWith()) { if (manaAbility.cannotCounterPaidWith()) {
this.paidWithCounterable = false; this.pumpCounterMagic = true;
} }
} }
if (source == null) { if (source == null) {
@@ -116,8 +116,8 @@ public class Mana {
* *
* @return a boolean. * @return a boolean.
*/ */
public final boolean isPaidWithCounterable() { public final boolean addsNoCounterMagic() {
return this.paidWithCounterable; return this.pumpCounterMagic;
} }
/** /**

View File

@@ -417,6 +417,9 @@ public class ManaPool {
manaCost.payMana(mana); manaCost.payMana(mana);
manaPaid.add(mana); manaPaid.add(mana);
this.removeManaFrom(this.floatingMana, mana); this.removeManaFrom(this.floatingMana, mana);
if (mana.addsNoCounterMagic() && sa.getSourceCard() != null) {
sa.getSourceCard().setCanCounter(false);
}
if (manaCost.isPaid()) { if (manaCost.isPaid()) {
keepPayingFromPool = false; keepPayingFromPool = false;
} }
@@ -455,6 +458,9 @@ public class ManaPool {
manaCost.payMana(mana); manaCost.payMana(mana);
manaPaid.add(mana); manaPaid.add(mana);
this.removeManaFrom(this.floatingMana, mana); this.removeManaFrom(this.floatingMana, mana);
if (mana.addsNoCounterMagic() && sa.getSourceCard() != null) {
sa.getSourceCard().setCanCounter(false);
}
} }
return manaCost; return manaCost;
} }
@@ -488,6 +494,9 @@ public class ManaPool {
manaCost.payMana(mana); manaCost.payMana(mana);
manaPaid.add(mana); manaPaid.add(mana);
this.removeManaFrom(this.floatingMana, mana); this.removeManaFrom(this.floatingMana, mana);
if (mana.addsNoCounterMagic() && sa.getSourceCard() != null) {
sa.getSourceCard().setCanCounter(false);
}
} }
} }
return manaCost; return manaCost;
@@ -521,6 +530,9 @@ public class ManaPool {
abilitiesUsedToPay.clear(); abilitiesUsedToPay.clear();
// move non-undoable paying mana back to floating // move non-undoable paying mana back to floating
if (refund) { if (refund) {
if (ability.getSourceCard() != null) {
ability.getSourceCard().setCanCounter(true);
}
for (final Mana m : manaPaid) { for (final Mana m : manaPaid) {
this.addManaToPool(this.floatingMana, m); this.addManaToPool(this.floatingMana, m);
} }

View File

@@ -1142,6 +1142,7 @@ public class MagicStack extends MyObservable {
// hostCard in AF is not the same object that's on the battlefield // hostCard in AF is not the same object that's on the battlefield
// verified by System.identityHashCode(card); // verified by System.identityHashCode(card);
final Card tmp = sa.getSourceCard(); final Card tmp = sa.getSourceCard();
tmp.setCanCounter(true); // reset mana pumped counter magic flag
if (tmp.getClones().size() > 0) { if (tmp.getClones().size() > 0) {
for (final Card c : AllZoneUtil.getCardsIn(ZoneType.Battlefield)) { for (final Card c : AllZoneUtil.getCardsIn(ZoneType.Battlefield)) {
if (c.equals(tmp)) { if (c.equals(tmp)) {