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);
|
counters.put(counterName, aux);
|
||||||
if(counterName.equals(Counters.TIME) && aux == 0)
|
if(counterName.equals(Counters.TIME) && aux == 0)
|
||||||
{
|
{
|
||||||
boolean hasVanish=false;
|
boolean hasVanish = CardFactory.hasKeyword(this, "Vanishing") != -1;
|
||||||
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;
|
|
||||||
}
|
|
||||||
if(hasVanish && AllZone.GameAction.isCardInPlay(this))
|
if(hasVanish && AllZone.GameAction.isCardInPlay(this))
|
||||||
AllZone.GameAction.sacrifice(this);
|
AllZone.GameAction.sacrifice(this);
|
||||||
if(hasSuspend() && AllZone.GameAction.isCardRemovedFromGame(this))
|
if(hasSuspend() && AllZone.GameAction.isCardRemovedFromGame(this))
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ public class CardFactory implements NewConstants {
|
|||||||
return getCard2(cardName, owner);
|
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();
|
ArrayList<String> a = c.getKeyword();
|
||||||
for(int i = 0; i < a.size(); i++)
|
for(int i = 0; i < a.size(); i++)
|
||||||
if(a.get(i).toString().startsWith(k)) return i;
|
if(a.get(i).toString().startsWith(k)) return i;
|
||||||
@@ -10924,6 +10924,7 @@ public class CardFactory implements NewConstants {
|
|||||||
}//getCard2
|
}//getCard2
|
||||||
|
|
||||||
public Card postFactoryKeywords(Card card){
|
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());
|
card.addColor(card.getManaCost());
|
||||||
int cardnameSpot = hasKeyword(card, "CARDNAME is ");
|
int cardnameSpot = hasKeyword(card, "CARDNAME is ");
|
||||||
if (cardnameSpot != -1){
|
if (cardnameSpot != -1){
|
||||||
@@ -10939,18 +10940,17 @@ public class CardFactory implements NewConstants {
|
|||||||
card.addColor(color);
|
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) {
|
if(hasKeyword(card, "Fading") != -1) {
|
||||||
int n = hasKeyword(card, "Fading");
|
int n = hasKeyword(card, "Fading");
|
||||||
if(n != -1) {
|
if(n != -1) {
|
||||||
String parse = card.getKeyword().get(n).toString();
|
String parse = card.getKeyword().get(n).toString();
|
||||||
card.removeIntrinsicKeyword(parse);
|
|
||||||
|
|
||||||
String k[] = parse.split(":");
|
String k[] = parse.split(":");
|
||||||
final int power = Integer.parseInt(k[1]);
|
final int power = Integer.parseInt(k[1]);
|
||||||
|
|
||||||
|
|
||||||
card.addComesIntoPlayCommand(CardFactoryUtil.fading(card, power));
|
card.addComesIntoPlayCommand(CardFactoryUtil.fading(card, power));
|
||||||
|
// todo: come up with better way to add description
|
||||||
card.addSpellAbility(CardFactoryUtil.fading_desc(card, power));
|
card.addSpellAbility(CardFactoryUtil.fading_desc(card, power));
|
||||||
}
|
}
|
||||||
}//Fading
|
}//Fading
|
||||||
@@ -10959,13 +10959,12 @@ public class CardFactory implements NewConstants {
|
|||||||
int n = hasKeyword(card, "Vanishing");
|
int n = hasKeyword(card, "Vanishing");
|
||||||
if(n != -1) {
|
if(n != -1) {
|
||||||
String parse = card.getKeyword().get(n).toString();
|
String parse = card.getKeyword().get(n).toString();
|
||||||
card.removeIntrinsicKeyword(parse);
|
|
||||||
|
|
||||||
String k[] = parse.split(":");
|
String k[] = parse.split(":");
|
||||||
final int power = Integer.parseInt(k[1]);
|
final int power = Integer.parseInt(k[1]);
|
||||||
|
|
||||||
|
|
||||||
card.addComesIntoPlayCommand(CardFactoryUtil.vanishing(card, power));
|
card.addComesIntoPlayCommand(CardFactoryUtil.vanishing(card, power));
|
||||||
|
// todo: come up with better way to add description
|
||||||
card.addSpellAbility(CardFactoryUtil.vanish_desc(card, power));
|
card.addSpellAbility(CardFactoryUtil.vanish_desc(card, power));
|
||||||
}
|
}
|
||||||
}//Vanishing
|
}//Vanishing
|
||||||
|
|||||||
@@ -2258,9 +2258,7 @@ public class CardFactoryUtil {
|
|||||||
public void resolve() {}
|
public void resolve() {}
|
||||||
};
|
};
|
||||||
// Be carefull changing this description cause it's crucial for ability to work (see GameActionUtil - vanishing for it)
|
// Be carefull changing this description cause it's crucial for ability to work (see GameActionUtil - vanishing for it)
|
||||||
desc.setDescription("Fading "
|
desc.setDescription("(This permanent enters the battlefield with "
|
||||||
+ power
|
|
||||||
+ " (This permanent enters the battlefield with "
|
|
||||||
+ power
|
+ power
|
||||||
+ " fade counters on it. At the beginning of your upkeep, remove a fade counter from it. If you can't, sacrifice it.)");
|
+ " fade counters on it. At the beginning of your upkeep, remove a fade counter from it. If you can't, sacrifice it.)");
|
||||||
return desc;
|
return desc;
|
||||||
@@ -2296,9 +2294,7 @@ public class CardFactoryUtil {
|
|||||||
public void resolve() {}
|
public void resolve() {}
|
||||||
};
|
};
|
||||||
// Be carefull changing this description cause it's crucial for ability to work (see GameActionUtil - vanishing for it)
|
// Be carefull changing this description cause it's crucial for ability to work (see GameActionUtil - vanishing for it)
|
||||||
desc.setDescription("Vanishing "
|
desc.setDescription("(This permanent enters the battlefield with "
|
||||||
+ power
|
|
||||||
+ " (This permanent enters the battlefield with "
|
|
||||||
+ power
|
+ power
|
||||||
+ " time counters on it. At the beginning of your upkeep, remove a time counter from it. When the last is removed, sacrifice it.)");
|
+ " 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;
|
return desc;
|
||||||
|
|||||||
@@ -7397,14 +7397,7 @@ public class GameActionUtil {
|
|||||||
CardList list = new CardList(playZone.getCards());
|
CardList list = new CardList(playZone.getCards());
|
||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
SpellAbility[] sas = c.getSpellAbility();
|
return CardFactory.hasKeyword(c, "Vanishing") != -1;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(list.size() > 0) {
|
if(list.size() > 0) {
|
||||||
@@ -7431,14 +7424,7 @@ public class GameActionUtil {
|
|||||||
CardList list = new CardList(playZone.getCards());
|
CardList list = new CardList(playZone.getCards());
|
||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
SpellAbility[] sas = c.getSpellAbility();
|
return CardFactory.hasKeyword(c, "Fading") != -1;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(list.size() > 0) {
|
if(list.size() > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user