forked from External/mage
[TDM] Implement omen mechanic (#13501)
* Abstract AdventureCard to SingleFaceSplitCard * Fix AdventureCardSpellImpl * Finish converting adventure card and adventure spell * Update Brightcap Badger change finalize call to adventure card * Update Darksteel Monolith being cast from hand condition referencing AdventureCardSpell * Update Tlincalli Hunter exiled creature condition referencing AdventureCardSpell * Update Twice Upon a Time finalizeAdventure called from Adventure card * Finish abstracting Adventure missed some more references to adventure cards * Implement Omen cards * Implement Dirgur Island Dragon * Missed some adventureSpellName references * OmenCardSpell had wrong comma symbol * Add tests for Omen Cards * Rename two part card components change from SingleFaceSplitCard to CardWithSpellOption * Update comments and variable name
This commit is contained in:
parent
e3937e31c1
commit
0df5f17603
36 changed files with 637 additions and 264 deletions
|
|
@ -1,98 +1,29 @@
|
|||
package mage.cards;
|
||||
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SpellAbilityType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author phulin
|
||||
*/
|
||||
public abstract class AdventureCard extends CardImpl {
|
||||
|
||||
/* The adventure spell card, i.e. Swift End. */
|
||||
protected AdventureCardSpell spellCard;
|
||||
public abstract class AdventureCard extends CardWithSpellOption {
|
||||
|
||||
public AdventureCard(UUID ownerId, CardSetInfo setInfo, CardType[] types, CardType[] typesSpell, String costs, String adventureName, String costsSpell) {
|
||||
super(ownerId, setInfo, types, costs);
|
||||
this.spellCard = new AdventureCardSpellImpl(ownerId, setInfo, adventureName, typesSpell, costsSpell, this);
|
||||
this.spellCard = new AdventureSpellCard(ownerId, setInfo, adventureName, typesSpell, costsSpell, this);
|
||||
}
|
||||
|
||||
public AdventureCard(AdventureCard card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
public void finalizeAdventure() {
|
||||
spellCard.finalizeAdventure();
|
||||
}
|
||||
|
||||
protected AdventureCard(final AdventureCard card) {
|
||||
super(card);
|
||||
this.spellCard = card.getSpellCard().copy();
|
||||
this.spellCard.setParentCard(this);
|
||||
}
|
||||
|
||||
public AdventureCardSpell getSpellCard() {
|
||||
return spellCard;
|
||||
}
|
||||
|
||||
public void setParts(AdventureCardSpell cardSpell) {
|
||||
// for card copy only - set new parts
|
||||
this.spellCard = cardSpell;
|
||||
cardSpell.setParentCard(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assignNewId() {
|
||||
super.assignNewId();
|
||||
spellCard.assignNewId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveToZone(Zone toZone, Ability source, Game game, boolean flag, List<UUID> appliedEffects) {
|
||||
if (super.moveToZone(toZone, source, game, flag, appliedEffects)) {
|
||||
Zone currentZone = game.getState().getZone(getId());
|
||||
game.getState().setZone(getSpellCard().getId(), currentZone);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setZone(Zone zone, Game game) {
|
||||
super.setZone(zone, game);
|
||||
game.setZone(getSpellCard().getId(), zone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveToExile(UUID exileId, String name, Ability source, Game game, List<UUID> appliedEffects) {
|
||||
if (super.moveToExile(exileId, name, source, game, appliedEffects)) {
|
||||
Zone currentZone = game.getState().getZone(getId());
|
||||
game.getState().setZone(getSpellCard().getId(), currentZone);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeFromZone(Game game, Zone fromZone, Ability source) {
|
||||
// zone contains only one main card
|
||||
return super.removeFromZone(game, fromZone, source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateZoneChangeCounter(Game game, ZoneChangeEvent event) {
|
||||
if (isCopy()) { // same as meld cards
|
||||
super.updateZoneChangeCounter(game, event);
|
||||
return;
|
||||
}
|
||||
super.updateZoneChangeCounter(game, event);
|
||||
getSpellCard().updateZoneChangeCounter(game, event);
|
||||
spellCard.finalizeSpell();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -103,45 +34,4 @@ public abstract class AdventureCard extends CardImpl {
|
|||
this.getSpellCard().getSpellAbility().setControllerId(controllerId);
|
||||
return super.cast(game, fromZone, ability, controllerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Abilities<Ability> getAbilities() {
|
||||
Abilities<Ability> allAbilities = new AbilitiesImpl<>();
|
||||
allAbilities.addAll(spellCard.getAbilities());
|
||||
allAbilities.addAll(super.getAbilities());
|
||||
return allAbilities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Abilities<Ability> getInitAbilities() {
|
||||
// must init only parent related abilities, spell card must be init separately
|
||||
return super.getAbilities();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Abilities<Ability> getAbilities(Game game) {
|
||||
Abilities<Ability> allAbilities = new AbilitiesImpl<>();
|
||||
allAbilities.addAll(spellCard.getAbilities(game));
|
||||
allAbilities.addAll(super.getAbilities(game));
|
||||
return allAbilities;
|
||||
}
|
||||
|
||||
public Abilities<Ability> getSharedAbilities(Game game) {
|
||||
// abilities without spellcard
|
||||
return super.getAbilities(game);
|
||||
}
|
||||
|
||||
public List<String> getSharedRules(Game game) {
|
||||
// rules without spellcard
|
||||
Abilities<Ability> sourceAbilities = this.getSharedAbilities(game);
|
||||
return CardUtil.getCardRulesWithAdditionalInfo(game, this, sourceAbilities, sourceAbilities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwnerId(UUID ownerId) {
|
||||
super.setOwnerId(ownerId);
|
||||
abilities.setControllerId(ownerId);
|
||||
spellCard.getAbilities().setControllerId(ownerId);
|
||||
spellCard.setOwnerId(ownerId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue