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