- Fixed several flaws in stAnimate. Now Blood Moon and friends will only change subtypes and leave land creatures their type and power/toughness.

This commit is contained in:
jendave
2011-08-07 00:33:21 +00:00
parent 54c89d0b3b
commit 9dc176cb57
7 changed files with 76 additions and 40 deletions

View File

@@ -2,7 +2,7 @@ Name:Blood Moon
ManaCost:2 R
Types:Enchantment
Text:no text
K:stAnimateAll:Land.nonBasic:0/0:Land,Mountain,Overwrite,KeepSupertype:no colors:Overwrite:No Condition:Nonbasic lands are Mountains.
K:stAnimateAll:Land.nonBasic:no changes:Land,Mountain,RemoveSubTypes:no colors:Overwrite:No Condition:Nonbasic lands are Mountains.
SVar:RemRandomDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/blood_moon.jpg

View File

@@ -3,7 +3,7 @@ ManaCost:1 B
Types:Enchantment Aura
Text:no text
K:Enchant Land Curse
K:stAnimateEnchanted:Land:0/0:Land,Swamp,Overwrite,KeepSupertype:no colors:Overwrite:No Condition:Enchanted land is a Swamp.
K:stAnimateEnchanted:Land:no changes:Land,Swamp,RemoveSubTypes:no colors:Overwrite:No Condition:Enchanted land is a Swamp.
T:Mode$ Taps | ValidCard$ Card.AttachedBy | TriggerZones$ Battlefield | Execute$ TrigLose | TriggerDescription$ Whenever enchanted land becomes tapped, its controller loses 2 life.
SVar:TrigLose:AB$LoseLife | Cost$ 0 | Defined$ EnchantedController | LifeAmount$ 2
SVar:Rarity:Common

View File

@@ -3,7 +3,7 @@ ManaCost:G
Types:Enchantment Aura
Text:no text
K:Enchant Land
K:stAnimateEnchanted:Land:0/0:Land,Mountain,Forest,Plains,Overwrite,KeepSupertype:no colors:Overwrite:No Condition:Enchanted land is a Mountain, Forest, and Plains.
K:stAnimateEnchanted:Land:no changes:Land,Mountain,Forest,Plains,RemoveSubTypes:no colors:Overwrite:No Condition:Enchanted land is a Mountain, Forest, and Plains.
SVar:RemRandomDeck:True
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/lush_growth.jpg

View File

@@ -3,7 +3,7 @@ ManaCost:2 R
Types:Creature Human Wizard
Text:no text
PT:2/2
K:stAnimateAll:Land.nonBasic:0/0:Land,Mountain,Overwrite,KeepSupertype:no colors:Overwrite:No Condition:Nonbasic lands are Mountains.
K:stAnimateAll:Land.nonBasic:no changes:Land,Mountain,RemoveSubTypes:no colors:Overwrite:No Condition:Nonbasic lands are Mountains.
SVar:RemRandomDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/magus_of_the_moon.jpg

View File

@@ -243,6 +243,10 @@ public class CardUtil {
|| cardType.equals("Snow") || cardType.equals("World"));
}
public static boolean isASubType(String cardType) {
return (!isASuperType(cardType) && !isACardType(cardType));
}
// Check if a Type is a Creature Type (by excluding all other types)
public static boolean isACreatureType(String cardType) {
return (!isACardType(cardType) && !isASuperType(cardType) && !isALandType(cardType)

View File

@@ -7343,17 +7343,19 @@ public class GameActionUtil {
CardList affectedCards = getAffectedCards(cardWithKeyword, k, specific); // options are All, Self, Enchanted etc.
se.setAffectedCards(affectedCards);
String[] pt = k[2].split("/");
int x = 0;
if (pt[0].contains("X") || pt[1].contains("X"))
x = CardFactoryUtil.xCount(cardWithKeyword, cardWithKeyword.getSVar("X").split("\\$")[1]);
se.setXValue(x);
int y = 0;
if (pt[1].contains("Y"))
y = CardFactoryUtil.xCount(cardWithKeyword, cardWithKeyword.getSVar("Y").split("\\$")[1]);
se.setYValue(y);
if(!k[2].equals("no changes")) {
String[] pt = k[2].split("/");
int x = 0;
if (pt[0].contains("X") || pt[1].contains("X"))
x = CardFactoryUtil.xCount(cardWithKeyword, cardWithKeyword.getSVar("X").split("\\$")[1]);
se.setXValue(x);
int y = 0;
if (pt[1].contains("Y"))
y = CardFactoryUtil.xCount(cardWithKeyword, cardWithKeyword.getSVar("Y").split("\\$")[1]);
se.setYValue(y);
}
ArrayList<String> types = new ArrayList<String>();
if(!k[3].equalsIgnoreCase("no types")) {
@@ -7366,6 +7368,10 @@ public class GameActionUtil {
types.remove("KeepSupertype");
se.setKeepSupertype(true);
}
if(types.contains("RemoveSubTypes")) {
types.remove("RemoveSubTypes");
se.setRemoveSubTypes(true);
}
}
String colors = "";
@@ -7392,18 +7398,33 @@ public class GameActionUtil {
private void addStaticEffects(StaticEffect se, Card source, CardList affectedCards, String details, ArrayList<String> types, String colors) {
String[] keyword = details.split("/", 3);
String powerStr = keyword[0];
String toughStr = keyword[1];
for(int i = 0; i < affectedCards.size(); i++) {
Card affectedCard = affectedCards.get(i);
//copied from stSetPT power/toughness
int power = powerStr.matches("[0-9][0-9]?") ? Integer.parseInt(powerStr) : CardFactoryUtil.xCount(affectedCard, powerStr);
int toughness = toughStr.matches("[0-9][0-9]?") ? Integer.parseInt(toughStr) : CardFactoryUtil.xCount(affectedCard, toughStr);
se.addOriginalPT(affectedCard, affectedCard.getBaseAttack(), affectedCard.getBaseDefense());
affectedCard.setBaseAttack(power);
affectedCard.setBaseDefense(toughness);
if(!details.equals("no changes")) {
String[] keyword = details.split("/", 3);
String powerStr = keyword[0];
String toughStr = keyword[1];
//copied from stSetPT power/toughness
int power = powerStr.matches("[0-9][0-9]?") ? Integer.parseInt(powerStr) : CardFactoryUtil.xCount(affectedCard, powerStr);
int toughness = toughStr.matches("[0-9][0-9]?") ? Integer.parseInt(toughStr) : CardFactoryUtil.xCount(affectedCard, toughStr);
se.addOriginalPT(affectedCard, affectedCard.getBaseAttack(), affectedCard.getBaseDefense());
affectedCard.setBaseAttack(power);
affectedCard.setBaseDefense(toughness);
if(se.isOverwriteKeywords()) {
se.addOriginalKeywords(affectedCard, affectedCard.getIntrinsicKeyword());
affectedCard.clearAllKeywords();
}
else {
if(keyword.length > 2) {
String keywords[] = keyword[2].split(" & ");
for(int j = 0; j < keywords.length; j++) {
String kw = keywords[j];
affectedCard.addExtrinsicKeyword(kw);
}
}
}
}
if(se.isOverwriteTypes()) {
se.addOriginalTypes(affectedCard, affectedCard.getType());
@@ -7417,6 +7438,13 @@ public class GameActionUtil {
}
}
}
if(se.isRemoveSubTypes()) {
se.addOriginalTypes(affectedCard, affectedCard.getType());
ArrayList<String> acTypes = affectedCard.getType();
for(String t : acTypes) {
if(CardUtil.isASubType(t)) affectedCard.removeType(t);
}
}
for(String type : types) {
if(!affectedCard.isType(type)) {
affectedCard.addType(type);
@@ -7426,19 +7454,6 @@ public class GameActionUtil {
se.removeType(affectedCard, type);
}
}
if(se.isOverwriteKeywords()) {
se.addOriginalKeywords(affectedCard, affectedCard.getIntrinsicKeyword());
affectedCard.clearAllKeywords();
}
else {
if(keyword.length > 2) {
String keywords[] = keyword[2].split(" & ");
for(int j = 0; j < keywords.length; j++) {
String kw = keywords[j];
affectedCard.addExtrinsicKeyword(kw);
}
}
}
//Abilities
if(se.isOverwriteAbilities()) {
se.addOriginalAbilities(affectedCard, affectedCard.getAllButFirstSpellAbility());
@@ -7469,8 +7484,10 @@ public class GameActionUtil {
private void removeStaticEffect(StaticEffect se, Card source, Card affectedCard, String[] details) {
affectedCard.setBaseAttack(se.getOriginalPower(affectedCard));
affectedCard.setBaseDefense(se.getOriginalToughness(affectedCard));
if(!details[2].equals("no changes")) {
affectedCard.setBaseAttack(se.getOriginalPower(affectedCard));
affectedCard.setBaseDefense(se.getOriginalToughness(affectedCard));
}
for(String type : se.getTypes(affectedCard)) {
affectedCard.removeType(type);
@@ -7482,6 +7499,11 @@ public class GameActionUtil {
}
}
}
if(se.isRemoveSubTypes()) {
for(String type : se.getOriginalTypes(affectedCard)) {
if(CardUtil.isASubType(type)) affectedCard.addType(type);
}
}
if(se.isOverwriteKeywords()) {
for(String kw : se.getOriginalKeywords(affectedCard)) affectedCard.addIntrinsicKeyword(kw);

View File

@@ -19,6 +19,7 @@ public class StaticEffect {
//for types
private boolean overwriteTypes = false;
private boolean keepSupertype = false;
private boolean removeSubTypes = false;
private HashMap<Card, ArrayList<String>> types = new HashMap<Card, ArrayList<String>>();
private HashMap<Card, ArrayList<String>> originalTypes = new HashMap<Card, ArrayList<String>>();
@@ -175,6 +176,15 @@ public class StaticEffect {
public void setKeepSupertype(boolean keepSupertype) {
this.keepSupertype = keepSupertype;
}
//should we overwrite land types?
public boolean isRemoveSubTypes() {
return removeSubTypes;
}
public void setRemoveSubTypes(boolean removeSubTypes) {
this.removeSubTypes = removeSubTypes;
}
//original types
public void addOriginalType(Card c, String s) {