Made TriggeredAbility.checkEventType() abstract. Added missing implementations.

This commit is contained in:
emerald000 2015-06-19 02:29:16 -04:00
parent 7a4d4265a4
commit cfd92dc8d5
464 changed files with 5501 additions and 3845 deletions

View file

@ -32,8 +32,8 @@ import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.combat.CantAttackBlockAttachedEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.combat.CantAttackBlockAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.AttachmentType;
@ -43,6 +43,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
@ -102,16 +103,19 @@ class CrystallizationTriggeredAbility extends TriggeredAbilityImpl {
return new CrystallizationTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TARGETED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.TARGETED) {
Permanent enchantment = game.getPermanent(sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
UUID enchanted = enchantment.getAttachedTo();
if (event.getTargetId().equals(enchanted)) {
getEffects().get(0).setTargetPointer(new FixedTarget(enchanted));
return true;
}
Permanent enchantment = game.getPermanent(sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
UUID enchanted = enchantment.getAttachedTo();
if (event.getTargetId().equals(enchanted)) {
getEffects().get(0).setTargetPointer(new FixedTarget(enchanted));
return true;
}
}
return false;

View file

@ -38,6 +38,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
*
@ -86,14 +87,15 @@ class DragonAppeasementTriggeredAbility extends TriggeredAbilityImpl {
return new DragonAppeasementTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SACRIFICED_PERMANENT;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT
&& event.getPlayerId().equals(this.getControllerId())
&& game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getCardType().contains(CardType.CREATURE)) {
return true;
}
return false;
return event.getPlayerId().equals(this.getControllerId())
&& game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD).getCardType().contains(CardType.CREATURE);
}
@Override

View file

@ -28,10 +28,6 @@
package mage.sets.alarareborn;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -41,8 +37,13 @@ import mage.abilities.keyword.CascadeAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
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.Library;
@ -101,20 +102,23 @@ class EnigmaSphinxTriggeredAbility extends TriggeredAbilityImpl {
return new EnigmaSphinxTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
Permanent permanent = zEvent.getTarget();
if (permanent != null &&
zEvent.getToZone() == Zone.GRAVEYARD &&
zEvent.getFromZone() == Zone.BATTLEFIELD &&
permanent.getId().equals(this.getSourceId()) &&
// 5/1/2009 If you control an Enigma Sphinx that's owned by another player, it's put into that player's
// graveyard from the battlefield, so Enigma Sphinx's middle ability won't trigger.
permanent.getOwnerId().equals(permanent.getControllerId())) {
return true;
}
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
Permanent permanent = zEvent.getTarget();
if (permanent != null &&
zEvent.getToZone() == Zone.GRAVEYARD &&
zEvent.getFromZone() == Zone.BATTLEFIELD &&
permanent.getId().equals(this.getSourceId()) &&
// 5/1/2009 If you control an Enigma Sphinx that's owned by another player, it's put into that player's
// graveyard from the battlefield, so Enigma Sphinx's middle ability won't trigger.
permanent.getOwnerId().equals(permanent.getControllerId())) {
return true;
}
return false;
}

View file

@ -29,23 +29,22 @@
package mage.sets.alarareborn;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TurnPhase;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.ExaltedAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TurnPhase;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.turn.TurnMod;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
@ -95,16 +94,19 @@ class FinestHourAbility extends TriggeredAbilityImpl {
return new FinestHourAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (checkInterveningIfClause(game) && game.getActivePlayerId().equals(this.controllerId)) {
if (event.getType() == EventType.DECLARED_ATTACKERS) {
if (game.getCombat().attacksAlone()) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
}
return true;
if (game.getActivePlayerId().equals(this.controllerId)) {
if (game.getCombat().attacksAlone()) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
}
return true;
}
}
return false;

View file

@ -29,16 +29,17 @@
package mage.sets.alarareborn;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.Spell;
/**
@ -85,15 +86,15 @@ class GloryscaleViashinoAbility extends TriggeredAbilityImpl {
return new GloryscaleViashinoAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.getColor(game).isMulticolored() && event.getPlayerId().equals(getControllerId())) {
return true;
}
}
return false;
Spell spell = game.getStack().getSpell(event.getTargetId());
return spell != null && spell.getColor(game).isMulticolored() && event.getPlayerId().equals(getControllerId());
}
@Override

View file

@ -28,17 +28,17 @@
package mage.sets.alarareborn;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
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;
@ -83,24 +83,27 @@ class MycoidShepherdTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
MageObject lastKnown = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (lastKnown == null) {
return false;
}
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
Permanent permanent = zEvent.getTarget();
if (permanent == null) {
return false;
}
if (super.getSourceId().equals(event.getTargetId())
|| permanent.getPower().getValue() > 4
&& permanent.getControllerId().equals(controllerId)) {
Zone after = game.getState().getZone(event.getTargetId());
return after != null && Zone.GRAVEYARD.match(after);
}
MageObject lastKnown = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (lastKnown == null) {
return false;
}
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
Permanent permanent = zEvent.getTarget();
if (permanent == null) {
return false;
}
if (super.getSourceId().equals(event.getTargetId())
|| permanent.getPower().getValue() > 4
&& permanent.getControllerId().equals(controllerId)) {
Zone after = game.getState().getZone(event.getTargetId());
return after != null && Zone.GRAVEYARD.match(after);
}
return false;
}

View file

@ -39,6 +39,7 @@ import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
@ -83,21 +84,24 @@ class SigilCaptainTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent == null) {
return false;
}
if (permanent.getControllerId().equals(controllerId)
&& permanent.getPower().getValue() == 1
&& permanent.getToughness().getValue() == 1) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}
return true;
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent == null) {
return false;
}
if (permanent.getControllerId().equals(controllerId)
&& permanent.getPower().getValue() == 1
&& permanent.getToughness().getValue() == 1) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}
return true;
}
return false;
}

View file

@ -28,10 +28,6 @@
package mage.sets.alarareborn;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -39,7 +35,10 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.ExaltedAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.other.AuraCardCanAttachToPermanentId;
@ -99,14 +98,17 @@ class CreatureControlledAttacksAloneTriggeredAbility extends TriggeredAbilityImp
return new CreatureControlledAttacksAloneTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (game.getActivePlayerId().equals(this.controllerId)) {
if (event.getType() == EventType.DECLARED_ATTACKERS) {
if (game.getCombat().attacksAlone()) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
return true;
}
if (game.getCombat().attacksAlone()) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0)));
return true;
}
}
return false;

View file

@ -44,6 +44,7 @@ import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.targetpointer.FixedTarget;
/**
@ -139,15 +140,15 @@ class PlayerSacrificesCreatureTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SACRIFICED_PERMANENT;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SACRIFICED_PERMANENT) {
MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (mageObject != null && mageObject.getCardType().contains(CardType.CREATURE)) {
return true;
}
}
return false;
MageObject mageObject = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
return mageObject != null && mageObject.getCardType().contains(CardType.CREATURE);
}
@Override

View file

@ -28,18 +28,15 @@
package mage.sets.alarareborn;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AddManaAnyColorAttachedControllerEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.ShroudAbility;
import mage.abilities.mana.TriggeredManaAbility;
import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
@ -48,8 +45,8 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
@ -109,15 +106,15 @@ class TraceOfAbundanceTriggeredAbility extends TriggeredManaAbility {
return new TraceOfAbundanceTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TAPPED_FOR_MANA;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (event.getType() == GameEvent.EventType.TAPPED_FOR_MANA) {
if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) {
return true;
}
}
return false;
return enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo());
}
@Override

View file

@ -48,6 +48,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
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.game.permanent.token.ZombieToken;
@ -103,9 +104,14 @@ class UnscytheKillerOfKingsTriggeredAbility extends TriggeredAbilityImpl {
return new UnscytheKillerOfKingsTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) {
if (((ZoneChangeEvent) event).isDiesEvent()) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getTarget().getCardType().contains(CardType.CREATURE)) { // target token can't create Zombie
Permanent equipment = game.getPermanent(getSourceId());

View file

@ -38,6 +38,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.targetpointer.FixedTarget;
/**
@ -82,9 +83,14 @@ class VedalkenGhoulTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.CREATURE_BLOCKED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.CREATURE_BLOCKED && event.getTargetId().equals(this.getSourceId())) {
if (event.getTargetId().equals(this.getSourceId())) {
UUID defendingPlayer = game.getCombat().getDefenderId(this.getSourceId());
if (defendingPlayer != null) {
for (Effect effect : this.getEffects()) {

View file

@ -29,20 +29,20 @@
package mage.sets.apocalypse;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.Spell;
/**
@ -87,15 +87,15 @@ class BogGnarrTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && filter.match(spell, game)) {
return true;
}
}
return false;
Spell spell = game.getStack().getSpell(event.getTargetId());
return spell != null && filter.match(spell, game);
}
@Override

View file

@ -27,23 +27,23 @@
*/
package mage.sets.apocalypse;
import mage.constants.CardType;
import mage.constants.Rarity;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.Spell;
import java.util.UUID;
/**
* @author Loki
*/
@ -85,15 +85,15 @@ class GladeGnarrTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && filter.match(spell, game)) {
return true;
}
}
return false;
Spell spell = game.getStack().getSpell(event.getTargetId());
return spell != null && filter.match(spell, game);
}
@Override

