use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class FlayerEffect method checkTrigger.
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && ((EntersTheBattlefieldEvent) event).getFromZone() == Zone.GRAVEYARD && permanent.isOwnedBy(controllerId) && (permanent.isCreature(game) || permanent.getId().equals(getSourceId()))) {
Effect effect = this.getEffects().get(0);
effect.setValue("damageSource", event.getTargetId());
return true;
}
return false;
}
use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class GraveBetrayalReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature != null) {
creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects());
ContinuousEffect effect = new BecomesBlackZombieAdditionEffect();
effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game) + 1));
game.addEffect(effect, source);
// discard(); why?
}
return false;
}
use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class RiotReplacementEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
Player controller = game.getPlayer(source.getControllerId());
if (creature != null && controller != null) {
if (controller.chooseUse(outcome, "Have " + creature.getLogName() + " enter the battlefield with a +1/+1 counter on it or with haste?", null, "+1/+1 counter", "Haste", source, game)) {
game.informPlayers(controller.getLogName() + " choose to put a +1/+1 counter on " + creature.getName());
creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects());
} else {
game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.Custom), source);
}
}
return false;
}
use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class UnleashRestrictionEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
Player controller = game.getPlayer(source.getControllerId());
if (creature != null && controller != null) {
if (controller.chooseUse(outcome, "Unleash " + creature.getLogName() + '?', source, game)) {
if (!game.isSimulation()) {
game.informPlayers(controller.getLogName() + " unleashes " + creature.getName());
}
creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects());
}
}
return false;
}
use of mage.game.events.EntersTheBattlefieldEvent in project mage by magefree.
the class MetallicMimicReplacementEffect method applies.
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Permanent enteringCreature = ((EntersTheBattlefieldEvent) event).getTarget();
if (enteringCreature != null && sourcePermanent != null && enteringCreature.isControlledBy(source.getControllerId()) && enteringCreature.isCreature(game) && !event.getTargetId().equals(source.getSourceId())) {
SubType subType = ChooseCreatureTypeEffect.getChosenCreatureType(source.getSourceId(), game);
return subType != null && enteringCreature.hasSubtype(subType, game);
}
return false;
}
Aggregations