Merge branch 'ramp' into 'master'

ManaEffectAi: Allow ramping with stuff like Upwelling

See merge request core-developers/forge!5891
This commit is contained in:
Michael Kamensky
2021-11-29 03:54:04 +00:00

View File

@@ -62,6 +62,9 @@ public class ManaEffectAi extends SpellAbilityAi {
*/ */
@Override @Override
protected boolean checkPhaseRestrictions(Player ai, SpellAbility sa, PhaseHandler ph) { protected boolean checkPhaseRestrictions(Player ai, SpellAbility sa, PhaseHandler ph) {
if (ph.is(PhaseType.END_OF_TURN) && ph.getNextTurn() == ai && !ai.getManaPool().willManaBeLostAtEndOfPhase()) {
return true;
}
if (!ph.is(PhaseType.MAIN2) || !ComputerUtil.activateForCost(sa, ai)) { if (!ph.is(PhaseType.MAIN2) || !ComputerUtil.activateForCost(sa, ai)) {
return false; return false;
} }
@@ -98,9 +101,14 @@ public class ManaEffectAi extends SpellAbilityAi {
return true; // handled elsewhere, does not meet the standard requirements return true; // handled elsewhere, does not meet the standard requirements
} }
PhaseHandler ph = ai.getGame().getPhaseHandler();
boolean moreManaNextTurn = false;
if (ph.is(PhaseType.END_OF_TURN) && ph.getNextTurn() == ai && !ai.getManaPool().willManaBeLostAtEndOfPhase()) {
moreManaNextTurn = true;
}
return sa.getPayCosts().hasNoManaCost() && sa.getPayCosts().isReusuableResource() return sa.getPayCosts().hasNoManaCost() && sa.getPayCosts().isReusuableResource()
&& sa.getSubAbility() == null && ComputerUtil.playImmediately(ai, sa); && sa.getSubAbility() == null && (ComputerUtil.playImmediately(ai, sa) || moreManaNextTurn);
// return super.checkApiLogic(ai, sa);
} }
/** /**