use of mage.game.events.DamageEvent in project mage by magefree.
the class DelayingShieldUpkeepEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
DamageEvent damageEvent = (DamageEvent) event;
new AddCountersSourceEffect(CounterType.DELAY.createInstance(damageEvent.getAmount()), true).apply(game, source);
return true;
}
use of mage.game.events.DamageEvent in project mage by magefree.
the class WallOfVaporEffect method applies.
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game) && event instanceof DamageEvent && event.getAmount() > 0) {
DamageEvent damageEvent = (DamageEvent) event;
if (event.getTargetId().equals(source.getSourceId())) {
Permanent permanent = game.getPermanentOrLKIBattlefield(damageEvent.getSourceId());
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new BlockedByIdPredicate(source.getSourceId()));
if (permanent != null && filter.match(permanent, game)) {
return true;
}
}
}
return false;
}
use of mage.game.events.DamageEvent in project mage by magefree.
the class PreventAllDamageByAllObjectsEffect method applies.
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!super.applies(event, source, game) || !(event instanceof DamageEvent) || event.getAmount() <= 0) {
return false;
}
DamageEvent damageEvent = (DamageEvent) event;
if (!damageEvent.isCombatDamage() && onlyCombat) {
return false;
}
if (filter == null) {
return true;
}
MageObject damageSource = game.getObject(damageEvent.getSourceId());
if (damageSource == null) {
return false;
}
if (filter instanceof FilterInPlay) {
return ((FilterInPlay) filter).match(damageSource, source.getSourceId(), source.getControllerId(), game);
}
return filter.match(damageSource, game);
}
use of mage.game.events.DamageEvent in project mage by magefree.
the class EqualTreatmentEffect method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
DamageEvent damageEvent = (DamageEvent) event;
damageEvent.setAmount(2);
return false;
}
use of mage.game.events.DamageEvent in project mage by magefree.
the class ForceBubbleStateTriggeredAbility method replaceEvent.
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
DamageEvent damageEvent = (DamageEvent) event;
new AddCountersSourceEffect(CounterType.DEPLETION.createInstance(damageEvent.getAmount()), true).apply(game, source);
return true;
}
Aggregations