forge icon indicating copy to clipboard operation
forge copied to clipboard

Refactor SpellAbility Payment

Open Hanmac opened this issue 3 years ago • 6 comments

Rules wise it should be like this:

  1. 601.2b If the spell is modal, the player announces the mode choice (see rule 700.2). If the player wishes to splice any cards onto the spell (see rule 702.47), they reveal those cards in their hand. If the spell has alternative or additional costs that will be paid as it’s being cast such as buyback or kicker costs (see rules 118.8 and 118.9), the player announces their intentions to pay any or all of those costs (see rule 601.2f). A player can’t apply two alternative methods of casting or two alternative costs to a single spell. If the spell has a variable cost that will be paid as it’s being cast (such as an {X} in its mana cost; see rule 107.3), the player announces the value of that variable. If the value of that variable is defined in the text of the spell by a choice that player would make later in the announcement or resolution of the spell, that player makes that choice at this time instead of that later time. If a cost that will be paid as the spell is being cast includes hybrid mana symbols, the player announces the nonhybrid equivalent cost they intend to pay. If a cost that will be paid as the spell is being cast includes Phyrexian mana symbols, the player announces whether they intend to pay 2 life or a corresponding colored mana cost for each of those symbols. Previously made choices (such as choosing to cast a spell with flashback from a graveyard or choosing to cast a creature with morph face down) may restrict the player’s options when making these choices.

    • This part is important for the Hybrid Mana #5374
  2. 601.2f The player determines the total cost of the spell. Usually this is just the mana cost. Some spells have additional or alternative costs. Some effects may increase or reduce the cost to pay, or may provide other alternative costs. Costs may include paying mana, tapping permanents, sacrificing permanents, discarding cards, and so on. The total cost is the mana cost or alternative cost (as determined in rule 601.2b), plus all additional costs and cost increases, and minus all cost reductions. If multiple cost reductions apply, the player may apply them in any order. If the mana component of the total cost is reduced to nothing by cost reduction effects, it is considered to be {0}. It can’t be reduced to less than {0}. Once the total cost is determined, any effects that directly affect the total cost are applied. Then the resulting total cost becomes “locked in.” If effects would change the total cost after this time, they have no effect.

    • First choose how to pay Hybrid and Phyrexian Mana, after that the ManaCost should only have normalized Mana Symbols now
  3. 601.2f The player determines the total cost of the spell. Usually this is just the mana cost. Some spells have additional or alternative costs. Some effects may increase or reduce the cost to pay, or may provide other alternative costs. Costs may include paying mana, tapping permanents, sacrificing permanents, discarding cards, and so on. The total cost is the mana cost or alternative cost (as determined in rule 601.2b), plus all additional costs and cost increases, and minus all cost reductions. If multiple cost reductions apply, the player may apply them in any order. If the mana component of the total cost is reduced to nothing by cost reduction effects, it is considered to be {0}. It can’t be reduced to less than {0}. Once the total cost is determined, any effects that directly affect the total cost are applied. Then the resulting total cost becomes “locked in.” If effects would change the total cost after this time, they have no effect.

    • Apply CostReduction and CostIncrease Effects. Previous parts that were looking for Hybrid Mana can be removed. Apply CostSet from TriniSphere. This Also means the AI would need logic to not Choose pay life for Phyrexian Mana if a TriniSphere applies.
    • The any order thing needs to be figured out: https://github.com/Card-Forge/forge/issues/1519
  4. 601.2g If the total cost includes a mana payment, the player then has a chance to activate mana abilities (see rule 605, “Mana Abilities”). Mana abilities must be activated before costs are paid.

  5. 601.2h The player pays the total cost. First, they pay all costs that don’t involve random elements or moving objects from the library to a public zone, in any order. Then they pay all remaining costs in any order. Partial payments are not allowed. Unpayable costs can’t be paid.

    • means some Special Actions like tapping stuff for Convoke and Improvise, or exiling them with Delve. Or paying Black Mana for K'rrik, Son of Yawgmoth
    • Interesting part is that some cost parts can be paid in any order. Sacrificing Omnath, Locus of Mana for something like Momentous Fall matters if you Sacrifice it before you pay with Green Mana or not.

because Mana Abilities needs to be activated before the cost is paid, we might need to implement some kind of stopper for when you want to Convoke or Improvise. Or like if you used Convoke or one of the others you can't activate ManaAbilities anymore.

Hanmac avatar May 09 '22 13:05 Hanmac

This issue has not been updated in a while and has now been marked as stale. Stale messages will be auto closed.

github-actions[bot] avatar Jul 02 '23 09:07 github-actions[bot]

@kevlahnota @tool4ever i think we might try to do this issue in tiny steps?

for example: extract the hybrid/phyrexian mana into a CostNormalizer or something, so it is normalized before the cost is put to the RaiseCost/ReduceCost functions?

this probably need some special GUI like in Arena were you can choose the Mana Symbols?

Hanmac avatar Aug 21 '23 15:08 Hanmac

Then they pay all remaining costs in any order. this might have effects on ManaConvert effects like spend mana of any type to cast creature spells from Vizier of the Menagerie if they are getting sacrificed as additional Cost to cast the creature spell

Hanmac avatar Sep 05 '23 08:09 Hanmac

Was this old branch a step in the right direction? https://github.com/Card-Forge/forge/tree/convokeImproviseDelve

tool4ever avatar Sep 30 '23 07:09 tool4ever

Was this old branch a step in the right direction? https://github.com/Card-Forge/forge/tree/convokeImproviseDelve

Yeah that was the plan (for a part of this issue) You can try to revive it if you want

Hanmac avatar Sep 30 '23 08:09 Hanmac

@tool4ever @Northmoc @kevlahnota @tehdiplomat what part of this what we might try to do is the Logic for Hybrid and Phyrexian Costs

if the Player would need to choose how they are paid before the CostAdjustment applies to them, that would help us with the other parts

this probably need some special GUI like in Arena were you can choose the Mana Symbols?

Hanmac avatar Jun 04 '24 12:06 Hanmac