[DFT] Implement Elvish Refueler (#13392)

This commit is contained in:
Jmlundeen 2025-03-13 22:24:26 -05:00 committed by GitHub
parent cd8cb6afe5
commit 9aaad5193f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 232 additions and 1 deletions

View file

@ -3,7 +3,9 @@ package mage.abilities.keyword;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.effects.Effect;
import mage.constants.AsThoughEffectType;
import mage.constants.Zone;
import mage.game.Game;
/**
* @author TheElk801
@ -24,6 +26,20 @@ public class ExhaustAbility extends ActivatedAbilityImpl {
return new ExhaustAbility(this);
}
@Override
public boolean hasMoreActivationsThisTurn(Game game) {
ActivationInfo info = getActivationInfo(game);
if (info != null && info.totalActivations >= maxActivationsPerGame) {
boolean canActivate = !game.getContinuousEffects()
.asThough(sourceId, AsThoughEffectType.ALLOW_EXHAUST_PER_TURN, this, controllerId, game)
.isEmpty();
if (canActivate) {
return true;
}
}
return super.hasMoreActivationsThisTurn(game);
}
@Override
public String getRule() {
return "Exhaust &mdash; " + super.getRule() + " <i>(Activate each exhaust ability only once.)</i>";

View file

@ -59,7 +59,10 @@ public enum AsThoughEffectType {
//
// ALLOW_FORETELL_ANYTIME:
// For Cosmos Charger effect
ALLOW_FORETELL_ANYTIME;
ALLOW_FORETELL_ANYTIME,
// ALLOW_EXHAUST_ACTIVE_ABILITY:
// Elvish Refueler effect allows Exhaust on your turn as though it hasn't been activated
ALLOW_EXHAUST_PER_TURN(true, false);
private final boolean needAffectedAbility; // mark what AsThough check must be called for specific ability, not full object (example: spell check)
private final boolean needPlayCardAbility; // mark what AsThough check must be called for play/cast abilities