forked from External/mage
implement [FIN] Vivi Ornitier ; limit mana computation for "only once per turn" abilities (#13639)
fixes #10930
This commit is contained in:
parent
fa20361e2e
commit
a9af84f533
9 changed files with 272 additions and 10 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue