Improved canActivate support:

* added support of non controller activates in ActivatedManaAbility (mayActivate);
* removed custom code from ActivatedManaAbility;
* removed custom code from Mana Cache;
* added additional comments;
This commit is contained in:
Oleg Agafonov 2021-08-21 01:44:00 +04:00
parent bdeb0dde66
commit 33380f09c2
8 changed files with 33 additions and 29 deletions

View file

@ -42,18 +42,6 @@ public abstract class ActivatedManaAbilityImpl extends ActivatedAbilityImpl impl
@Override
public ActivationStatus canActivate(UUID playerId, Game game) {
if (!super.hasMoreActivationsThisTurn(game) || !(condition == null || condition.apply(game, this))) {
return ActivationStatus.getFalse();
}
if (!controlsAbility(playerId, game)) {
return ActivationStatus.getFalse();
}
if (timing == TimingRule.SORCERY
&& !game.canPlaySorcery(playerId)
&& null == game.getContinuousEffects().asThough(sourceId, AsThoughEffectType.ACTIVATE_AS_INSTANT, this, controllerId, game)) {
return ActivationStatus.getFalse();
}
// check if player is in the process of playing spell costs and they are no longer allowed to use
// activated mana abilities (e.g. because they started to use improvise or convoke)
if (!game.getStack().isEmpty()) {
@ -69,8 +57,7 @@ public abstract class ActivatedManaAbilityImpl extends ActivatedAbilityImpl impl
}
}
//20091005 - 605.3a
return new ActivationStatus(costs.canPay(this, this, controllerId, game), null);
return super.canActivate(playerId, game);
}
/**