mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Conform AdventureCard to new getAbilities plan.
This commit is contained in:
parent
383069f5eb
commit
27bb6fa432
3 changed files with 15 additions and 10 deletions
|
@ -20,10 +20,7 @@ public abstract class AdventureCard extends CardImpl {
|
|||
|
||||
public AdventureCard(UUID ownerId, CardSetInfo setInfo, CardType[] types, CardType[] typesSpell, String costs, String adventureName, String costsSpell) {
|
||||
super(ownerId, setInfo, types, costs);
|
||||
spellCard = new AdventureCardSpellImpl(ownerId, setInfo, adventureName, typesSpell, costsSpell, this);
|
||||
Ability adventureAbility = spellCard.getSpellAbility();
|
||||
this.addAbility(adventureAbility);
|
||||
adventureAbility.setSourceId(spellCard.getId());
|
||||
this.spellCard = new AdventureCardSpellImpl(ownerId, setInfo, adventureName, typesSpell, costsSpell, this);
|
||||
}
|
||||
|
||||
public AdventureCard(AdventureCard card) {
|
||||
|
@ -78,11 +75,19 @@ public abstract class AdventureCard extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Abilities<Ability> getAbilities() {
|
||||
Abilities<Ability> allAbilities = new AbilitiesImpl<>();
|
||||
allAbilities.addAll(spellCard.getAbilities());
|
||||
allAbilities.addAll(super.getAbilities());
|
||||
return allAbilities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Abilities<Ability> getAbilities(Game game) {
|
||||
Abilities<Ability> allAbilities = new AbilitiesImpl<>();
|
||||
allAbilities.addAll(super.getAbilities(game));
|
||||
allAbilities.addAll(spellCard.getAbilities(game));
|
||||
allAbilities.addAll(super.getAbilities(game));
|
||||
return allAbilities;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ public interface Card extends MageObject {
|
|||
|
||||
/**
|
||||
*
|
||||
* @return The main card of a split half card, otherwise the card itself is
|
||||
* @return The main card of a split half card or adventure spell card, otherwise the card itself is
|
||||
* returned
|
||||
*/
|
||||
Card getMainCard();
|
||||
|
|
|
@ -3422,10 +3422,10 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
playableObjects.add(ability.getSourceId());
|
||||
|
||||
// main card must be marked playable in GUI
|
||||
MageObject object = game.getObject(ability.getSourceId());
|
||||
if (object instanceof SplitCardHalf) {
|
||||
UUID splitCardId = ((Card) object).getMainCard().getId();
|
||||
playableObjects.add(splitCardId);
|
||||
Card card = game.getCard(ability.getSourceId());
|
||||
if (card != null && card.getMainCard().getId() != card.getId()) {
|
||||
UUID mainCardId = card.getMainCard().getId();
|
||||
playableObjects.add(mainCardId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue