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

Implement relic recharge #2284

Merged
merged 6 commits into from
Jan 17, 2023
Merged

Conversation

olanti-p
Copy link
Contributor

@olanti-p olanti-p commented Jan 9, 2023

Summary

SUMMARY: Features "Relics can recharge now"

Purpose of change

Working towards #1816 (implements step 3)

Describe the solution

Depends on #2283 and #2254 Rebased on latest upload, does not depend on them anymore.

This PR implements relic recharge that mirrors existing artifact recharge code, except it works for NPCs and also has a variety of knobs accessible from JSON.
Tweaked behavior of "close to skin" to be more transparent.

Describe alternatives you've considered

  • Porting DDA relic recharge.
    I'm not sure how reliable it is. Also, no ARTC_PORTAL, which is a thing CV wants.

Testing

TODO:

  • playtest
  • implement analogue to ACR_SKIN
  • write tests? Feeling lazy, added test relics but no tests
  • add more features? Let's wait for actors framework on this
  • extract new strings to translation template
  • add docs

@github-actions github-actions bot added JSON related to game datas in JSON format. mods PR changes related to mods. src changes related to source code. tests changes related to tests labels Jan 9, 2023
@github-actions github-actions bot removed the tests changes related to tests label Jan 11, 2023
@olanti-p olanti-p changed the title [WiP] Implement relic recharge Implement relic recharge Jan 11, 2023
@chaosvolt
Copy link
Member

Started testing and everything works as expected so far. Does retain the "unloads a none if assigned an ammo type and unloaded after recharging from empty" behavior if you attempt that:

 DEBUG    : cannot determine reload cost as none is neither ammo or magazine

 FUNCTION : item_reload_cost
 FILE     : C:\Users\Vincent\Downloads\Cataclysm-BN-relics-4\Cataclysm-BN-relics-4\src\player.cpp
 LINE     : 1315
 VERSION  : BN Please install `git` to generate VERSION, or set the variable manually

However, this is status quo behavior, artifact recharging will already do that if abused in this manner, so fixing it's most likely outside scope.


bool check_recharge_reqs( const item &itm, const relic_recharge &rech, const Character &carrier )
{
switch( rech.req ) {
Copy link
Member

Choose a reason for hiding this comment

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

This switch looks like it really wants to be something like rech.req_impl.check_reqs( itm, carrier ).

@Coolthulhu
Copy link
Member

Coolthulhu commented Jan 17, 2023

Untestable, but only modders can be affected.
Not a good practice, but it doesn't look like it will cause harm if merged. Other than modders being misled into thinking this is properly tested and can be trusted. Modders who don't use it won't see it.

@Coolthulhu Coolthulhu merged commit 429f377 into cataclysmbnteam:upload Jan 17, 2023
@chaosvolt
Copy link
Member

chaosvolt commented Jan 17, 2023

Bit belatedly, I did some basic testing in the process of implementing chaosvolt/cdda-arcana-mod#307, compiles and recharging seems to work as intended. Tested both time-based and trap-removal types.

Will be able to also test solar when I get the opportunity to prepare an update for Cata++ as well.

@olanti-p
Copy link
Contributor Author

olanti-p commented Jan 18, 2023

I tested it manually by enabling TEST_DATA mod for regular world and spawning all the relics added here, then checking how they recharge (they're in TEST_DATA so they don't pollute translation files). This is in no way an alternative to automated testing, of course, but after artifact->relic migration they'll be at least testable by regular players.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JSON related to game datas in JSON format. mods PR changes related to mods. src changes related to source code. translation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants