@Override public void init(Ability source, Game game) { super.init(source, game); if (durationPhaseStep != null) { durationPlayerId = source.getControllerId(); sameStep = true; } }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { if (this.layer == layer && this.sublayer == sublayer) { return apply(game, source); } return false; }
@Override public EnumSet<DependencyType> getDependencyTypes() { if (effect != null) { return effect.getDependencyTypes(); } return super.getDependencyTypes(); }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { UUID cardId = this.getTargetPointer().getFirst(game, source); new ReturnFromGraveyardToBattlefieldTargetEffect().apply(game, source); Permanent permanent = game.getPermanent(cardId); if (permanent != null) { ContinuousEffectImpl effect = new BecomesColorTargetEffect(ObjectColor.BLACK, Duration.WhileOnBattlefield); effect.setTargetPointer(new FixedTarget(permanent, game)); game.addEffect(effect, source); effect = new BecomesCreatureTypeTargetEffect(Duration.WhileOnBattlefield, SubType.NIGHTMARE, false); effect.setTargetPointer(new FixedTarget(permanent, game)); game.addEffect(effect, source); } return true; } return false; } }
@Override public Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer) { if (effect != null) { return effect.isDependentTo(allEffectsInLayer); } return super.isDependentTo(allEffectsInLayer); }
@Override public void init(Ability source, Game game) { targetPointer.init(game, source); //20100716 - 611.2c if (AbilityType.ACTIVATED == source.getAbilityType() || AbilityType.SPELL == source.getAbilityType() || AbilityType.TRIGGERED == source.getAbilityType()) { if (layer != null) { switch (layer) { case CopyEffects_1: case ControlChangingEffects_2: case TextChangingEffects_3: case TypeChangingEffects_4: case ColorChangingEffects_5: case AbilityAddingRemovingEffects_6: case PTChangingEffects_7: this.affectedObjectsSet = true; } } else if (hasLayer(Layer.CopyEffects_1) || hasLayer(Layer.ControlChangingEffects_2) || hasLayer(Layer.TextChangingEffects_3) || hasLayer(Layer.TypeChangingEffects_4) || hasLayer(Layer.ColorChangingEffects_5) || hasLayer(Layer.AbilityAddingRemovingEffects_6) || hasLayer(Layer.PTChangingEffects_7)) { this.affectedObjectsSet = true; } } startingTurn = game.getTurnNum(); startingControllerId = source.getControllerId(); }
@Override public Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer) { Set<UUID> dependentToEffects = new HashSet<UUID>(); if (dependendToTypes != null) { for (ContinuousEffect effect : allEffectsInLayer) { if (!effect.getId().equals(this.getId())) { for (DependencyType dependencyType : effect.getDependencyTypes()) { if (dependendToTypes.contains(dependencyType)) { dependentToEffects.add(effect.getId()); break; } } } } } return dependentToEffects; /* return allEffectsInLayer.stream() .filter(effect -> effect.getDependencyTypes().contains(dependendToTypes)) .map(Effect::getId) .collect(Collectors.toSet()); } return new HashSet<>();*/ }
@Override public boolean isInactive(Ability source, Game game) { if (super.isInactive(source, game)) { return true; } if (durationPhaseStep != null && durationPhaseStep == game.getPhase().getStep().getType()) { return !sameStep && game.isActivePlayer(durationPlayerId) || game.getPlayer(durationPlayerId).hasReachedNextTurnAfterLeaving(); } else { sameStep = false; } return false; }
effect.setTargetPointer(new FixedTarget(creature1.getId())); game.addEffect(effect, source); effect = new GainAbilityTargetEffect(BlocksThisTurnMarkerAbility.getInstance(), Duration.EndOfTurn, ""); effect.setTargetPointer(new FixedTarget(creature1.getId())); game.addEffect(effect, source); } else { effect.setTargetPointer(new FixedTarget(creature1.getId())); game.addEffect(effect, source); effect = new GainAbilityTargetEffect(AttacksThisTurnMarkerAbility.getInstance(), Duration.EndOfTurn, ""); effect.setTargetPointer(new FixedTarget(creature1.getId())); game.addEffect(effect, source); effect.setTargetPointer(new FixedTarget(creature2.getId())); game.addEffect(effect, source); } else { effect.setTargetPointer(new FixedTarget(creature2.getId())); game.addEffect(effect, source);
@Override public void init(Ability source, Game game) { if (this.controllingPlayerId == null && fixedControl) { this.controllingPlayerId = source.getControllerId(); } super.init(source, game); }
if (permanent != null) { ContinuousEffectImpl effect = new AshiokNightmareWeaverAddTypeEffect(); effect.setTargetPointer(new FixedTarget(permanent, game)); game.addEffect(effect, source);
@Override public void init(Ability source, Game game) { super.init(source, game); //To change body of generated methods, choose Tools | Templates. startingTurn = game.getTurnNum(); }
@Override public void init(Ability source, Game game) { super.init(source, game); affectedObjectList.add(new MageObjectReference(source.getSourceId(), game)); }
@Override public void init(Ability source, Game game) { super.init(source, game); affectedObjectList.add(new MageObjectReference(source.getSourceId(), game)); }
@Override public void init(Ability source, Game game) { super.init(source, game); if (affectedObjectsSet) { affectedObjectList.add(new MageObjectReference(source.getSourceId(), game)); } }
@Override public void init(Ability source, Game game) { super.init(source, game); if (this.affectedObjectsSet) { for (UUID permId: targetPointer.getTargets(game, source)) { affectedObjectList.add(new MageObjectReference(permId, game)); } } }
@Override public void init(Ability source, Game game) { super.init(source, game); affectedObjectList.add(new MageObjectReference(source.getSourceId(), game)); }
@Override public void init(Ability source, Game game) { super.init(source, game); affectedObjectList.add(new MageObjectReference(source.getSourceId(), game)); }
@Override public void init(Ability source, Game game) { super.init(source, game); affectedObjectList.add(new MageObjectReference(source.getSourceId(), game)); }
@Override public void init(Ability source, Game game) { super.init(source, game); affectedObjectList.add(new MageObjectReference(source.getSourceId(), game)); }