View file

@ -27,16 +27,16 @@
*/
package mage.sets.avacynrestored;
import mage.constants.CardType;
import mage.constants.Rarity;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import java.util.UUID;
import mage.game.events.GameEvent.EventType;
/**
* @author noxx
@ -78,9 +78,14 @@ class ExquisiteBloodTriggeredAbility extends TriggeredAbilityImpl {
return new ExquisiteBloodTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.LOST_LIFE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.LOST_LIFE && game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
this.getEffects().clear();
this.addEffect(new GainLifeEffect(event.getAmount()));
return true;

View file

@ -27,22 +27,22 @@
*/
package mage.sets.avacynrestored;
import mage.constants.CardType;
import mage.constants.Rarity;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author noxx
@ -89,9 +89,14 @@ class HavengulSkaabAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
if (event.getSourceId().equals(this.getSourceId())) {
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, filter, false);
this.addTarget(target);
return true;

View file

@ -42,6 +42,7 @@ import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
/**
@ -91,10 +92,14 @@ class LoneRevenantTriggeredAbility extends TriggeredAbilityImpl {
return new LoneRevenantTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId)
&& ((DamagedPlayerEvent) event).isCombatDamage()) {
if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) {
Permanent permanent = game.getPermanent(event.getSourceId());
int number = game.getBattlefield().countAll(filter, controllerId, game);

View file

@ -27,9 +27,8 @@
*/
package mage.sets.avacynrestored;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
@ -37,18 +36,18 @@ import mage.abilities.effects.common.DestroySourceEffect;
import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
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.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
import mage.MageObject;
import mage.game.stack.Spell;
/**
*
* @author noxx
@ -99,16 +98,19 @@ class SpectralPrisonAbility extends TriggeredAbilityImpl {
return new SpectralPrisonAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TARGETED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.TARGETED) {
MageObject eventSourceObject = game.getObject(event.getSourceId());
if (eventSourceObject != null && eventSourceObject instanceof Spell) {
Permanent enchantment = game.getPermanent(sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (event.getTargetId().equals(enchantment.getAttachedTo())) {
return true;
}
MageObject eventSourceObject = game.getObject(event.getSourceId());
if (eventSourceObject != null && eventSourceObject instanceof Spell) {
Permanent enchantment = game.getPermanent(sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (event.getTargetId().equals(enchantment.getAttachedTo())) {
return true;
}
}
}

View file

@ -28,14 +28,14 @@
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -93,9 +93,13 @@ class JettingGlasskiteAbility extends TriggeredAbilityImpl {
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.TARGETED && event.getTargetId().equals(this.getSourceId()) && game.getTurnNum() > turnUsed) {
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TARGETED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(this.getSourceId()) && game.getTurnNum() > turnUsed) {
this.getTargets().clear();
TargetStackObject target = new TargetStackObject();
target.add(event.getSourceId(), game);

View file

@ -28,10 +28,6 @@
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -39,9 +35,13 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.SoulshiftAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player;
/**
@ -92,11 +92,16 @@ class KamiOfTheHonoredDeadTriggeredAbility extends TriggeredAbilityImpl {
return new KamiOfTheHonoredDeadTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_CREATURE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId)) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
return true;
if (event.getTargetId().equals(this.sourceId)) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
return true;
}
return false;
}

View file

@ -30,10 +30,6 @@ package mage.sets.betrayersofkamigawa;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
@ -41,6 +37,10 @@ import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
@ -102,20 +102,25 @@ class KiraGreatGlassSpinnerAbility extends TriggeredAbilityImpl {
return new KiraGreatGlassSpinnerAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TARGETED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.TARGETED && event.getTargetId().equals(this.getSourceId())) {
if (event.getTargetId().equals(this.getSourceId())) {
Integer turn = turnUsed.get(event.getTargetId());
if (turn == null || turn.intValue() < game.getTurnNum()) {
if (turn == null || turn < game.getTurnNum()) {
this.getTargets().clear();
TargetStackObject target = new TargetStackObject();
target.add(event.getSourceId(), game);
this.addTarget(target);
if (turnUsed.containsKey(event.getTargetId())) {
turnUsed.remove(event.getTargetId());
turnUsed.put(event.getTargetId(),new Integer(game.getTurnNum()));
turnUsed.put(event.getTargetId(), game.getTurnNum());
} else {
turnUsed.put(event.getTargetId(), new Integer(game.getTurnNum()));
turnUsed.put(event.getTargetId(), game.getTurnNum());
}
return true;

View file

@ -44,8 +44,9 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.DamagedEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
@ -101,18 +102,21 @@ class MarkOfSakikoTriggeredAbility extends TriggeredAbilityImpl {
return new MarkOfSakikoTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
if (((DamagedPlayerEvent) event).isCombatDamage()) {
if (event.getSourceId().equals(getSourceId())) {
this.getEffects().clear();
Effect effect = new AddManaToManaPoolTargetControllerEffect(new Mana(0,event.getAmount(),0,0,0,0,0), "that player", true);
effect.setTargetPointer(new FixedTarget(getControllerId()));
effect.setText("add that much {G} to your mana pool. Until end of turn, this mana doesn't empty from your mana pool as steps and phases end");
this.addEffect(effect);
return true;
}
if (((DamagedEvent) event).isCombatDamage()) {
if (event.getSourceId().equals(getSourceId())) {
this.getEffects().clear();
Effect effect = new AddManaToManaPoolTargetControllerEffect(new Mana(0,event.getAmount(),0,0,0,0,0), "that player", true);
effect.setTargetPointer(new FixedTarget(getControllerId()));
effect.setText("add that much {G} to your mana pool. Until end of turn, this mana doesn't empty from your mana pool as steps and phases end");
this.addEffect(effect);
return true;
}
}
return false;

View file

@ -28,20 +28,21 @@
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.keyword.NinjutsuAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
@ -92,10 +93,14 @@ class MistbladeShinobiTriggeredAbility extends TriggeredAbilityImpl {
return new MistbladeShinobiTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent
&& ((DamagedPlayerEvent) event).isCombatDamage()
if (((DamagedPlayerEvent) event).isCombatDamage()
&& event.getSourceId().equals(sourceId)) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null) {

View file

@ -28,9 +28,6 @@
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
@ -38,6 +35,9 @@ import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.keyword.OfferingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -87,17 +87,20 @@ class PatronOfTheNezumiTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD
&& zEvent.getToZone() == Zone.GRAVEYARD) {
Card card = game.getCard(zEvent.getTargetId());
if (card != null && game.getOpponents(controllerId).contains(card.getOwnerId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(zEvent.getPlayerId()));
return true;
}
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD
&& zEvent.getToZone() == Zone.GRAVEYARD) {
Card card = game.getCard(zEvent.getTargetId());
if (card != null && game.getOpponents(controllerId).contains(card.getOwnerId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(zEvent.getPlayerId()));
return true;
}
}
return false;

View file

@ -28,10 +28,6 @@
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
@ -40,8 +36,13 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
@ -88,25 +89,28 @@ public class RoninWarclub extends CardImpl {
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.getCardType().contains(CardType.CREATURE)
&& (permanent.getControllerId().equals(this.controllerId))) {
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
}
if (!this.getTargets().isEmpty()) {
// remove previous target
if (this.getTargets().get(0).getTargets().size() > 0) {
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent());
}
Target target = this.getTargets().get(0);
if (target instanceof TargetCreaturePermanent) {
target.add(event.getTargetId(), game);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.getCardType().contains(CardType.CREATURE)
&& (permanent.getControllerId().equals(this.controllerId))) {
if (!this.getTargets().isEmpty()) {
// remove previous target
if (this.getTargets().get(0).getTargets().size() > 0) {
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent());
}
Target target = this.getTargets().get(0);
if (target instanceof TargetCreaturePermanent) {
target.add(event.getTargetId(), game);
}
return true;
}
return true;
}
return false;
}

View file

@ -33,15 +33,14 @@ import mage.Mana;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AddManaToManaPoolTargetControllerEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
@ -91,19 +90,22 @@ class SakikoMotherOfSummerTriggeredAbility extends TriggeredAbilityImpl {
return new SakikoMotherOfSummerTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
if (((DamagedPlayerEvent) event).isCombatDamage()) {
Permanent creature = game.getPermanent(event.getSourceId());
if (creature != null && creature.getControllerId().equals(controllerId)) {
this.getEffects().clear();
Effect effect = new AddManaToManaPoolTargetControllerEffect(new Mana(0,event.getAmount(),0,0,0,0,0), "that player", true);
effect.setTargetPointer(new FixedTarget(creature.getControllerId()));
effect.setText("add that much {G} to your mana pool. Until end of turn, this mana doesn't empty from your mana pool as steps and phases end");
this.addEffect(effect);
return true;
}
if (((DamagedPlayerEvent) event).isCombatDamage()) {
Permanent creature = game.getPermanent(event.getSourceId());
if (creature != null && creature.getControllerId().equals(controllerId)) {
this.getEffects().clear();
Effect effect = new AddManaToManaPoolTargetControllerEffect(new Mana(0,event.getAmount(),0,0,0,0,0), "that player", true);
effect.setTargetPointer(new FixedTarget(creature.getControllerId()));
effect.setText("add that much {G} to your mana pool. Until end of turn, this mana doesn't empty from your mana pool as steps and phases end");
this.addEffect(effect);
return true;
}
}
return false;

View file

@ -28,14 +28,14 @@
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
@ -93,9 +93,13 @@ class ShimmeringGlasskiteAbility extends TriggeredAbilityImpl {
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.TARGETED && event.getTargetId().equals(this.getSourceId()) && game.getTurnNum() > turnUsed) {
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TARGETED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(this.getSourceId()) && game.getTurnNum() > turnUsed) {
this.getTargets().clear();
TargetStackObject target = new TargetStackObject();
target.add(event.getSourceId(), game);

View file

@ -94,23 +94,26 @@ class ShireiShizosCaretakerTriggeredAbility extends TriggeredAbilityImpl {
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
Permanent LKIpermanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId());
Card card = game.getCard(zEvent.getTargetId());
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
if (card != null && LKIpermanent != null &&
card.getOwnerId().equals(this.controllerId) &&
zEvent.getToZone() == Zone.GRAVEYARD &&
zEvent.getFromZone() == Zone.BATTLEFIELD &&
card.getCardType().contains(CardType.CREATURE) &&
LKIpermanent.getPower().getValue() <= 1) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(zEvent.getTargetId()));
}
return true;
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
Permanent LKIpermanent = game.getPermanentOrLKIBattlefield(zEvent.getTargetId());
Card card = game.getCard(zEvent.getTargetId());
if (card != null && LKIpermanent != null &&
card.getOwnerId().equals(this.controllerId) &&
zEvent.getToZone() == Zone.GRAVEYARD &&
zEvent.getFromZone() == Zone.BATTLEFIELD &&
card.getCardType().contains(CardType.CREATURE) &&
LKIpermanent.getPower().getValue() <= 1) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(zEvent.getTargetId()));
}
return true;
}
return false;
}

View file

@ -28,9 +28,6 @@
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -38,6 +35,8 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.keyword.NinjutsuAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledCreaturePermanent;
@ -46,6 +45,7 @@ import mage.filter.predicate.permanent.UnblockedPredicate;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.common.TargetCardInOpponentsGraveyard;
/**
@ -103,10 +103,14 @@ class SkullsnatcherTriggeredAbility extends TriggeredAbilityImpl {
return new SkullsnatcherTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent
&& ((DamagedPlayerEvent) event).isCombatDamage()
if (((DamagedPlayerEvent) event).isCombatDamage()
&& event.getSourceId().equals(sourceId)) {
FilterCard filter = new FilterCard("up to two target cards from that player's graveyard");

View file

@ -28,9 +28,6 @@
package mage.sets.betrayersofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.TriggeredAbilityImpl;
@ -38,6 +35,9 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.NinjutsuAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
@ -45,6 +45,7 @@ import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.TargetPermanent;
/**
@ -94,10 +95,14 @@ class ThroatSlitterTriggeredAbility extends TriggeredAbilityImpl {
return new ThroatSlitterTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent
&& ((DamagedPlayerEvent) event).isCombatDamage()
if (((DamagedPlayerEvent) event).isCombatDamage()
&& event.getSourceId().equals(sourceId)) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("nonblack creature that player controls");

View file

@ -45,6 +45,7 @@ import mage.constants.SubLayer;
import mage.constants.Zone;
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;
@ -130,9 +131,14 @@ class PerplexingChimeraTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST && game.getOpponents(controllerId).contains(event.getPlayerId())) {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}

View file

@ -115,9 +115,14 @@ class SearingBloodDelayedTriggeredAbility extends DelayedTriggeredAbility {
this.target = ability.target;
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(target)) {
if (event.getTargetId().equals(target)) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
return true;

View file

@ -42,6 +42,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
@ -94,26 +95,28 @@ class SpitefulReturnedTriggeredAbility extends TriggeredAbilityImpl {
return new SpitefulReturnedTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) {
Permanent sourcePermanent = game.getPermanent(this.getSourceId());
if (sourcePermanent != null) {
if (sourcePermanent.getCardType().contains(CardType.CREATURE)) {
if (event.getSourceId() == this.getSourceId()) {
UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
return true;
}
} else {
if (sourcePermanent.getAttachedTo() != null && sourcePermanent.getAttachedTo().equals(event.getSourceId())) {
UUID defender = game.getCombat().getDefendingPlayerId(sourcePermanent.getAttachedTo(), game);
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
return true;
}
Permanent sourcePermanent = game.getPermanent(this.getSourceId());
if (sourcePermanent != null) {
if (sourcePermanent.getCardType().contains(CardType.CREATURE)) {
if (event.getSourceId() == this.getSourceId()) {
UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
return true;
}
} else {
if (sourcePermanent.getAttachedTo() != null && sourcePermanent.getAttachedTo().equals(event.getSourceId())) {
UUID defender = game.getCombat().getDefendingPlayerId(sourcePermanent.getAttachedTo(), game);
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
return true;
}
}
}
return false;
}

View file

@ -1,5 +1,6 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
@ -11,16 +12,19 @@ import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.token.Token;
import java.util.UUID;
/**
* @author Loki
*/
@ -68,15 +72,15 @@ class AkkiLavarunnerAbility extends TriggeredAbilityImpl {
return new AkkiLavarunnerAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
if (damageEvent.isCombatDamage() && this.sourceId.equals(event.getSourceId())) {
return true;
}
}
return false;
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
return damageEvent.isCombatDamage() && this.sourceId.equals(event.getSourceId());
}
@Override

