[BRO] fix Slagstone Refinery trigger (#9761)

* fix Slagstone Refinery trigger

fixes #9755 by rewritting the checkTrigger method.

* apply changes from review

* minor fix, remove unecessary import
This commit is contained in:
Susucre 2022-11-16 20:47:30 +01:00 committed by GitHub
parent 4ee59174cb
commit 038bee5402
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,7 +15,7 @@ import mage.game.permanent.token.PowerstoneToken;
import java.util.UUID;
/**
* @author TheElk801
* @author TheElk801, Susucre
*/
public final class SlagstoneRefinery extends CardImpl {
@ -59,10 +59,19 @@ class SlagstoneRefineryTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
return zEvent.getFromZone().match(Zone.BATTLEFIELD)
&& (zEvent.getToZone().match(Zone.GRAVEYARD) || zEvent.getToZone().match(Zone.EXILED))
&& zEvent.getTargetId().equals(getSourceId())
|| (zEvent.getTarget().isArtifact(game) && !(zEvent.getTarget() instanceof PermanentToken));
// Filters ZC events for only battlefield => graveyard or battlefield => exile.
if (zEvent.getFromZone() == Zone.BATTLEFIELD && (zEvent.getToZone() == Zone.GRAVEYARD || zEvent.getToZone() == Zone.EXILED)) {
if(zEvent.getTargetId().equals(getSourceId())) { // {this}
return true;
} else { // another
return zEvent.getTarget().isArtifact(game) // artifact
&& !(zEvent.getTarget() instanceof PermanentToken) // nontoken
&& (zEvent.getTarget().getControllerId().equals(getControllerId())); // you control
}
}
return false;
}
@Override