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

Add support for damage overtime and move super healing from panacea to Aftershock #40082

Merged
merged 8 commits into from
May 4, 2020

Conversation

Fris0uman
Copy link
Contributor

@Fris0uman Fris0uman commented May 2, 2020

Summary

SUMMARY: Infrastructure "Add support for damage overtime"

Purpose of change

Damage over time is a usefull thing to have
When making panacea spawn in vanilla I missed its super healing effect. This moves the effect back into Aftershock.

Describe the solution

Add damage_over_time_data class to damage namespace
Add std::vector< damage_over_time_data > damage_over_time_map; to creature and the associated functions to store damage into it and process it every turn.

Describe alternatives you've considered

Testing

Damage all body part
Eat panacea
nothing happen

Start a world with aftershock
Damage all body part
Eat panacea
Everything is healed in a few sconds
Save and quit before being completly healed
Reload
Healing continues

Additional context

@Maleclypse @John-Candlebury Are you ok with this in Aftershock?

Copy link
Member

@KorGgenT KorGgenT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a real good start, though I have some comments

I would advise making a new class for the DoT data, have it store the damage in a private member and you can use accessors to get and set those values.
I would like for it to be possible that when you add a new DoT effect, it just adds that effect to the stack of effects and continues to get processed. for example: I have a DoT acid spell that applies 3 or 4 damage per tick over 5 seconds. i cast it once and apply the 3 damage per 5 seconds, and i cast it again and apply 4 damage over 5 seconds. time has already elapsed for the first one, sowe just want to add a new one.

If you need any additional assistance with the Json loading functions you can ask, though there are plenty of examples of having load functions as member functions in the code.

src/creature.cpp Outdated Show resolved Hide resolved
src/creature.h Outdated Show resolved Hide resolved
src/iuse_actor.cpp Outdated Show resolved Hide resolved
src/iuse_actor.cpp Outdated Show resolved Hide resolved
@Maleclypse
Copy link
Member

I'm not opposed to it, is the healing ability jsonized if we need to change it for balance?

@anothersimulacrum
Copy link
Member

Yes.

src/damage.h Outdated Show resolved Hide resolved
src/iuse_actor.cpp Outdated Show resolved Hide resolved
src/savegame_json.cpp Outdated Show resolved Hide resolved
src/savegame_json.cpp Outdated Show resolved Hide resolved
src/damage.cpp Outdated Show resolved Hide resolved
src/damage.cpp Outdated Show resolved Hide resolved
@KorGgenT
Copy link
Member

KorGgenT commented May 3, 2020

So a couple little implementation details with how json is used in our infrastructure. one trick you can do if you are loading and deserializing the same data (because deserialize needs a JsonIn parameter) is the load function can just be something like
https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/item_category.cpp#L27-L32

Copy link
Member

@John-Candlebury John-Candlebury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeems good to me!

@KorGgenT KorGgenT merged commit 11714a3 into CleverRaven:master May 4, 2020
@Fris0uman Fris0uman deleted the DoT branch May 4, 2020 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants