Fixed Electryte triggered ability
@@ -40,6 +40,7 @@ import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.common.FilterBlockingCreature;
import mage.game.Game;
+import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
@@ -55,9 +56,8 @@ public class Electryte extends CardImpl {
this.power = new MageInt(3);
this.toughness = new MageInt(3);
- // Whenever Electryte successfully deals combat damage to defending player,
- // Electryte deals damage equal to its power to each blocking creature.
- this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new ElectryteEffect(), false));
+ // Whenever Electryte deals combat damage to defending player, it deals damage equal to its power to each blocking creature.
+ this.addAbility(new ElectryteTriggeredAbility());
}
public Electryte(final Electryte card) {
@@ -70,6 +70,36 @@ public class Electryte extends CardImpl {
}
}
+class ElectryteTriggeredAbility extends DealsCombatDamageToAPlayerTriggeredAbility {
+
+ ElectryteTriggeredAbility() {
+ super(new ElectryteEffect(), false);
+ }
+
+ ElectryteTriggeredAbility(final ElectryteTriggeredAbility effect) {
+ super(effect);
+ }
+
+ @Override
+ public ElectryteTriggeredAbility copy() {
+ return new ElectryteTriggeredAbility(this);
+ }
+
+ @Override
+ public boolean checkTrigger(GameEvent event, Game game) {
+ if (super.checkTrigger(event, game)) {
+ return game.getCombat().getDefenderId(getSourceId()).equals(event.getPlayerId());
+ }
+ return false;
+ }
+
+ @Override
+ public String getRule() {
+ return "Whenever {this} deals combat damage to defending player, "
+ + "it deals damage equal to its power to each blocking creature";
+ }
+}
+
class ElectryteEffect extends OneShotEffect {
static private FilterBlockingCreature filter = new FilterBlockingCreature();
