implement [FIN] Vivi Ornitier ; limit mana computation for "only once per turn" abilities (#13639)

fixes #10930
This commit is contained in:
Susucre 2025-05-16 19:45:01 +02:00 committed by GitHub
parent fa20361e2e
commit a9af84f533
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 272 additions and 10 deletions

View file

@ -215,6 +215,23 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa
|| activationInfo.activationCounter < getMaxActivationsPerTurn(game);
}
public int getMaxMoreActivationsThisTurn(Game game) {
if (getMaxActivationsPerTurn(game) == Integer.MAX_VALUE && maxActivationsPerGame == Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
ActivationInfo activationInfo = getActivationInfo(game);
if (activationInfo == null) {
return Math.min(maxActivationsPerGame, getMaxActivationsPerTurn(game));
}
if (activationInfo.totalActivations >= maxActivationsPerGame) {
return 0;
}
if (activationInfo.turnNum != game.getTurnNum()) {
return getMaxActivationsPerTurn(game);
}
return Math.max(0, getMaxActivationsPerTurn(game) - activationInfo.activationCounter);
}
@Override
public boolean activate(Game game, Set<MageIdentifier> allowedIdentifiers, boolean noMana) {
if (!hasMoreActivationsThisTurn(game) || !super.activate(game, allowedIdentifiers, noMana)) {