mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
finish plumbing in stAnimate for Lignify to become an Aura
This commit is contained in:
@@ -979,8 +979,8 @@ public class Card extends MyObservable {
|
|||||||
else if(k.length > 5) sbLong.append(k[6]).append("\r\n");
|
else if(k.length > 5) sbLong.append(k[6]).append("\r\n");
|
||||||
else sbLong.append(k[3]).append("\r\n");
|
else sbLong.append(k[3]).append("\r\n");
|
||||||
} else if (keyword.get(i).toString().contains("stAnimate")) {
|
} else if (keyword.get(i).toString().contains("stAnimate")) {
|
||||||
String k[] = keyword.get(i).split(":", 7);
|
String k[] = keyword.get(i).split(":", 8);
|
||||||
if (!k[4].contains("no text")) sbLong.append(k[6]).append("\r\n");
|
if (!k[7].contains("no text")) sbLong.append(k[7]).append("\r\n");
|
||||||
}else if (keyword.get(i).toString().contains("Protection:")) {
|
}else if (keyword.get(i).toString().contains("Protection:")) {
|
||||||
String k[] = keyword.get(i).split(":");
|
String k[] = keyword.get(i).split(":");
|
||||||
sbLong.append(k[2]).append("\r\n");
|
sbLong.append(k[2]).append("\r\n");
|
||||||
@@ -1245,6 +1245,22 @@ public class Card extends MyObservable {
|
|||||||
spellAbility.remove(0);
|
spellAbility.remove(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearAllButFirstSpellAbility(){
|
||||||
|
SpellAbility first = spellAbility.get(0);
|
||||||
|
spellAbility.clear();
|
||||||
|
spellAbility.add(first);
|
||||||
|
manaAbility.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<SpellAbility> getAllButFirstSpellAbility() {
|
||||||
|
ArrayList<SpellAbility> sas = new ArrayList<SpellAbility>();
|
||||||
|
sas.addAll(spellAbility);
|
||||||
|
sas.addAll(manaAbility);
|
||||||
|
SpellAbility first = spellAbility.get(0);
|
||||||
|
sas.remove(first);
|
||||||
|
return sas;
|
||||||
|
}
|
||||||
|
|
||||||
public void clearSpellAbility() {
|
public void clearSpellAbility() {
|
||||||
spellAbility.clear();
|
spellAbility.clear();
|
||||||
manaAbility.clear();
|
manaAbility.clear();
|
||||||
@@ -2211,11 +2227,22 @@ public class Card extends MyObservable {
|
|||||||
return new ArrayList<String>(intrinsicKeyword);
|
return new ArrayList<String>(intrinsicKeyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearIntrinsicKeyword() {
|
||||||
|
intrinsicKeyword.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public void setIntrinsicKeyword(ArrayList<String> a) {
|
public void setIntrinsicKeyword(ArrayList<String> a) {
|
||||||
intrinsicKeyword = new ArrayList<String>(a);
|
intrinsicKeyword = new ArrayList<String>(a);
|
||||||
this.updateObservers();
|
this.updateObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearAllKeywords() {
|
||||||
|
intrinsicKeyword.clear();
|
||||||
|
extrinsicKeyword.clear();
|
||||||
|
otherExtrinsicKeyword.clear();
|
||||||
|
HiddenExtrinsicKeyword.clear(); //Hidden keywords won't be displayed on the card
|
||||||
|
}
|
||||||
|
|
||||||
public void setIntrinsicAbilities(ArrayList<String> a)
|
public void setIntrinsicAbilities(ArrayList<String> a)
|
||||||
{
|
{
|
||||||
intrinsicAbility = new ArrayList<String>(a);
|
intrinsicAbility = new ArrayList<String>(a);
|
||||||
|
|||||||
@@ -5,219 +5,212 @@ import java.util.Observable;
|
|||||||
|
|
||||||
public class DefaultPlayerZone extends PlayerZone implements java.io.Serializable
|
public class DefaultPlayerZone extends PlayerZone implements java.io.Serializable
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = -5687652485777639176L;
|
private static final long serialVersionUID = -5687652485777639176L;
|
||||||
|
|
||||||
private ArrayList<Card> cards = new ArrayList<Card>();
|
private ArrayList<Card> cards = new ArrayList<Card>();
|
||||||
private String zoneName;
|
private String zoneName;
|
||||||
private Player player;
|
private Player player;
|
||||||
private boolean update = true;
|
private boolean update = true;
|
||||||
|
|
||||||
private CardList cardsAddedThisTurn = new CardList();
|
private CardList cardsAddedThisTurn = new CardList();
|
||||||
private ArrayList<String> cardsAddedThisTurnSource = new ArrayList<String>();
|
private ArrayList<String> cardsAddedThisTurnSource = new ArrayList<String>();
|
||||||
|
|
||||||
public DefaultPlayerZone(String zone, Player inPlayer)
|
public DefaultPlayerZone(String zone, Player inPlayer)
|
||||||
{
|
{
|
||||||
zoneName = zone;
|
zoneName = zone;
|
||||||
player = inPlayer;
|
player = inPlayer;
|
||||||
}
|
}
|
||||||
//************ BEGIN - these methods fire updateObservers() *************
|
//************ BEGIN - these methods fire updateObservers() *************
|
||||||
public void add(Object o)
|
public void add(Object o)
|
||||||
{
|
{
|
||||||
/*
|
Card c = (Card)o;
|
||||||
if (is("Graveyard"))
|
|
||||||
System.out.println("GRAAAAAAAAAAAAAAAVE");
|
|
||||||
*/
|
|
||||||
|
|
||||||
Card c = (Card)o;
|
|
||||||
|
|
||||||
cardsAddedThisTurn.add(c);
|
cardsAddedThisTurn.add(c);
|
||||||
if(AllZone.getZone(c) != null)
|
if(AllZone.getZone(c) != null)
|
||||||
{
|
{
|
||||||
cardsAddedThisTurnSource.add(AllZone.getZone(c).getZoneName());
|
cardsAddedThisTurnSource.add(AllZone.getZone(c).getZoneName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cardsAddedThisTurnSource.add("None");
|
cardsAddedThisTurnSource.add("None");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is("Graveyard")
|
if (is("Graveyard")
|
||||||
&& c.getKeyword().contains("When CARDNAME is put into a graveyard from anywhere, reveal CARDNAME and shuffle it into its owner's library instead."))
|
&& c.getKeyword().contains("When CARDNAME is put into a graveyard from anywhere, reveal CARDNAME and shuffle it into its owner's library instead."))
|
||||||
{
|
{
|
||||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, c.getOwner());
|
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, c.getOwner());
|
||||||
lib.add(c);
|
lib.add(c);
|
||||||
c.getOwner().shuffle();
|
c.getOwner().shuffle();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//slight difference from above I guess, the card gets put into the grave first, then shuffled into library.
|
//slight difference from above I guess, the card gets put into the grave first, then shuffled into library.
|
||||||
//key is that this would trigger abilities that trigger on cards hitting the graveyard
|
//key is that this would trigger abilities that trigger on cards hitting the graveyard
|
||||||
else if (is("Graveyard") && c.getKeyword().contains("When CARDNAME is put into a graveyard from anywhere, shuffle it into its owner's library."))
|
else if (is("Graveyard") && c.getKeyword().contains("When CARDNAME is put into a graveyard from anywhere, shuffle it into its owner's library."))
|
||||||
{
|
{
|
||||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, c.getOwner());
|
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, c.getOwner());
|
||||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, c.getOwner());
|
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, c.getOwner());
|
||||||
|
|
||||||
grave.addOnce(c);
|
|
||||||
grave.remove(c);
|
|
||||||
lib.add(c);
|
|
||||||
c.getOwner().shuffle();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (is("Graveyard")
|
|
||||||
&& c.getKeyword().contains("When CARDNAME is put into a graveyard from anywhere, reveal CARDNAME and its owner shuffles his or her graveyard into his or her library."))
|
|
||||||
{
|
|
||||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, c.getOwner());
|
|
||||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, c.getOwner());
|
|
||||||
lib.add(c);
|
|
||||||
for(Card gc : AllZoneUtil.getPlayerGraveyard(c.getOwner()))
|
|
||||||
lib.add(gc);
|
|
||||||
grave.reset();
|
|
||||||
c.getOwner().shuffle();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (c.isUnearthed() && (is("Graveyard") || is("Hand") || is("Library")))
|
|
||||||
{
|
|
||||||
PlayerZone removed = AllZone.getZone(Constant.Zone.Exile, c.getOwner());
|
|
||||||
removed.add(c);
|
|
||||||
c.setUnearthed(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
c.addObserver(this);
|
|
||||||
|
|
||||||
c.setTurnInZone(AllZone.Phase.getTurn());
|
grave.addOnce(c);
|
||||||
|
grave.remove(c);
|
||||||
|
lib.add(c);
|
||||||
|
c.getOwner().shuffle();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cards.add((Card)c);
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
//hack... use for adding Dread / Serra Avenger to grave
|
|
||||||
public void addOnce(Object o)
|
|
||||||
{
|
|
||||||
Card c = (Card)o;
|
|
||||||
|
|
||||||
cardsAddedThisTurn.add(c);
|
if (is("Graveyard")
|
||||||
if(AllZone.getZone(c) != null)
|
&& c.getKeyword().contains("When CARDNAME is put into a graveyard from anywhere, reveal CARDNAME and its owner shuffles his or her graveyard into his or her library."))
|
||||||
{
|
{
|
||||||
cardsAddedThisTurnSource.add(AllZone.getZone(c).getZoneName());
|
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, c.getOwner());
|
||||||
}
|
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, c.getOwner());
|
||||||
else
|
lib.add(c);
|
||||||
{
|
for(Card gc : AllZoneUtil.getPlayerGraveyard(c.getOwner()))
|
||||||
cardsAddedThisTurnSource.add("None");
|
lib.add(gc);
|
||||||
}
|
grave.reset();
|
||||||
|
c.getOwner().shuffle();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
c.addObserver(this);
|
if (c.isUnearthed() && (is("Graveyard") || is("Hand") || is("Library")))
|
||||||
|
{
|
||||||
cards.add((Card)c);
|
PlayerZone removed = AllZone.getZone(Constant.Zone.Exile, c.getOwner());
|
||||||
update();
|
removed.add(c);
|
||||||
}
|
c.setUnearthed(false);
|
||||||
public void update(Observable ob, Object object)
|
return;
|
||||||
{
|
}
|
||||||
this.update();
|
|
||||||
}
|
|
||||||
public void add(Card c, int index)
|
|
||||||
{
|
|
||||||
cardsAddedThisTurn.add(c);
|
|
||||||
if(AllZone.getZone(c) != null)
|
|
||||||
{
|
|
||||||
cardsAddedThisTurnSource.add(AllZone.getZone(c).getZoneName());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cardsAddedThisTurnSource.add("None");
|
|
||||||
}
|
|
||||||
|
|
||||||
cards.add(index, c);
|
|
||||||
c.setTurnInZone(AllZone.Phase.getTurn());
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
public void remove(Object c)
|
|
||||||
{
|
|
||||||
cards.remove((Card)c);
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
public void setCards(Card c[])
|
|
||||||
{
|
|
||||||
cards = new ArrayList<Card>(Arrays.asList(c));
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
//removes all cards
|
|
||||||
public void reset()
|
|
||||||
{
|
|
||||||
cards.clear();
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
//************ END - these methods fire updateObservers() *************
|
|
||||||
|
|
||||||
public boolean is(String zone)
|
c.addObserver(this);
|
||||||
{
|
|
||||||
return zone.equals(zoneName);
|
|
||||||
}
|
|
||||||
public boolean is(String zone, Player player)
|
|
||||||
{
|
|
||||||
return (zone.equals(zoneName) && player.isPlayer(player));
|
|
||||||
}
|
|
||||||
public Player getPlayer()
|
|
||||||
{
|
|
||||||
return player;
|
|
||||||
}
|
|
||||||
public String getZoneName()
|
|
||||||
{
|
|
||||||
return zoneName;
|
|
||||||
}
|
|
||||||
public int size()
|
|
||||||
{
|
|
||||||
return cards.size();
|
|
||||||
}
|
|
||||||
public Card get(int index)
|
|
||||||
{
|
|
||||||
return (Card)cards.get(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Card[] getCards()
|
c.setTurnInZone(AllZone.Phase.getTurn());
|
||||||
{
|
|
||||||
Card c[] = new Card[cards.size()];
|
|
||||||
cards.toArray(c);
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
public void update()
|
|
||||||
{
|
|
||||||
if(update)
|
|
||||||
updateObservers();
|
|
||||||
}
|
|
||||||
public void setUpdate(boolean b) {update = b;}
|
|
||||||
public boolean getUpdate() {return update;}
|
|
||||||
|
|
||||||
public String toString(){
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
if (player != null)
|
|
||||||
sb.append(player.toString()).append(" ");
|
|
||||||
sb.append(zoneName);
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CardList getCardsAddedThisTurn(String origin)
|
cards.add((Card)c);
|
||||||
{
|
update();
|
||||||
System.out.print("Request cards put into " + getZoneName() + " from " + origin + ".Amount: ");
|
}
|
||||||
CardList ret = new CardList();
|
|
||||||
for(int i=0;i<cardsAddedThisTurn.size();i++)
|
|
||||||
{
|
|
||||||
if(origin.equals(cardsAddedThisTurnSource.get(i)) || origin.equals("Any"))
|
|
||||||
{
|
|
||||||
ret.add(cardsAddedThisTurn.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println(ret.size());
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetCardsAddedThisTurn()
|
//hack... use for adding Dread / Serra Avenger to grave
|
||||||
{
|
public void addOnce(Object o)
|
||||||
cardsAddedThisTurn.clear();
|
{
|
||||||
cardsAddedThisTurnSource.clear();
|
Card c = (Card)o;
|
||||||
}
|
|
||||||
|
cardsAddedThisTurn.add(c);
|
||||||
|
if(AllZone.getZone(c) != null)
|
||||||
|
{
|
||||||
|
cardsAddedThisTurnSource.add(AllZone.getZone(c).getZoneName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cardsAddedThisTurnSource.add("None");
|
||||||
|
}
|
||||||
|
|
||||||
|
c.addObserver(this);
|
||||||
|
|
||||||
|
cards.add((Card)c);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
public void update(Observable ob, Object object)
|
||||||
|
{
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
|
public void add(Card c, int index)
|
||||||
|
{
|
||||||
|
cardsAddedThisTurn.add(c);
|
||||||
|
if(AllZone.getZone(c) != null)
|
||||||
|
{
|
||||||
|
cardsAddedThisTurnSource.add(AllZone.getZone(c).getZoneName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cardsAddedThisTurnSource.add("None");
|
||||||
|
}
|
||||||
|
|
||||||
|
cards.add(index, c);
|
||||||
|
c.setTurnInZone(AllZone.Phase.getTurn());
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
public void remove(Object c)
|
||||||
|
{
|
||||||
|
cards.remove((Card)c);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
public void setCards(Card c[])
|
||||||
|
{
|
||||||
|
cards = new ArrayList<Card>(Arrays.asList(c));
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
//removes all cards
|
||||||
|
public void reset()
|
||||||
|
{
|
||||||
|
cards.clear();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
//************ END - these methods fire updateObservers() *************
|
||||||
|
|
||||||
|
public boolean is(String zone)
|
||||||
|
{
|
||||||
|
return zone.equals(zoneName);
|
||||||
|
}
|
||||||
|
public boolean is(String zone, Player player)
|
||||||
|
{
|
||||||
|
return (zone.equals(zoneName) && player.isPlayer(player));
|
||||||
|
}
|
||||||
|
public Player getPlayer()
|
||||||
|
{
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
public String getZoneName()
|
||||||
|
{
|
||||||
|
return zoneName;
|
||||||
|
}
|
||||||
|
public int size()
|
||||||
|
{
|
||||||
|
return cards.size();
|
||||||
|
}
|
||||||
|
public Card get(int index)
|
||||||
|
{
|
||||||
|
return (Card)cards.get(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Card[] getCards()
|
||||||
|
{
|
||||||
|
Card c[] = new Card[cards.size()];
|
||||||
|
cards.toArray(c);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
public void update()
|
||||||
|
{
|
||||||
|
if(update)
|
||||||
|
updateObservers();
|
||||||
|
}
|
||||||
|
public void setUpdate(boolean b) {update = b;}
|
||||||
|
public boolean getUpdate() {return update;}
|
||||||
|
|
||||||
|
public String toString(){
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
if (player != null)
|
||||||
|
sb.append(player.toString()).append(" ");
|
||||||
|
sb.append(zoneName);
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CardList getCardsAddedThisTurn(String origin)
|
||||||
|
{
|
||||||
|
System.out.print("Request cards put into " + getZoneName() + " from " + origin + ".Amount: ");
|
||||||
|
CardList ret = new CardList();
|
||||||
|
for(int i=0;i<cardsAddedThisTurn.size();i++)
|
||||||
|
{
|
||||||
|
if(origin.equals(cardsAddedThisTurnSource.get(i)) || origin.equals("Any"))
|
||||||
|
{
|
||||||
|
ret.add(cardsAddedThisTurn.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println(ret.size());
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetCardsAddedThisTurn()
|
||||||
|
{
|
||||||
|
cardsAddedThisTurn.clear();
|
||||||
|
cardsAddedThisTurnSource.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7394,10 +7394,10 @@ public class GameActionUtil {
|
|||||||
|
|
||||||
public static Command stAnimate = new Command() {
|
public static Command stAnimate = new Command() {
|
||||||
/** stAnimate
|
/** stAnimate
|
||||||
* Syntax:[ k[0] stAnimate[All][Self][Enchanted] : k[1] AnimateValid :
|
* Syntax:[ k[0] stAnimate[All][Self][Enchanted] : k[1] AnimateValid :
|
||||||
* k[2] P/T/Keyword : k[3] extra types : k[4] extra colors : k[5] Special Conditions : k[6] Description
|
* k[2] P/T/Keyword : k[3] extra types : k[4] extra colors :
|
||||||
|
* k[5] Abilities : k[6] Special Conditions : k[7] Description
|
||||||
*
|
*
|
||||||
* extra colors k[4] - not implemented yet
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static final long serialVersionUID = -1404133561787349004L;
|
private static final long serialVersionUID = -1404133561787349004L;
|
||||||
@@ -7435,9 +7435,9 @@ public class GameActionUtil {
|
|||||||
|
|
||||||
|
|
||||||
//get the affected cards
|
//get the affected cards
|
||||||
String k[] = keyword.split(":", 7);
|
String k[] = keyword.split(":", 8);
|
||||||
|
|
||||||
if(areSpecialConditionsMet(cardWithKeyword, k[5])) { //special conditions are isPresent, isValid
|
if(areSpecialConditionsMet(cardWithKeyword, k[6])) { //special conditions are isPresent, isValid
|
||||||
|
|
||||||
final String affected = k[1];
|
final String affected = k[1];
|
||||||
final String specific[] = affected.split(",");
|
final String specific[] = affected.split(",");
|
||||||
@@ -7471,6 +7471,14 @@ public class GameActionUtil {
|
|||||||
colors = CardUtil.getShortColorsString(new ArrayList<String>(Arrays.asList(k[4].split(","))));
|
colors = CardUtil.getShortColorsString(new ArrayList<String>(Arrays.asList(k[4].split(","))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(k[2].contains("Overwrite")) {
|
||||||
|
se.setOverwriteKeywords(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(k[5].contains("Overwrite")) {
|
||||||
|
se.setOverwriteAbilities(true);
|
||||||
|
}
|
||||||
|
|
||||||
addStaticEffects(se, cardWithKeyword, affectedCards, k[2], types, colors); //give the boni to the affected cards
|
addStaticEffects(se, cardWithKeyword, affectedCards, k[2], types, colors); //give the boni to the affected cards
|
||||||
|
|
||||||
storage.add(se); // store the information
|
storage.add(se); // store the information
|
||||||
@@ -7485,7 +7493,6 @@ public class GameActionUtil {
|
|||||||
String[] keyword = details.split("/", 3);
|
String[] keyword = details.split("/", 3);
|
||||||
String powerStr = keyword[0];
|
String powerStr = keyword[0];
|
||||||
String toughStr = keyword[1];
|
String toughStr = keyword[1];
|
||||||
boolean overwriteTypes = se.isOverwriteTypes();
|
|
||||||
|
|
||||||
for(int i = 0; i < affectedCards.size(); i++) {
|
for(int i = 0; i < affectedCards.size(); i++) {
|
||||||
Card affectedCard = affectedCards.get(i);
|
Card affectedCard = affectedCards.get(i);
|
||||||
@@ -7496,7 +7503,7 @@ public class GameActionUtil {
|
|||||||
affectedCard.setBaseAttack(power);
|
affectedCard.setBaseAttack(power);
|
||||||
affectedCard.setBaseDefense(toughness);
|
affectedCard.setBaseDefense(toughness);
|
||||||
|
|
||||||
if(overwriteTypes) {
|
if(se.isOverwriteTypes()) {
|
||||||
se.addOriginalTypes(affectedCard, affectedCard.getType());
|
se.addOriginalTypes(affectedCard, affectedCard.getType());
|
||||||
affectedCard.clearAllTypes();
|
affectedCard.clearAllTypes();
|
||||||
}
|
}
|
||||||
@@ -7509,28 +7516,42 @@ public class GameActionUtil {
|
|||||||
se.removeType(affectedCard, type);
|
se.removeType(affectedCard, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(se.isOverwriteKeywords()) {
|
||||||
if(keyword.length > 2) {
|
se.addOriginalKeywords(affectedCard, affectedCard.getIntrinsicKeyword());
|
||||||
String keywords[] = keyword[2].split(" & ");
|
affectedCard.clearAllKeywords();
|
||||||
for(int j = 0; j < keywords.length; j++) {
|
}
|
||||||
String kw = keywords[j];
|
else {
|
||||||
/*if(kw.startsWith("SVar=")) {
|
if(keyword.length > 2) {
|
||||||
|
String keywords[] = keyword[2].split(" & ");
|
||||||
|
for(int j = 0; j < keywords.length; j++) {
|
||||||
|
String kw = keywords[j];
|
||||||
|
/*if(kw.startsWith("SVar=")) {
|
||||||
String sVar = source.getSVar(kw.split("SVar=")[1]);
|
String sVar = source.getSVar(kw.split("SVar=")[1]);
|
||||||
if (sVar.startsWith("AB")) { // grant the ability
|
if (sVar.startsWith("AB")) { // grant the ability
|
||||||
AbilityFactory AF = new AbilityFactory();
|
AbilityFactory AF = new AbilityFactory();
|
||||||
SpellAbility sa = AF.getAbility(sVar, affectedCard);
|
SpellAbility sa = AF.getAbility(sVar, affectedCard);
|
||||||
sa.setType("Temporary");
|
sa.setType("Temporary");
|
||||||
|
|
||||||
affectedCard.addSpellAbility(sa);
|
affectedCard.addSpellAbility(sa);
|
||||||
}
|
}
|
||||||
else { // Copy this SVar
|
else { // Copy this SVar
|
||||||
affectedCard.setSVar(kw.split("SVar=")[1], sVar);
|
affectedCard.setSVar(kw.split("SVar=")[1], sVar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else */ affectedCard.addExtrinsicKeyword(kw);
|
else */ affectedCard.addExtrinsicKeyword(kw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Abilities
|
||||||
|
if(se.isOverwriteAbilities()) {
|
||||||
|
se.addOriginalAbilities(affectedCard, affectedCard.getAllButFirstSpellAbility());
|
||||||
|
affectedCard.clearAllButFirstSpellAbility();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//TODO - adding SpellAbilities statically here not supported at this time
|
||||||
|
}
|
||||||
|
|
||||||
long t = affectedCard.addColor(colors, affectedCard, true, true);
|
long t = affectedCard.addColor(colors, affectedCard, true, true);
|
||||||
se.addTimestamp(affectedCard, t);
|
se.addTimestamp(affectedCard, t);
|
||||||
}//end for
|
}//end for
|
||||||
@@ -7562,11 +7583,15 @@ public class GameActionUtil {
|
|||||||
for(String type : se.getOriginalTypes(affectedCard)) affectedCard.addType(type);
|
for(String type : se.getOriginalTypes(affectedCard)) affectedCard.addType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] kw = details[2].split("/", 3);
|
if(se.isOverwriteKeywords()) {
|
||||||
if (kw.length > 2) {
|
for(String kw : se.getOriginalKeywords(affectedCard)) affectedCard.addIntrinsicKeyword(kw);
|
||||||
String kws[] = kw[2].split(" & ");
|
}
|
||||||
for(int j = 0; j < kws.length; j++) {
|
else {
|
||||||
String keyword = kws[j];
|
String[] kw = details[2].split("/", 3);
|
||||||
|
if (kw.length > 2) {
|
||||||
|
String kws[] = kw[2].split(" & ");
|
||||||
|
for(int j = 0; j < kws.length; j++) {
|
||||||
|
String keyword = kws[j];
|
||||||
/*
|
/*
|
||||||
if(keyword.startsWith("SVar=")) {
|
if(keyword.startsWith("SVar=")) {
|
||||||
String sVar = source.getSVar(keyword.split("SVar=")[1]);
|
String sVar = source.getSVar(keyword.split("SVar=")[1]);
|
||||||
@@ -7580,8 +7605,17 @@ public class GameActionUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else */ affectedCard.removeExtrinsicKeyword(keyword);
|
else */ affectedCard.removeExtrinsicKeyword(keyword);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Abilities
|
||||||
|
if(se.isOverwriteAbilities()) {
|
||||||
|
for(SpellAbility sa : se.getOriginalAbilities(affectedCard)) affectedCard.addSpellAbility(sa);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//TODO - adding SpellAbilities statically here not supported at this time
|
||||||
|
}
|
||||||
|
|
||||||
affectedCard.removeColor(se.getColorDesc(), affectedCard, true, se.getTimestamp(affectedCard));
|
affectedCard.removeColor(se.getColorDesc(), affectedCard, true, se.getTimestamp(affectedCard));
|
||||||
}//end removeStaticEffects
|
}//end removeStaticEffects
|
||||||
|
|
||||||
|
|||||||
@@ -4,26 +4,131 @@ package forge;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import forge.card.spellability.SpellAbility;
|
||||||
|
|
||||||
public class StaticEffect {
|
public class StaticEffect {
|
||||||
private Card source = new Card();
|
private Card source = new Card();
|
||||||
private int keywordNumber = 0;
|
private int keywordNumber = 0;
|
||||||
private CardList affectedCards = new CardList();
|
private CardList affectedCards = new CardList();
|
||||||
private int xValue = 0;
|
private int xValue = 0;
|
||||||
private int yValue = 0;
|
private int yValue = 0;
|
||||||
|
|
||||||
//for P/T
|
//for P/T
|
||||||
private HashMap<Card, String> originalPT = new HashMap<Card, String>();
|
private HashMap<Card, String> originalPT = new HashMap<Card, String>();
|
||||||
|
|
||||||
//for types
|
//for types
|
||||||
private HashMap<Card, ArrayList<String>> types = new HashMap<Card, ArrayList<String>>();
|
private boolean overwriteTypes = false;
|
||||||
private HashMap<Card, ArrayList<String>> originalTypes = new HashMap<Card, ArrayList<String>>();
|
private HashMap<Card, ArrayList<String>> types = new HashMap<Card, ArrayList<String>>();
|
||||||
private boolean overwriteTypes = false;
|
private HashMap<Card, ArrayList<String>> originalTypes = new HashMap<Card, ArrayList<String>>();
|
||||||
|
|
||||||
|
//keywords
|
||||||
|
private boolean overwriteKeywords = false;
|
||||||
|
private HashMap<Card, ArrayList<String>> originalKeywords = new HashMap<Card, ArrayList<String>>();
|
||||||
|
|
||||||
|
//for abilities
|
||||||
|
private boolean overwriteAbilities = false;
|
||||||
|
private HashMap<Card, ArrayList<SpellAbility>> originalAbilities = new HashMap<Card, ArrayList<SpellAbility>>();
|
||||||
|
|
||||||
//for colors
|
//for colors
|
||||||
private String colorDesc = "";
|
private String colorDesc = "";
|
||||||
private HashMap<Card, Long> timestamps = new HashMap<Card, Long>();
|
private HashMap<Card, Long> timestamps = new HashMap<Card, Long>();
|
||||||
|
|
||||||
|
|
||||||
|
//overwrite SAs
|
||||||
|
public boolean isOverwriteAbilities() {
|
||||||
|
return overwriteAbilities;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOverwriteAbilities(boolean overwriteAbilities) {
|
||||||
|
this.overwriteAbilities = overwriteAbilities;
|
||||||
|
}
|
||||||
|
|
||||||
|
//original SAs
|
||||||
|
public void addOriginalAbilities(Card c, SpellAbility sa) {
|
||||||
|
if(!originalAbilities.containsKey(c)) {
|
||||||
|
ArrayList<SpellAbility> list = new ArrayList<SpellAbility>();
|
||||||
|
list.add(sa);
|
||||||
|
originalAbilities.put(c, list);
|
||||||
|
}
|
||||||
|
else originalAbilities.get(c).add(sa);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOriginalAbilities(Card c, ArrayList<SpellAbility> s) {
|
||||||
|
ArrayList<SpellAbility> list = new ArrayList<SpellAbility>(s);
|
||||||
|
if(!originalAbilities.containsKey(c)) {
|
||||||
|
originalAbilities.put(c, list);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
originalAbilities.remove(c);
|
||||||
|
originalAbilities.put(c, list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<SpellAbility> getOriginalAbilities(Card c) {
|
||||||
|
ArrayList<SpellAbility> returnList = new ArrayList<SpellAbility>();
|
||||||
|
if(originalAbilities.containsKey(c)) {
|
||||||
|
returnList.addAll(originalAbilities.get(c));
|
||||||
|
}
|
||||||
|
return returnList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearOriginalAbilities(Card c) {
|
||||||
|
if(originalAbilities.containsKey(c)) {
|
||||||
|
originalAbilities.get(c).clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearAllOriginalAbilities() {
|
||||||
|
originalAbilities.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//overwrite keywords
|
||||||
|
public boolean isOverwriteKeywords() {
|
||||||
|
return overwriteKeywords;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOverwriteKeywords(boolean overwriteKeywords) {
|
||||||
|
this.overwriteKeywords = overwriteKeywords;
|
||||||
|
}
|
||||||
|
|
||||||
|
//original keywords
|
||||||
|
public void addOriginalKeyword(Card c, String s) {
|
||||||
|
if(!originalKeywords.containsKey(c)) {
|
||||||
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
|
list.add(s);
|
||||||
|
originalKeywords.put(c, list);
|
||||||
|
}
|
||||||
|
else originalKeywords.get(c).add(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOriginalKeywords(Card c, ArrayList<String> s) {
|
||||||
|
ArrayList<String> list = new ArrayList<String>(s);
|
||||||
|
if(!originalKeywords.containsKey(c)) {
|
||||||
|
originalKeywords.put(c, list);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
originalKeywords.remove(c);
|
||||||
|
originalKeywords.put(c, list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getOriginalKeywords(Card c) {
|
||||||
|
ArrayList<String> returnList = new ArrayList<String>();
|
||||||
|
if(originalKeywords.containsKey(c)) {
|
||||||
|
returnList.addAll(originalKeywords.get(c));
|
||||||
|
}
|
||||||
|
return returnList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearOriginalKeywords(Card c) {
|
||||||
|
if(originalKeywords.containsKey(c)) {
|
||||||
|
originalKeywords.get(c).clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearAllOriginalKeywords() {
|
||||||
|
originalKeywords.clear();
|
||||||
|
}
|
||||||
|
|
||||||
//original power/toughness
|
//original power/toughness
|
||||||
public void addOriginalPT(Card c, int power, int toughness) {
|
public void addOriginalPT(Card c, int power, int toughness) {
|
||||||
|
|||||||
Reference in New Issue
Block a user