Improved commander support for mdf/split/adventure cards (additional fixes for ac98a3a31a)

This commit is contained in:
Oleg Agafonov 2021-02-06 17:07:10 +04:00
parent 9416c6140a
commit 9b8df48183
12 changed files with 148 additions and 60 deletions

View file

@ -127,7 +127,8 @@ public abstract class SplitCard extends CardImpl {
public Abilities<Ability> getAbilities() {
Abilities<Ability> allAbilites = new AbilitiesImpl<>();
for (Ability ability : super.getAbilities()) {
// ignore split abilities TODO: why it here, for GUI's cleanup in card texts? Maybe it can be removed
// ignore split abilities
// TODO: why it here, for GUI's cleanup in card texts? Maybe it can be removed, see mdf cards
if (ability instanceof SpellAbility
&& (((SpellAbility) ability).getSpellAbilityType() == SpellAbilityType.SPLIT
|| ((SpellAbility) ability).getSpellAbilityType() == SpellAbilityType.SPLIT_AFTERMATH)) {
@ -140,6 +141,12 @@ public abstract class SplitCard extends CardImpl {
return allAbilites;
}
@Override
public Abilities<Ability> getInitAbilities() {
// must init only full split card aiblities like fuse, parts must be init separately
return super.getAbilities();
}
/**
* Currently only gets the fuse SpellAbility if there is one, but generally
* gets any abilities on a split card as a whole, and not on either half
@ -155,7 +162,8 @@ public abstract class SplitCard extends CardImpl {
public Abilities<Ability> getAbilities(Game game) {
Abilities<Ability> allAbilites = new AbilitiesImpl<>();
for (Ability ability : super.getAbilities(game)) {
// ignore split abilities TODO: why it here, for GUI's cleanup in card texts? Maybe it can be removed
// ignore split abilities
// TODO: why it here, for GUI's cleanup in card texts? Maybe it can be removed, see mdf cards
if (ability instanceof SpellAbility
&& (((SpellAbility) ability).getSpellAbilityType() == SpellAbilityType.SPLIT
|| ((SpellAbility) ability).getSpellAbilityType() == SpellAbilityType.SPLIT_AFTERMATH)) {