Added Reflecting Pool and Exotic Orchard with abAddReflectedMana keyword.

Changed getColors() and getColor2() to getLongManaString and getShortManaString.
Clean-up from FinestHour: rename resetAttackedThisPhase to resetAttackedThisCombat.
This commit is contained in:
jendave
2011-08-06 03:53:36 +00:00
parent 3b292208dd
commit 65f0068817
14 changed files with 587 additions and 308 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,15 @@
Exotic Orchard
no cost
Land
no text
abAddReflectedMana:Color:Opp
Reflecting Pool
no cost
Land
no text
abAddReflectedMana:Type:You
Fallowsage Fallowsage
3 U 3 U
Creature Merfolk Wizard Creature Merfolk Wizard
@@ -2390,7 +2402,7 @@ Peacekeeper
Creature Human Creature Human
Creatures can't attack Creatures can't attack
1/1 1/1
At the beginning of your upkeep, sacrifice CARDNAME unless you pay:1 W Upkeep:1 W
Arctic Nishoba Arctic Nishoba
5 G 5 G
@@ -4682,7 +4694,6 @@ Treetop Bracers
Enchantment Aura Enchantment Aura
Enchanted creature gets +1/+1 and can't be blocked except by creatures with flying. Enchanted creature gets +1/+1 and can't be blocked except by creatures with flying.
Enchant creature Enchant creature
enPump:+1/+1/This creature can't be blocked except by creatures with flying
Silhana Ledgewalker Silhana Ledgewalker
1 G 1 G
@@ -4934,9 +4945,8 @@ Eternity Snare
5 U 5 U
Enchantment Aura Enchantment Aura
Enchanted creature doesn't untap during its controller's untap step. Enchanted creature doesn't untap during its controller's untap step.
Enchant creature
enPumpCurse:This card doesn't untap during your untap step.
When this card comes into play, draw a card. When this card comes into play, draw a card.
Enchant creature
Elvish Hunter Elvish Hunter
1 G 1 G
@@ -4967,9 +4977,8 @@ abDrawCards 3 U T:1:Draw a card.:Scepter of Insight - draw a card
Asha's Favor Asha's Favor
2 W 2 W
Enchantment Aura Enchantment Aura
Enchanted creature has flying, first strike, and vigilance. Enchanted creature gains flying, first strike and vigilance.
Enchant creature Enchant creature
enPump:Flying & First Strike & Vigilance
Frontline Sage Frontline Sage
2 U 2 U
@@ -5052,7 +5061,7 @@ spDrawCards:2:Draw two cards.:Touch of Brilliance - draw 2 cards.
Inspiration Inspiration
3 U 3 U
Instant Sorcery
no text no text
spDrawCardsTgt:2:Target player draws two cards.:Inspiration - draw 2 cards. spDrawCardsTgt:2:Target player draws two cards.:Inspiration - draw 2 cards.
@@ -5146,7 +5155,6 @@ Rejuvenate
3 G 3 G
Sorcery Sorcery
no text no text
spGainLife:6
Cycling:2 Cycling:2
Absolute Grace Absolute Grace
@@ -5163,7 +5171,6 @@ Braidwood Cup
3 3
Artifact Artifact
no text no text
abGainLife T:1
Onyx Goblet Onyx Goblet
2 B 2 B
@@ -5176,15 +5183,13 @@ Lightning Talons
Enchantment Aura Enchantment Aura
Enchanted creature gets +3/+0 and has first strike. Enchanted creature gets +3/+0 and has first strike.
Enchant creature Enchant creature
enPump:+3/+0/First Strike
Despondency Despondency
1 B 1 B
Enchantment Aura Enchantment Aura
Enchanted creature gets -2/-0. Enchanted creature gets -2/+0.
Enchant creature
enPumpCurse:-2/-0
When this card is put into a graveyard from the battlefield, return this card to its owner's hand When this card is put into a graveyard from the battlefield, return this card to its owner's hand
Enchant creature
Snow-Covered Forest Snow-Covered Forest
no cost no cost
@@ -5260,17 +5265,15 @@ Tiger Claws
2 G 2 G
Enchantment Aura Enchantment Aura
Enchanted creature gets +1/+1 and has trample. Enchanted creature gets +1/+1 and has trample.
Flash
Enchant creature Enchant creature
enPump:+1/+1/Trample Flash
Mageta's Boon Mageta's Boon
1 W 1 W
Enchantment Aura Enchantment Aura
Enchanted creature gets +1/+2. Enchanted creature gets +1/+2.
Flash
Enchant creature Enchant creature
enPump:+1/+2 Flash
Buoyancy Buoyancy
1 U 1 U
@@ -5285,7 +5288,6 @@ Feast of the Unicorn
Enchantment Aura Enchantment Aura
Enchanted creature gets +4/+0. Enchanted creature gets +4/+0.
Enchant creature Enchant creature
enPump:+4/+0
Vigilance Vigilance
W W
@@ -5298,7 +5300,6 @@ W
Enchantment Aura Enchantment Aura
Enchanted creature has protection from black and from red. Enchanted creature has protection from black and from red.
Enchant creature Enchant creature
enPump:Protection from black & Protection from red
Benalish Heralds Benalish Heralds
3 W 3 W
@@ -5312,7 +5313,6 @@ U R
Enchantment Aura Enchantment Aura
Enchanted creature gets +2/+0 and has flying. Enchanted creature gets +2/+0 and has flying.
Enchant creature Enchant creature
enPump:+2/+0/Flying
Benalish Trapper Benalish Trapper
1 W 1 W
@@ -5324,36 +5324,31 @@ Sacred Nectar
1 W 1 W
Sorcery Sorcery
no text no text
spGainLife:4
Maniacal Rage Maniacal Rage
1 R 1 R
Enchantment Aura Enchantment Aura
Enchanted creature gets +2/+2 and can't block. Enchanted creature gets +2/+2 and this creature cannot block.
Enchant creature Enchant creature
enPump:+2/+2/This creature cannot block
Scavenged Weaponry Scavenged Weaponry
2 B 2 B
Enchantment Aura Enchantment Aura
Enchanted creature gets +1/+1. Enchanted creature gets +1/+1.
Enchant creature Enchant creature
enPump:+1/+1 Draw a card.
When this card comes into play, draw a card.
Shield of Duty and Reason Shield of Duty and Reason
W W
Enchantment Aura Enchantment Aura
Enchanted creature has protection from green and from blue. Enchanted creature has protection from green and from blue.
Enchant creature Enchant creature
enPump:Protection from green & Protection from blue
Reflexes Reflexes
R R
Enchantment Aura Enchantment Aura
Enchanted creature has first strike. Enchanted creature has first strike.
Enchant creature Enchant creature
enPump:First Strike
Dakmor Ghoul Dakmor Ghoul
2 B B 2 B B
@@ -5663,14 +5658,12 @@ R R
Enchantment Aura Enchantment Aura
Enchanted creature gets +2/+2. Enchanted creature gets +2/+2.
Enchant creature Enchant creature
enPump:+2/+2
Goblin War Paint Goblin War Paint
1 R 1 R
Enchantment Aura Enchantment Aura
Enchanted creature gets +2/+2 and has haste. Enchanted creature gets +2/+2 and has haste.
Enchant creature Enchant creature
enPump:+2/+2/Haste
Vithian Renegades Vithian Renegades
1 R G 1 R G
@@ -5782,23 +5775,20 @@ Cessation
2 W 2 W
Enchantment Aura Enchantment Aura
Enchanted creature can't attack. Enchanted creature can't attack.
Enchant creature
enPumpCurse:This creature can't attack
When this card is put into a graveyard from the battlefield, return this card to its owner's hand When this card is put into a graveyard from the battlefield, return this card to its owner's hand
Enchant creature
Pacifism Pacifism
1 W 1 W
Enchantment Aura Enchantment Aura
Enchanted creature can't attack or block. Enchanted creature can't attack or block.
Enchant creature Enchant creature
enPumpCurse:This creature can't attack or block
Bound in Silence Bound in Silence
2 W 2 W
Tribal Enchantment Rebel Aura Tribal Enchantment Rebel Aura
Enchanted creature can't attack or block. Enchanted creature can't attack or block.
Enchant creature Enchant creature
enPumpCurse:This creature can't attack or block
Barrenton Cragtreads Barrenton Cragtreads
2 WU WU 2 WU WU
@@ -6344,14 +6334,12 @@ Silent Attendant
Creature Human Cleric Creature Human Cleric
no text no text
0/2 0/2
abGainLife T:1
Zephid's Embrace Zephid's Embrace
2 U U 2 U U
Enchantment Aura Enchantment Aura
Enchanted creature gets +2/+2 and has flying and shroud. Enchanted creature gets +2/+2 and has flying and shroud.
Enchant creature Enchant creature
enPump:+2/+2/Flying & Shroud
Sunastian Falconer Sunastian Falconer
3 R G 3 R G
@@ -6383,7 +6371,6 @@ Protective Bubble
Enchantment Aura Enchantment Aura
Enchanted creature is unblockable and has shroud. Enchanted creature is unblockable and has shroud.
Enchant creature Enchant creature
enPump:Unblockable & Shroud
Diplomatic Immunity Diplomatic Immunity
1 U 1 U
@@ -6410,15 +6397,13 @@ Battle Mastery
Enchantment Aura Enchantment Aura
Enchanted creature has double strike. Enchanted creature has double strike.
Enchant creature Enchant creature
enPump:Double Strike
Uncontrollable Anger Uncontrollable Anger
2 R R 2 R R
Enchantment Aura Enchantment Aura
Enchanted creature gets +2/+2 and attacks each turn if able. Enchanted creature gets +2/+2 and attacks each turn if able.
Enchant creature
enPump:+2/+2/This card attacks each turn if able.
Flash Flash
Enchant creature
Soulscour Soulscour
7 W W W 7 W W W
@@ -6492,10 +6477,9 @@ no text
AEther Web AEther Web
1 G 1 G
Enchantment Aura Enchantment Aura
Enchanted creature gets +1/+1, has reach, and can block creatures with shadow as though they didn't have shadow. Enchanted creature gets +1/+1, has reach, and can block creatures with shadow as though they didn't have shadow.
Flash
Enchant creature Enchant creature
enPump:+1/+1/Reach & This creature can block creatures with shadow as though they didn't have shadow. Flash
Emeria Angel Emeria Angel
2 W W 2 W W
@@ -6511,7 +6495,6 @@ Enchantment Aura
Enchanted creature gets +1/+2. Enchanted creature gets +1/+2.
Flash Flash
Enchant creature Enchant creature
enPump:+1/+2
Cleanfall Cleanfall
2 W 2 W
@@ -6529,7 +6512,6 @@ Nourish
G G G G
Instant Instant
no text no text
spGainLife:6
Arcbound Bruiser Arcbound Bruiser
5 5
@@ -6754,14 +6736,12 @@ W U
Enchantment Aura Enchantment Aura
Enchanted creature gets +1/+3 and has flying. Enchanted creature gets +1/+3 and has flying.
Enchant creature Enchant creature
enPump:+1/+3/Flying
Serra's Embrace Serra's Embrace
2 W W 2 W W
Enchantment Aura Enchantment Aura
Enchanted creature gets +2/+2 and has flying and vigilance. Enchanted creature gets +2/+2 and has flying and vigilance.
Enchant creature Enchant creature
enPump:+2/+2/Flying & Vigilance
Flight Flight
U U
@@ -6786,16 +6766,14 @@ Dosan's Oldest Chant
4 G 4 G
Sorcery Sorcery
no text no text
spGainLife:6
Draw a card. Draw a card.
Sluggishness Sluggishness
1 R 1 R
Enchantment Aura Enchantment Aura
Enchanted creature can't block. Enchanted creature can't block.
Enchant creature
enPumpCurse:This creature cannot block
When this card is put into a graveyard from the battlefield, return this card to its owner's hand When this card is put into a graveyard from the battlefield, return this card to its owner's hand
Enchant creature
Aspect of Mongoose Aspect of Mongoose
1 G 1 G
@@ -6813,12 +6791,11 @@ enPump:Flying
When this card is put into a graveyard from the battlefield, return this card to its owner's hand When this card is put into a graveyard from the battlefield, return this card to its owner's hand
Sleeper's Guile Sleeper's Guile
2 B 1 B
Enchantment Aura Enchantment Aura
Enchanted creature has fear. Enchanted creature has fear.
Enchant creature
enPump:Fear
When this card is put into a graveyard from the battlefield, return this card to its owner's hand When this card is put into a graveyard from the battlefield, return this card to its owner's hand
Enchant creature
Weatherseed Treefolk Weatherseed Treefolk
2 G G G 2 G G G
@@ -6832,25 +6809,22 @@ Brilliant Halo
1 W 1 W
Enchantment Aura Enchantment Aura
Enchanted creature gets +1/+2. Enchanted creature gets +1/+2.
Enchant creature
enPump:+1/+2
When this card is put into a graveyard from the battlefield, return this card to its owner's hand When this card is put into a graveyard from the battlefield, return this card to its owner's hand
Enchant creature
Rancor Rancor
G G
Enchantment Aura Enchantment Aura
Enchanted creature gets +2/+0 and has trample. Enchanted creature gets +2/+0 and has trample.
Enchant creature
enPump:+2/+0/Trample
When this card is put into a graveyard from the battlefield, return this card to its owner's hand When this card is put into a graveyard from the battlefield, return this card to its owner's hand
Enchant creature
Undying Rage Undying Rage
2 R 2 R
Enchantment Aura Enchantment Aura
Enchanted creature gets +2/+2 and can't block. Enchanted creature gets +2/+2 and can't block.
Enchant creature
enPump:+2/+2/This creature cannot block
When this card is put into a graveyard from the battlefield, return this card to its owner's hand When this card is put into a graveyard from the battlefield, return this card to its owner's hand
Enchant creature
Vedalken Plotter Vedalken Plotter
2 U 2 U
@@ -6880,7 +6854,6 @@ Armadillo Cloak
Enchantment Aura Enchantment Aura
Enchanted creature gets +2/+2 and has trample and lifelink. Enchanted creature gets +2/+2 and has trample and lifelink.
Enchant creature Enchant creature
enPump:+2/+2/Trample & Lifelink
Dryad Sophisticate Dryad Sophisticate
1 G 1 G
@@ -8241,21 +8214,18 @@ B
Enchantment Aura Enchantment Aura
Enchanted creature gets -2/-1. Enchanted creature gets -2/-1.
Enchant creature Enchant creature
enPumpCurse:-2/-1
Unholy Strength Unholy Strength
B B
Enchantment Aura Enchantment Aura
Enchanted creature gets +2/+1. Enchanted creature gets +2/+1.
Enchant creature Enchant creature
enPump:+2/+1
Holy Strength Holy Strength
W W
Enchantment Aura Enchantment Aura
Enchanted creature gets +1/+2. Enchanted creature gets +1/+2.
Enchant creature Enchant creature
enPump:+1/+2
Giant Growth Giant Growth
G G
@@ -13207,9 +13177,7 @@ Put X 1/1 white Pegasus creature tokens with flying into play, where X is your l
Festival of Trokin Festival of Trokin
W W
Sorcery Sorcery
no text For each creature you have in play, you gain 2 life.
spGainLife:X:You gain 2 life for each creature you control.:Festival of Trokin - player gains X life
SVar:X:Count$TypeYouCtrl.Creature/Times.2
Savannah Savannah
no cost no cost
@@ -16704,8 +16672,6 @@ Wellwisher
Creature Elf Creature Elf
no text no text
1/1 1/1
abGainLife T:X:You gain 1 life for each Elf on the battlefield.:Wellwisher - you gain life
SVar:X:Count$TypeOnBattlefield.Elf
Sylvan Messenger Sylvan Messenger
3 G 3 G
@@ -17407,9 +17373,7 @@ Search your library for two basic land cards, reveal those cards, and put one in
Wandering Stream Wandering Stream
2 G 2 G
Sorcery Sorcery
no text You gain 2 life for each basic land type among lands you control.
spGainLife:X:Domain - You gain 2 life for each basic land type among lands you control.:Wandering Stream - player gains X life
SVar:X:Count$Domain/Times.2
Aggressive Urge Aggressive Urge
1 G 1 G
@@ -17697,8 +17661,7 @@ Tap all nonwhite creatures.
Reviving Dose Reviving Dose
2 W 2 W
Instant Instant
no text You gain 3 life.
spGainLife:3
Draw a card. Draw a card.
Angelic Blessing Angelic Blessing
@@ -17756,7 +17719,6 @@ Tanglebloom
1 1
Artifact Artifact
no text no text
abGainLife 1 T:1
Nevinyrral's Disk Nevinyrral's Disk
4 4
@@ -17768,7 +17730,6 @@ Renewed Faith
Instant Instant
no text no text
Cycling:1 W Cycling:1 W
spGainLife:6
Hymn to Tourach Hymn to Tourach
B B B B

