mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Changed Fading and Vanishing so they aren't removed as keywords.
- Updated subtractCounter to use Vanishing as a keyword.
This commit is contained in:
@@ -390,12 +390,8 @@ public class Card extends MyObservable {
|
||||
counters.put(counterName, aux);
|
||||
if(counterName.equals(Counters.TIME) && aux == 0)
|
||||
{
|
||||
boolean hasVanish=false;
|
||||
for(SpellAbility sa:getSpellAbility()) {
|
||||
if(sa.toString().contains(
|
||||
"At the beginning of your upkeep, remove a time counter from it. When the last is removed, sacrifice it.)")) //this is essentially ".getDescription()"
|
||||
hasVanish = true;
|
||||
}
|
||||
boolean hasVanish = CardFactory.hasKeyword(this, "Vanishing") != -1;
|
||||
|
||||
if(hasVanish && AllZone.GameAction.isCardInPlay(this))
|
||||
AllZone.GameAction.sacrifice(this);
|
||||
if(hasSuspend() && AllZone.GameAction.isCardRemovedFromGame(this))
|
||||
|
||||
@@ -231,7 +231,7 @@ public class CardFactory implements NewConstants {
|
||||
return getCard2(cardName, owner);
|
||||
}
|
||||
|
||||
private final int hasKeyword(Card c, String k) {
|
||||
final static int hasKeyword(Card c, String k) {
|
||||
ArrayList<String> a = c.getKeyword();
|
||||
for(int i = 0; i < a.size(); i++)
|
||||
if(a.get(i).toString().startsWith(k)) return i;
|
||||
@@ -10924,6 +10924,7 @@ public class CardFactory implements NewConstants {
|
||||
}//getCard2
|
||||
|
||||
public Card postFactoryKeywords(Card card){
|
||||
// this function should handle any keywords that need to be added after a spell goes through the factory
|
||||
card.addColor(card.getManaCost());
|
||||
int cardnameSpot = hasKeyword(card, "CARDNAME is ");
|
||||
if (cardnameSpot != -1){
|
||||
@@ -10939,18 +10940,17 @@ public class CardFactory implements NewConstants {
|
||||
card.addColor(color);
|
||||
}
|
||||
|
||||
// this function should handle any keywords that need to be added after a spell goes through the factory
|
||||
if(hasKeyword(card, "Fading") != -1) {
|
||||
int n = hasKeyword(card, "Fading");
|
||||
if(n != -1) {
|
||||
String parse = card.getKeyword().get(n).toString();
|
||||
card.removeIntrinsicKeyword(parse);
|
||||
|
||||
String k[] = parse.split(":");
|
||||
final int power = Integer.parseInt(k[1]);
|
||||
|
||||
|
||||
card.addComesIntoPlayCommand(CardFactoryUtil.fading(card, power));
|
||||
// todo: come up with better way to add description
|
||||
card.addSpellAbility(CardFactoryUtil.fading_desc(card, power));
|
||||
}
|
||||
}//Fading
|
||||
@@ -10959,13 +10959,12 @@ public class CardFactory implements NewConstants {
|
||||
int n = hasKeyword(card, "Vanishing");
|
||||
if(n != -1) {
|
||||
String parse = card.getKeyword().get(n).toString();
|
||||
card.removeIntrinsicKeyword(parse);
|
||||
|
||||
String k[] = parse.split(":");
|
||||
final int power = Integer.parseInt(k[1]);
|
||||
|
||||
|
||||
card.addComesIntoPlayCommand(CardFactoryUtil.vanishing(card, power));
|
||||
// todo: come up with better way to add description
|
||||
card.addSpellAbility(CardFactoryUtil.vanish_desc(card, power));
|
||||
}
|
||||
}//Vanishing
|
||||
|
||||
@@ -2258,9 +2258,7 @@ public class CardFactoryUtil {
|
||||
public void resolve() {}
|
||||
};
|
||||
// Be carefull changing this description cause it's crucial for ability to work (see GameActionUtil - vanishing for it)
|
||||
desc.setDescription("Fading "
|
||||
+ power
|
||||
+ " (This permanent enters the battlefield with "
|
||||
desc.setDescription("(This permanent enters the battlefield with "
|
||||
+ power
|
||||
+ " fade counters on it. At the beginning of your upkeep, remove a fade counter from it. If you can't, sacrifice it.)");
|
||||
return desc;
|
||||
@@ -2296,9 +2294,7 @@ public class CardFactoryUtil {
|
||||
public void resolve() {}
|
||||
};
|
||||
// Be carefull changing this description cause it's crucial for ability to work (see GameActionUtil - vanishing for it)
|
||||
desc.setDescription("Vanishing "
|
||||
+ power
|
||||
+ " (This permanent enters the battlefield with "
|
||||
desc.setDescription("(This permanent enters the battlefield with "
|
||||
+ power
|
||||
+ " time counters on it. At the beginning of your upkeep, remove a time counter from it. When the last is removed, sacrifice it.)");
|
||||
return desc;
|
||||
|
||||
@@ -7397,14 +7397,7 @@ public class GameActionUtil {
|
||||
CardList list = new CardList(playZone.getCards());
|
||||
list = list.filter(new CardListFilter() {
|
||||
public boolean addCard(Card c) {
|
||||
SpellAbility[] sas = c.getSpellAbility();
|
||||
boolean hasRegen = false;
|
||||
for(SpellAbility sa:sas) {
|
||||
if(sa.toString().contains(
|
||||
"At the beginning of your upkeep, remove a time counter from it. When the last is removed, sacrifice it.)")) //this is essentially ".getDescription()"
|
||||
hasRegen = true;
|
||||
}
|
||||
return hasRegen;
|
||||
return CardFactory.hasKeyword(c, "Vanishing") != -1;
|
||||
}
|
||||
});
|
||||
if(list.size() > 0) {
|
||||
@@ -7431,14 +7424,7 @@ public class GameActionUtil {
|
||||
CardList list = new CardList(playZone.getCards());
|
||||
list = list.filter(new CardListFilter() {
|
||||
public boolean addCard(Card c) {
|
||||
SpellAbility[] sas = c.getSpellAbility();
|
||||
boolean isFading = false;
|
||||
for(SpellAbility sa:sas) {
|
||||
if(sa.toString().contains(
|
||||
"At the beginning of your upkeep, remove a fade counter from it. If you can't, sacrifice it.)")) //this is essentially ".getDescription()"
|
||||
isFading = true;
|
||||
}
|
||||
return isFading;
|
||||
return CardFactory.hasKeyword(c, "Fading") != -1;
|
||||
}
|
||||
});
|
||||
if(list.size() > 0) {
|
||||
|
||||
Reference in New Issue
Block a user