use of mage.abilities.effects.common.CopyTargetSpellEffect in project mage by magefree.
the class SplitDecisionEffect method apply.
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(getTargetPointer().getFirst(game, source));
if (spell == null) {
return false;
}
// Outcome.Benefit - AI will use counter all the time (Denial choice)
// TODO: add AI hint logic in the choice method, see Tyrant's Choice as example
TwoChoiceVote vote = new TwoChoiceVote("Denial (counter " + spell.getIdName() + ")", "Duplication (copy " + spell.getIdName() + ")", Outcome.Benefit);
vote.doVotes(source, game);
int denialCount = vote.getVoteCount(true);
int duplicationCount = vote.getVoteCount(false);
if (denialCount > duplicationCount) {
return game.getStack().counter(spell.getId(), source, game);
} else {
return new CopyTargetSpellEffect().apply(game, source);
}
}
use of mage.abilities.effects.common.CopyTargetSpellEffect in project mage by magefree.
the class RepeatedReverberationEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!event.getPlayerId().equals(this.getControllerId())) {
return false;
}
// activated ability
if (event.getType() == GameEvent.EventType.ACTIVATED_ABILITY) {
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
if (stackAbility != null && stackAbility.getStackAbility() instanceof LoyaltyAbility) {
this.getEffects().clear();
this.addEffect(new RepeatedReverberationEffect().setTargetPointer(new FixedTarget(event.getTargetId(), game)));
return true;
}
}
// spell
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.isInstantOrSorcery(game)) {
this.getEffects().clear();
this.addEffect(new CopyTargetSpellEffect(true).setTargetPointer(new FixedTarget(event.getTargetId(), game)));
this.addEffect(new CopyTargetSpellEffect(true).setTargetPointer(new FixedTarget(event.getTargetId(), game)));
return true;
}
}
return false;
}
use of mage.abilities.effects.common.CopyTargetSpellEffect in project mage by magefree.
the class SevinneTheChronoclasmWatcher method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!super.checkTrigger(event, game) || event.getZone() != Zone.GRAVEYARD) {
return false;
}
SevinneTheChronoclasmWatcher watcher = game.getState().getWatcher(SevinneTheChronoclasmWatcher.class);
if (watcher == null || !watcher.checkFirstSpellThisTurn(this.getControllerId(), event.getTargetId())) {
return false;
}
this.getEffects().clear();
Effect effect = new CopyTargetSpellEffect(true);
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
this.addEffect(effect);
return true;
}
Aggregations