mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38: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);
|
||||||
|
|||||||
@@ -23,11 +23,6 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
|||||||
//************ BEGIN - these methods fire updateObservers() *************
|
//************ BEGIN - these methods fire updateObservers() *************
|
||||||
public void add(Object o)
|
public void add(Object o)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (is("Graveyard"))
|
|
||||||
System.out.println("GRAAAAAAAAAAAAAAAVE");
|
|
||||||
*/
|
|
||||||
|
|
||||||
Card c = (Card)o;
|
Card c = (Card)o;
|
||||||
|
|
||||||
cardsAddedThisTurn.add(c);
|
cardsAddedThisTurn.add(c);
|
||||||
@@ -76,8 +71,6 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (c.isUnearthed() && (is("Graveyard") || is("Hand") || is("Library")))
|
if (c.isUnearthed() && (is("Graveyard") || is("Hand") || is("Library")))
|
||||||
{
|
{
|
||||||
PlayerZone removed = AllZone.getZone(Constant.Zone.Exile, c.getOwner());
|
PlayerZone removed = AllZone.getZone(Constant.Zone.Exile, c.getOwner());
|
||||||
|
|||||||
@@ -7395,9 +7395,9 @@ 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,7 +7516,11 @@ public class GameActionUtil {
|
|||||||
se.removeType(affectedCard, type);
|
se.removeType(affectedCard, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(se.isOverwriteKeywords()) {
|
||||||
|
se.addOriginalKeywords(affectedCard, affectedCard.getIntrinsicKeyword());
|
||||||
|
affectedCard.clearAllKeywords();
|
||||||
|
}
|
||||||
|
else {
|
||||||
if(keyword.length > 2) {
|
if(keyword.length > 2) {
|
||||||
String keywords[] = keyword[2].split(" & ");
|
String keywords[] = keyword[2].split(" & ");
|
||||||
for(int j = 0; j < keywords.length; j++) {
|
for(int j = 0; j < keywords.length; j++) {
|
||||||
@@ -7531,6 +7542,16 @@ public class GameActionUtil {
|
|||||||
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,6 +7583,10 @@ public class GameActionUtil {
|
|||||||
for(String type : se.getOriginalTypes(affectedCard)) affectedCard.addType(type);
|
for(String type : se.getOriginalTypes(affectedCard)) affectedCard.addType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(se.isOverwriteKeywords()) {
|
||||||
|
for(String kw : se.getOriginalKeywords(affectedCard)) affectedCard.addIntrinsicKeyword(kw);
|
||||||
|
}
|
||||||
|
else {
|
||||||
String[] kw = details[2].split("/", 3);
|
String[] kw = details[2].split("/", 3);
|
||||||
if (kw.length > 2) {
|
if (kw.length > 2) {
|
||||||
String kws[] = kw[2].split(" & ");
|
String kws[] = kw[2].split(" & ");
|
||||||
@@ -7582,6 +7607,15 @@ 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,6 +4,7 @@ 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();
|
||||||
@@ -16,15 +17,119 @@ public class StaticEffect {
|
|||||||
private HashMap<Card, String> originalPT = new HashMap<Card, String>();
|
private HashMap<Card, String> originalPT = new HashMap<Card, String>();
|
||||||
|
|
||||||
//for types
|
//for types
|
||||||
|
private boolean overwriteTypes = false;
|
||||||
private HashMap<Card, ArrayList<String>> types = new HashMap<Card, ArrayList<String>>();
|
private HashMap<Card, ArrayList<String>> types = new HashMap<Card, ArrayList<String>>();
|
||||||
private HashMap<Card, ArrayList<String>> originalTypes = new HashMap<Card, ArrayList<String>>();
|
private HashMap<Card, ArrayList<String>> originalTypes = new HashMap<Card, ArrayList<String>>();
|
||||||
private boolean overwriteTypes = false;
|
|
||||||
|
|
||||||
|
//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) {
|
||||||
String pt = power+"/"+toughness;
|
String pt = power+"/"+toughness;
|
||||||
|
|||||||
Reference in New Issue
Block a user