Similar to CardType changes in #9375
Especially the stuff with updateBasicLandAbilities should be moved into CardState.
|
for (int i = 0; i < MagicColor.WUBRG.length; i++ ) { |
|
byte c = MagicColor.WUBRG[i]; |
|
if (type.hasSubtype(MagicColor.Constant.BASIC_LANDS.get(i))) { |
|
SpellAbility sa = basicLandAbilities[i]; |
|
|
|
// no Ability for this type yet, make a new one |
|
if (sa == null) { |
|
sa = CardFactory.buildBasicLandAbility(state, c); |
|
basicLandAbilities[i] = sa; |
|
} |
|
|
|
list.add(sa); |
|
} |
|
} |
|
} |
And the two places that check for hasRemoveIntrinsic, should be handled by a different kind of extra class (second implementation of the new Interface)
|
public Iterable<CardTraitChanges> getChangedCardTraitsList(CardState state) { |
|
List<SpellAbility> landManaAbilities = Lists.newArrayList(); |
|
this.updateBasicLandAbilities(landManaAbilities, state); |
|
|
|
return Iterables.concat( |
|
changedCardTraitsByText.values(), // Layer 3 |
|
ImmutableList.of(new CardTraitChanges(landManaAbilities, null, null, null, null, hasRemoveIntrinsic(), false)), // Layer 4 |
|
changedCardTraits.values() // Layer 6 |
|
); |
|
} |
I don't know yet if i want to move the implementation of the changes into the new classes/records like i did with the CardType changes:
|
for (final CardTraitChanges ck : getChangedCardTraitsList(state)) { |
|
if (ck.isRemoveNonMana()) { |
|
// List only has nonMana |
|
if (null == mana) { |
|
list.removeIf(Predicate.not(SpellAbility::isManaAbility)); |
|
} else if (false == mana) { |
|
list.clear(); |
|
} |
|
} else if (ck.isRemoveAll()) { |
|
list.clear(); |
|
} |
|
list.removeAll(ck.getRemovedAbilities()); |
|
for (SpellAbility sa : ck.getAbilities()) { |
|
if (mana == null || mana == sa.isManaAbility()) { |
|
list.add(sa); |
|
} |
|
} |
|
} |
|
for (final CardTraitChanges ck : getChangedCardTraitsList(state)) { |
|
if (ck.isRemoveAll()) { |
|
list.clear(); |
|
} |
|
list.addAll(ck.getStaticAbilities()); |
|
} |
|
for (final CardTraitChanges ck : getChangedCardTraitsList(state)) { |
|
if (ck.isRemoveAll()) { |
|
list.clear(); |
|
} |
|
list.addAll(ck.getTriggers()); |
|
} |
|
for (final CardTraitChanges ck : getChangedCardTraitsList(state)) { |
|
if (ck.isRemoveAll()) { |
|
list.clear(); |
|
} |
|
list.addAll(ck.getReplacements()); |
|
} |
If possible, i want KeywordChanges/KeywordCollection to inherit the CardTraitChanges Interface, because Keywords have Card Traits inside.
Similar to CardType changes in #9375
Especially the stuff with
updateBasicLandAbilitiesshould be moved into CardState.forge/forge-game/src/main/java/forge/game/card/Card.java
Lines 3522 to 3536 in 2c0c656
And the two places that check for
hasRemoveIntrinsic, should be handled by a different kind of extra class (second implementation of the new Interface)forge/forge-game/src/main/java/forge/game/card/Card.java
Lines 5023 to 5032 in 2c0c656
I don't know yet if i want to move the implementation of the changes into the new classes/records like i did with the CardType changes:
forge/forge-game/src/main/java/forge/game/card/Card.java
Lines 3466 to 3483 in 2c0c656
forge/forge-game/src/main/java/forge/game/card/Card.java
Lines 7150 to 7155 in 2c0c656
forge/forge-game/src/main/java/forge/game/card/Card.java
Lines 7193 to 7198 in 2c0c656
forge/forge-game/src/main/java/forge/game/card/Card.java
Lines 7216 to 7221 in 2c0c656
If possible, i want KeywordChanges/KeywordCollection to inherit the CardTraitChanges Interface, because Keywords have Card Traits inside.