forked from External/mage
dies triggers improves:
* tests: added additional tests and verify/runtime checks for wrong die trigger settings; * refactor: removed some usage of short LKI ; * fixed dies events support in "or trigger" and "conditional trigger" (use cases like sacrifice cost); * fixed dies events support in shared triggered abilities (use cases like sacrifice cost);
This commit is contained in:
parent
a2ed52b8de
commit
66b338c6fc
18 changed files with 233 additions and 63 deletions
|
|
@ -48,6 +48,7 @@ public class DiesCreatureTriggeredAbility extends TriggeredAbilityImpl {
|
|||
super(zone, effect, optional);
|
||||
this.filter = filter;
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
setTriggerPhrase("Whenever " + filter.getMessage() + (filter.getMessage().startsWith("one or more") ? " die, " : " dies, "));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public class DiesThisOrAnotherTriggeredAbility extends TriggeredAbilityImpl {
|
|||
filterMessage = filterMessage.substring(2);
|
||||
}
|
||||
setTriggerPhrase("Whenever {this} or another " + filterMessage + " dies, ");
|
||||
setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
protected DiesThisOrAnotherTriggeredAbility(final DiesThisOrAnotherTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -48,22 +48,6 @@ public class ExploitCreatureTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return event.getType() == GameEvent.EventType.EXPLOITED_CREATURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
Permanent sourcePermanent = null;
|
||||
if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) {
|
||||
sourcePermanent = game.getPermanent(getSourceId());
|
||||
} else {
|
||||
if (game.checkShortLivingLKI(getSourceId(), Zone.BATTLEFIELD)) {
|
||||
sourcePermanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD);
|
||||
}
|
||||
}
|
||||
if (sourcePermanent == null) {
|
||||
return false;
|
||||
}
|
||||
return hasSourceObjectAbility(game, sourcePermanent, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getSourceId().equals(getSourceId())) {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public class GodEternalDiesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public GodEternalDiesTriggeredAbility() {
|
||||
super(Zone.ALL, null, true);
|
||||
this.setLeavesTheBattlefieldTrigger(true);
|
||||
}
|
||||
|
||||
private GodEternalDiesTriggeredAbility(GodEternalDiesTriggeredAbility ability) {
|
||||
|
|
@ -49,22 +50,6 @@ public class GodEternalDiesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {
|
||||
Permanent sourcePermanent = null;
|
||||
if (game.getState().getZone(getSourceId()) == Zone.BATTLEFIELD) {
|
||||
sourcePermanent = game.getPermanent(getSourceId());
|
||||
} else {
|
||||
if (game.checkShortLivingLKI(getSourceId(), Zone.BATTLEFIELD)) {
|
||||
sourcePermanent = (Permanent) game.getLastKnownInformation(getSourceId(), Zone.BATTLEFIELD);
|
||||
}
|
||||
}
|
||||
if (sourcePermanent == null) {
|
||||
return false;
|
||||
}
|
||||
return hasSourceObjectAbility(game, sourcePermanent, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GodEternalDiesTriggeredAbility copy() {
|
||||
return new GodEternalDiesTriggeredAbility(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue