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

Infrastructure for Energy Shield type Armor #77520

Merged
merged 6 commits into from
Nov 12, 2024

Conversation

John-Candlebury
Copy link
Member

Summary

Infrastructure "Add a new Energy Shield type of armor for use in mods."

Purpose of change

I mostly want this for Aftershock energy shields. but it has clear applications for the rest of our magic mods.

Describe the solution

Energy shields work just like normal armor. The only difference is that they dont degrade with attacks, they instead have a health pool, tracked by the dialogue variable ENERGY_SHIELD_HP that gets depleted by blocked damage. With the shield instantly breaking down when it reaches zero. Energy shields take 1 hp damage for every point of damage they block.

They also have a second variable ENERGY_SHIELD_MAX_HP if you want to make the item regen HP using EOCs.

You'll need to both define an energy_shield_max_hp > 0 and give an item the ENERGY_SHIELD flag if you want it to behave like a shield.

Describe alternatives you've considered

Increasing the hardcoded behaviors of the shields but I think the ability to modify their Hp variables with EOCs is enough.

Testing

Spawn and wear a weak energy shield item, which protects only agains ballistic damage. Get hit by a zombie and notice no degradation. Get shot by a MP5 turret, recieve no damage and watch the shield collapse.

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` [Markdown] Markdown issues and PRs Melee Melee weapons, tactics, techniques, reach attack Items: Armor / Clothing Armor and clothing Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Nov 2, 2024
@Maleclypse
Copy link
Member

I can't understand how ENERGY_SHIELD_MAX_HP works from the documentation. Probably needs an example?

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Nov 2, 2024
@John-Candlebury
Copy link
Member Author

It doesnt do anything but record the max hp if you want a regen HP eoc for the shield. (which you need to code yourself)

doc/JSON_FLAGS.md Outdated Show resolved Hide resolved
doc/JSON_FLAGS.md Outdated Show resolved Hide resolved
src/item.cpp Outdated Show resolved Hide resolved
src/item.cpp Outdated Show resolved Hide resolved
@John-Candlebury John-Candlebury marked this pull request as draft November 3, 2024 05:37
@John-Candlebury John-Candlebury marked this pull request as ready for review November 3, 2024 17:59
@GuardianDll
Copy link
Member

Writing it here so i won't forget about it, but i have #77515, so whoever pr will be merged last (and i suspect your PR would be merged first) would need to update the code

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Nov 10, 2024
@Maleclypse Maleclypse merged commit dc1a524 into CleverRaven:master Nov 12, 2024
21 of 27 checks passed
GuardianDll added a commit to GuardianDll/Cataclysm-DDA that referenced this pull request Nov 12, 2024
Maleclypse pushed a commit that referenced this pull request Nov 17, 2024
* get rid of npctalk_var_ prefix for eoc variables

* cleanup after #77055

* deprecate more of type and context

* migrate item vars, make migration happen only once

* doc updates

* migrate u/npc/monster variables

* fix context var migration

* remove `substr( 12 )` in math parser

* move migration to a single function where possible

* no auto

* please clang

* Please clang more

* fix submap load test

* clean up after #77656

* cleanups after #77520
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <Documentation> Design documents, internal info, guides and help. Items: Armor / Clothing Armor and clothing [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs Melee Melee weapons, tactics, techniques, reach attack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants