Fix handling of damage to permanents (WIP) (#7592)

* initial refactor of damage events

* cleaned up some instances of classes that need to be removed

* removed old damage event classes

* removed outdated imports

* temporarily refactor Everlasting Torment (this will need to be changed more)

* updated damage handling to use new changes

* some reworking of lethal/excess damage plus a test

* updated damage marking to handle planeswalkers

* updated implementation of Phyrexian Unlife

* updated implementation of Everlasting Torment

* added some more excess damage tests

* small change to wither check
This commit is contained in:
Evan Kranzler 2021-02-22 17:11:24 -05:00 committed by GitHub
parent 39f6b69391
commit 5390963d38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
201 changed files with 1132 additions and 1187 deletions

View file

@ -56,12 +56,7 @@ class AegarTheFreezingFlameTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGED_CREATURE:
case DAMAGED_PLANESWALKER:
return true;
}
return false;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override
@ -98,12 +93,8 @@ class AegarTheFreezingFlameWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGED_CREATURE:
case DAMAGED_PLANESWALKER:
break;
default:
return;
if (event.getType() != GameEvent.EventType.DAMAGED_PERMANENT) {
return;
}
DamagedEvent dEvent = (DamagedEvent) event;
MageObject sourceObject = game.getObject(event.getSourceId());

View file

@ -83,8 +83,7 @@ class AngelOfDeliveranceDealsDamageTriggeredAbility extends TriggeredAbilityImpl
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGED_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER;
|| event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -64,8 +64,7 @@ class AngrathsMaraudersEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(EventType.DAMAGE_PLAYER)
|| event.getType().equals(EventType.DAMAGE_CREATURE)
|| event.getType().equals(EventType.DAMAGE_PLANESWALKER);
|| event.getType().equals(EventType.DAMAGE_PERMANENT);
}
@Override

View file

@ -69,9 +69,8 @@ class AnthemOfRakdosHellbentEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGE_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER;
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}
@Override

View file

@ -14,9 +14,8 @@ import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.BlockingPredicate;
import mage.game.Game;
import mage.game.events.DamagedCreatureEvent;
import mage.game.events.DamagedEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
/**
@ -73,14 +72,14 @@ class ArashinWarBeastTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE || event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST ;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT || event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST ;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE &&
if (event.getType() == GameEvent.EventType.DAMAGED_PERMANENT &&
event.getSourceId().equals(this.sourceId) &&
((DamagedCreatureEvent) event).isCombatDamage() &&
((DamagedEvent) event).isCombatDamage() &&
!usedForCombatDamageStep) {
Permanent creature = game.getPermanentOrLKIBattlefield(event.getTargetId());
if (creature == null || !filter.match(creature, getSourceId(), getControllerId(), game)) {

View file

@ -85,7 +85,7 @@ class ArcbondDelayedTriggeredAbility extends DelayedTriggeredAbility {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -73,7 +73,7 @@ class ArchfiendOfSpiteAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -128,13 +128,13 @@ class AscentOfTheWorthyRedirectEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
return permanent != null && permanent.isControlledBy(source.getControllerId());
return permanent != null && permanent.isCreature() && permanent.isControlledBy(source.getControllerId());
}
@Override

View file

@ -18,7 +18,6 @@ import mage.constants.Outcome;
import mage.constants.WatcherScope;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.players.Player;
@ -177,21 +176,19 @@ class AureliasFuryDamagedByWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) {
MageObject obj = game.getObject(event.getSourceId());
if (obj instanceof Spell) {
if (sourceId.equals(((Spell) obj).getSourceId())) {
MageObject obj = game.getObject(event.getSourceId());
if (!(obj instanceof Spell) || !sourceId.equals(((Spell) obj).getSourceId())) {
return;
}
switch (event.getType()) {
case DAMAGED_PERMANENT:
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isCreature()) {
damagedCreatures.add(event.getTargetId());
}
}
}
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
MageObject obj = game.getObject(event.getSourceId());
if (obj instanceof Spell) {
if (sourceId.equals(((Spell) obj).getSourceId())) {
damagedPlayers.add(event.getTargetId());
}
}
return;
case DAMAGED_PLAYER:
damagedPlayers.add(event.getTargetId());
}
}

View file

@ -1,7 +1,5 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.ObjectColor;
@ -24,8 +22,9 @@ import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetPlayerOrPlaneswalker;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class AvacynGuardianAngel extends CardImpl {
@ -80,7 +79,7 @@ class AvacynGuardianAngelPreventToCreatureEffect extends OneShotEffect {
this.staticText = "Prevent all damage that would be dealt to another target creature this turn by sources of the color of your choice";
}
AvacynGuardianAngelPreventToCreatureEffect(final AvacynGuardianAngelPreventToCreatureEffect effect) {
private AvacynGuardianAngelPreventToCreatureEffect(final AvacynGuardianAngelPreventToCreatureEffect effect) {
super(effect);
}
@ -112,7 +111,7 @@ class AvacynGuardianAngelPreventToCreaturePreventionEffect extends PreventionEff
this.color = color;
}
AvacynGuardianAngelPreventToCreaturePreventionEffect(AvacynGuardianAngelPreventToCreaturePreventionEffect effect) {
private AvacynGuardianAngelPreventToCreaturePreventionEffect(AvacynGuardianAngelPreventToCreaturePreventionEffect effect) {
super(effect);
this.color = effect.color;
}
@ -124,16 +123,13 @@ class AvacynGuardianAngelPreventToCreaturePreventionEffect extends PreventionEff
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) {
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE
&& event.getTargetId().equals(getTargetPointer().getFirst(game, source))) {
MageObject sourceObject = game.getObject(event.getSourceId());
if (sourceObject != null && sourceObject.getColor(game).shares(this.color)) {
return true;
}
}
if (!super.applies(event, source, game)
|| event.getType() != GameEvent.EventType.DAMAGE_PERMANENT
|| !event.getTargetId().equals(getTargetPointer().getFirst(game, source))) {
return false;
}
return false;
MageObject sourceObject = game.getObject(event.getSourceId());
return sourceObject != null && sourceObject.getColor(game).shares(this.color);
}
@Override
@ -149,7 +145,7 @@ class AvacynGuardianAngelPreventToPlayerEffect extends OneShotEffect {
this.staticText = "Prevent all damage that would be dealt to target player or planeswalker this turn by sources of the color of your choice";
}
AvacynGuardianAngelPreventToPlayerEffect(final AvacynGuardianAngelPreventToPlayerEffect effect) {
private AvacynGuardianAngelPreventToPlayerEffect(final AvacynGuardianAngelPreventToPlayerEffect effect) {
super(effect);
}
@ -181,7 +177,7 @@ class AvacynGuardianAngelPreventToPlayerPreventionEffect extends PreventionEffec
this.color = color;
}
AvacynGuardianAngelPreventToPlayerPreventionEffect(AvacynGuardianAngelPreventToPlayerPreventionEffect effect) {
private AvacynGuardianAngelPreventToPlayerPreventionEffect(AvacynGuardianAngelPreventToPlayerPreventionEffect effect) {
super(effect);
this.color = effect.color;
}
@ -193,17 +189,11 @@ class AvacynGuardianAngelPreventToPlayerPreventionEffect extends PreventionEffec
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) {
if ((event.getType() == GameEvent.EventType.DAMAGE_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER)
&& event.getTargetId().equals(getTargetPointer().getFirst(game, source))) {
MageObject sourceObject = game.getObject(event.getSourceId());
if (sourceObject != null && sourceObject.getColor(game).shares(this.color)) {
return true;
}
}
if (!super.applies(event, source, game) || !event.getTargetId().equals(getTargetPointer().getFirst(game, source))) {
return false;
}
return false;
MageObject sourceObject = game.getObject(event.getSourceId());
return sourceObject != null && sourceObject.getColor(game).shares(this.color);
}
@Override

View file

@ -73,8 +73,7 @@ class BansheesBladeAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGED_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER
|| event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_PRE;
}

View file

@ -64,7 +64,7 @@ class BelltowerSphinxEffect extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -76,7 +76,8 @@ class BenevolentUnicornEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE || event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER || event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
return event.getType() == EventType.DAMAGE_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}
@Override

View file

@ -111,9 +111,8 @@ class BitterFeudEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PERMANENT:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
return true;
default:
return false;
@ -130,8 +129,7 @@ class BitterFeudEffect extends ReplacementEffectImpl {
case DAMAGE_PLAYER:
targetPlayerId = event.getTargetId();
break;
case DAMAGE_CREATURE:
case DAMAGE_PLANESWALKER:
case DAMAGE_PERMANENT:
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null) {
targetPlayerId = permanent.getControllerId();

View file

@ -84,7 +84,8 @@ class BlazeCommandoTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER || event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override

View file

@ -89,7 +89,7 @@ class BlazingEffigyWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) {
if (event.getType() == GameEvent.EventType.DAMAGED_PERMANENT) {
if (!event.getSourceId().equals(event.getTargetId())) {
MageObjectReference damageSourceRef = new MageObjectReference(event.getSourceId(), game);
MageObjectReference damageTargetRef = new MageObjectReference(event.getTargetId(), game);

View file

@ -72,7 +72,7 @@ class BlazingSunsteelTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -11,7 +11,7 @@ import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.DamageCreatureEvent;
import mage.game.events.DamageEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.util.CardUtil;
@ -63,7 +63,7 @@ class FurnaceOfRathEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
}
@Override
@ -71,7 +71,7 @@ class FurnaceOfRathEffect extends ReplacementEffectImpl {
Permanent permanent = game.getPermanent(event.getSourceId());
return permanent != null
&& permanent.isCreature()
&& ((DamageCreatureEvent) event).isCombatDamage();
&& ((DamageEvent) event).isCombatDamage();
}

View file

@ -12,6 +12,7 @@ import mage.constants.Outcome;
import mage.game.Game;
import mage.game.events.DamageEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
@ -55,7 +56,7 @@ class BloodOfTheMartyrEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
}
@Override
@ -77,8 +78,11 @@ class BloodOfTheMartyrEffect extends ReplacementEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(event.getTargetId());
DamageEvent damageEvent = (DamageEvent) event;
return controller != null
&& controller.chooseUse(outcome, "Would you like to have " + damageEvent.getAmount() + " damage dealt to you instead of " + game.getPermanentOrLKIBattlefield(damageEvent.getTargetId()).getLogName() + "?", source, game);
&& permanent != null
&& permanent.isCreature()
&& controller.chooseUse(outcome, "Have " + damageEvent.getAmount() + " damage dealt to you instead of " + permanent.getLogName() + "?", source, game);
}
}

View file

@ -72,8 +72,7 @@ class CalamityBearerEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PLANESWALKER:
case DAMAGE_PERMANENT:
case DAMAGE_PLAYER:
return true;
default:

View file

@ -15,8 +15,8 @@ import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.events.DamageEvent;
import mage.game.events.GameEvent;
import mage.game.events.DamageCreatureEvent;
import mage.game.permanent.Permanent;
/**
@ -73,8 +73,8 @@ class CamelEffect extends PreventionEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game) && event instanceof DamageCreatureEvent && event.getAmount() > 0) {
DamageCreatureEvent damageEvent = (DamageCreatureEvent) event;
if (super.applies(event, source, game) && event instanceof DamageEvent && event.getAmount() > 0) {
DamageEvent damageEvent = (DamageEvent) event;
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null
&& sourcePermanent.isAttacking()

View file

@ -119,9 +119,8 @@ class CloakOfConfusionEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PERMANENT:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
return true;
default:
return false;

View file

@ -65,7 +65,7 @@ class CoverOfWinterEffect extends PreventionEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER || event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER || event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
}
@Override
@ -86,9 +86,9 @@ class CoverOfWinterEffect extends PreventionEffectImpl {
return super.applies(event, source, game);
}
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE) {
if (event.getType() == GameEvent.EventType.DAMAGE_PERMANENT) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isControlledBy(source.getControllerId())) {
if (permanent != null && permanent.isCreature() && permanent.isControlledBy(source.getControllerId())) {
return super.applies(event, source, game);
}
}

View file

@ -94,7 +94,7 @@ public final class CragSaurian extends CardImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -1,7 +1,5 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -10,24 +8,25 @@ import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamagedCreatureEvent;
import mage.game.events.DamagedEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author nantuko
*/
public final class CreepyDoll extends CardImpl {
public CreepyDoll(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{5}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{5}");
this.subtype.add(SubType.CONSTRUCT);
this.power = new MageInt(1);
@ -67,13 +66,17 @@ class CreepyDollTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (((DamagedCreatureEvent) event).isCombatDamage() && event.getSourceId().equals(sourceId)) {
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null
&& permanent.isCreature()
&& ((DamagedEvent) event).isCombatDamage()
&& event.getSourceId().equals(sourceId)) {
getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true;
}
return false;

View file

@ -63,9 +63,9 @@ class DauntingDefenderEffect extends PreventionEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE) {
if (event.getType() == GameEvent.EventType.DAMAGE_PERMANENT) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isControlledBy(source.getControllerId()) && permanent.hasSubtype(SubType.CLERIC, game)) {
if (permanent != null && permanent.isControlledBy(source.getControllerId()) && permanent.isCreature() && permanent.hasSubtype(SubType.CLERIC, game)) {
return super.applies(event, source, game);
}
}

View file

@ -1,9 +1,7 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -11,16 +9,18 @@ import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author Plopman
*/
public final class DeathPitsOfRath extends CardImpl {
public DeathPitsOfRath(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}{B}");
// Whenever a creature is dealt damage, destroy it. It can't be regenerated.
this.addAbility(new DeathPitsOfRathTriggeredAbility());
@ -53,14 +53,16 @@ class DeathPitsOfRathTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent == null || !permanent.isCreature()) {
return false;
}
getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true;
}

