public Mana getAndResetLastPayment() { Mana returnPayment = null; if (payment != null) { returnPayment = payment.copy(); } return returnPayment; }
IceCauldronAddManaEffect(IceCauldronAddManaEffect effect) { super(effect); storedMana = effect.storedMana.copy(); exiledCardMor = effect.exiledCardMor; }
@Override public Mana produceMana(boolean netMana, Game game, Ability source) { if (netMana) { return null; } return mana.copy(); } }
@Override public Mana produceMana(boolean netMana, Game game, Ability source) { return manaTemplate.copy(); }
public AstralCornucopiaManaEffect(final AstralCornucopiaManaEffect effect) { super(effect); this.computedMana = effect.computedMana.copy(); }
public ManaEffect(final ManaEffect effect) { super(effect); this.createdMana = effect.createdMana == null ? null : effect.createdMana.copy(); }
public BasicManaEffect(final BasicManaEffect effect) { super(effect); this.manaTemplate = effect.manaTemplate.copy(); }
public ManaScrewEffect(final ManaScrewEffect effect) { super(effect); this.manaTemplate = effect.manaTemplate.copy(); }
@Override public Mana produceMana(boolean netMana, Game game, Ability source) { return mana.copy(); }
public CorruptedGrafstoneManaEffect(final CorruptedGrafstoneManaEffect effect) { super(effect); this.computedMana = effect.computedMana.copy(); }
public ManaCostImpl(final ManaCostImpl manaCost) { super(manaCost); this.payment = manaCost.payment.copy(); this.usedManaToPay = manaCost.usedManaToPay.copy(); this.cost = manaCost.cost.copy(); this.options = manaCost.options.copy(); if (manaCost.sourceFilter != null) { this.sourceFilter = manaCost.sourceFilter.copy(); } }
public SimpleManaAbility(Zone zone, Mana mana, Cost cost) { super(zone, new BasicManaEffect(mana), cost); this.netMana.add(mana.copy()); this.predictable = true; }
public ProtectiveSphereEffect(final ProtectiveSphereEffect effect) { super(effect); this.target = effect.target.copy(); manaUsed = effect.manaUsed.copy(); colorsOfChosenSource = effect.colorsOfChosenSource; }
public ManaOptions(final ManaOptions options) { for (Mana mana : options) { this.add(mana.copy()); } }
private void addManaCombination(Mana mana, Mana existingMana, List<Mana> payCombinations, List<String> payCombinationsStrings) { Mana newMana = existingMana.copy(); newMana.add(mana); payCombinations.add(newMana); payCombinationsStrings.add(newMana.toString()); }
/** * Used to check the possible mana production to determine which spells * and/or abilities can be used. (player.getPlayable()). * * @param game * @return */ @Override public List<Mana> getNetMana(Game game) { if (netMana.isEmpty()) { ArrayList<Mana> dynamicNetMana = new ArrayList<>(); for (Effect effect : getEffects()) { if (effect instanceof ManaEffect) { List<Mana> effectNetMana = ((ManaEffect) effect).getNetMana(game, this); if (effectNetMana != null) { dynamicNetMana.addAll(effectNetMana); } } } return dynamicNetMana; } ArrayList<Mana> netManaCopy = new ArrayList<>(); for (Mana mana : netMana) { netManaCopy.add(mana.copy()); } return netManaCopy; }
@Override public Mana produceMana(boolean netMana, Game game, Ability source) { Permanent land = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); if (land != null) { Mana mana = (Mana) getValue("mana"); if (mana != null) { return mana.copy(); } } return null; }
@Override public Mana produceMana(boolean netMana, Game game, Ability source) { Permanent jeweledAmulet = game.getPermanent(source.getSourceId()); Player controller = game.getPlayer(source.getControllerId()); if (jeweledAmulet != null && controller != null) { storedMana = (Mana) game.getState().getValue("JeweledAmulet" + source.getSourceId().toString()); if (storedMana != null) { return storedMana.copy(); } } return null; }
@Override public Mana produceMana(boolean netMana, Game game, Ability source) { Mana mana = new Mana(); if (condition.apply(game, source)) { mana = effect.getManaTemplate().copy(); } else if (otherwiseEffect != null) { mana = otherwiseEffect.getManaTemplate().copy(); } if (mana.getAny() > 0) { int amount = mana.getAny(); Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return mana; } ChoiceColor choice = new ChoiceColor(true); if (controller.choose(outcome, choice, game)) { mana.setAny(0); mana.add(choice.getMana(amount)); } } return mana; } }
public void addMana(Mana manaToAdd, Game game, Ability source, boolean emptyOnTurnsEnd) { if (manaToAdd != null) { Mana mana = manaToAdd.copy(); if (!game.replaceEvent(new ManaEvent(EventType.ADD_MANA, source.getId(), source.getSourceId(), playerId, mana))) { if (mana instanceof ConditionalMana) { ManaPoolItem item = new ManaPoolItem((ConditionalMana) mana, source.getSourceObject(game), ((ConditionalMana) mana).getManaProducerOriginalId() != null ? ((ConditionalMana) mana).getManaProducerOriginalId() : source.getOriginalId()); if (emptyOnTurnsEnd) { item.setDuration(Duration.EndOfTurn); } this.manaItems.add(item); } else { ManaPoolItem item = new ManaPoolItem(mana.getRed(), mana.getGreen(), mana.getBlue(), mana.getWhite(), mana.getBlack(), mana.getGeneric() + mana.getColorless(), source.getSourceObject(game), source.getOriginalId(), mana.getFlag()); if (emptyOnTurnsEnd) { item.setDuration(Duration.EndOfTurn); } this.manaItems.add(item); } ManaEvent manaEvent = new ManaEvent(EventType.MANA_ADDED, source.getId(), source.getSourceId(), playerId, mana); manaEvent.setData(mana.toString()); game.fireEvent(manaEvent); } } }