Closed petertseng closed 1 month ago
I have been considering spirit specific resource for a little bit, given how more recent spirits keep going in that direction.
I think it'll be a good idea to have a generic "Spirit Specific Resource" field And also "Spirit Specific Resource name"
That way you can count the resource as well as know immediately what it's called
Snake is another spirit where spirit specific resource will matter, and fractured too, in a way.
Snake is easier to simplify in a way that gives you just the number (though it's still advisable to use some other way to track which spirits the slurped presences are from).
Days is a bit harder, and it would be worth thinking about how to merge that kind of spirit specific resource with general. The same field but variable variable type? A second "spirit specific deck" that only gets activated for that spirit? Something else?
This would be also helpful for dances, as well as destiny unfolds or certain other scenarios. Not to mention simplify the implementation for future proofing or even more custom stuff, both of which i wanna support
And also "Spirit Specific Resource name"
Under the reasoning of "we want to add a Spirit Specific Resource field if we are concerned that there are too many fields in GamePlayer", we wouldn't add a Spirit Specific Resource name field, as the meaning of the field is based solely on the spirit and doesn't vary on an individual row basis beyond that.
Days is a bit harder, and it would be worth thinking about how to merge that kind of spirit specific resource with general. The same field but variable variable type? A second "spirit specific deck" that only gets activated for that spirit? Something else?
This would be also helpful for dances
Anything that is a many-to-many relationship (Days that Never Were, impending cards) isn't subject to the same concerns because they do not take up a column in GamePlayer. I suspect that trying to combine those two with each other or anything else would be too confusing, but I would be happy to be proven wrong! In either case, it's personally a low priority for me because of not taking up a column in GamePlayer.
I don't even know if the way it's currently written is even a problem at all under database principles. I don't want to start imagining solutions to a problem that doesn't exist.
as well as destiny unfolds or certain other scenarios
Being able to support Destiny Unfolds would be interesting for sure! :+1:
I've thought about it a bit more and I think I've talked myself into using the spirit-specific resource field.
The reason for this: since we've by this time identified a number of spirits who might potentially use it, are we going to add a separate endpoint for change_rot
, change_metal
, change_prepared_beasts
, change_healing_markers
? That seems repetitive for what is the same operation behind-the-scenes!
So I add it, if a spirit is able to use it, great. If it's not a good fit for the spirit, don't use it and instead do what's the right fit. It's fine to have the option.
For this reason, please wait a moment while I redo #44 and #46
Redone with the spirit-specific resource field, and already the benefits are becoming clear - much less duplicate code this way.
Requires adding:
as part of https://github.com/nathanj/spirit-island-pbp/issues/27
NB: migration required
Now's a good time to look at the consequences of adding these two apocrypha spirits. Each has a unique resource, and I originally implemented it by adding a field for each (along with two auxiliary fields for Rot). However, I found that that resulted in a lot of repetitive code - I had code that incremented Rot, code that incremented Metal, code that decremented Rot, code that decremented Metal.
To deduplicate things, I decided to create the field "spirit-specific resource". For Spreading Rot, the value in this field is Rot. For Covets Gleaming Shards, the value in this field is Metal. There are still a few things specific to Rot, but at least the things in common between Metal and Rot are deduplicated, and I see this as a win.
Other possibilities for spirits who might use spirit-specific resource: