*Added ManaSpent & ManaNotSpent restrictions to Triggers. Triggers with ManaSpent$ Green for instance will only go off if Green mana was spent to cast the host card.

*New AI SVar; "ManaNeededToAvoidNegativeEffect". This is a comma-separated list of colors the AI will try to use to pay for the cost, but only if it actually has a source for that color mana.
*Added Plaxmanta.
This commit is contained in:
Hellfish
2011-09-22 13:42:16 +00:00
parent 501fbd20ae
commit d495b687f4
5 changed files with 72 additions and 5 deletions

1
.gitattributes vendored
View File

@@ -5678,6 +5678,7 @@ res/cardsfolder/p/plated_wurm.txt svneol=native#text/plain
res/cardsfolder/p/platinum_angel.txt svneol=native#text/plain res/cardsfolder/p/platinum_angel.txt svneol=native#text/plain
res/cardsfolder/p/platinum_emperion.txt svneol=native#text/plain res/cardsfolder/p/platinum_emperion.txt svneol=native#text/plain
res/cardsfolder/p/plaxcaster_frogling.txt -text res/cardsfolder/p/plaxcaster_frogling.txt -text
res/cardsfolder/p/plaxmanta.txt -text
res/cardsfolder/p/plover_knights.txt svneol=native#text/plain res/cardsfolder/p/plover_knights.txt svneol=native#text/plain
res/cardsfolder/p/plow_under.txt svneol=native#text/plain res/cardsfolder/p/plow_under.txt svneol=native#text/plain
res/cardsfolder/p/plumes_of_peace.txt svneol=native#text/plain res/cardsfolder/p/plumes_of_peace.txt svneol=native#text/plain

View File

@@ -0,0 +1,15 @@
Name:Plaxmanta
ManaCost:1 U
Types:Creature Beast
Text:no text
PT:2/2
K:Flash
T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigPumpAll | TriggerDescription$ When CARDNAME enters the battlefield, creatures you control gain shroud until end of turn. (They can't be the targets of spells or abilities.)
T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSac | ManaNotSpent$ G | TriggerDescription$ When CARDNAME enters the battlefield, sacrifice it unless G was spent to cast it.
SVar:TrigPumpAll:AB$PumpAll | Cost$ 0 | ValidCards$ Creature.YouCtrl | KW$ Shroud
SVar:TrigSac:AB$Sacrifice | Cost$ 0 | Defined$ Self
SVar:ManaNeededToAvoidNegativeEffect:Green
SVar:RemRandomDeck:True
Oracle:Flash\nWhen Plaxmanta enters the battlefield, creatures you control gain shroud until end of turn. (They can't be the targets of spells or abilities.)\nWhen Plaxmanta enters the battlefield, sacrifice it unless {G} was spent to cast it.
SetInfo:DIS|Uncommon|http://magiccards.info/scans/en/di/29.jpg
End

View File

@@ -488,6 +488,9 @@ public class ComputerUtil {
ArrayList<String> colors; ArrayList<String> colors;
cost = ((ManaPool) manapool).subtractMana(sa, cost); cost = ((ManaPool) manapool).subtractMana(sa, cost);
if(card.getSVar("ManaNeededToAvoidNegativeEffect") != "") {
cost.setManaNeededToAvoidNegativeEffect(card.getSVar("ManaNeededToAvoidNegativeEffect").split(","));
}
CardList manaSources = getAvailableMana(); CardList manaSources = getAvailableMana();
@@ -732,6 +735,8 @@ public class ComputerUtil {
static public ArrayList<Ability_Mana> sortForNeeded(ManaCost cost, ArrayList<Ability_Mana> manaAbilities, Player player) { static public ArrayList<Ability_Mana> sortForNeeded(ManaCost cost, ArrayList<Ability_Mana> manaAbilities, Player player) {
ArrayList<String> colors; ArrayList<String> colors;
ArrayList<String> colorsNeededToAvoidNegativeEffect = cost.getManaNeededToAvoidNegativeEffect();
ArrayList<Ability_Mana> res = new ArrayList<Ability_Mana>(); ArrayList<Ability_Mana> res = new ArrayList<Ability_Mana>();
@@ -746,6 +751,12 @@ public class ComputerUtil {
res.add(am); res.add(am);
break; break;
} }
for(String col : colorsNeededToAvoidNegativeEffect) {
if(col.equalsIgnoreCase(colors.get(j))
|| col.substring(0,1).equalsIgnoreCase(colors.get(j))) {
res.add(am);
}
}
} }
} }
@@ -759,6 +770,12 @@ public class ComputerUtil {
res.add(am); res.add(am);
break; break;
} }
for(String col : colorsNeededToAvoidNegativeEffect) {
if(col.equalsIgnoreCase(colors.get(j))
|| col.substring(0,1).equalsIgnoreCase(colors.get(j))) {
res.add(am);
}
}
} }
} }

