mage icon indicating copy to clipboard operation
mage copied to clipboard

Disable auto-payment of mana for spells which care about mana color

Open Alex-Vasile opened this issue 2 years ago • 6 comments

Spells with sunburst care about the color choices being made.

This PR stops mana from being auto-paid and colors from being auto-chosen.

Closes #9070.

Left TODO:

  • [ ] Tests
  • [x] Use setCaresAboutManaColorManualOverride for classes with custom code
  • [x] Figure out if I missed any ability/conditions for the auto-implementation

Alex-Vasile avatar Jun 27 '22 19:06 Alex-Vasile

It's probably better to add a flag to abilities that care about which colours you use. There are other cards such as Firespout and friends, and the Adamant ability.

emerald000 avatar Jun 27 '22 19:06 emerald000

It's probably better to add a flag to abilities that care about which colours you use. There are other cards such as Firespout and friends, and the Adamant ability.

Good point. I had completely forgotten about those. I will draw up a list and add a flag to them.

Alex-Vasile avatar Jun 27 '22 20:06 Alex-Vasile

  • [ ] 1. I don’t like THREE diff places for one “field” (card, effect, ability). Must be in one place. Why you can’t keep that field in ability only?

  • [x] 2. Code must be without class/reflect hacks (it definitely restricted for usage in the game engine code without really needs).

  • [x] 3. You must work with dynamic abilities list all the time (e.g. get card abilities with game param).

  • [x] 4. Spell ability in abilities list already, no need to check it specially;

  • [x] 5. Is it compatible with AI games (e.g. AI can play related cards/abilities)?

JayDi85 avatar Jun 29 '22 05:06 JayDi85

Re 2: The reason I need the reflection is because as currently implemented, the alternative is a chain of long instanceof checks for each ability/effect.

Perhaps they should be refactored so that this isn't needed.

Alex-Vasile avatar Jun 29 '22 13:06 Alex-Vasile

  • [ ] 1. I don’t like THREE diff places for one “field” (card, effect, ability). Must be in one place. Why you can’t keep that field in ability only?
  • [ ] 2. Code must be without class/reflect hacks (it definitely restricted for usage in the game engine code without really needs).
  • [x] 3. You must work with dynamic abilities list all the time (e.g. get card abilities with game param).
  • [x] 4. Spell ability in abilities list already, no need to check it specially;
  • [ ] 5. Is it compatible with AI games (e.g. AI can play related cards/abilities)?

Re 1: I have it in multiple places for a few reasons:

  • The CardImpl: there so that I don't have to copy and paste code inside HumanPlayer. I need to perform this check in two difference places, so I will need a helper method somewhere, and having it in the Card class made more sense than in the HumanPlayer class
  • Ability and Effect:
    • Sunburst and Modular are implemented as abilities
    • Adamant and "If {R} is spent do X, if {W} is spend to Y, if both {R}{W} are spend to X and Y" are implemented as conditional effects.

But, I think I can refactor checks out of Effects class and have the ability class check all of it's effects to see if they care about mana color.

I can get it down to: Card, Ability, Condition.

Alex-Vasile avatar Jul 02 '22 20:07 Alex-Vasile

Re 5: This only affects the human player

Alex-Vasile avatar Jul 02 '22 20:07 Alex-Vasile

Potential TODO: add hint to stack objects which care about color cast which indicate the current colors spent (as well as a total) in paying the cost.

I think that would be usefull, does it belong in this PR?

Alex-Vasile avatar Sep 27 '22 14:09 Alex-Vasile