mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
Fix DestroyPlaneswalkerWhenDamagedTriggeredAbility (#12093)
This commit is contained in:
parent
1eda4aaad4
commit
40b1dcc526
2 changed files with 46 additions and 5 deletions
|
|
@ -40,13 +40,17 @@ public class DestroyPlaneswalkerWhenDamagedTriggeredAbility extends TriggeredAbi
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = getSourcePermanentIfItStillExists(game);
|
||||
if (permanent == null) {
|
||||
Permanent sourcePermanent = getSourcePermanentIfItStillExists(game);
|
||||
if (sourcePermanent == null) {
|
||||
return false;
|
||||
}
|
||||
boolean applies = filter != null ?
|
||||
permanent.isPlaneswalker(game) && filter.match(permanent, game) : event.getSourceId().equals(getSourceId());
|
||||
if (applies) {
|
||||
Permanent damagedPermanent = game.getPermanent(event.getTargetId());
|
||||
if (damagedPermanent == null) {
|
||||
return false;
|
||||
}
|
||||
boolean targetsPlaneswalker = damagedPermanent.isPlaneswalker(game);
|
||||
boolean filterMatch = filter != null ? filter.match(sourcePermanent, game) : event.getSourceId().equals(getSourceId());
|
||||
if (targetsPlaneswalker && filterMatch) {
|
||||
Effect effect = new DestroyTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId(), game));
|
||||
this.getEffects().clear();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue