public CardImpl(final CardImpl card) { super(card); ownerId = card.ownerId; cardNumber = card.cardNumber; expansionSetCode = card.expansionSetCode; tokenDescriptor = card.tokenDescriptor; rarity = card.rarity; transformable = card.transformable; if (transformable) { secondSideCardClazz = card.secondSideCardClazz; nightCard = card.nightCard; } if (card.spellAbility != null) { spellAbility = card.getSpellAbility().copy(); } else { spellAbility = null; } flipCard = card.flipCard; flipCardName = card.flipCardName; splitCard = card.splitCard; usesVariousArt = card.usesVariousArt; this.attachments.addAll(card.attachments); }
public Spell copySpell(UUID newController) { Spell copy = new Spell(this.card, this.ability.copySpell(), this.controllerId, this.fromZone); boolean firstDone = false; for (SpellAbility spellAbility : this.getSpellAbilities()) { if (!firstDone) { firstDone = true; continue; } SpellAbility newAbility = spellAbility.copy(); // e.g. spliced spell newAbility.newId(); copy.addSpellAbility(newAbility); } copy.setCopy(true, this); copy.setControllerId(newController); return copy; }
@Override public boolean apply(Card input, Game game) { SpellAbility ability = input.getSpellAbility().copy(); ability.setControllerId(controllerId); input.adjustTargets(ability, game); return ability.canChooseTarget(game); }
public Spell(Card card, SpellAbility ability, UUID controllerId, Zone fromZone) { this.card = card; this.color = card.getColor(null).copy(); this.frameColor = card.getFrameColor(null).copy(); this.frameStyle = card.getFrameStyle(); id = ability.getId(); this.ability = ability; this.ability.setControllerId(controllerId); if (ability.getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) { spellCards.add(((SplitCard) card).getLeftHalfCard()); spellAbilities.add(((SplitCard) card).getLeftHalfCard().getSpellAbility().copy()); spellCards.add(((SplitCard) card).getRightHalfCard()); spellAbilities.add(((SplitCard) card).getRightHalfCard().getSpellAbility().copy()); } else { spellCards.add(card); spellAbilities.add(ability); } this.controllerId = controllerId; this.fromZone = fromZone; this.countered = false; }
@Override public boolean apply(Game game, Ability source, Ability abilityToModify) { Player controller = game.getPlayer(source.getControllerId()); Card spliceCard = game.getCard(source.getSourceId()); if (spliceCard != null && controller != null) { Spell spell = game.getStack().getSpell(abilityToModify.getId()); if (spell != null) { SpellAbility splicedAbility = spliceCard.getSpellAbility().copy(); splicedAbility.setSpellAbilityType(SpellAbilityType.SPLICE); splicedAbility.setSourceId(abilityToModify.getSourceId()); spell.addSpellAbility(splicedAbility); for (Iterator it = ((SpliceOntoArcaneAbility) source).getSpliceCosts().iterator(); it.hasNext();) { spell.getSpellAbility().getCosts().add(((Cost) it.next()).copy()); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); // use target pointer here, so it's the same card that triggered the event (not gone back to library e.g.) Card card = game.getCard(getTargetPointer().getFirst(game, source)); if (controller != null && card != null) { SpellAbility abilityToCast = card.getSpellAbility().copy(); ManaCosts<ManaCost> costRef = abilityToCast.getManaCostsToPay(); // replace with the new cost costRef.clear(); costRef.add(miracleCosts); controller.cast(abilityToCast, game, false, new MageObjectReference(source.getSourceObject(game), game)); return true; } return false; } }
if (card.isSplitCard()) { if (((SplitCard) card).getLeftHalfCard().getName().equals(abilityName)) { spellAbilityCopy = ((SplitCard) card).getLeftHalfCard().getSpellAbility().copy(); } else if (((SplitCard) card).getRightHalfCard().getName().equals(abilityName)) { spellAbilityCopy = ((SplitCard) card).getRightHalfCard().getSpellAbility().copy(); spellAbilityCopy = card.getSpellAbility().copy();
@Override public boolean apply(Game game, Ability source) { Player owner = null; Card card = game.getCard(source.getSourceId()); if (card != null) { owner = game.getPlayer(card.getOwnerId()); } if (owner != null && card != null && owner.chooseUse(outcome, "Cast " + card.getLogName() + " by madness?", source, game)) { // replace with the new cost SpellAbility castByMadness = card.getSpellAbility().copy(); ManaCosts<ManaCost> costRef = castByMadness.getManaCostsToPay(); castByMadness.setSpellAbilityType(SpellAbilityType.BASE_ALTERNATE); castByMadness.setSpellAbilityCastMode(SpellAbilityCastMode.MADNESS); costRef.clear(); costRef.add(madnessCost); boolean result = owner.cast(castByMadness, game, false, new MageObjectReference(source.getSourceObject(game), game)); return result; } return false; }
if (commander != null && game.getState().getZone(commanderId) == Zone.COMMAND) { SpellAbility ability = commander.getSpellAbility(); SpellAbility newAbility = commander.getSpellAbility().copy(); newAbility.getCosts().clear();
SpellAbility ability = originalAbility.copy(); ability.setControllerId(getId()); ability.setSourceObjectZoneChangeCounter(game.getState().getZoneChangeCounter(ability.getSourceId()));
spell = ((ZoneChangeInfo.Stack) info).spell; } else { spell = new Spell(card, card.getSpellAbility().copy(), card.getOwnerId(), event.getFromZone());