View file

@ -139,9 +139,8 @@ class DelifsConePreventEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PERMANENT:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
return true;
default:
return false;

View file

@ -117,9 +117,8 @@ class DelifsCubePreventEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PERMANENT:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
return true;
default:
return false;

View file

@ -80,8 +80,7 @@ class DesperateGambitEffect extends PreventionEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE ||
event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER ||
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT ||
event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}

View file

@ -64,9 +64,8 @@ class DictateOfTheTwinGodsEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PERMANENT:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
return true;
default:
return false;

View file

@ -1,18 +1,20 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.*;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author JayDi85
*/
@ -57,19 +59,20 @@ class DinosaurHunterAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(getSourceId())) {
Permanent targetPermanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
if (targetPermanent.hasSubtype(SubType.DINOSAUR, game)) {
getEffects().setTargetPointer(new FixedTarget(targetPermanent, game));
return true;
}
if (!event.getSourceId().equals(getSourceId())) {
return false;
}
return false;
Permanent targetPermanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
if (targetPermanent == null || !targetPermanent.hasSubtype(SubType.DINOSAUR, game)) {
return false;
}
getEffects().setTargetPointer(new FixedTarget(targetPermanent, game));
return true;
}
@Override

View file

@ -56,9 +56,8 @@ class DivinePresenceEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PERMANENT:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
return true;
default:
return false;

View file

@ -84,9 +84,9 @@ class DjeruWithEyesOpenPreventEffect extends PreventionEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER) {
if (event.getType() == GameEvent.EventType.DAMAGE_PERMANENT) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isControlledBy(source.getControllerId())) {
if (permanent != null && permanent.isPlaneswalker() && permanent.isControlledBy(source.getControllerId())) {
return super.applies(event, source, game);
}
}

View file

@ -19,7 +19,7 @@ import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.game.events.DamageCreatureEvent;
import mage.game.events.DamageEvent;
import mage.game.events.GameEvent;
import mage.target.common.TargetCardInYourGraveyard;
@ -76,14 +76,14 @@ class DralnuLichLordReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
DamageCreatureEvent damageEvent = (DamageCreatureEvent) event;
DamageEvent damageEvent = (DamageEvent) event;
new SacrificeControllerEffect(new FilterPermanent(), damageEvent.getAmount(), "").apply(game, source);
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
}
@Override

View file

@ -63,8 +63,7 @@ class EmbermawHellionEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch(event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PLANESWALKER:
case DAMAGE_PERMANENT:
case DAMAGE_PLAYER:
return true;
default:

View file

@ -72,9 +72,8 @@ class EmberwildeCaliphTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override

View file

@ -57,9 +57,8 @@ class EqualTreatmentEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGE_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER;
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}
@Override

View file

@ -65,9 +65,8 @@ class DealsDamageAllTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override

View file

@ -1,7 +1,5 @@
package mage.cards.e;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
@ -12,32 +10,31 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.DamageEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public final class EverlastingTorment extends CardImpl {
public EverlastingTorment(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B/R}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B/R}");
// Players can't gain life.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantGainLifeAllEffect()));
this.addAbility(new SimpleStaticAbility(new CantGainLifeAllEffect()));
// Damage can't be prevented.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new DamageCantBePreventedEffect(Duration.WhileOnBattlefield, "Damage can't be prevented", true, false)));
this.addAbility(new SimpleStaticAbility(new DamageCantBePreventedEffect(
Duration.WhileOnBattlefield, "Damage can't be prevented",
true, false
)));
// All damage is dealt as though its source had wither.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DamageDealtAsIfSourceHadWitherEffect()));
this.addAbility(new SimpleStaticAbility(new DamageDealtAsIfSourceHadWitherEffect()));
}
private EverlastingTorment(final EverlastingTorment card) {
@ -52,12 +49,12 @@ public final class EverlastingTorment extends CardImpl {
class DamageDealtAsIfSourceHadWitherEffect extends ReplacementEffectImpl {
public DamageDealtAsIfSourceHadWitherEffect() {
DamageDealtAsIfSourceHadWitherEffect() {
super(Duration.WhileOnBattlefield, Outcome.Neutral);
staticText = "All damage is dealt as though its source had wither";
}
public DamageDealtAsIfSourceHadWitherEffect(final DamageDealtAsIfSourceHadWitherEffect effect) {
private DamageDealtAsIfSourceHadWitherEffect(final DamageDealtAsIfSourceHadWitherEffect effect) {
super(effect);
}
@ -73,23 +70,15 @@ class DamageDealtAsIfSourceHadWitherEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
int damageAmount = event.getAmount();
if (damageAmount > 0) {
Counter counter = CounterType.M1M1.createInstance(damageAmount);
Permanent creatureDamaged = game.getPermanent(event.getTargetId());
if (creatureDamaged != null) {
creatureDamaged.addCounters(counter, source.getControllerId(), source, game);
}
}
return true;
((DamageEvent) event).setAsThoughWither(true);
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return true;

View file

@ -173,9 +173,8 @@ class FarrelsMantleDamageEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PERMANENT:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
return true;
default:
return false;

View file

@ -56,8 +56,7 @@ class FieryEmancipationEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)
|| event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE)
|| event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER);
|| event.getType().equals(GameEvent.EventType.DAMAGE_PERMANENT);
}
@Override

View file

@ -60,7 +60,7 @@ class DealtDamageLoseLifeTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -65,8 +65,7 @@ class FireServantEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE ||
event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER ||
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT ||
event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}

