Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor spells to use "shape" enums #44481

Merged
merged 2 commits into from
Oct 7, 2020

Conversation

KorGgenT
Copy link
Member

Summary

SUMMARY: Infrastructure "refactor spells to use shape as an additional json member"

Purpose of change

There's a couple reasons I wanted to do this.

  • @John-Candlebury has mentioned several times that he would like a "wall" shape of spell, but it was kinda weird to shoehorn it in
  • there were several spell effects that I wanted the possibilities to use cone in addition to a circular blast, but making a whole new function doesn't seem so good.
  • DRY. essentially. adding a new member to the spell_type class will allow a lot of reduction in code duplication and even a bit of extra "free" ways to add shapes to arbitrary spell effects.
  • to add to the above, combine the 4 separate attack type effects into one.

Describe the solution

add two new spell_type members: an enum for the spell shape which is used for a map to a function, and the function itself. in every spell effect function, refactor the way they calculate the set of tripoints that end up being the targets so it can be generalized.

Testing

wip, intending to write some tests for this.

@KorGgenT KorGgenT added [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Sep 28, 2020
@KorGgenT KorGgenT marked this pull request as ready for review October 3, 2020 23:59
@ZhilkinSerg ZhilkinSerg merged commit 49a278e into CleverRaven:master Oct 7, 2020
chaosvolt added a commit to chaosvolt/cdda-arcana-mod that referenced this pull request Oct 9, 2020
* Updated spells to have shapes as warranted by
CleverRaven/Cataclysm-DDA#44481. Would've saved
a lot of excess JSON to just assume "blast" to be a default, but oh
well. Now I have suffered as Korg suffered.
* Converted all uses of line, cone, etc attacks to use attacks with the
correct shape.
* Dumped in `NO_PROJECTILE` into appropriate places. There are PROBABLY
more places that could use it but 90% of the time there's no effective
difference between a projectile spell and a non-projectile spell since
you can't actually miss.
* Also, a fine time to cleanse this world of obsolete.,json since it had
spells in it that likely have not been on anyone's save file in ages.
chaosvolt added a commit to chaosvolt/nocts_cata_mod that referenced this pull request Oct 11, 2020
* Updated spells due to
CleverRaven/Cataclysm-DDA#44481
* Changed use of lockpicking skill to trapping and removed use of barter
skill, now that lockpicking and trapping have been merged, and speech is
now used for both functions. I guess now I'm glad I never got free time
to make a Rebuilding Civilization pair for lockpicking. Speaking of...
* Obsoleted the encyclopedias for barter for now, changed their skills
to refer to speech just in case they delete barter'a obosleted JSON
outright, and removed its spawns.
* Updated gunmod data for un-CBM'd monomolecular blade and sword to fix
a minor load error, uses the same general data as basically all other
bayonets in vanilla. No idea why bayonets all need 20 minutes to
install, seems a bit excessive. :/
* And gave install times to gunmods missing it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style [JSON] Changes (can be) made in JSON
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants