@Override public void init(Ability source, Game game) { super.init(source, game); if (baseCondition instanceof LockedInCondition) { condition = new FixedCondition(((LockedInCondition) baseCondition).getBaseCondition().apply(game, source)); } else { condition = baseCondition; } effect.setTargetPointer(this.targetPointer); effect.init(source, game); if (otherwiseEffect != null) { otherwiseEffect.setTargetPointer(this.targetPointer); otherwiseEffect.init(source, game); } initDone = true; }
@Override public boolean applies(Permanent permanent, Ability source, Game game) { if (!initDone) { // if simpleStaticAbility, init won't be called init(source, game); } conditionState = condition.apply(game, source); if (conditionState) { effect.setTargetPointer(this.targetPointer); return effect.applies(permanent, source,game); } else if (otherwiseEffect != null) { otherwiseEffect.setTargetPointer(this.targetPointer); return otherwiseEffect.applies(permanent, source, game); } if (!conditionState && effect.getDuration() == Duration.OneUse) { used = true; } if (!conditionState && effect.getDuration() == Duration.Custom) { this.discard(); } return false; }
@Override public boolean apply(Game game, Ability source) { Player defendingPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (defendingPlayer != null) { Target target = new TargetControlledCreaturePermanent(1, 1, filter, true); if (target.choose(Outcome.Neutral, defendingPlayer.getId(), source.getSourceId(), game)) { RequirementEffect effect = new MustBeBlockedByTargetSourceEffect(); effect.setTargetPointer(new FixedTarget(target.getFirstTarget())); game.addEffect(effect, source); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); if (targetPlayer != null) { ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfTurn, targetPlayer.getId()); effect.setTargetPointer(new SecondTargetPointer()); effect.setText("Target player gains control of up to three target nonattacking creatures until end of turn"); game.addEffect(effect, source); Effect effect2 = new UntapTargetEffect(); effect2.setTargetPointer(new SecondTargetPointer()); effect2.setText("Untap those creatures"); effect2.apply(game, source); RequirementEffect effect3 = new BlocksIfAbleTargetEffect(Duration.EndOfTurn); effect3.setTargetPointer(new SecondTargetPointer()); effect3.setText("They block this turn if able"); game.addEffect(effect3, source); return true; } return false; } }
RequirementEffect effect = new AttacksIfAbleTargetEffect(Duration.EndOfCombat); effect.setText(""); effect.setTargetPointer(new FixedTarget(permanent.getId())); game.addEffect(effect, source); game.informPlayers(controller.getLogName() + " has decided that " + permanent.getLogName() + " attacks this combat if able");
@Override public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source)); if (opponent != null) { Target target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, new FilterControlledCreaturePermanent(), true); if (target.choose(Outcome.Neutral, opponent.getId(), source.getSourceId(), game)) { for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), opponent.getId(), source.getSourceId(), game)) { if (target.getTargets().contains(permanent.getId())) { RequirementEffect effect = new OracleEnVecMustAttackRequirementEffect(); effect.setTargetPointer(new FixedTarget(permanent.getId())); game.addEffect(effect, source); } else { RestrictionEffect effect = new OracleEnVecCantAttackRestrictionEffect(); effect.setTargetPointer(new FixedTarget(permanent.getId())); game.addEffect(effect, source); } } game.addDelayedTriggeredAbility(new OracleEnVecDelayedTriggeredAbility(game.getTurnNum(), target.getTargets()), source); return true; } } return false; } }