View file

@ -78,16 +78,14 @@ class FiveAlarmFireTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|| event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER
if (event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
if (((DamagedEvent) event).isCombatDamage() && !triggeringCreatures.contains(event.getSourceId())) {
Permanent permanent = game.getPermanent(event.getSourceId());

View file

@ -3,7 +3,6 @@ package mage.cards.f;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -15,8 +14,6 @@ import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
import static mage.game.combat.CombatGroup.getLethalDamage;
/**
* @author TheElk801
*/
@ -64,10 +61,7 @@ class FlameSpillEffect extends OneShotEffect {
if (permanent == null || sourceObject == null) {
return false;
}
int lethal = getLethalDamage(permanent, game);
if (sourceObject.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
lethal = Math.min(lethal, 1);
}
int lethal = permanent.getLethalDamage(source.getSourceId(), game);
lethal = Math.min(lethal, 4);
permanent.damage(lethal, source.getSourceId(), source, game);
Player player = game.getPlayer(permanent.getControllerId());

View file

@ -63,8 +63,7 @@ class FlamebladeAngelTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}

View file

@ -72,9 +72,8 @@ class FlashConscriptionTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override

View file

@ -3,7 +3,6 @@ package mage.cards.f;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -50,7 +49,7 @@ class FleshReaverTriggeredAbility extends TriggeredAbilityImpl {
super(Zone.BATTLEFIELD, new FleshReaverEffect());
}
FleshReaverTriggeredAbility(final FleshReaverTriggeredAbility effect) {
private FleshReaverTriggeredAbility(final FleshReaverTriggeredAbility effect) {
super(effect);
}
@ -61,23 +60,22 @@ class FleshReaverTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE || event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!event.getSourceId().equals(sourceId)) {
if (!event.getSourceId().equals(getSourceId())) {
return false;
}
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
if (event.getTargetId().equals(controllerId)) {
return false;
}
Permanent permanent = game.getPermanent(event.getTargetId());
if ((permanent != null && permanent.isCreature())
|| game.getOpponents(event.getTargetId()).contains(getControllerId())) {
this.getEffects().setValue("damage", event.getAmount());
return true;
}
for (Effect effect : this.getEffects()) {
effect.setValue("damage", event.getAmount());
}
return true;
return false;
}
@Override
@ -94,7 +92,7 @@ class FleshReaverEffect extends OneShotEffect {
this.staticText = "{this} deals that much damage to you.";
}
FleshReaverEffect(final FleshReaverEffect effect) {
private FleshReaverEffect(final FleshReaverEffect effect) {
super(effect);
}

View file

@ -59,10 +59,7 @@ class FurnaceOfRathEffect extends ReplacementEffectImpl {
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_PLAYER:
return true;
case DAMAGE_CREATURE:
return true;
case DAMAGE_PLANESWALKER:
case DAMAGE_PERMANENT:
return true;
}
return false;

View file

@ -142,9 +142,8 @@ class GazeOfPainDamageEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PERMANENT:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
return true;
default:
return false;

View file

@ -61,9 +61,8 @@ class GhostsOfTheInnocentPreventDamageEffect extends ReplacementEffectImpl imple
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGE_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER;
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER
|| event.getType() == EventType.DAMAGE_PERMANENT;
}
@Override

View file

@ -11,7 +11,7 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamagedCreatureEvent;
import mage.game.events.DamagedEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.FoodToken;
@ -65,12 +65,12 @@ class GiantsSkewerTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!((DamagedCreatureEvent) event).isCombatDamage()) {
if (!((DamagedEvent) event).isCombatDamage()) {
return false;
}
Permanent permanent = game.getPermanent(event.getSourceId());

View file

@ -135,9 +135,8 @@ class GideonsInterventionPreventAllDamageEffect extends PreventionEffectImpl {
MageObject object = game.getObject(event.getSourceId());
Permanent targetPerm = game.getPermanent(event.getTargetId());
String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY);
if (object != null && (event.getType() == GameEvent.EventType.DAMAGE_PLAYER
|| targetPerm != null && (event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER))) {
if (object != null && (event.getType() == EventType.DAMAGE_PLAYER
|| targetPerm != null && event.getType() == EventType.DAMAGE_PERMANENT)) {
if (CardUtil.haveSameNames(object, cardName, game)
&& (event.getTargetId().equals(source.getControllerId())
|| targetPerm != null && targetPerm.isControlledBy(source.getControllerId()))) {

View file

@ -107,9 +107,8 @@ class GideonsSacrificeEffectReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
case DAMAGE_PERMANENT:
return true;
default:
return false;
@ -122,8 +121,7 @@ class GideonsSacrificeEffectReplacementEffect extends ReplacementEffectImpl {
&& event.getPlayerId().equals(source.getControllerId())) {
return true;
}
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER) {
if (event.getType() == GameEvent.EventType.DAMAGE_PERMANENT) {
Permanent targetPermanent = game.getPermanent(event.getTargetId());
if (targetPermanent != null
&& targetPermanent.isControlledBy(source.getControllerId())) {

View file

@ -72,9 +72,8 @@ class GiselaBladeOfGoldnightDoubleDamageEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
case DAMAGE_PERMANENT:
return true;
default:
return false;

View file

@ -87,7 +87,7 @@ class GlarecasterEffect extends RedirectionEffect {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE || event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
return event.getType() == EventType.DAMAGE_PERMANENT || event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}
@Override

View file

@ -67,13 +67,13 @@ class GloomSurgeonEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getTargetId().equals(source.getSourceId())) {
DamageCreatureEvent damageEvent = (DamageCreatureEvent) event;
DamageEvent damageEvent = (DamageEvent) event;
return damageEvent.isCombatDamage();
}
return false;

View file

@ -15,9 +15,8 @@ import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.DamagedEvent;
import mage.game.events.GameEvent;
import mage.game.events.DamagedCreatureEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
@ -70,13 +69,13 @@ class GlyphOfLifeTriggeredAbility extends DelayedTriggeredAbility {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(this.getFirstTarget())) {
DamagedCreatureEvent damageEvent = (DamagedCreatureEvent) event;
DamagedEvent damageEvent = (DamagedEvent) event;
Permanent attackingCreature = game.getPermanentOrLKIBattlefield(damageEvent.getSourceId());
if (attackingCreature != null && attackingCreature.isCreature() && attackingCreature.isAttacking()) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());

View file

@ -66,9 +66,8 @@ class GoblinBowlingTeamEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
case DAMAGE_PERMANENT:
return true;
default:
return false;

View file

@ -70,8 +70,7 @@ class GoblinPsychopathEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}

View file

@ -72,7 +72,7 @@ class GoldnightCastigatorDoubleDamageEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE ||
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT ||
event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}
@ -95,7 +95,7 @@ class GoldnightCastigatorDoubleDamageEffect extends ReplacementEffectImpl {
event.setAmount(CardUtil.overflowMultiply(event.getAmount(), 2));
}
break;
case DAMAGE_CREATURE:
case DAMAGE_PERMANENT:
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null) {
if (permanent.getId().equals(source.getSourceId())) {

View file

@ -58,9 +58,8 @@ class GratuitousViolenceReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
case DAMAGE_PERMANENT:
return true;
default:
return false;

View file

@ -72,7 +72,7 @@ class GreatbowDoyenTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -176,12 +176,12 @@ class GrothamaAllDevouringWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.DAMAGED_CREATURE) {
if (event.getType() != GameEvent.EventType.DAMAGED_PERMANENT) {
return;
}
UUID damageControllerId = game.getControllerId(event.getSourceId());
Permanent damaged = game.getPermanentOrLKIBattlefield(event.getTargetId());
if (damaged == null || damageControllerId == null) {
if (damaged == null || !damaged.isCreature() || damageControllerId == null) {
return;
}
MageObjectReference mor = new MageObjectReference(damaged, game);

View file

@ -80,9 +80,8 @@ class HanSoloScrumratTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override

View file

@ -88,9 +88,9 @@ class HedronFieldPuristsEffect extends PreventionEffectImpl {
return super.applies(event, source, game);
}
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE) {
if (event.getType() == GameEvent.EventType.DAMAGE_PERMANENT) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isControlledBy(source.getControllerId())) {
if (permanent != null && permanent.isCreature() && permanent.isControlledBy(source.getControllerId())) {
return super.applies(event, source, game);
}
}

View file

@ -60,7 +60,7 @@ class HighPriestOfPenanceTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -69,7 +69,7 @@ class HotSoupTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -13,7 +13,6 @@ import mage.constants.Outcome;
import mage.game.Game;
import mage.game.events.DamagedEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.common.TargetControlledCreaturePermanent;
@ -92,7 +91,7 @@ class HuntersInsightTriggeredAbility extends DelayedTriggeredAbility {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER;
|| event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override
@ -101,6 +100,10 @@ class HuntersInsightTriggeredAbility extends DelayedTriggeredAbility {
|| !((DamagedEvent) event).isCombatDamage()) {
return false;
}
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && !permanent.isPlaneswalker()) {
return false;
}
this.getEffects().clear();
this.addEffect(new DrawCardSourceControllerEffect(event.getAmount()));
return true;

View file

@ -96,8 +96,7 @@ class GreatestAmountOfDamageWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
switch(event.getType()) {
case DAMAGED_CREATURE:
case DAMAGED_PLANESWALKER:
case DAMAGED_PERMANENT:
case DAMAGED_PLAYER:
if (event.getAmount() > damageAmount) {
damageAmount = event.getAmount();

View file

@ -68,8 +68,7 @@ class ImpulsiveManeuversEffect extends PreventionEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE ||
event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER ||
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT ||
event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}

View file

@ -1,7 +1,6 @@
package mage.cards.i;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
@ -9,25 +8,22 @@ import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.DamageCreatureEvent;
import mage.game.events.DamageEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author nantuko
*/
public final class InquisitorsFlail extends CardImpl {
public InquisitorsFlail(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
this.subtype.add(SubType.EQUIPMENT);
// If equipped creature would deal combat damage, it deals double that damage instead.
@ -67,20 +63,13 @@ class InquisitorsFlailEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE ||
event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER ||
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT ||
event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
boolean isCombat = false;
if (event instanceof DamageCreatureEvent) {
isCombat = ((DamageCreatureEvent) event).isCombatDamage();
} else if (event instanceof DamageEvent) {
isCombat = ((DamageEvent) event).isCombatDamage();
}
if (isCombat) {
if (((DamageEvent) event).isCombatDamage()) {
Permanent equipment = game.getPermanent(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
UUID attachedTo = equipment.getAttachedTo();

View file

@ -72,9 +72,8 @@ class InsultDoubleDamageEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGE_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER;
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
}
@Override

View file

@ -93,15 +93,13 @@ class JadeMonolithRedirectionEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == EventType.DAMAGE_PERMANENT;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getSourceId().equals(targetSource.getFirstTarget()) && event.getTargetId().equals(source.getFirstTarget())) {
return true;
}
return false;
return event.getSourceId().equals(targetSource.getFirstTarget())
&& event.getTargetId().equals(source.getFirstTarget());
}
}

View file

@ -64,8 +64,7 @@ class JayaVeneratedFiremageEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PLANESWALKER:
case DAMAGE_PERMANENT:
case DAMAGE_PLAYER:
return true;
default:

View file

@ -67,9 +67,8 @@ class JusticeTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override

View file

@ -68,7 +68,7 @@ class KamiOfTheHonoredDeadTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -75,22 +75,15 @@ class KazarovSengirPurebloodTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event == null) {
return false;
}
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
if (permanent == null) {
return false;
}
if (permanent.isControlledBy(this.getControllerId())) {
return false;
}
return true;
return permanent!=null
&& permanent.isCreature()
&& game.getOpponents(permanent.getControllerId()).contains(this.getControllerId());
}
@Override

View file

@ -72,7 +72,7 @@ class KillSuitCultistEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == EventType.DAMAGE_PERMANENT;
}
@Override

View file

@ -2,6 +2,7 @@ package mage.cards.k;
import java.util.UUID;
import mage.constants.SubType;
import mage.game.events.DamageEvent;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -20,7 +21,6 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamageCreatureEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.TargetSource;
@ -155,11 +155,11 @@ class KithkinArmorPreventionEffect extends PreventionEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)
&& event instanceof DamageCreatureEvent
&& event instanceof DamageEvent
&& event.getAmount() > 0
&& !this.used) {
UUID enchantedCreatureId = (UUID) game.getState().getValue(source.getSourceId().toString() + "attachedToPermanent");
DamageCreatureEvent damageEvent = (DamageCreatureEvent) event;
DamageEvent damageEvent = (DamageEvent) event;
if (enchantedCreatureId != null
&& event.getTargetId().equals(enchantedCreatureId)
&& damageEvent.getSourceId().equals(source.getFirstTarget())) {

View file

@ -89,8 +89,7 @@ class KiyomaroFirstToStandDealsDamageTriggeredAbility extends TriggeredAbilityIm
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGED_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER;
|| event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -76,7 +76,7 @@ class KorChantEffect extends RedirectionEffect {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
}
@Override

View file

@ -76,7 +76,7 @@ class KorDirgeEffect extends RedirectionEffect {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
}
@Override

View file

@ -1,8 +1,5 @@
package mage.cards.k;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -11,26 +8,22 @@ import mage.abilities.condition.Condition;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeTargetEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.watchers.Watcher;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public final class KrovikanVampire extends CardImpl {
@ -149,10 +142,15 @@ class KrovikanVampireCreaturesDamagedWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE
&& sourceId.equals(event.getSourceId())) {
damagedBySource.add(event.getTargetId());
if (event.getType() != GameEvent.EventType.DAMAGED_PERMANENT
|| !sourceId.equals(event.getSourceId())) {
return;
}
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent == null || !permanent.isCreature()) {
return;
}
damagedBySource.add(event.getTargetId());
}
public Set<UUID> getDamagedBySource() {

View file

@ -13,10 +13,8 @@ import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.watchers.Watcher;
@ -110,12 +108,14 @@ class DamagedByEnchantedWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) {
if (event.getType() == GameEvent.EventType.DAMAGED_PERMANENT) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null && enchantment.isAttachedTo(event.getSourceId())) {
MageObjectReference mor = new MageObjectReference(event.getTargetId(), game);
damagedCreatures.add(mor);
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isCreature()) {
MageObjectReference mor = new MageObjectReference(event.getTargetId(), game);
damagedCreatures.add(mor);
}
}
}
}

