* Exploit - Fixed that Exploit also triggered if the creature with Exploit left the battlefield before the first ability of Exploit resolved.

This commit is contained in:
LevelX2 2015-04-07 00:27:07 +02:00
parent a56cccebf9
commit f62d3ac227
17 changed files with 231 additions and 44 deletions

View file

@ -27,6 +27,7 @@
*/
package mage.abilities.common;
import mage.MageObject;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.SetTargetPointer;
@ -48,7 +49,7 @@ public class ExploitCreatureTriggeredAbility extends TriggeredAbilityImpl {
}
public ExploitCreatureTriggeredAbility(Effect effect, boolean optional, SetTargetPointer setTargetPointer) {
super(Zone.ALL, effect, optional);
super(Zone.BATTLEFIELD, effect, optional);
this.setTargetPointer = setTargetPointer;
}
@ -62,11 +63,20 @@ public class ExploitCreatureTriggeredAbility extends TriggeredAbilityImpl {
return new ExploitCreatureTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.EXPLOITED_CREATURE;
}
@Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
if (event.getTargetId().equals(getSourceId()) && event.getSourceId().equals(getSourceId())) {
return true; // if Exploits creature sacrifices itself, exploit triggers
}
return super.isInUseableZone(game, source, event);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(getSourceId())) {