View file

@ -29,19 +29,19 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.SacrificeEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.targetpointer.FixedTarget;
/**
@ -88,16 +88,19 @@ class AkkiUnderminerAbility extends TriggeredAbilityImpl {
return new AkkiUnderminerAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
}
return false;
}

View file

@ -28,18 +28,18 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.Spell;
public class GlimpseOfNature extends CardImpl {
@ -79,9 +79,14 @@ class GlimpseOfNatureTriggeredAbility extends DelayedTriggeredAbility {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.getControllerId())) {
if (event.getPlayerId().equals(this.getControllerId())) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && filter.match(spell, game)) {
return true;

View file

@ -109,16 +109,21 @@ class GodoBanditWarlordAttacksTriggeredAbility extends TriggeredAbilityImpl {
@Override
public void reset(Game game) {
game.getState().setValue(CardUtil.getCardZoneString("amountAttacks", this.getSourceId(), game), new Integer(0));
game.getState().setValue(CardUtil.getCardZoneString("amountAttacks", this.getSourceId(), game), 0);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId()) ) {
if (event.getSourceId().equals(this.getSourceId()) ) {
Integer amountAttacks = (Integer) game.getState().getValue(CardUtil.getCardZoneString("amountAttacks", this.getSourceId(), game));
if (amountAttacks == null || amountAttacks.intValue() < 1) {
if (amountAttacks == null || amountAttacks < 1) {
if (amountAttacks == null) {
amountAttacks = new Integer(1);
amountAttacks = 1;
} else {
++amountAttacks;
}

View file

@ -97,14 +97,17 @@ class HorobiDeathsWailAbility extends TriggeredAbilityImpl {
return new HorobiDeathsWailAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TARGETED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.TARGETED) {
Permanent creature = game.getPermanent(event.getTargetId());
if (creature != null && creature.getCardType().contains(CardType.CREATURE)) {
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
return true;
}
Permanent creature = game.getPermanent(event.getTargetId());
if (creature != null && creature.getCardType().contains(CardType.CREATURE)) {
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
return true;
}
return false;
}

View file

@ -48,8 +48,8 @@ import mage.constants.Zone;
import mage.filter.common.FilterBlockingCreature;
import mage.filter.common.FilterCreaturePermanent;
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;
/**
@ -102,16 +102,19 @@ class KusariGamaAbility extends TriggeredAbilityImpl {
return new KusariGamaAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_CREATURE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedEvent) {
Permanent sourcePermanet = game.getPermanent(event.getSourceId());
Permanent targetPermanet = game.getPermanent(event.getTargetId());
if (sourcePermanet != null && targetPermanet != null && sourcePermanet.getAttachments().contains(this.getSourceId()) && filter.match(targetPermanet, game)) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
this.getEffects().get(0).setValue("damagedCreatureId", targetPermanet.getId());
return true;
}
Permanent sourcePermanet = game.getPermanent(event.getSourceId());
Permanent targetPermanet = game.getPermanent(event.getTargetId());
if (sourcePermanet != null && targetPermanet != null && sourcePermanet.getAttachments().contains(this.getSourceId()) && filter.match(targetPermanet, game)) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
this.getEffects().get(0).setValue("damagedCreatureId", targetPermanet.getId());
return true;
}
return false;
}

View file

@ -44,6 +44,7 @@ import mage.filter.common.FilterLandPermanent;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
/**
@ -92,9 +93,14 @@ class NaturesWillTriggeredAbility extends TriggeredAbilityImpl {
return new NaturesWillTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER || event.getType() == EventType.COMBAT_DAMAGE_STEP_POST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent) {
if (event.getType() == EventType.DAMAGED_PLAYER) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
Permanent p = game.getPermanent(event.getSourceId());
if (damageEvent.isCombatDamage() && p != null && p.getControllerId().equals(this.getControllerId())) {
@ -102,7 +108,7 @@ class NaturesWillTriggeredAbility extends TriggeredAbilityImpl {
damagedPlayers.add(event.getPlayerId());
}
}
if (event.getType().equals(GameEvent.EventType.COMBAT_DAMAGE_STEP_POST)) {
if (event.getType().equals(EventType.COMBAT_DAMAGE_STEP_POST)) {
if (madeDamge) {
Set<UUID> damagedPlayersCopy = new HashSet<UUID>();
damagedPlayersCopy.addAll(damagedPlayers);

View file

@ -29,11 +29,6 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
@ -41,8 +36,13 @@ import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
@ -99,16 +99,19 @@ class RaggedVeinsTriggeredAbility extends TriggeredAbilityImpl {
return new RaggedVeinsTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_CREATURE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) {
Permanent enchantment = game.getPermanent(sourceId);
UUID targetId = event.getTargetId();
if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId));
return true;
}
Permanent enchantment = game.getPermanent(sourceId);
UUID targetId = event.getTargetId();
if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId));
return true;
}
return false;
}

View file

@ -29,22 +29,22 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
/**
@ -97,14 +97,17 @@ class SeshiroTheAnointedAbility extends TriggeredAbilityImpl {
return new SeshiroTheAnointedAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
Permanent p = game.getPermanent(event.getSourceId());
if (damageEvent.isCombatDamage() && p != null && p.hasSubtype("Snake") && p.getControllerId().equals(controllerId)) {
return true;
}
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
Permanent p = game.getPermanent(event.getSourceId());
if (damageEvent.isCombatDamage() && p != null && p.hasSubtype("Snake") && p.getControllerId().equals(controllerId)) {
return true;
}
return false;
}

View file

@ -28,8 +28,6 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -39,11 +37,17 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.DamagedCreatureEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
@ -100,17 +104,20 @@ class SosukeSonOfSeshiroTriggeredAbility extends TriggeredAbilityImpl {
return new SosukeSonOfSeshiroTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_CREATURE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedCreatureEvent) {
if (((DamagedCreatureEvent) event).isCombatDamage()) {
Permanent sourceCreature = game.getPermanent(event.getSourceId());
Permanent targetCreature = game.getPermanent(event.getTargetId());
if (sourceCreature != null && sourceCreature.getControllerId().equals(this.getControllerId())
&& targetCreature != null && sourceCreature.hasSubtype("Warrior")) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId()));
return true;
}
if (((DamagedCreatureEvent) event).isCombatDamage()) {
Permanent sourceCreature = game.getPermanent(event.getSourceId());
Permanent targetCreature = game.getPermanent(event.getTargetId());
if (sourceCreature != null && sourceCreature.getControllerId().equals(this.getControllerId())
&& targetCreature != null && sourceCreature.hasSubtype("Warrior")) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(targetCreature.getId()));
return true;
}
}
return false;

View file

@ -49,6 +49,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.token.Token;
import mage.target.targetpointer.FixedTarget;
@ -137,9 +138,14 @@ class TatsumaTheDragonsFangTriggeredAbility extends DelayedTriggeredAbility {
return new TatsumaTheDragonsFangTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) {
if (((ZoneChangeEvent) event).isDiesEvent()) {
if (fixedTarget.getFirst(game, this).equals(event.getTargetId())) {
return true;
}

View file

@ -42,6 +42,7 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -80,13 +81,16 @@ class BlocksTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DECLARED_BLOCKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DECLARED_BLOCKERS) {
for (CombatGroup combatGroup: game.getCombat().getGroups()) {
if (!combatGroup.getBlockers().isEmpty()) {
return true;
}
for (CombatGroup combatGroup: game.getCombat().getGroups()) {
if (!combatGroup.getBlockers().isEmpty()) {
return true;
}
}
return false;

View file

@ -28,19 +28,19 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.Game;
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;
@ -95,18 +95,21 @@ class ZoZuThePunisherAbility extends TriggeredAbilityImpl {
return new ZoZuThePunisherAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.getCardType().contains(CardType.LAND)) {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(player.getId()));
}
return true;
if (permanent != null && permanent.getCardType().contains(CardType.LAND)) {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(player.getId()));
}
return true;
}
}
return false;

View file

@ -28,11 +28,6 @@
package mage.sets.coldsnap;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
@ -43,10 +38,16 @@ import mage.abilities.effects.common.ReturnToBattlefieldUnderYourControlTargetEf
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
@ -141,9 +142,14 @@ class AdarkarValkyrieDelayedTriggeredAbility extends DelayedTriggeredAbility {
return new AdarkarValkyrieDelayedTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) {
if (((ZoneChangeEvent) event).isDiesEvent()) {
if (fixedTarget.getFirst(game, this).equals(event.getTargetId())) {
return true;
}

View file

@ -40,6 +40,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.token.SoldierToken;
import mage.players.Player;
@ -87,12 +88,17 @@ class DarienKingOfKjeldorTriggeredAbility extends TriggeredAbilityImpl {
return new DarienKingOfKjeldorTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if ((event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.getControllerId()))) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
return true;
}
if ((event.getTargetId().equals(this.getControllerId()))) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
return true;
}
return false;
}

View file

@ -45,6 +45,7 @@ import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.turn.TurnMod;
import mage.target.common.TargetCardInHand;
@ -180,6 +181,11 @@ class DelayedAddMainPhaseAbility extends DelayedTriggeredAbility {
return new DelayedAddMainPhaseAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.PHASE_CHANGED || event.getType() == EventType.COMBAT_PHASE_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.PHASE_CHANGED && this.connectedTurnMod.equals(event.getSourceId())) {

View file

@ -87,10 +87,13 @@ class EdricSpymasterOfTrestTriggeredAbility extends TriggeredAbilityImpl {
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
if (event.getType().equals(EventType.DAMAGED_PLAYER) &&
((DamagedPlayerEvent) event).isCombatDamage() &&
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (((DamagedPlayerEvent) event).isCombatDamage() &&
game.getOpponents(this.controllerId).contains(((DamagedPlayerEvent) event).getPlayerId())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getPermanent(event.getSourceId()).getControllerId()));

View file

@ -30,15 +30,15 @@ package mage.sets.commander;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
@ -94,9 +94,14 @@ class KaaliaOfTheVastAttacksAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId())) {
if (event.getSourceId().equals(this.getSourceId())) {
Player opponent = game.getPlayer(event.getTargetId());
if (opponent != null) {
return true;

View file

@ -27,6 +27,7 @@
*/
package mage.sets.commander;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -38,16 +39,19 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveTargetEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.cards.CardImpl;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author LevelX2
@ -155,15 +159,17 @@ class SewerNemesisTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
// chosen player casts a spell
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
UUID playerId = (UUID) game.getState().getValue(getSourceId() + "_player");
if (playerId.equals(event.getPlayerId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(playerId));
return true;
}
UUID playerId = (UUID) game.getState().getValue(getSourceId() + "_player");
if (playerId.equals(event.getPlayerId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(playerId));
return true;
}
return false;
}

View file

@ -90,18 +90,21 @@ class CurseOfChaosTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(EventType.DECLARED_ATTACKERS)) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
}
return true;
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
}
return true;
}
return false;
}

View file

@ -94,26 +94,29 @@ class CurseOfPredationTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(EventType.ATTACKER_DECLARED)) {
Player defender = game.getPlayer(event.getTargetId());
if (defender == null) {
Permanent planeswalker = game.getPermanent(event.getTargetId());
if (planeswalker != null) {
defender = game.getPlayer(planeswalker.getControllerId());
}
Player defender = game.getPlayer(event.getTargetId());
if (defender == null) {
Permanent planeswalker = game.getPermanent(event.getTargetId());
if (planeswalker != null) {
defender = game.getPlayer(planeswalker.getControllerId());
}
if (defender != null) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& enchantment.getAttachedTo().equals(defender.getId())) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
}
return true;
}
if (defender != null) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& enchantment.getAttachedTo().equals(defender.getId())) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
}
return true;
}
}
return false;

View file

@ -44,7 +44,6 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.ZombieToken;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.targetpointer.FixedTarget;
@ -95,18 +94,21 @@ class CurseOfShallowTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(EventType.DECLARED_ATTACKERS)) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
}
return true;
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& game.getCombat().getPlayerDefenders(game).contains(enchantment.getAttachedTo())) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackerId()));
}
return true;
}
return false;
}

