public ConditionalContinuousEffect(final ConditionalContinuousEffect effect) { super(effect); this.effect = effect.effect.copy(); if (effect.otherwiseEffect != null) { this.otherwiseEffect = effect.otherwiseEffect.copy(); } this.condition = effect.condition; this.baseCondition = effect.baseCondition; this.initDone = effect.initDone; }
public ContinuousEffectsList(final ContinuousEffectsList<T> effects) { this.ensureCapacity(effects.size()); for (ContinuousEffect cost : effects) { this.add((T) cost.copy()); } for (Map.Entry<UUID, Set<Ability>> entry : effects.effectAbilityMap.entrySet()) { Set<Ability> newSet = new HashSet<>(); for (Ability ability : entry.getValue()) { newSet.add(ability.copy()); } effectAbilityMap.put(entry.getKey(), newSet); } }
public ContinuousEffects(final ContinuousEffects effect) { this.applyCounters = effect.applyCounters.copy(); // this.planeswalkerRedirectionEffect = effect.planeswalkerRedirectionEffect.copy(); this.auraReplacementEffect = effect.auraReplacementEffect.copy(); layeredEffects = effect.layeredEffects.copy(); continuousRuleModifyingEffects = effect.continuousRuleModifyingEffects.copy(); replacementEffects = effect.replacementEffects.copy(); preventionEffects = effect.preventionEffects.copy(); requirementEffects = effect.requirementEffects.copy(); restrictionEffects = effect.restrictionEffects.copy(); restrictionUntapNotMoreThanEffects = effect.restrictionUntapNotMoreThanEffects.copy(); for (Map.Entry<AsThoughEffectType, ContinuousEffectsList<AsThoughEffect>> entry : effect.asThoughEffectsMap.entrySet()) { asThoughEffectsMap.put(entry.getKey(), entry.getValue().copy()); } costModificationEffects = effect.costModificationEffects.copy(); spliceCardEffects = effect.spliceCardEffects.copy(); for (Map.Entry<ContinuousEffect, Set<Ability>> entry : effect.temporaryEffects.entrySet()) { temporaryEffects.put(entry.getKey().copy(), entry.getValue()); } collectAllEffects(); order = effect.order; }
@Override public void addEffect(ContinuousEffect continuousEffect, Ability source) { Ability newAbility = source.copy(); newAbility.setSourceObjectZoneChangeCounter(getState().getZoneChangeCounter(source.getSourceId())); ContinuousEffect newEffect = continuousEffect.copy(); newEffect.newId(); newEffect.init(newAbility, this); state.addEffect(newEffect, newAbility); }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (controller != null && creature != null) { ContinuousEffect effect = new BoostTargetEffect(2,2,Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(creature.getId())); game.addEffect(effect, source); if (ClashEffect.getInstance().apply(game, source)) { game.addEffect(effect.copy(), source); effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn); effect.setTargetPointer(new FixedTarget(creature.getId())); game.addEffect(effect.copy(), source); } return true; } return false; } }