Fixed Vazi's triggered ability (#9883)

This commit is contained in:
Alexander Novotny 2023-01-27 09:02:11 -08:00 committed by GitHub
parent 383c83f74a
commit 94ff57f992
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,6 +23,7 @@ import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.TreasureToken;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetOpponent;
@ -93,14 +94,15 @@ class VaziKeenNegotiatorOpponentCastsOrActivatesTriggeredAbility extends Trigger
public boolean checkTrigger(GameEvent event, Game game) {
Player controller = game.getPlayer(getControllerId());
Player caster = game.getPlayer(event.getPlayerId());
Optional<Ability> optionalAbility = game.getAbility(event.getTargetId(), this.sourceId);
if (controller == null
|| caster == null
|| !game.getOpponents(controller.getId()).contains(caster.getId())
|| !optionalAbility.isPresent()) {
|| !game.getOpponents(controller.getId()).contains(caster.getId())) {
return false;
}
return TreasureSpentToCastCondition.instance.apply(game, optionalAbility.get());
Ability ability = game.getStack().getStackObject(event.getTargetId()).getStackAbility();
return TreasureSpentToCastCondition.instance.apply(game, ability);
}
@Override