View file

@ -93,26 +93,29 @@ class CurseOfTheForsakenTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(EventType.ATTACKER_DECLARED)) {
Player defender = game.getPlayer(event.getTargetId());
if (defender == null) {
Permanent planeswalker = game.getPermanent(event.getTargetId());
if (planeswalker != null) {
defender = game.getPlayer(planeswalker.getControllerId());
}
Player defender = game.getPlayer(event.getTargetId());
if (defender == null) {
Permanent planeswalker = game.getPermanent(event.getTargetId());
if (planeswalker != null) {
defender = game.getPlayer(planeswalker.getControllerId());
}
if (defender != null) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& enchantment.getAttachedTo().equals(defender.getId())) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
}
if (defender != null) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if (enchantment != null
&& enchantment.getAttachedTo() != null
&& enchantment.getAttachedTo().equals(defender.getId())) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
}
}
return false;

View file

@ -46,6 +46,7 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
@ -97,6 +98,11 @@ class DereviEmpyrialTacticianTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD || event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD

View file

@ -89,24 +89,27 @@ class GahijiHonoredOneTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(EventType.ATTACKER_DECLARED)) {
Player defender = game.getPlayer(event.getTargetId());
if (defender == null) {
Permanent planeswalker = game.getPermanent(event.getTargetId());
if (planeswalker != null) {
defender = game.getPlayer(planeswalker.getControllerId());
}
Player defender = game.getPlayer(event.getTargetId());
if (defender == null) {
Permanent planeswalker = game.getPermanent(event.getTargetId());
if (planeswalker != null) {
defender = game.getPlayer(planeswalker.getControllerId());
}
if (defender != null) {
Set<UUID> opponents = game.getOpponents(this.getControllerId());
if (opponents != null && opponents.contains(defender.getId())) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
}
return true;
}
if (defender != null) {
Set<UUID> opponents = game.getOpponents(this.getControllerId());
if (opponents != null && opponents.contains(defender.getId())) {
for (Effect effect: this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getSourceId()));
}
return true;
}
}
return false;

View file

