[WOE] Implement Curse of the Werefox (#11009)

* [WOE] Implement Curse of the Werefox

* apply review

* Fix aura (and equipment?) tokens not checking for protection on target

* fix targetting of reflexive trigger, by creating a custom fight effect.

* fix reflexive ability target.
This commit is contained in:
Susucre 2023-08-31 01:16:22 +02:00 committed by GitHub
parent 2d9599fbbd
commit fab00d2f27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 217 additions and 2 deletions

View file

@ -7,6 +7,7 @@ import mage.constants.Outcome;
import mage.constants.RoleType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
/**
* @author TheElk801
@ -36,8 +37,9 @@ public class CreateRoleAttachedTargetEffect extends OneShotEffect {
if (permanent == null) {
return false;
}
roleType.createToken(permanent, game, source);
return true;
Token token = roleType.createToken(permanent, game, source);
// The token may not be created, for instance if the creature has protection from enchantments.
return token.getLastAddedTokenIds().size() > 0;
}
@Override

View file

@ -10,6 +10,8 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.game.permanent.token.Token;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.util.CardUtil;
@ -89,6 +91,10 @@ public class ProtectionAbility extends StaticAbility {
return !((FilterCard) filter).match((Card) source, ((Permanent) source).getControllerId(), this, game);
} else if (source instanceof Card) {
return !((FilterCard) filter).match((Card) source, ((Card) source).getOwnerId(), this, game);
} else if (source instanceof Token) {
// Fake a permanent with the Token info.
PermanentToken token = new PermanentToken((Token) source, null, game);
return !((FilterCard) filter).match((Card) token, game);
}
return true;
}