- Added "{cost}Sacrifice CARDNAME: Add {mana} to your mana pool." keyword plus added a bunch of cards that support this (still in the process of adding a bunch more).

- Converted Composite Golem and Black Lotus to use this keyword (they are actual Mana Abilities now, so they can be used to pay for upkeep costs etc.)
This commit is contained in:
jendave
2011-08-06 04:07:09 +00:00
parent 13241c9076
commit 7abee899a9
4 changed files with 127 additions and 59 deletions

View File

@@ -1,3 +1,90 @@
Black Lotus
0
Artifact
no text
tap, Sacrifice CARDNAME: Add W W W to your mana pool.
tap, Sacrifice CARDNAME: Add U U U to your mana pool.
tap, Sacrifice CARDNAME: Add B B B to your mana pool.
tap, Sacrifice CARDNAME: Add R R R to your mana pool.
tap, Sacrifice CARDNAME: Add G G G to your mana pool.
Crystal Vein
no cost
Land
no text
tap: add 1
tap, Sacrifice Crystal Vein: Add 2 to your mana pool.
Horn of Ramos
3
Artifact
no text
tap: add G
Sacrifice CARDNAME: Add G to your mana pool.
Heart of Ramos
3
Artifact
no text
tap: add R
Sacrifice CARDNAME: Add R to your mana pool.
Eye of Ramos
3
Artifact
no text
tap: add U
Sacrifice CARDNAME: Add U to your mana pool.
Coal Golem
5
Artifact Creature Golem
no text
3/3
3, Sacrifice Coal Golem: Add R R R to your mana pool.
Dromar's Attendant
5
Artifact Creature Golem
no text
3/3
1, Sacrifice Dromar's Attendant: Add W U B to your mana pool.
Darigaaz's Attendant
5
Artifact Creature Golem
no text
3/3
1, Sacrifice Darigaaz's Attendant: Add B R G to your mana pool.
Crosis's Attendant
5
Artifact Creature Golem
no text
3/3
1, Sacrifice Crosis's Attendant: Add U B R to your mana pool.
Blood Vassal
2 B
Creature Thrull
no text
2/2
Sacrifice CARDNAME: Add B B to your mana pool.
Composite Golem
6
Artifact Creature Golem
no text
4/4
Sacrifice CARDNAME: Add W U B R G to your mana pool.
Blood Pet
B
Creature Thrull
no text
1/1
Sacrifice CARDNAME: Add B to your mana pool.
Entangling Vines Entangling Vines
3 G 3 G
Enchantment Aura Enchantment Aura
@@ -7232,12 +7319,6 @@ Instant
no text no text
This card can't be countered. This card can't be countered.
Composite Golem
6
Artifact Creature Golem
no text
4/4
Madrush Cyclops Madrush Cyclops
1 B R G 1 B R G
Creature Cyclops Warrior Creature Cyclops Warrior
@@ -9375,11 +9456,6 @@ no text
spDamageTgtCP:1 spDamageTgtCP:1
Draw a card. Draw a card.
Black Lotus
0
Artifact
no text
Kitchen Finks Kitchen Finks
1 GW GW 1 GW GW
Creature Ouphe Creature Ouphe

View File

@@ -3,6 +3,8 @@ package forge;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
abstract public class Ability_Mana extends SpellAbility implements java.io.Serializable { abstract public class Ability_Mana extends SpellAbility implements java.io.Serializable {
private ArrayList<Command> runcommands = new ArrayList<Command>(); private ArrayList<Command> runcommands = new ArrayList<Command>();
@@ -15,6 +17,11 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
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)));
} }
public boolean isSacrifice()
{
return orig.contains("Sacrifice CARDNAME: Add ");
}
public boolean isUndoableMana() { public boolean isUndoableMana() {
// isBasic, plus "2" so Sol Ring is counted // isBasic, plus "2" so Sol Ring is counted
return (orig.length() == 10 && orig.startsWith("tap: add ") && "21WBURG".contains("" + orig.charAt(9))); return (orig.length() == 10 && orig.startsWith("tap: add ") && "21WBURG".contains("" + orig.charAt(9)));
@@ -69,6 +76,9 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
this.orig = (sourceCard.getName().length() == 0? orig:orig.replaceAll(sourceCard.getName(), "CARDNAME")); this.orig = (sourceCard.getName().length() == 0? orig:orig.replaceAll(sourceCard.getName(), "CARDNAME"));
setDescription(orig); setDescription(orig);
if (sourceCard.getName().equals("Black Lotus"))
System.out.println("BLACK LOTUS!");
/* /*
String parts[] = orig.split(":"); String parts[] = orig.split(":");
System.out.println("0:" +parts[0]); System.out.println("0:" +parts[0]);
@@ -88,6 +98,19 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
setManaCost("0"); setManaCost("0");
return; return;
} }
else if (isSacrifice())
{
String regex = "[0-9]+,";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(orig);
if (orig.startsWith("Sacrifice ") || orig.startsWith("tap, Sacrifice "))
setManaCost("0");
else if(matcher.find())
setManaCost(matcher.group().substring(0, matcher.group().length()-1));
return;
}
String[] parts = orig.split(":"); String[] parts = orig.split(":");
Mana = parts[1]; Mana = parts[1];
Mana = Mana.replaceAll(" add ", ""); Mana = Mana.replaceAll(" add ", "");
@@ -199,6 +222,9 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
@Override @Override
public void resolve() { public void resolve() {
if (isSacrifice())
AllZone.GameAction.sacrifice(sourceCard);
AllZone.ManaPool.addMana(this); AllZone.ManaPool.addMana(this);
if(!runcommands.isEmpty()) for(Command c:runcommands) if(!runcommands.isEmpty()) for(Command c:runcommands)
c.execute(); c.execute();
@@ -242,7 +268,14 @@ abstract public class Ability_Mana extends SpellAbility implements java.io.Seria
sb.append(m); sb.append(m);
return sb.toString(); return sb.toString();
} else { }
else if ((orig.contains("Sacrifice this creature: Add ") || orig.contains("Sacrifice CARDNAME: Add "))
&& orig.contains(" to your mana pool."))
{
String m = orig.split(": Add ")[1].split(" to ")[0];
return m;
}
else {
return Mana; return Mana;
} }

View File

@@ -170,7 +170,7 @@ public class CardFactory implements NewConstants {
private final int shouldManaAbility(Card c) { private final int shouldManaAbility(Card c) {
ArrayList<String> a = c.getIntrinsicKeyword(); ArrayList<String> a = c.getIntrinsicKeyword();
for(int i = 0; i < a.size(); i++) for(int i = 0; i < a.size(); i++)
if(a.get(i).toString().contains(": add ")) return i; if(a.get(i).toString().contains(": add ") || a.get(i).toString().contains(": Add ") ) return i;
return -1; return -1;
} }
@@ -13724,12 +13724,12 @@ public class CardFactory implements NewConstants {
return card; return card;
}//*************** END ************ END ************************** }//*************** END ************ END **************************
/*
//*************** START *********** START ************************** //*************** START *********** START **************************
else if(cardName.equals("Black Lotus")) { else if(cardName.equals("Black Lotus")) {
final Ability_Tap ability = new Ability_Tap(card, "0") { final Ability_Tap ability = new Ability_Tap(card, "0") {
private static final long serialVersionUID = 8394047173115959008L; private static final long serialVersionUID = 8394047173115959008L;
@Override @Override
public boolean canPlayAI() { public boolean canPlayAI() {
return false; return false;
@@ -13781,7 +13781,7 @@ public class CardFactory implements NewConstants {
card.addSpellAbility(ability); card.addSpellAbility(ability);
}//*************** END ************ END ************************** }//*************** END ************ END **************************
*/
//**************************Equipment***************************** //**************************Equipment*****************************

View File

@@ -13810,47 +13810,6 @@ public class CardFactory_Creatures {
}//*************** END ************ END ************************** }//*************** END ************ END **************************
//*************** START *********** START **************************
if(cardName.equals("Composite Golem")) {
final Ability ability = new Ability(card, "0") {
@Override
public boolean canPlay() {
SpellAbility sa;
for(int i = 0; i < AllZone.Stack.size(); i++) {
sa = AllZone.Stack.peek(i);
if(sa.getSourceCard().equals(card)) return false;
}
return AllZone.GameAction.isCardInPlay(card);
}
@Override
public boolean canPlayAI() {
return false;
}
@Override
public void resolve() {
if(card.getController().equals(Constant.Player.Human)) {
/*CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, Constant.Player.Human).getCards());
list = list.getName("Mana Pool");*/
Card mp = AllZone.ManaPool;//list.getCard(0);
mp.addExtrinsicKeyword("ManaPool:W");
mp.addExtrinsicKeyword("ManaPool:U");
mp.addExtrinsicKeyword("ManaPool:B");
mp.addExtrinsicKeyword("ManaPool:R");
mp.addExtrinsicKeyword("ManaPool:G");
AllZone.GameAction.sacrifice(card);
}
}
};
ability.setDescription("Sacrifice Composite Golem: Add W U B R G to your mana pool.");
ability.setStackDescription("Add WUBRG your mana pool");
card.addSpellAbility(ability);
}//*************** END ************ END **************************
//*************** START ************ START ************************** //*************** START ************ START **************************
if(cardName.equals("Rats of Rath")) { if(cardName.equals("Rats of Rath")) {
final Ability ability = new Ability(card, "B") { final Ability ability = new Ability(card, "B") {