mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Merge branch 'removeIntrinsic' into 'master'
Card: remove removeIntrinsic from Trait and Keyword Changes, check ChangedType instead See merge request core-developers/forge!5420
This commit is contained in:
@@ -1689,7 +1689,7 @@ public class ComputerUtilCard {
|
||||
pumped.addPTBoost(power + berserkPower, toughness, timestamp, 0);
|
||||
|
||||
if (!kws.isEmpty()) {
|
||||
pumped.addChangedCardKeywords(kws, null, false, false, timestamp, 0);
|
||||
pumped.addChangedCardKeywords(kws, null, false, timestamp, 0);
|
||||
}
|
||||
if (!hiddenKws.isEmpty()) {
|
||||
pumped.addHiddenExtrinsicKeywords(timestamp, 0, hiddenKws);
|
||||
@@ -1713,7 +1713,7 @@ public class ComputerUtilCard {
|
||||
}
|
||||
}
|
||||
final long timestamp2 = c.getGame().getNextTimestamp(); //is this necessary or can the timestamp be re-used?
|
||||
pumped.addChangedCardKeywordsInternal(toCopy, null, false, false, timestamp2, 0, true);
|
||||
pumped.addChangedCardKeywordsInternal(toCopy, null, false, timestamp2, 0, true);
|
||||
applyStaticContPT(ai.getGame(), pumped, new CardCollection(c));
|
||||
return pumped;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public abstract class AnimateEffectBase extends SpellAbilityEffect {
|
||||
removeLandTypes, removeCreatureTypes, removeArtifactTypes, removeEnchantmentTypes, timestamp, true, false);
|
||||
}
|
||||
|
||||
c.addChangedCardKeywords(keywords, removeKeywords, removeAll, removeLandTypes, timestamp, 0);
|
||||
c.addChangedCardKeywords(keywords, removeKeywords, removeAll, timestamp, 0);
|
||||
|
||||
if (sa.hasParam("CantHaveKeyword")) {
|
||||
c.addCantHaveKeyword(timestamp, Keyword.setValueOf(sa.getParam("CantHaveKeyword")));
|
||||
@@ -188,7 +188,7 @@ public abstract class AnimateEffectBase extends SpellAbilityEffect {
|
||||
|| !addedAbilities.isEmpty() || !removedAbilities.isEmpty() || !addedTriggers.isEmpty()
|
||||
|| !addedReplacements.isEmpty() || !addedStaticAbilities.isEmpty()) {
|
||||
c.addChangedCardTraits(addedAbilities, removedAbilities, addedTriggers, addedReplacements,
|
||||
addedStaticAbilities, removeAll, false, removeLandTypes, timestamp, 0);
|
||||
addedStaticAbilities, removeAll, false, timestamp, 0);
|
||||
}
|
||||
|
||||
if (!"Permanent".equals(sa.getParam("Duration"))) {
|
||||
|
||||
@@ -650,7 +650,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
movedCard = game.getAction().moveTo(gameCard.getController().getZone(destination), gameCard, sa, moveParams);
|
||||
if (sa.hasParam("Unearth")) {
|
||||
movedCard.setUnearthed(true);
|
||||
movedCard.addChangedCardKeywords(Lists.newArrayList("Haste"), null, false, false,
|
||||
movedCard.addChangedCardKeywords(Lists.newArrayList("Haste"), null, false,
|
||||
game.getNextTimestamp(), 0, true);
|
||||
registerDelayedTrigger(sa, "Exile", Lists.newArrayList(movedCard));
|
||||
addLeaveBattlefieldReplacement(movedCard, sa, "Exile");
|
||||
|
||||
@@ -137,7 +137,7 @@ public class CloneEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (!pumpKeywords.isEmpty()) {
|
||||
tgtCard.addChangedCardKeywords(pumpKeywords, Lists.newArrayList(), false, false, ts, 0);
|
||||
tgtCard.addChangedCardKeywords(pumpKeywords, Lists.newArrayList(), false, ts, 0);
|
||||
}
|
||||
|
||||
tgtCard.updateStateForView();
|
||||
|
||||
@@ -168,7 +168,7 @@ public class ControlGainEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (!kws.isEmpty()) {
|
||||
tgtC.addChangedCardKeywords(kws, Lists.newArrayList(), false, false, tStamp, 0);
|
||||
tgtC.addChangedCardKeywords(kws, Lists.newArrayList(), false, tStamp, 0);
|
||||
game.fireEvent(new GameEventCardStatsChanged(tgtC));
|
||||
}
|
||||
if (hiddenKws.isEmpty()) {
|
||||
|
||||
@@ -137,7 +137,7 @@ public class DebuffEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
removedKW.addAll(kws);
|
||||
tgtC.addChangedCardKeywords(addedKW, removedKW, false, false, timestamp, 0);
|
||||
tgtC.addChangedCardKeywords(addedKW, removedKW, false, timestamp, 0);
|
||||
}
|
||||
if (!"Permanent".equals(sa.getParam("Duration"))) {
|
||||
final GameCommand until = new GameCommand() {
|
||||
|
||||
@@ -92,7 +92,7 @@ public class ProtectAllEffect extends SpellAbilityEffect {
|
||||
|
||||
for (final Card tgtC : list) {
|
||||
if (tgtC.isInPlay()) {
|
||||
tgtC.addChangedCardKeywords(gainsKWList, null, false, false, timestamp, 0, true);
|
||||
tgtC.addChangedCardKeywords(gainsKWList, null, false, timestamp, 0, true);
|
||||
|
||||
if (!"Permanent".equals(sa.getParam("Duration"))) {
|
||||
// If not Permanent, remove protection at EOT
|
||||
|
||||
@@ -142,7 +142,7 @@ public class ProtectEffect extends SpellAbilityEffect {
|
||||
continue;
|
||||
}
|
||||
|
||||
tgtC.addChangedCardKeywords(gainsKWList, null, false, false, timestamp, 0, true);
|
||||
tgtC.addChangedCardKeywords(gainsKWList, null, false, timestamp, 0, true);
|
||||
|
||||
if (!"Permanent".equals(sa.getParam("Duration"))) {
|
||||
// If not Permanent, remove protection at EOT
|
||||
@@ -166,7 +166,7 @@ public class ProtectEffect extends SpellAbilityEffect {
|
||||
continue;
|
||||
}
|
||||
|
||||
unTgtC.addChangedCardKeywords(gainsKWList, null, false, false, timestamp, 0, true);
|
||||
unTgtC.addChangedCardKeywords(gainsKWList, null, false, timestamp, 0, true);
|
||||
|
||||
if (!"Permanent".equals(sa.getParam("Duration"))) {
|
||||
// If not Permanent, remove protection at EOT
|
||||
|
||||
@@ -58,7 +58,7 @@ public class PumpAllEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (!kws.isEmpty()) {
|
||||
tgtC.addChangedCardKeywords(kws, null, false, false, timestamp, 0);
|
||||
tgtC.addChangedCardKeywords(kws, null, false, timestamp, 0);
|
||||
}
|
||||
if (redrawPT) {
|
||||
tgtC.updatePowerToughnessForView();
|
||||
|
||||
@@ -67,7 +67,7 @@ public class PumpEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
if (!kws.isEmpty()) {
|
||||
gameCard.addChangedCardKeywords(kws, Lists.newArrayList(), false, false, timestamp, 0);
|
||||
gameCard.addChangedCardKeywords(kws, Lists.newArrayList(), false, timestamp, 0);
|
||||
}
|
||||
if (!hiddenKws.isEmpty()) {
|
||||
gameCard.addHiddenExtrinsicKeywords(timestamp, 0, hiddenKws);
|
||||
|
||||
@@ -167,7 +167,7 @@ public abstract class TokenEffectBase extends SpellAbilityEffect {
|
||||
moved.setCloneOrigin(host);
|
||||
}
|
||||
if (!pumpKeywords.isEmpty()) {
|
||||
moved.addChangedCardKeywords(pumpKeywords, Lists.newArrayList(), false, false, timestamp, 0);
|
||||
moved.addChangedCardKeywords(pumpKeywords, Lists.newArrayList(), false, timestamp, 0);
|
||||
addPumpUntil(sa, moved, timestamp);
|
||||
}
|
||||
|
||||
|
||||
@@ -1474,7 +1474,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
SpellAbility sa = AbilityFactory.getAbility(abStr, this);
|
||||
sa.setIntrinsic(false);
|
||||
|
||||
addChangedCardTraits(ImmutableList.of(sa), null, null, null, null, true, false, false, timestamp, 0);
|
||||
addChangedCardTraits(ImmutableList.of(sa), null, null, null, null, true, false, timestamp, 0);
|
||||
return true;
|
||||
}
|
||||
if (!counterType.isKeywordCounter()) {
|
||||
@@ -1484,7 +1484,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
|
||||
long timestamp = game.getNextTimestamp();
|
||||
counterTypeTimestamps.put(counterType, timestamp);
|
||||
addChangedCardKeywords(ImmutableList.of(counterType.toString()), null, false, false, timestamp, 0, updateView);
|
||||
addChangedCardKeywords(ImmutableList.of(counterType.toString()), null, false, timestamp, 0, updateView);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2814,8 +2814,8 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
}
|
||||
|
||||
public boolean hasRemoveIntrinsic() {
|
||||
for (final CardTraitChanges ck : changedCardTraits.values()) {
|
||||
if (ck.isRemoveIntrinsic()) {
|
||||
for (final CardChangedType ct : this.changedCardTypes.values()) {
|
||||
if (ct.isRemoveLandTypes()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -4128,9 +4128,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
|
||||
public final void addChangedCardTraits(Collection<SpellAbility> spells, Collection<SpellAbility> removedAbilities,
|
||||
Collection<Trigger> trigger, Collection<ReplacementEffect> replacements, Collection<StaticAbility> statics,
|
||||
boolean removeAll, boolean removeNonMana, boolean removeIntrinsic, long timestamp, long staticId) {
|
||||
boolean removeAll, boolean removeNonMana, long timestamp, long staticId) {
|
||||
changedCardTraits.put(timestamp, staticId, new CardTraitChanges(
|
||||
spells, removedAbilities, trigger, replacements, statics, removeAll, removeNonMana, removeIntrinsic
|
||||
spells, removedAbilities, trigger, replacements, statics, removeAll, removeNonMana
|
||||
));
|
||||
// update view
|
||||
updateAbilityTextForView();
|
||||
@@ -4209,12 +4209,12 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
}
|
||||
|
||||
public final void addChangedCardKeywords(final List<String> keywords, final List<String> removeKeywords,
|
||||
final boolean removeAllKeywords, final boolean removeIntrinsicKeywords, final long timestamp, final long staticId) {
|
||||
addChangedCardKeywords(keywords, removeKeywords, removeAllKeywords, removeIntrinsicKeywords, timestamp, staticId, true);
|
||||
final boolean removeAllKeywords, final long timestamp, final long staticId) {
|
||||
addChangedCardKeywords(keywords, removeKeywords, removeAllKeywords, timestamp, staticId, true);
|
||||
}
|
||||
public final void addChangedCardKeywords(final List<String> keywords, final List<String> removeKeywords,
|
||||
final boolean removeAllKeywords, final boolean removeIntrinsicKeywords, final long timestamp, final long staticId, final boolean updateView) {
|
||||
final KeywordsChange newCks = new KeywordsChange(keywords, removeKeywords, removeAllKeywords, removeIntrinsicKeywords);
|
||||
final boolean removeAllKeywords, final long timestamp, final long staticId, final boolean updateView) {
|
||||
final KeywordsChange newCks = new KeywordsChange(keywords, removeKeywords, removeAllKeywords);
|
||||
newCks.addKeywordsToCard(this);
|
||||
changedCardKeywords.put(timestamp, staticId, newCks);
|
||||
|
||||
@@ -4227,10 +4227,10 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
|
||||
public final void addChangedCardKeywordsInternal(
|
||||
final List<KeywordInterface> keywords, final List<KeywordInterface> removeKeywords,
|
||||
final boolean removeAllKeywords, final boolean removeIntrinsicKeywords,
|
||||
final boolean removeAllKeywords,
|
||||
final long timestamp, final long staticId, final boolean updateView) {
|
||||
|
||||
final KeywordsChange newCks = new KeywordsChange(keywords, removeKeywords, removeAllKeywords, removeIntrinsicKeywords);
|
||||
final KeywordsChange newCks = new KeywordsChange(keywords, removeKeywords, removeAllKeywords);
|
||||
newCks.addKeywordsToCard(this);
|
||||
changedCardKeywords.put(timestamp, staticId, newCks);
|
||||
|
||||
@@ -4275,15 +4275,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
KeywordCollection keywords = new KeywordCollection();
|
||||
|
||||
//final List<KeywordInterface> keywords = Lists.newArrayList();
|
||||
boolean removeIntrinsic = false;
|
||||
for (final KeywordsChange ck : changedCardKeywords.values()) {
|
||||
if (ck.isRemoveIntrinsicKeywords()) {
|
||||
removeIntrinsic = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!removeIntrinsic) {
|
||||
if (!this.hasRemoveIntrinsic()) {
|
||||
keywords.insertAll(state.getIntrinsicKeywords());
|
||||
}
|
||||
|
||||
@@ -4383,7 +4375,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
}
|
||||
}
|
||||
if (!addKeywords.isEmpty() || !removeKeywords.isEmpty()) {
|
||||
addChangedCardKeywordsInternal(addKeywords, removeKeywords, false, false, timestamp, staticId, true);
|
||||
addChangedCardKeywordsInternal(addKeywords, removeKeywords, false, timestamp, staticId, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5557,7 +5549,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
new CardType(Collections.singletonList("Creature"), true),
|
||||
false, false, false, false, false, false, true, bestowTimestamp, updateView, false);
|
||||
addChangedCardKeywords(Collections.singletonList("Enchant creature"), Lists.newArrayList(),
|
||||
false, false, bestowTimestamp, 0, updateView);
|
||||
false, bestowTimestamp, 0, updateView);
|
||||
}
|
||||
|
||||
public final void unanimateBestow() {
|
||||
|
||||
@@ -21,11 +21,10 @@ public class CardTraitChanges implements Cloneable {
|
||||
|
||||
private boolean removeAll = false;
|
||||
private boolean removeNonMana = false;
|
||||
private boolean removeIntrinsic = false;
|
||||
|
||||
public CardTraitChanges(Collection<SpellAbility> spells, Collection<SpellAbility> removedAbilities,
|
||||
Collection<Trigger> trigger, Collection<ReplacementEffect> res, Collection<StaticAbility> st,
|
||||
boolean removeAll, boolean removeNonMana, boolean removeIntrinsic) {
|
||||
boolean removeAll, boolean removeNonMana) {
|
||||
if (spells != null) {
|
||||
this.abilities.addAll(spells);
|
||||
}
|
||||
@@ -44,7 +43,6 @@ public class CardTraitChanges implements Cloneable {
|
||||
|
||||
this.removeAll |= removeAll;
|
||||
this.removeNonMana |= removeNonMana;
|
||||
this.removeIntrinsic |= removeIntrinsic;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,11 +86,7 @@ public class CardTraitChanges implements Cloneable {
|
||||
public boolean isRemoveNonMana() {
|
||||
return removeNonMana;
|
||||
}
|
||||
|
||||
public boolean isRemoveIntrinsic() {
|
||||
return removeIntrinsic;
|
||||
}
|
||||
|
||||
|
||||
public CardTraitChanges copy(Card host, boolean lki) {
|
||||
try {
|
||||
CardTraitChanges result = (CardTraitChanges) super.clone();
|
||||
|
||||
@@ -41,7 +41,6 @@ public class KeywordsChange implements Cloneable {
|
||||
private List<KeywordInterface> removeKeywordInterfaces = Lists.newArrayList();
|
||||
private List<String> removeKeywords = Lists.newArrayList();
|
||||
private boolean removeAllKeywords;
|
||||
private boolean removeIntrinsicKeywords;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -54,8 +53,7 @@ public class KeywordsChange implements Cloneable {
|
||||
public KeywordsChange(
|
||||
final Iterable<String> keywordList,
|
||||
final Collection<String> removeKeywordList,
|
||||
final boolean removeAll,
|
||||
final boolean removeIntrinsic) {
|
||||
final boolean removeAll) {
|
||||
if (keywordList != null) {
|
||||
this.keywords.addAll(keywordList);
|
||||
}
|
||||
@@ -65,14 +63,12 @@ public class KeywordsChange implements Cloneable {
|
||||
}
|
||||
|
||||
this.removeAllKeywords = removeAll;
|
||||
this.removeIntrinsicKeywords = removeIntrinsic;
|
||||
}
|
||||
|
||||
public KeywordsChange(
|
||||
final Collection<KeywordInterface> keywordList,
|
||||
final Collection<KeywordInterface> removeKeywordInterfaces,
|
||||
final boolean removeAll,
|
||||
final boolean removeIntrinsic) {
|
||||
final boolean removeAll) {
|
||||
if (keywordList != null) {
|
||||
this.keywords.insertAll(keywordList);
|
||||
}
|
||||
@@ -82,7 +78,6 @@ public class KeywordsChange implements Cloneable {
|
||||
}
|
||||
|
||||
this.removeAllKeywords = removeAll;
|
||||
this.removeIntrinsicKeywords = removeIntrinsic;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,10 +113,6 @@ public class KeywordsChange implements Cloneable {
|
||||
return this.removeAllKeywords;
|
||||
}
|
||||
|
||||
public final boolean isRemoveIntrinsicKeywords() {
|
||||
return this.removeIntrinsicKeywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether this KeywordsChange doesn't have any effect.
|
||||
*/
|
||||
|
||||
@@ -1005,11 +1005,11 @@ public class Player extends GameEntity implements Comparable<Player> {
|
||||
// ================ POISON Merged =================================
|
||||
public final void addChangedKeywords(final List<String> addKeywords, final List<String> removeKeywords, final Long timestamp, final long staticId) {
|
||||
// if the key already exists - merge entries
|
||||
KeywordsChange cks = new KeywordsChange(addKeywords, removeKeywords, false, false);
|
||||
KeywordsChange cks = new KeywordsChange(addKeywords, removeKeywords, false);
|
||||
cks.addKeywordsToPlayer(this);
|
||||
if (!cks.getAbilities().isEmpty() || !cks.getTriggers().isEmpty() || !cks.getReplacements().isEmpty() || !cks.getStaticAbilities().isEmpty()) {
|
||||
getKeywordCard().addChangedCardTraits(
|
||||
cks.getAbilities(), null, cks.getTriggers(), cks.getReplacements(), cks.getStaticAbilities(), false, false, false, timestamp, staticId);
|
||||
cks.getAbilities(), null, cks.getTriggers(), cks.getReplacements(), cks.getStaticAbilities(), false, false, timestamp, staticId);
|
||||
}
|
||||
changedKeywords.put(timestamp, staticId, cks);
|
||||
updateKeywords();
|
||||
|
||||
@@ -616,7 +616,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
&& host.getType().hasStringType(mana.getManaAbility().getAddsKeywordsType())) {
|
||||
final long timestamp = host.getGame().getNextTimestamp();
|
||||
final List<String> kws = Arrays.asList(mana.getAddedKeywords().split(" & "));
|
||||
host.addChangedCardKeywords(kws, null, false, false, timestamp, 0);
|
||||
host.addChangedCardKeywords(kws, null, false, timestamp, 0);
|
||||
if (mana.addsKeywordsUntil()) {
|
||||
final GameCommand untilEOT = new GameCommand() {
|
||||
private static final long serialVersionUID = -8285169579025607693L;
|
||||
|
||||
@@ -659,7 +659,7 @@ public final class StaticAbilityContinuous {
|
||||
// add keywords
|
||||
// TODO regular keywords currently don't try to use keyword multiplier
|
||||
// (Although nothing uses it at this time)
|
||||
if ((addKeywords != null) || (removeKeywords != null) || removeAllAbilities || removeLandTypes) {
|
||||
if ((addKeywords != null) || (removeKeywords != null) || removeAllAbilities) {
|
||||
List<String> newKeywords = null;
|
||||
if (addKeywords != null) {
|
||||
newKeywords = Lists.newArrayList(addKeywords);
|
||||
@@ -702,8 +702,7 @@ public final class StaticAbilityContinuous {
|
||||
}
|
||||
|
||||
affectedCard.addChangedCardKeywords(newKeywords, removeKeywords,
|
||||
removeAllAbilities, removeLandTypes,
|
||||
hostCard.getTimestamp(), stAb.getId());
|
||||
removeAllAbilities, hostCard.getTimestamp(), stAb.getId());
|
||||
}
|
||||
|
||||
// add HIDDEN keywords
|
||||
@@ -835,7 +834,7 @@ public final class StaticAbilityContinuous {
|
||||
if (!addedAbilities.isEmpty() || addReplacements != null || addTriggers != null || addStatics != null
|
||||
|| removeAllAbilities) {
|
||||
affectedCard.addChangedCardTraits(
|
||||
addedAbilities, null, addedTrigger, addedReplacementEffects, addedStaticAbility, removeAllAbilities, removeNonMana, false,
|
||||
addedAbilities, null, addedTrigger, addedReplacementEffects, addedStaticAbility, removeAllAbilities, removeNonMana,
|
||||
hostCard.getTimestamp(), stAb.getId()
|
||||
);
|
||||
}
|
||||
@@ -845,10 +844,6 @@ public final class StaticAbilityContinuous {
|
||||
}
|
||||
}
|
||||
|
||||
if (layer == StaticAbilityLayer.TYPE && removeLandTypes) {
|
||||
affectedCard.addChangedCardTraits(null, null, null, null, null, false, false, true, hostCard.getTimestamp(), stAb.getId());
|
||||
}
|
||||
|
||||
// add Types
|
||||
if ((addTypes != null) || (removeTypes != null)) {
|
||||
affectedCard.addChangedCardTypes(addTypes, removeTypes, removeSuperTypes, removeCardTypes,
|
||||
@@ -935,7 +930,7 @@ public final class StaticAbilityContinuous {
|
||||
addIgnore.setIntrinsic(false);
|
||||
addIgnore.setApi(ApiType.InternalIgnoreEffect);
|
||||
addIgnore.setDescription(cost + " Ignore the effect until end of turn.");
|
||||
sourceCard.addChangedCardTraits(ImmutableList.of(addIgnore), null, null, null, null, false, false, false, sourceCard.getTimestamp(), stAb.getId());
|
||||
sourceCard.addChangedCardTraits(ImmutableList.of(addIgnore), null, null, null, null, false, false, sourceCard.getTimestamp(), stAb.getId());
|
||||
|
||||
final GameCommand removeIgnore = new GameCommand() {
|
||||
private static final long serialVersionUID = -5415775215053216360L;
|
||||
|
||||
Reference in New Issue
Block a user