@ -41,6 +41,7 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.Spell;
import mage.target.TargetSpell;
@ -95,9 +96,14 @@ class MirariTriggeredAbility extends TriggeredAbilityImpl {
return new MirariTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.getControllerId())) {
if (event.getPlayerId().equals(this.getControllerId())) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (isControlledInstantOrSorcery(spell)) {
this.getTargets().get(0).clearChosen();

View file

@ -126,9 +126,14 @@ class PlagueBoilerTriggeredAbility extends TriggeredAbilityImpl {
return new PlagueBoilerTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.COUNTER_ADDED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(EventType.COUNTER_ADDED) && event.getTargetId().equals(this.getSourceId()) && event.getData().equals(CounterType.PLAGUE.getName())) {
if (event.getTargetId().equals(this.getSourceId()) && event.getData().equals(CounterType.PLAGUE.getName())) {
Permanent sourcePermanent = game.getPermanent(this.getSourceId());
if (sourcePermanent != null && sourcePermanent.getCounters().getCount(CounterType.PLAGUE) >= 3) {
return true;

View file

@ -117,9 +117,14 @@ class ReincarnationDelayedTriggeredAbility extends DelayedTriggeredAbility {
this.target = ability.target;
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(target)) {
if (event.getTargetId().equals(target)) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
return true;

View file

@ -48,6 +48,7 @@ import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
*
@ -93,9 +94,14 @@ class SunDropletTriggeredAbility extends TriggeredAbilityImpl {
return new SunDropletTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if ((event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getTargetId().equals(this.getControllerId()))) {
if (event.getTargetId().equals(this.getControllerId())) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
return true;
}

View file

@ -40,6 +40,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
import mage.target.targetpointer.FixedTarget;
@ -84,15 +85,17 @@ class WidespreadPanicTriggeredAbility extends TriggeredAbilityImpl {
return new WidespreadPanicTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.LIBRARY_SHUFFLED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(GameEvent.EventType.LIBRARY_SHUFFLED)) {
for(Effect effect :this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
for (Effect effect :this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return false;
return true;
}
@Override

View file

@ -200,19 +200,22 @@ class DarettiScrapSavantTriggeredAbility extends TriggeredAbilityImpl {
return new DarettiScrapSavantTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.ZONE_CHANGE) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Zone.GRAVEYARD &&
zEvent.getFromZone() == Zone.BATTLEFIELD &&
zEvent.getTarget().getCardType().contains(CardType.ARTIFACT) &&
zEvent.getTarget().getOwnerId().equals(this.controllerId)) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(zEvent.getTargetId()));
}
return true;
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.getToZone() == Zone.GRAVEYARD &&
zEvent.getFromZone() == Zone.BATTLEFIELD &&
zEvent.getTarget().getCardType().contains(CardType.ARTIFACT) &&
zEvent.getTarget().getOwnerId().equals(this.controllerId)) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(zEvent.getTargetId()));
}
return true;
}
return false;
}

View file

@ -103,10 +103,15 @@ class PlayerLosesTheGameTriggeredAbility extends TriggeredAbilityImpl {
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.LOSES;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return true;
}
@Override
public String getRule() {
return "Whenever a player loses the game, put five +1/+1 counters on {this}.";

View file

@ -28,14 +28,15 @@
package mage.sets.conflux;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
@ -44,8 +45,6 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import java.util.UUID;
/**
*
* @author loki
@ -95,9 +94,14 @@ class BloodhallOozeTriggeredAbility1 extends TriggeredAbilityImpl {
return new BloodhallOozeTriggeredAbility1(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.UPKEEP_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) {
if (event.getPlayerId().equals(this.controllerId)) {
return true;
}
return false;
@ -135,9 +139,14 @@ class BloodhallOozeTriggeredAbility2 extends TriggeredAbilityImpl {
return new BloodhallOozeTriggeredAbility2(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.UPKEEP_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) {
if (event.getPlayerId().equals(this.controllerId)) {
return true;
}
return false;

View file

@ -44,6 +44,7 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetLandPermanent;
@ -101,18 +102,21 @@ class CorruptedRootsTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TAPPED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.TAPPED) {
Permanent enchantment = game.getPermanent(this.sourceId);
if (enchantment != null && enchantment.getAttachedTo().equals(event.getTargetId())) {
Permanent attached = game.getPermanent(enchantment.getAttachedTo());
if (attached != null) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(attached.getControllerId()));
}
return true;
Permanent enchantment = game.getPermanent(this.sourceId);
if (enchantment != null && enchantment.getAttachedTo().equals(event.getTargetId())) {
Permanent attached = game.getPermanent(enchantment.getAttachedTo());
if (attached != null) {
for (Effect effect : getEffects()) {
effect.setTargetPointer(new FixedTarget(attached.getControllerId()));
}
return true;
}
}
return false;

View file

@ -29,16 +29,15 @@
package mage.sets.conflux;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.DrawCardTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.TargetPlayer;
/**
@ -79,15 +78,17 @@ class FontOfMythosAbility extends TriggeredAbilityImpl {
return new FontOfMythosAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DRAW_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.DRAW_STEP_PRE) {
this.getTargets().clear();
this.addTarget(new TargetPlayer());
getTargets().get(0).add(event.getPlayerId(),game);
return true;
}
return false;
this.getTargets().clear();
this.addTarget(new TargetPlayer());
getTargets().get(0).add(event.getPlayerId(),game);
return true;
}
@Override

View file

@ -28,16 +28,16 @@
package mage.sets.conflux;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
@ -84,9 +84,14 @@ class KederektParasiteTriggeredAbility extends TriggeredAbilityImpl {
return new KederektParasiteTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DREW_CARD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DREW_CARD && game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) {
if (game.getOpponents(this.getControllerId()).contains(event.getPlayerId())) {
boolean youControlRedPermanent = false;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(this.getControllerId())) {
if (permanent.getColor(game).isRed()) {

View file

@ -92,12 +92,14 @@ class ParasiticStrixTriggeredAbility extends TriggeredAbilityImpl {
return new ParasiticStrixTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(EventType.ENTERS_THE_BATTLEFIELD) && event.getTargetId().equals(this.getSourceId())) {
return true;
}
return false;
return event.getTargetId().equals(this.getSourceId());
}
@Override

View file

@ -30,9 +30,6 @@ package mage.sets.conflux;
import java.util.UUID;
import mage.MageObject;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.SpecialAction;
@ -43,10 +40,12 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.RemoveDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.RemoveSpecialActionEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.TargetPlayer;
/**
@ -148,9 +147,14 @@ class QuenchableFireDelayedTriggeredAbility extends DelayedTriggeredAbility {
return new QuenchableFireDelayedTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.UPKEEP_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.UPKEEP_STEP_PRE && event.getPlayerId().equals(this.controllerId)) {
if (event.getPlayerId().equals(this.controllerId)) {
for (SpecialAction action: game.getState().getSpecialActions()) {
if (action.getId().equals(specialActionId)) {
game.getState().getSpecialActions().remove(action);
@ -178,5 +182,4 @@ class QuenchableFireSpecialAction extends SpecialAction {
public QuenchableFireSpecialAction copy() {
return new QuenchableFireSpecialAction(this);
}
}

View file

@ -45,6 +45,7 @@ import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
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;
@ -98,6 +99,11 @@ class SludgeStriderTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD || event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {

View file

@ -54,6 +54,7 @@ import mage.counters.CounterType;
import mage.game.Game;
import mage.game.command.Emblem;
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;
@ -130,13 +131,18 @@ class DackFaydenEmblemTriggeredAbility extends TriggeredAbilityImpl {
return new DackFaydenEmblemTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
boolean returnValue = false;
List<UUID> targettedPermanents = new ArrayList<>(0);
Player player = game.getPlayer(this.getControllerId());
if (player != null) {
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getPlayerId().equals(this.getControllerId())) {
if (event.getPlayerId().equals(this.getControllerId())) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null) {
SpellAbility spellAbility = spell.getSpellAbility();

View file

@ -28,11 +28,6 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
@ -42,8 +37,14 @@ import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
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.game.permanent.token.SpiritWhiteToken;
@ -93,9 +94,14 @@ class AvacynsCollarTriggeredAbility extends TriggeredAbilityImpl {
return new AvacynsCollarTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) {
if (((ZoneChangeEvent) event).isDiesEvent()) {
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (permanent.getAttachments().contains(this.getSourceId()) && permanent.hasSubtype("Human")) {
return true;

View file

@ -27,6 +27,7 @@
*/
package mage.sets.darkascension;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.dynamicvalue.DynamicValue;
@ -41,13 +42,12 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author BetaSteward
@ -97,16 +97,19 @@ class CurseOfThirstAbility extends TriggeredAbilityImpl {
return new CurseOfThirstAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.UPKEEP_STEP_PRE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.UPKEEP_STEP_PRE) {
Permanent enchantment = game.getPermanent(this.sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player player = game.getPlayer(enchantment.getAttachedTo());
if (player != null && game.getActivePlayerId().equals(player.getId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
return true;
}
Permanent enchantment = game.getPermanent(this.sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
Player player = game.getPlayer(enchantment.getAttachedTo());
if (player != null && game.getActivePlayerId().equals(player.getId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
return true;
}
}
return false;

View file

@ -27,8 +27,7 @@
*/
package mage.sets.darkascension;
import mage.constants.CardType;
import mage.constants.Rarity;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
@ -36,18 +35,19 @@ import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
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.target.common.TargetOpponent;
import java.util.UUID;
/**
*
* @author Loki
@ -103,9 +103,14 @@ class DiregrafCaptainTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && !event.getTargetId().equals(this.getSourceId())) {
if (!event.getTargetId().equals(this.getSourceId())) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
if (zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getToZone() == Zone.GRAVEYARD) {
Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);

View file

@ -40,6 +40,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
*
@ -87,9 +88,14 @@ class DrogskolReaverAbility extends TriggeredAbilityImpl {
return new DrogskolReaverAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.GAINED_LIFE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.GAINED_LIFE && event.getPlayerId().equals(controllerId);
return event.getPlayerId().equals(controllerId);
}
@Override

View file

@ -27,8 +27,7 @@
*/
package mage.sets.darkascension;
import mage.constants.CardType;
import mage.constants.Rarity;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -36,17 +35,18 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.UndyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreatureOrPlayer;
import java.util.UUID;
import mage.game.events.EntersTheBattlefieldEvent;
/**
*
* @author BetaSteward
@ -89,17 +89,20 @@ class FlayerTriggeredAbility extends TriggeredAbilityImpl {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (((EntersTheBattlefieldEvent) event).getFromZone() == Zone.GRAVEYARD
&& permanent.getOwnerId().equals(controllerId)
&& permanent.getCardType().contains(CardType.CREATURE)) {
Effect effect = this.getEffects().get(0);
effect.setValue("damageSource", event.getTargetId());
return true;
}
Permanent permanent = game.getPermanent(event.getTargetId());
if (((EntersTheBattlefieldEvent) event).getFromZone() == Zone.GRAVEYARD
&& permanent.getOwnerId().equals(controllerId)
&& permanent.getCardType().contains(CardType.CREATURE)) {
Effect effect = this.getEffects().get(0);
effect.setValue("damageSource", event.getTargetId());
return true;
}
return false;
}

View file

@ -51,6 +51,7 @@ import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInGraveyard;
@ -169,9 +170,14 @@ class HavengulLichDelayedTriggeredAbility extends DelayedTriggeredAbility {
this.cardId = ability.cardId;
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST && event.getSourceId().equals(cardId);
return event.getSourceId().equals(cardId);
}
@Override

View file

@ -28,16 +28,17 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
@ -85,15 +86,18 @@ class HellriderTriggeredAbility extends TriggeredAbilityImpl {
return new HellriderTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED) {
Permanent source = game.getPermanent(event.getSourceId());
if (source != null && source.getControllerId().equals(controllerId)) {
UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(event.getSourceId(), game);
this.getEffects().get(0).setTargetPointer(new FixedTarget(defendingPlayerId));
return true;
}
Permanent source = game.getPermanent(event.getSourceId());
if (source != null && source.getControllerId().equals(controllerId)) {
UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(event.getSourceId(), game);
this.getEffects().get(0).setTargetPointer(new FixedTarget(defendingPlayerId));
return true;
}
return false;
}

View file

@ -28,10 +28,6 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
@ -45,10 +41,15 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterCard;
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;
@ -100,10 +101,14 @@ class JarOfEyeballsTriggeredAbility extends TriggeredAbilityImpl {
return new JarOfEyeballsTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE
&& ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD
if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD
&& ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) {
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE)) {

View file

@ -28,18 +28,19 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.PutLibraryIntoGraveTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.targetpointer.FixedTarget;
/**
@ -86,16 +87,19 @@ class ShriekgeistTriggeredAbility extends TriggeredAbilityImpl {
return new ShriekgeistTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
}
return false;
}

View file

@ -28,10 +28,6 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
@ -39,12 +35,16 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
@ -99,19 +99,22 @@ class SoulSeizerTriggeredAbility extends TriggeredAbilityImpl {
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
filter.add(new ControllerIdPredicate(opponent.getId()));
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent(filter));
return true;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
Player opponent = game.getPlayer(event.getPlayerId());
if (opponent != null) {
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature " + opponent.getLogName() + " controls");
filter.add(new ControllerIdPredicate(opponent.getId()));
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent(filter));
return true;
}
}
return false;

View file

@ -28,18 +28,19 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
@ -92,16 +93,19 @@ class SpitefulShadowsTriggeredAbility extends TriggeredAbilityImpl {
return new SpitefulShadowsTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_CREATURE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE) {
Permanent enchantment = game.getPermanent(sourceId);
UUID targetId = event.getTargetId();
if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId));
return true;
}
Permanent enchantment = game.getPermanent(sourceId);
UUID targetId = event.getTargetId();
if (enchantment != null && enchantment.getAttachedTo() != null && targetId.equals(enchantment.getAttachedTo())) {
this.getEffects().get(0).setValue("damageAmount", event.getAmount());
this.getEffects().get(0).setTargetPointer(new FixedTarget(targetId));
return true;
}
return false;
}

View file

@ -28,10 +28,6 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.TriggeredAbilityImpl;
@ -42,8 +38,13 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.targetpointer.FixedTarget;
/**
@ -99,9 +100,14 @@ class TovolarsMagehunterTriggeredAbility extends TriggeredAbilityImpl {
return new TovolarsMagehunterTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST && game.getOpponents(controllerId).contains(event.getPlayerId())) {
if (game.getOpponents(controllerId).contains(event.getPlayerId())) {
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
return true;
}

View file

@ -28,7 +28,6 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
@ -42,11 +41,15 @@ import mage.abilities.effects.common.InfoEffect;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
@ -108,13 +111,17 @@ class WerewolfRansackerAbility extends TriggeredAbilityImpl {
return new WerewolfRansackerAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TRANSFORMED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.TRANSFORMED) {
if (event.getTargetId().equals(sourceId)) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && permanent.isTransformed())
return true;
if (event.getTargetId().equals(sourceId)) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && permanent.isTransformed()) {
return true;
}
}
return false;

View file

@ -28,9 +28,6 @@
package mage.sets.darkascension;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
@ -38,10 +35,13 @@ import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.IntimidateAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
*
@ -96,11 +96,14 @@ class WithengarUnboundTriggeredAbility extends TriggeredAbilityImpl {
return new WithengarUnboundTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.LOST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.LOST)
return true;
return false;
return true;
}
@Override

View file

@ -86,9 +86,14 @@ class LichsTombTriggeredAbility extends TriggeredAbilityImpl {
return new LichsTombTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.LOST_LIFE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.LOST_LIFE && event.getPlayerId() == this.getControllerId()) {
if (event.getPlayerId() == this.getControllerId()) {
((SacrificeEffect) this.getEffects().get(0)).setAmount(new StaticValue(event.getAmount()));
return true;
}

View file

@ -29,12 +29,6 @@
package mage.sets.darksteel;
import java.util.UUID;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.ObjectColor;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
@ -46,12 +40,18 @@ import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreatureOrPlayer;
@ -111,16 +111,16 @@ class SwordOfFireAndIceAbility extends TriggeredAbilityImpl {
return new SwordOfFireAndIceAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
Permanent p = game.getPermanent(event.getSourceId());
if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) {
return true;
}
}
return false;
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
Permanent p = game.getPermanent(event.getSourceId());
return damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId());
}
@Override

View file

@ -55,6 +55,7 @@ import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
@ -129,16 +130,16 @@ class SwordOfLightAndShadowAbility extends TriggeredAbilityImpl {
return new SwordOfLightAndShadowAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
Permanent p = game.getPermanent(event.getSourceId());
if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) {
return true;
}
}
return false;
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
Permanent p = game.getPermanent(event.getSourceId());
return damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId());
}
@Override

View file

@ -28,14 +28,15 @@
package mage.sets.dissension;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
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;
@ -79,10 +80,14 @@ class ProperBurialTriggeredAbility extends TriggeredAbilityImpl {
return new ProperBurialTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE
&& ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD
if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD
&& ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) {
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (permanent.getControllerId().equals(this.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE)) {

View file

@ -28,10 +28,6 @@
package mage.sets.dissension;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.Mana;
import mage.ObjectColor;
import mage.abilities.Ability;
@ -43,12 +39,16 @@ import mage.abilities.keyword.EnchantAbility;
import mage.abilities.mana.TriggeredManaAbility;
import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
@ -138,13 +138,16 @@ class UtopiaSprawlTriggeredAbility extends TriggeredManaAbility {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.TAPPED_FOR_MANA;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(this.getSourceId());
if(event.getType() == GameEvent.EventType.TAPPED_FOR_MANA){
if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) {
return true;
}
if (enchantment != null && event.getSourceId().equals(enchantment.getAttachedTo())) {
return true;
}
return false;
}

View file

@ -29,24 +29,20 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class BeckCall extends SplitCard {
@ -88,14 +84,17 @@ class BeckTriggeredAbility extends DelayedTriggeredAbility {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
if (filter.match(permanent, getSourceId(), getControllerId(), game)) {
return true;
}
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
if (filter.match(permanent, getSourceId(), getControllerId(), game)) {
return true;
}
return false;
}

View file

@ -28,22 +28,19 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.DamagedEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class BredForTheHunt extends CardImpl {
@ -83,9 +80,14 @@ class BredForTheHuntTriggeredAbility extends TriggeredAbilityImpl {
return new BredForTheHuntTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && ((DamagedPlayerEvent) event).isCombatDamage()) {
if (((DamagedEvent) event).isCombatDamage()) {
Permanent creature = game.getPermanent(event.getSourceId());
if (creature != null && creature.getControllerId().equals(getControllerId()) && creature.getCounters().getCount(CounterType.P1P1) > 0) {
return true;

View file

@ -29,10 +29,6 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
@ -40,15 +36,15 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.effects.common.RegenerateSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author LevelX2
*/
public class CarnageGladiator extends CardImpl {
@ -97,14 +93,17 @@ class CarnageGladiatorTriggeredAbility extends TriggeredAbilityImpl {
return new CarnageGladiatorTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.BLOCKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.BLOCKER_DECLARED) {
Permanent blocker = game.getPermanent(event.getSourceId());
if (blocker != null) {
getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getControllerId()));
return true;
}
Permanent blocker = game.getPermanent(event.getSourceId());
if (blocker != null) {
getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getControllerId()));
return true;
}
return false;
}

View file

@ -28,25 +28,25 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.CanAttackOnlyAloneAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.DeathtouchAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import mage.game.events.DamageEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -102,18 +102,21 @@ class MasterOfCrueltiesTriggeredAbility extends TriggeredAbilityImpl {
return new MasterOfCrueltiesTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DECLARED_BLOCKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DECLARED_BLOCKERS) {
Permanent sourcePermanent = game.getPermanent(getSourceId());
if (sourcePermanent.isAttacking()) {
for (CombatGroup combatGroup: game.getCombat().getGroups()) {
if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) {
// check if a player is attacked (instead of a planeswalker)
Player defendingPlayer = game.getPlayer(combatGroup.getDefenderId());
if (defendingPlayer != null) {
return true;
}
Permanent sourcePermanent = game.getPermanent(getSourceId());
if (sourcePermanent.isAttacking()) {
for (CombatGroup combatGroup: game.getCombat().getGroups()) {
if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) {
// check if a player is attacked (instead of a planeswalker)
Player defendingPlayer = game.getPlayer(combatGroup.getDefenderId());
if (defendingPlayer != null) {
return true;
}
}
}

View file

@ -28,10 +28,6 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
@ -40,6 +36,9 @@ import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.abilities.effects.common.continuous.PlayTheTopCardEffect;
import mage.abilities.effects.common.continuous.PlayWithTheTopCardRevealedEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -108,10 +107,14 @@ class MelekIzzetParagonTriggeredAbility extends TriggeredAbilityImpl {
return new MelekIzzetParagonTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == EventType.SPELL_CAST
&& event.getZone() == Zone.LIBRARY) {
if (event.getZone() == Zone.LIBRARY) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null
&& spell.getControllerId().equals(super.getControllerId())

View file

@ -31,10 +31,6 @@ package mage.sets.dragonsmaze;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -43,16 +39,17 @@ import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.BloodrushAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.DamagedEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class PyrewildShaman extends CardImpl {
@ -102,10 +99,17 @@ class PyrewildShamanTriggeredAbility extends TriggeredAbilityImpl {
return new PyrewildShamanTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER
|| event.getType() == EventType.END_COMBAT_STEP_POST
|| event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
if (((DamagedPlayerEvent) event).isCombatDamage()) {
if (((DamagedEvent) event).isCombatDamage()) {
Permanent creature = game.getPermanent(event.getSourceId());
if (creature != null && creature.getControllerId().equals(controllerId) && !damagedPlayerIds.contains(event.getTargetId())) {
damagedPlayerIds.add(event.getTargetId());

View file

@ -29,26 +29,23 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.counter.AddCountersAllEffect;
import mage.abilities.keyword.EvolveAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.StackObject;
/**
*
* @author LevelX2
*/
public class RenegadeKrasis extends CardImpl {
@ -101,10 +98,14 @@ class RenegadeKrasisTriggeredAbility extends TriggeredAbilityImpl {
return new RenegadeKrasisTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.COUNTER_ADDED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType().equals(GameEvent.EventType.COUNTER_ADDED)
&& event.getTargetId().equals(getSourceId())) {
if (event.getTargetId().equals(getSourceId())) {
Object object = game.getState().getValue("EvolveAddCounterActive");
if (object != null && (Boolean) object) {
StackObject stackObject = game.getStack().getLast();

View file

@ -28,20 +28,20 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.AttacksEachTurnStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.VigilanceAbility;
import mage.abilities.keyword.ReachAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.Spell;
import mage.target.targetpointer.FixedTarget;
@ -99,18 +99,20 @@ class RuricTharTheUnbowedAbility extends TriggeredAbilityImpl {
return new RuricTharTheUnbowedAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null
&& !spell.getCardType().contains(CardType.CREATURE)) {
if (spell != null && !spell.getCardType().contains(CardType.CREATURE)) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
}
}
return false;
}

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