Can't be activated effects - fixed that some restricted effects show abilities as playable (example: Sharkey, Tyrant of the Shire and Karakas, fixed #10642)

This commit is contained in:
Oleg Agafonov 2024-07-27 15:38:13 +04:00
parent 21ad11dbdc
commit 393dbc4047
9 changed files with 136 additions and 44 deletions

View file

@ -10,6 +10,7 @@ import mage.cards.Card;
import mage.constants.*;
import mage.game.Game;
import mage.game.command.CommandObject;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.CardUtil;
@ -138,6 +139,13 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa
return ActivationStatus.getFalse();
}
// activate restrictions by replacement effects (example: Sharkey, Tyrant of the Shire)
if (this.isActivatedAbility()) {
if (game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATE_ABILITY, this.getId(), this, playerId))) {
return ActivationStatus.getFalse();
}
}
// all fine, can be activated
// TODO: WTF, must be rework to remove data change in canActivate call
// (it can be called from any place by any player or card).