mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- 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:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user