- Improved Commander replacement ability AI to properly account for the delayed trigger implementation of blink (e.g. Flickerwisp).

This commit is contained in:
Agetian
2017-06-03 19:51:43 +00:00
parent 70914eef47
commit 5d887c2025

View File

@@ -1597,12 +1597,18 @@ public class ChangeZoneAi extends SpellAbilityAi {
if (causeSa != null && (causeSub = causeSa.getSubAbility()) != null) { if (causeSa != null && (causeSub = causeSa.getSubAbility()) != null) {
ApiType subApi = causeSub.getApi(); ApiType subApi = causeSub.getApi();
if ((subApi == ApiType.DelayedTrigger || subApi == ApiType.ChangeZone) if (subApi == ApiType.ChangeZone && "Exile".equals(causeSub.getParam("Origin"))
&& "Exile".equals(causeSub.getParam("Origin"))
&& "Battlefield".equals(causeSub.getParam("Destination"))) { && "Battlefield".equals(causeSub.getParam("Destination"))) {
// This is some kind of a blink effect, the commander will be back, so don't put him in Command zone instead // A blink effect implemented using ChangeZone API
// TODO: if this is too permissive, maybe make it also dependent on who's activating causeSa (activating player should be aiPlayer?)
return false; return false;
} else if (subApi == ApiType.DelayedTrigger) {
SpellAbility exec = causeSub.getAdditonalAbility("Execute");
if (exec != null && exec.getApi() == ApiType.ChangeZone) {
if ("Exile".equals(exec.getParam("Origin")) && "Battlefield".equals(exec.getParam("Destination"))) {
// A blink effect implemented using a delayed trigger
return false;
}
}
} else if (causeSa.getHostCard() != null && causeSa.getHostCard().equals((Card)sa.getReplacingObject("Card")) } else if (causeSa.getHostCard() != null && causeSa.getHostCard().equals((Card)sa.getReplacingObject("Card"))
&& causeSa.getActivatingPlayer().equals(aiPlayer)) { && causeSa.getActivatingPlayer().equals(aiPlayer)) {
// This is an intrinsic effect that blinks the card (e.g. Obzedat, Ghost Council), no need to // This is an intrinsic effect that blinks the card (e.g. Obzedat, Ghost Council), no need to