View File

@@ -20,6 +20,8 @@ public class ManaCost {
private ArrayList<Object> manaPart; private ArrayList<Object> manaPart;
private HashMap<String, Integer> sunburstMap = new HashMap<String, Integer>(); private HashMap<String, Integer> sunburstMap = new HashMap<String, Integer>();
private int xcounter = 0; private int xcounter = 0;
private ArrayList<String> manaNeededToAvoidNegativeEffect = new ArrayList<String>();
private ArrayList<String> manaPaidToAvoidNegativeEffect = new ArrayList<String>();
//manaCost can be like "0", "3", "G", "GW", "10", "3 GW", "10 GW" //manaCost can be like "0", "3", "G", "GW", "10", "3 GW", "10 GW"
//or "split hybrid mana" like "2/G 2/G", "2/B 2/B 2/B" //or "split hybrid mana" like "2/G 2/G", "2/B 2/B 2/B"
@@ -63,11 +65,11 @@ public class ManaCost {
public String getColorsPaid() { public String getColorsPaid() {
String s = ""; String s = "";
for (String key: sunburstMap.keySet()) { for (String key: sunburstMap.keySet()) {
if(key.equals("black")) s+= "B"; if(key.equalsIgnoreCase("black") || key.equalsIgnoreCase("B")) s+= "B";
if(key.equals("blue")) s+= "U"; if(key.equalsIgnoreCase("blue") || key.equalsIgnoreCase("U")) s+= "U";
if(key.equals("green")) s+= "G"; if(key.equalsIgnoreCase("green") || key.equalsIgnoreCase("G")) s+= "G";
if(key.equals("red")) s+= "R"; if(key.equalsIgnoreCase("red") || key.equalsIgnoreCase("R")) s+= "R";
if(key.equals("white")) s+= "W"; if(key.equalsIgnoreCase("white") || key.equalsIgnoreCase("W")) s+= "W";
} }
return s; return s;
} }
@@ -146,6 +148,14 @@ public class ManaCost {
* @return a boolean. * @return a boolean.
*/ */
public boolean isNeeded(String mana) { public boolean isNeeded(String mana) {
if(manaNeededToAvoidNegativeEffect.size() != 0) {
for(String s : manaNeededToAvoidNegativeEffect) {
if ((s.equalsIgnoreCase(mana) || s.substring(0,1).equalsIgnoreCase(mana))
&& !manaPaidToAvoidNegativeEffect.contains(mana)) {
return true;
}
}
}
if (mana.length() > 1) if (mana.length() > 1)
mana = Input_PayManaCostUtil.getShortColorString(mana); mana = Input_PayManaCostUtil.getShortColorString(mana);
Mana_Part m; Mana_Part m;
@@ -203,6 +213,9 @@ public class ManaCost {
* @return a boolean. * @return a boolean.
*/ */
public boolean payMana(String color) { public boolean payMana(String color) {
if(manaNeededToAvoidNegativeEffect.contains(color) && !manaPaidToAvoidNegativeEffect.contains(color)) {
manaPaidToAvoidNegativeEffect.add(color);
}
color = Input_PayManaCostUtil.getShortColorString(color); color = Input_PayManaCostUtil.getShortColorString(color);
return addMana(color); return addMana(color);
} }
@@ -488,4 +501,14 @@ public class ManaCost {
manaPart.remove(manaPart.get(i)); manaPart.remove(manaPart.get(i));
} }
} }
public void setManaNeededToAvoidNegativeEffect(String[] manaCol) {
for(String s : manaCol) {
manaNeededToAvoidNegativeEffect.add(s);
}
}
public ArrayList<String> getManaNeededToAvoidNegativeEffect() {
return manaNeededToAvoidNegativeEffect;
}
} }

View File

@@ -431,6 +431,17 @@ public abstract class Trigger {
} }
} }
if(mapParams.containsKey("ManaSpent")) {
if(!hostCard.getColorsPaid().contains(mapParams.get("ManaSpent"))) {
return false;
}
}
if(mapParams.containsKey("ManaNotSpent")) {
if(hostCard.getColorsPaid().contains(mapParams.get("ManaNotSpent"))) {
return false;
}
}
return true; return true;
} }