mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- PumpAllEffect and DebuffEffect will now add/remove keywords with timestamp.
This commit is contained in:
@@ -4211,13 +4211,13 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
* @param timestamp
|
||||
* the timestamp
|
||||
*/
|
||||
public final void addChangedCardKeywords(final ArrayList<String> keywords, final ArrayList<String> removeKeywords,
|
||||
public final void addChangedCardKeywords(final List<String> keywords, final List<String> removeKeywords,
|
||||
final boolean removeAllKeywords, final long timestamp) {
|
||||
|
||||
// if the key already exists - merge entries
|
||||
if (changedCardKeywords.containsKey(timestamp)) {
|
||||
ArrayList<String> kws = keywords;
|
||||
ArrayList<String> rkws = removeKeywords;
|
||||
List<String> kws = keywords;
|
||||
List<String> rkws = removeKeywords;
|
||||
boolean remAll = removeAllKeywords;
|
||||
CardKeywords cks = changedCardKeywords.get(timestamp);
|
||||
kws.addAll(cks.getKeywords());
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package forge;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@@ -29,8 +30,8 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class CardKeywords {
|
||||
// takes care of individual card types
|
||||
private ArrayList<String> keywords = new ArrayList<String>();
|
||||
private ArrayList<String> removeKeywords = new ArrayList<String>();
|
||||
private List<String> keywords = new ArrayList<String>();
|
||||
private List<String> removeKeywords = new ArrayList<String>();
|
||||
private boolean removeAllKeywords = false;
|
||||
|
||||
/**
|
||||
@@ -46,7 +47,7 @@ public class CardKeywords {
|
||||
* @param stamp
|
||||
* a long
|
||||
*/
|
||||
CardKeywords(final ArrayList<String> keywordList, final ArrayList<String> removeKeywordList, final boolean removeAll) {
|
||||
CardKeywords(final List<String> keywordList, final List<String> removeKeywordList, final boolean removeAll) {
|
||||
this.keywords = keywordList;
|
||||
this.removeKeywords = removeKeywordList;
|
||||
this.removeAllKeywords = removeAll;
|
||||
@@ -58,7 +59,7 @@ public class CardKeywords {
|
||||
*
|
||||
* @return ArrayList<String>
|
||||
*/
|
||||
public final ArrayList<String> getKeywords() {
|
||||
public final List<String> getKeywords() {
|
||||
return this.keywords;
|
||||
}
|
||||
|
||||
@@ -68,7 +69,7 @@ public class CardKeywords {
|
||||
*
|
||||
* @return ArrayList<String>
|
||||
*/
|
||||
public final ArrayList<String> getRemoveKeywords() {
|
||||
public final List<String> getRemoveKeywords() {
|
||||
return this.removeKeywords;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ public class DebuffEffect extends SpellAbilityEffect {
|
||||
public void resolve(SpellAbility sa) {
|
||||
final List<String> kws = sa.hasParam("Keywords") ? Arrays.asList(sa.getParam("Keywords").split(" & ")) : new ArrayList<String>();
|
||||
final GameState game = sa.getActivatingPlayer().getGame();
|
||||
final long timestamp = game.getNextTimestamp();
|
||||
|
||||
for (final Card tgtC : getTargetCards(sa)) {
|
||||
final ArrayList<String> hadIntrinsic = new ArrayList<String>();
|
||||
@@ -67,6 +68,7 @@ public class DebuffEffect extends SpellAbilityEffect {
|
||||
}
|
||||
tgtC.removeIntrinsicKeyword(kw);
|
||||
tgtC.removeAllExtrinsicKeyword(kw);
|
||||
tgtC.addChangedCardKeywords(new ArrayList<String>(), kws, false, timestamp);
|
||||
}
|
||||
}
|
||||
if (!sa.hasParam("Permanent")) {
|
||||
@@ -75,6 +77,7 @@ public class DebuffEffect extends SpellAbilityEffect {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
tgtC.removeChangedCardKeywords(timestamp);
|
||||
if (tgtC.isInPlay()) {
|
||||
for (final String kw : hadIntrinsic) {
|
||||
tgtC.addIntrinsicKeyword(kw);
|
||||
|
||||
@@ -19,6 +19,22 @@ public class PumpAllEffect extends SpellAbilityEffect {
|
||||
final int d, final List<String> keywords, final ArrayList<ZoneType> affectedZones) {
|
||||
|
||||
final GameState game = sa.getActivatingPlayer().getGame();
|
||||
final long timestamp = game.getNextTimestamp();
|
||||
final ArrayList<String> kws = new ArrayList<String>();
|
||||
final ArrayList<String> hiddenkws = new ArrayList<String>();
|
||||
boolean suspend = false;
|
||||
|
||||
for (String kw : keywords) {
|
||||
if (kw.startsWith("HIDDEN")) {
|
||||
hiddenkws.add(kw);
|
||||
} else {
|
||||
kws.add(kw);
|
||||
if (kw.equals("Suspend")) {
|
||||
suspend = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (final Card tgtC : list) {
|
||||
|
||||
// only pump things in the affected zones.
|
||||
@@ -35,12 +51,13 @@ public class PumpAllEffect extends SpellAbilityEffect {
|
||||
|
||||
tgtC.addTempAttackBoost(a);
|
||||
tgtC.addTempDefenseBoost(d);
|
||||
tgtC.addChangedCardKeywords(kws, new ArrayList<String>(), false, timestamp);
|
||||
|
||||
for (int i = 0; i < keywords.size(); i++) {
|
||||
tgtC.addExtrinsicKeyword(keywords.get(i));
|
||||
if (keywords.get(i).equals("Suspend")) {
|
||||
tgtC.setSuspend(true);
|
||||
for (String kw : hiddenkws) {
|
||||
tgtC.addHiddenExtrinsicKeyword(kw);
|
||||
}
|
||||
if (suspend) {
|
||||
tgtC.setSuspend(true);
|
||||
}
|
||||
|
||||
if (sa.hasParam("RememberAllPumped")) {
|
||||
@@ -56,11 +73,10 @@ public class PumpAllEffect extends SpellAbilityEffect {
|
||||
public void run() {
|
||||
tgtC.addTempAttackBoost(-1 * a);
|
||||
tgtC.addTempDefenseBoost(-1 * d);
|
||||
tgtC.removeChangedCardKeywords(timestamp);
|
||||
|
||||
if (keywords.size() > 0) {
|
||||
for (int i = 0; i < keywords.size(); i++) {
|
||||
tgtC.removeExtrinsicKeyword(keywords.get(i));
|
||||
}
|
||||
for (String kw : hiddenkws) {
|
||||
tgtC.removeHiddenExtrinsicKeyword(kw);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ public class PumpEffect extends SpellAbilityEffect {
|
||||
|
||||
applyTo.addTempAttackBoost(a);
|
||||
applyTo.addTempDefenseBoost(d);
|
||||
applyTo.addChangedCardKeywords(kws, null, false, timestamp);
|
||||
applyTo.addChangedCardKeywords(kws, new ArrayList<String>(), false, timestamp);
|
||||
|
||||
if (!sa.hasParam("Permanent")) {
|
||||
// If not Permanent, remove Pumped at EOT
|
||||
|
||||
Reference in New Issue
Block a user