View file

@ -79,7 +79,7 @@ class KusariGamaAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -71,13 +71,13 @@ class LashknifeBarrierEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == EventType.DAMAGE_PERMANENT;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent creature = game.getPermanent(event.getTargetId());
return creature != null && creature.isControlledBy(source.getControllerId());
return creature != null && creature.isPlaneswalker() && creature.isControlledBy(source.getControllerId());
}
}

View file

@ -58,7 +58,8 @@ class LeylinePhantomTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER || event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override

View file

@ -18,7 +18,7 @@ import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.DamageCreatureEvent;
import mage.game.events.DamageEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
@ -66,7 +66,7 @@ class LichenthropeEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
DamageCreatureEvent damageEvent = (DamageCreatureEvent) event;
DamageEvent damageEvent = (DamageEvent) event;
Permanent p = game.getPermanent(source.getSourceId());
if (p != null) {
p.addCounters(CounterType.M1M1.createInstance(damageEvent.getAmount()), source.getControllerId(), source, game);
@ -76,7 +76,7 @@ class LichenthropeEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
}
@Override

View file

@ -54,9 +54,9 @@ class LightOfSanctionEffect extends PreventionEffectImpl {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE) {
if (event.getType() == GameEvent.EventType.DAMAGE_PERMANENT) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isControlledBy(source.getControllerId())) {
if (permanent != null && permanent.isCreature() && permanent.isControlledBy(source.getControllerId())) {
MageObject damageSource = game.getObject(event.getSourceId());
if (damageSource instanceof Controllable) {
return ((Controllable) damageSource).isControlledBy(source.getControllerId());

View file

@ -56,8 +56,7 @@ class LuminescePreventionEffect extends PreventionEffectImpl {
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) {
if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGE_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER) {
|| event.getType() == GameEvent.EventType.DAMAGE_PERMANENT) {
MageObject sourceObject = game.getObject(event.getSourceId());
if (sourceObject != null
&& (sourceObject.getColor(game).shares(ObjectColor.BLACK) || sourceObject.getColor(game).shares(ObjectColor.RED))) {

View file

@ -150,9 +150,8 @@ class MasterOfCrueltiesNoDamageEffect extends ContinuousRuleModifyingEffectImpl
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGE_CREATURE:
case DAMAGE_PERMANENT:
case DAMAGE_PLAYER:
case DAMAGE_PLANESWALKER:
return true;
default:
return false;

View file

@ -73,7 +73,7 @@ class MirrorwoodTreefolkEffect extends RedirectionEffect {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT;
}
@Override

View file

@ -59,7 +59,7 @@ class NestedGhoulTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override

View file

@ -156,8 +156,7 @@ class NikoArisDamageTriggeredAbility extends DelayedTriggeredAbility {
public boolean checkEventType(GameEvent event, Game game) {
switch (event.getType()) {
case DAMAGED_PLAYER:
case DAMAGED_CREATURE:
case DAMAGED_PLANESWALKER:
case DAMAGED_PERMANENT:
return true;
}
return false;

View file

@ -55,9 +55,8 @@ class NoblePurposeTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|| event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER;
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT
|| event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override

View file

@ -88,8 +88,7 @@ class OboshThePreypiercerEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)
|| event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE)
|| event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER);
|| event.getType().equals(GameEvent.EventType.DAMAGED_PERMANENT);
}
@Override

View file

@ -83,8 +83,7 @@ class OpalEyeKondasYojimboRedirectionEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE ||
event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER ||
return event.getType() == GameEvent.EventType.DAMAGE_PERMANENT ||
event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}

View file

@ -15,7 +15,7 @@ import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamageCreatureEvent;
import mage.game.events.DamageEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
@ -80,7 +80,7 @@ class OraclesAttendantsReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(source.getSourceId());
DamageCreatureEvent damageEvent = (DamageCreatureEvent) event;
DamageEvent damageEvent = (DamageEvent) event;
if (permanent != null) {
permanent.damage(damageEvent.getAmount(), damageEvent.getSourceId(), source, game, damageEvent.isCombatDamage(), damageEvent.isPreventable());
return true;
@ -90,7 +90,7 @@ class OraclesAttendantsReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_CREATURE;
return event.getType() == EventType.DAMAGE_PERMANENT;
}
@Override

Some files were not shown because too many files have changed in this diff Show more