View File

@@ -10,6 +10,7 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
public String orig; public String orig;
private String Mana; private String Mana;
private Card sourceCard; private Card sourceCard;
private boolean reflectedMana = false;
public boolean isBasic() { public boolean isBasic() {
return (orig.length() == 10 && orig.startsWith("tap: add ") && "1WBURG".contains("" + orig.charAt(9))); return (orig.length() == 10 && orig.startsWith("tap: add ") && "1WBURG".contains("" + orig.charAt(9)));
@@ -21,6 +22,13 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
{ {
this(sourceCard, "0"); this(sourceCard, "0");
}*/ }*/
public void setReflectedMana(boolean b) {
this.reflectedMana = b;
}
public boolean isReflectedMana() {
return (this.reflectedMana);
}
public boolean isSnow() { public boolean isSnow() {
return getSourceCard().isSnow(); return getSourceCard().isSnow();
}//override? }//override?
@@ -30,6 +38,16 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
return isTapAbility(orig); return isTapAbility(orig);
} }
// This is a work-in-progress *coughcough HACK coughcough*
// This should return the list of all possible colors for the mana ability
// Instead, right now it only does so for reflected lands, which override
// this ability.
// For any other kind of land, the method asserts. If you find you need to call
// this method, implement it...
public ArrayList<String> getPossibleColors() {
throw new RuntimeException("Ability_Mana : getPossibleColors() not implemented");
}
private static boolean isTapAbility(String orig) { private static boolean isTapAbility(String orig) {
String cost = orig.split(":")[0]; String cost = orig.split(":")[0];
cost = cost.replaceAll("Tap", "tap").replaceAll("tap", "T"); cost = cost.replaceAll("Tap", "tap").replaceAll("tap", "T");
@@ -76,7 +94,7 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
setManaCost("0"); setManaCost("0");
return; return;
} }
String[] parts = orig.split(":"); String[] parts = orig.split(":");
Mana = parts[1]; Mana = parts[1];
Mana = Mana.replaceAll(" add ", ""); Mana = Mana.replaceAll(" add ", "");
Mana = Mana.replaceAll(" ", ""); Mana = Mana.replaceAll(" ", "");
@@ -201,8 +219,7 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
}//i.e. "T, remove X charge counters from {name}: add X+1 <color> mana to your mana pool" }//i.e. "T, remove X charge counters from {name}: add X+1 <color> mana to your mana pool"
public String mana() { public String mana() {
if(!orig.contains("for each")) return Mana; if (orig.contains("for each")) {
else {
/*String[] manaPart = orig.split(": add "); /*String[] manaPart = orig.split(": add ");
String m = manaPart[1]; String m = manaPart[1];
m = m.replaceAll(" add ", ""); m = m.replaceAll(" add ", "");
@@ -231,6 +248,8 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
sb.append(m); sb.append(m);
return sb.toString(); return sb.toString();
} else {
return Mana;
} }
}//override for all non-X variable mana, }//override for all non-X variable mana,

View File

@@ -52,6 +52,7 @@ public class Card extends MyObservable {
private boolean faceDown = false; private boolean faceDown = false;
private boolean sacrificeAtEOT = false; private boolean sacrificeAtEOT = false;
private boolean kicked = false; private boolean kicked = false;
private boolean reflectedLand = false;
private boolean firstStrike = false; private boolean firstStrike = false;
private boolean doubleStrike = false; private boolean doubleStrike = false;
@@ -510,10 +511,24 @@ public class Card extends MyObservable {
return new ArrayList<Ability_Mana>(manaAbility); return new ArrayList<Ability_Mana>(manaAbility);
} }
public ArrayList<Ability_Mana> getBasicMana() { // Returns basic mana abilities plus "reflected mana" abilities
public ArrayList<Ability_Mana> getAIPlayableMana() {
ArrayList<Ability_Mana> res = new ArrayList<Ability_Mana>(); ArrayList<Ability_Mana> res = new ArrayList<Ability_Mana>();
for(Ability_Mana am:getManaAbility()) for(Ability_Mana am:getManaAbility())
if(am.isBasic() && !res.contains(am)) res.add(am); if(am.isBasic() && !res.contains(am)) {
res.add(am);
} else if (am.isReflectedMana() && !res.contains(am)) {
res.add(am);
}
return res;
}
public ArrayList<Ability_Mana> getBasicMana() {
ArrayList<Ability_Mana> res = new ArrayList<Ability_Mana>();
for(Ability_Mana am:getManaAbility())
if(am.isBasic() && !res.contains(am)) res.add(am);
return res; return res;
} }
@@ -1543,4 +1558,12 @@ public class Card extends MyObservable {
public boolean isKicked() { public boolean isKicked() {
return kicked; return kicked;
} }
public void setReflectedLand(boolean b) {
reflectedLand = b;
}
public boolean isReflectedLand() {
return reflectedLand;
}
} }

View File

@@ -13842,7 +13842,7 @@ public class CardFactory implements NewConstants {
@Override @Override
public void showMessage() { public void showMessage() {
retrieve.choices_made[0] = Input_PayManaCostUtil.getColor2(AllZone.Display.getChoiceOptional( retrieve.choices_made[0] = Input_PayManaCostUtil.getShortColorString(AllZone.Display.getChoiceOptional(
"Select a Color", Constant.Color.onlyColors)); "Select a Color", Constant.Color.onlyColors));
AllZone.Stack.add(retrieve); AllZone.Stack.add(retrieve);
stop(); stop();

View File

@@ -1636,6 +1636,132 @@ public class CardFactoryUtil {
return onLeavesPlay; return onLeavesPlay;
}//enPump_LeavesPlay }//enPump_LeavesPlay
public static Ability_Mana getReflectedManaAbility(final Card card, String colorOrType, String who) {
class ReflectedManaInfo {
String colorChosen;
String colorOrType;
String who;
};
String whoString;
if (who.startsWith("Opp")) {
whoString = new String("an opponent controls");
} else
whoString = new String("you control");
String abString = "tap: add to your mana pool one mana of any " + colorOrType.toLowerCase() +
" that a land " + whoString + " could produce.";
final Ability_Mana theAbility = new Ability_Mana(card, abString) {
private static final long serialVersionUID = 1839038296416458319L;
@Override
public void undo() {
card.untap();
}
@Override
public String getTargetPlayer() {
ReflectedManaInfo rfi = (ReflectedManaInfo) this.choices_made[0];
String targetPlayer;
if (rfi.who.startsWith("Opp")) {
targetPlayer = AllZone.GameAction.getOpponent(card.getController());
} else {
targetPlayer = card.getController();
}
return targetPlayer;
}
@Override
public void resolve() {
// Only tap the card if it was not canceled
ReflectedManaInfo rfi = (ReflectedManaInfo) this.choices_made[0];
if (rfi.colorChosen != "0") {
card.tap();
super.resolve();
}
}
@Override
public String mana() {
ReflectedManaInfo rfi = (ReflectedManaInfo) this.choices_made[0];
return rfi.colorChosen;
}
@Override
public ArrayList<String> getPossibleColors() {
ReflectedManaInfo rfi = (ReflectedManaInfo) this.choices_made[0];
String targetPlayer;
if (rfi.who.startsWith("Opp")) {
targetPlayer = AllZone.GameAction.getOpponent(card.getController());
} else {
targetPlayer = card.getController();
}
ArrayList<String> possibleColors = GameActionUtil.getManaProduceList(targetPlayer, rfi.colorOrType);
return possibleColors;
}
@Override
public boolean canPlay() {
ArrayList<String> possibleColors = this.getPossibleColors();
if (possibleColors.isEmpty()) {
// Can't use these cards if there are no mana-producing lands in play
return false;
} else {
//if(choices_made[0] == null) choices_made[0] = "0";
return super.canPlay();
}
}
};
theAbility.undoable=true;
//theAbility.choices_made = new String[1];
theAbility.choices_made = new ReflectedManaInfo[1];
ReflectedManaInfo rfi = new ReflectedManaInfo();
rfi.colorChosen = new String("0");
rfi.colorOrType = new String(colorOrType);
rfi.who = new String(who);
theAbility.choices_made[0] = rfi;
//((ReflectedManaInfo)theAbility.choices_made[0]).colorChosen = new String("0");
//((ReflectedManaInfo)theAbility.choices_made[0]).colorOrType = new String(colorOrType);
//((ReflectedManaInfo)theAbility.choices_made[0]).who = new String(who);
theAbility.setReflectedMana(true);
theAbility.setBeforePayMana(new Input() {
private static final long serialVersionUID = -2106126894846529731L;
@Override
public void showMessage() {
ArrayList<String> possibleColors = theAbility.getPossibleColors();
if (possibleColors.isEmpty()) {
// No mana available: card doesn't tap and nothing happens
((ReflectedManaInfo)theAbility.choices_made[0]).colorChosen = "0";
} else if (possibleColors.size() == 1) {
// Card taps for the only mana available
// If there's only one choice, we're not giving the option to cancel.
((ReflectedManaInfo)theAbility.choices_made[0]).colorChosen =
Input_PayManaCostUtil.getShortColorString(possibleColors.get(0));
}
else {
// Choose a color of mana to produce. If cancel is chosen, no mana is produced and the
// card doesn't tap.
Object o = AllZone.Display.getChoiceOptional("Select a Color of Mana to Produce", possibleColors.toArray());
if (o == null) {
((ReflectedManaInfo)theAbility.choices_made[0]).colorChosen = "0";
} else {
((ReflectedManaInfo)theAbility.choices_made[0]).colorChosen =
Input_PayManaCostUtil.getShortColorString((String) o);
}
}
AllZone.Stack.add(theAbility);
stop();
}
});
return theAbility;
} // End getReflectedManaAbility
public static SpellAbility enPumpCurse_Enchant(final Card sourceCard, final int Power, final int Tough, final String[] extrinsicKeywords, public static SpellAbility enPumpCurse_Enchant(final Card sourceCard, final int Power, final int Tough, final String[] extrinsicKeywords,
final String[] spellDescription, final String[] stackDescription) { final String[] spellDescription, final String[] stackDescription) {
@@ -3327,7 +3453,7 @@ public class CardFactoryUtil {
CardList list = new CardList(play.getCards()); CardList list = new CardList(play.getCards());
list = list.filter(new CardListFilter() { list = list.filter(new CardListFilter() {
public boolean addCard(Card c) { public boolean addCard(Card c) {
for(Ability_Mana am:c.getBasicMana()) for(Ability_Mana am:c.getAIPlayableMana())
if(am.canPlay()) return true; if(am.canPlay()) return true;
return false; return false;
} }

View File

@@ -62,6 +62,24 @@ class CardFactory_Lands {
card.addSpellAbility(ability); card.addSpellAbility(ability);
} }
//*************** END ************ END ************************** //*************** END ************ END **************************
//*************** START *********** START **************************
if (hasKeyword(card, "abAddReflectedMana") != -1) {
int n = hasKeyword(card,"abAddReflectedMana");
String parse = card.getKeyword().get(n).toString();
card.removeIntrinsicKeyword(parse);
String[] k = parse.split(":");
// Reflecting Pool, Exotic Orchard
card.setReflectedLand(true);
//
final Ability_Mana reflectedManaAbility = CardFactoryUtil.getReflectedManaAbility(card, k[1], k[2]);
card.addSpellAbility(reflectedManaAbility);
} // ReflectingPool
//*************** END ************ END **************************
//*************** START *********** START ************************** //*************** START *********** START **************************
//Ravinca Dual Lands //Ravinca Dual Lands

View File

@@ -103,6 +103,7 @@ public class ComputerAI_General implements Computer {
play.add("Expunge"); play.add("Expunge");
play.add("Faceless Butcher"); play.add("Faceless Butcher");
play.add("Feral Lightning"); play.add("Feral Lightning");
play.add("Finest Hour");
play.add("Firebolt"); play.add("Firebolt");
play.add("Flamebreak"); play.add("Flamebreak");

View File

@@ -236,21 +236,19 @@ public class ComputerUtil
for(int i = 0; i < land.size(); i++) for(int i = 0; i < land.size(); i++)
{ {
colors = getColors(land.get(i)); colors = getColors(land.get(i));
for(int j = 0; j <colors.size();j++)
for(int j = 0; j <colors.size();j++) {
{ if(cost.isNeeded(colors.get(j)) && land.get(i).isUntapped())
if(cost.isNeeded(colors.get(j)) && land.get(i).isUntapped()) {
{ land.get(i).tap();
land.get(i).tap(); cost.subtractMana(colors.get(j));
cost.subtractMana(colors.get(j)); //System.out.println("just subtracted " + colors.get(j) + ", cost is now: " + cost.toString());
//System.out.println("just subtracted " + colors.get(j) + ", cost is now: " + cost.toString());
}
if(cost.isPaid())
break;
}
}
if(cost.isPaid())
break;
}
} }
if(! cost.isPaid()) if(! cost.isPaid())
@@ -284,20 +282,24 @@ public class ComputerUtil
*/ */
public static ArrayList<String> getColors(Card land) public static ArrayList<String> getColors(Card land)
{ {
ArrayList<String> colors = new ArrayList<String>(); ArrayList<String> colors = new ArrayList<String>();
if (land.getKeyword().contains("tap: add B")) if (land.isReflectedLand()){
colors.add(Constant.Color.Black); ArrayList<Ability_Mana> amList = land.getManaAbility();
if (land.getKeyword().contains("tap: add W")) colors = amList.get(0).getPossibleColors();
colors.add(Constant.Color.White); } else {
if (land.getKeyword().contains("tap: add G")) if (land.getKeyword().contains("tap: add B"))
colors.add(Constant.Color.Green); colors.add(Constant.Color.Black);
if (land.getKeyword().contains("tap: add R")) if (land.getKeyword().contains("tap: add W"))
colors.add(Constant.Color.Red); colors.add(Constant.Color.White);
if (land.getKeyword().contains("tap: add U")) if (land.getKeyword().contains("tap: add G"))
colors.add(Constant.Color.Blue); colors.add(Constant.Color.Green);
if (land.getKeyword().contains("tap: add 1")) if (land.getKeyword().contains("tap: add R"))
colors.add(Constant.Color.Colorless); colors.add(Constant.Color.Red);
if (land.getKeyword().contains("tap: add U"))
colors.add(Constant.Color.Blue);
if (land.getKeyword().contains("tap: add 1"))
colors.add(Constant.Color.Colorless);
}
return colors; return colors;
} }
@@ -332,8 +334,9 @@ public class ComputerUtil
//if(c.isCreature() && c.hasSickness()) //if(c.isCreature() && c.hasSickness())
// return false; // return false;
for (Ability_Mana am : c.getBasicMana()) for (Ability_Mana am : c.getAIPlayableMana())
if (am.canPlay()) return true; if (am.canPlay()) return true;
return false; return false;
} }
});//CardListFilter });//CardListFilter
@@ -353,6 +356,7 @@ public class ComputerUtil
sortedMana.add(mana.get(j)); sortedMana.add(mana.get(j));
} }
return sortedMana; return sortedMana;
}//getAvailableMana() }//getAvailableMana()
@@ -362,9 +366,15 @@ public class ComputerUtil
{ {
ArrayList<Card> landList = PlayerZoneUtil.getCardType(AllZone.Computer_Hand, "Land"); ArrayList<Card> landList = PlayerZoneUtil.getCardType(AllZone.Computer_Hand, "Land");
if(! landList.isEmpty()) if(! landList.isEmpty())
{ {
AllZone.Computer_Hand.remove(landList.get(0)); int ix = 0;
AllZone.Computer_Play.add(landList.get(0)); while (landList.get(ix).isReflectedLand() && (ix+1 < landList.size())) {
// Play reflected lands LAST so that there is colored mana in play
// Don't increment past the end of the list!
ix++;
}
AllZone.Computer_Hand.remove(landList.get(ix));
AllZone.Computer_Play.add(landList.get(ix));
if (!AllZone.GameInfo.computerPlayedFirstLandThisTurn()) { if (!AllZone.GameInfo.computerPlayedFirstLandThisTurn()) {
AllZone.GameInfo.setComputerPlayedFirstLandThisTurn(true); AllZone.GameInfo.setComputerPlayedFirstLandThisTurn(true);

View File

@@ -2688,6 +2688,121 @@ public class GameActionUtil {
//END ENDOFTURN CARDS //END ENDOFTURN CARDS
// Return the list of mana types or colors that the target player's land can produce
// This is used by the mana abilities created by the abReflectedMana keyword
public static ArrayList<String> getManaProduceList(String player, String colorOrType) {
ArrayList<String> colorsPlayerCanProduce = new ArrayList<String>();
ArrayList<String> colorsToLookFor = new ArrayList<String>();
if (colorOrType.startsWith("Type")) {
// Includes colorless (like Reflecting Pool)
for (int ic = 0; ic < Constant.Color.Colors.length; ic++) {
colorsToLookFor.add(Constant.Color.Colors[ic]);
}
} else {
// Excludes colorless (like Exotic Orchard)
for (int ic = 0; ic < Constant.Color.onlyColors.length; ic++) {
colorsToLookFor.add(Constant.Color.onlyColors[ic]);
}
}
// Build the list of cards to search for mana colors
// First, add all the cards owned by the target player
CardList cl = new CardList();
cl.addAll(AllZone.getZone(Constant.Zone.Play,player).getCards());
// Narrow down the card list to only non-reflected lands
// If during this search we find another reflected land, and it targets a different player
// than this land, then we have to search that player's lands as well
boolean addOtherPlayerLands = false;
int ix = 0;
while (ix < cl.size()) {
Card otherCard = cl.get(ix);
if (otherCard.isLand()) {
if (otherCard.isReflectedLand() && !addOtherPlayerLands) {
ArrayList<Ability_Mana> amList = otherCard.getManaAbility();
// We assume reflected lands have only one mana ability
// Find out which player it targets
Ability_Mana am = amList.get(0);
String otherTargetPlayer = am.getTargetPlayer();
// If the target player of the other land isn't the same as the target player
// of this land, we need to search the sets of mana he can produce as well.
if (!otherTargetPlayer.equals(player)) {
addOtherPlayerLands = true; // We only need to record this decision once
}
// Don't keep reflected lands in the list of lands
cl.remove(ix);
} else {
// Other card is a land but not a reflected land
ix++; // leave in list & look at next card
}
} else {
// Other card is not a land -- remove it
cl.remove(ix);
}
} // while ix < cl.size
GameActionUtil.getManaFromCardList(cl, colorsPlayerCanProduce, colorsToLookFor);
if (addOtherPlayerLands) {
cl.clear();
cl.addAll(AllZone.getZone(Constant.Zone.Play,AllZone.GameAction.getOpponent(player)).getCards());
cl.filter(new CardListFilter() {
public boolean addCard(Card c) {
return c.isLand() && !c.isReflectedLand();
}
});
// Exotic Orchard, which is the only way to get colors from another
// player's lands, looks for colors. Therefore, we should not look
// through another player's lands for colorless mana. This is true
// even if the original card happens to have been a reflecting pool.
if (colorsToLookFor.contains(Constant.Color.Colorless)) {
colorsToLookFor.remove(Constant.Color.Colorless);
}
if (!colorsToLookFor.isEmpty()) {
GameActionUtil.getManaFromCardList(cl, colorsPlayerCanProduce, colorsToLookFor);
}
}
return colorsPlayerCanProduce;
}
public static void getManaFromCardList(CardList cl, ArrayList<String> colorsPlayerCanProduce, ArrayList<String>colorsToLookFor) {
int ix;
// In this routine, the list cl must be a list of lands that are not reflected lands
// Otherwise if both players had Exotic Orchards we might keep searching
// their lands forever.
for (ix = 0; ix < cl.size(); ix++) {
Card otherCard = cl.get(ix);
ArrayList<Ability_Mana> amList = otherCard.getManaAbility();
for (int im = 0; im < amList.size(); im++) {
// Search all the mana abilities and add colors of mana
Ability_Mana am = amList.get(im);
String newMana = am.mana(); // This call would break for a reflected mana ability
int ic = 0;
// Check if any of the remaining colors are in this mana ability
while (ic < colorsToLookFor.size()) {
if (newMana.contains(Input_PayManaCostUtil.getShortColorString(colorsToLookFor.get(ic)))) {
colorsPlayerCanProduce.add(colorsToLookFor.remove(ic));
continue; // Don't increment index -- list got smaller
}
ic++; // Only increment if nothing was found
}
// If the search list is empty stop
if (colorsToLookFor.isEmpty()) {
break; // No point in continuing
}
} // Loop over mana abilities
if (colorsToLookFor.isEmpty()) {
break;
}
} // loop over list of lands
}
public static void removeAttackedBlockedThisTurn() { public static void removeAttackedBlockedThisTurn() {
// resets the status of attacked/blocked this turn // resets the status of attacked/blocked this turn
String player = AllZone.Phase.getActivePlayer(); String player = AllZone.Phase.getActivePlayer();

View File

@@ -14,7 +14,7 @@ public class Input_PayManaCostUtil
StringBuilder cneeded = new StringBuilder(); StringBuilder cneeded = new StringBuilder();
for(String color : Constant.Color.ManaColors) for(String color : Constant.Color.ManaColors)
if(manaCost.isNeeded(color)) if(manaCost.isNeeded(color))
cneeded.append(getColor2(color)); cneeded.append(getShortColorString(color));
Iterator<Ability_Mana> it = abilities.iterator();//you can't remove unneded abilitie inside a for(am:abilities) loop :( Iterator<Ability_Mana> it = abilities.iterator();//you can't remove unneded abilitie inside a for(am:abilities) loop :(
while(it.hasNext()) while(it.hasNext())
{ {
@@ -41,7 +41,9 @@ public class Input_PayManaCostUtil
} }
} }
public static ArrayList<Ability_Mana> getManaAbilities(Card card) public static ArrayList<Ability_Mana> getManaAbilities(Card card)
{return card.getManaAbility();} {
return card.getManaAbility();
}
//color is like "G", returns "Green" //color is like "G", returns "Green"
public static boolean canMake(Ability_Mana am, String mana) public static boolean canMake(Ability_Mana am, String mana)
{ {
@@ -51,7 +53,9 @@ public class Input_PayManaCostUtil
if(mana.contains(color)) return true; if(mana.contains(color)) return true;
return false; return false;
} }
public static String getColor(String color)
public static String getLongColorString(String color)
{ {
Map<String, String> m = new HashMap<String, String>(); Map<String, String> m = new HashMap<String, String>();
m.put("G", Constant.Color.Green); m.put("G", Constant.Color.Green);
@@ -70,7 +74,7 @@ public class Input_PayManaCostUtil
return o.toString(); return o.toString();
} }
public static String getColor2(String color) public static String getShortColorString(String color)
{ {
Map<String, String> m = new HashMap<String, String>(); Map<String, String> m = new HashMap<String, String>();
m.put(Constant.Color.Green, "G"); m.put(Constant.Color.Green, "G");

View File

@@ -195,7 +195,7 @@ public class ManaPool extends Card {
} }
String getColor(String s) { String getColor(String s) {
return Input_PayManaCostUtil.getColor(s); return Input_PayManaCostUtil.getLongColorString(s);
} }
public void addMana(Ability_Mana am) { public void addMana(Ability_Mana am) {
@@ -405,11 +405,11 @@ public class ManaPool extends Card {
} }
public String getColor2(String s) { public String getColor2(String s) {
return Input_PayManaCostUtil.getColor2(s); return Input_PayManaCostUtil.getShortColorString(s);
}//wrapper }//wrapper
public int hasMana(String color) { public int hasMana(String color) {
String s = (color.length() == 1? color:Input_PayManaCostUtil.getColor2(color)); String s = (color.length() == 1? color:Input_PayManaCostUtil.getShortColorString(color));
Mana_Part.checkSingleMana(s); Mana_Part.checkSingleMana(s);
return (containsColor(color)); return (containsColor(color));
} }

View File

@@ -167,7 +167,7 @@ public class Phase extends MyObservable
} }
if (getPhase().equals(Constant.Phase.End_Of_Combat)) { if (getPhase().equals(Constant.Phase.End_Of_Combat)) {
resetAttackedThisPhase(getActivePlayer()); resetAttackedThisCombat(getActivePlayer());
} }
//if (getPhase().equals(Constant.Phase.Cleanup) && extraTurns > 0) //if (getPhase().equals(Constant.Phase.Cleanup) && extraTurns > 0)
@@ -308,7 +308,7 @@ public class Phase extends MyObservable
return (nCombatsThisTurn == 1); return (nCombatsThisTurn == 1);
} }
public void resetAttackedThisPhase(String player) { public void resetAttackedThisCombat(String player) {
// resets the status of attacked/blocked this phase // resets the status of attacked/blocked this phase
PlayerZone play = AllZone.getZone(Constant.Zone.Play, player); PlayerZone play = AllZone.getZone(Constant.Zone.Play, player);

View File

@@ -189,8 +189,8 @@ public class RunTest
check("97", c.isUntapped()); check("97", c.isUntapped());
//test Input_PayManaCostUtil //test Input_PayManaCostUtil
check("98", Input_PayManaCostUtil.getColor("G").equals(Constant.Color.Green)); check("98", Input_PayManaCostUtil.getLongColorString("G").equals(Constant.Color.Green));
check("99", Input_PayManaCostUtil.getColor("1").equals(Constant.Color.Colorless)); check("99", Input_PayManaCostUtil.getLongColorString("1").equals(Constant.Color.Colorless));
/* /*
check("101", Input_PayManaCostUtil.isManaNeeded(Constant.Color.Green, new ManaCost("5")) == true); check("101", Input_PayManaCostUtil.isManaNeeded(Constant.Color.Green, new ManaCost("5")) == true);