do the removal
add to iso protocol
remove current test
remove unused variable
iwyu
attempt to do tests
iwyu?
fix something that shouldnt have been removed
Update tests/effect_test.cpp
Update tests/effect_test.cpp
points for test mutation
actually give them the mutation in the test
change body part to test torso
fix body_part_test_torso error
style and fix torso?
another attempt to fix test_torso
remove connected to, recommended by snup
revert recommendation
fix typo pointed out by candleburry
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: mqrause <38702195+mqrause@users.noreply.github.com>
Co-authored-by: John Candlebury <johncandlebury@gmail.com>
Co-authored-by: Anton Simakov <67688115+GuardianDll@users.noreply.github.com>
Fixes an issue where healing qualities shown when applying a bandage was
different than the applied quality.
The problem before was:
* For example, applying an adhesive bandage with "wound care"
proficiency should give bandaging intensity 2, as returned from
`get_bandaged_level` - this is correct.
* The `bandaged` effect as defined in `effects.json` specifies
`int_dur_factor=6h`, so the intensity of this effect should be defined
by setting its duration as multiples of `int_dur_factor`.
* When calculating the duration for the created effect, the code
previously added `0.5f` to the desired intensity, likely to prevent it
from getting 0. <- This was one part of the previous problem.
* In `effect::set_duration`, the intensity is calculated from how many
multiples of `int_dur_factor` that the desired `duration` is. That
calulation added 1 to the desired intensity, likely to also prevent it
from being 0. <- This was the second problem before.
* In effect, instead of applying intensity 2 for an adhesive bandage,
the code previously applied intensity 3.5 .
With this commit, we instead use `std::max(1, intensity)` to prevent
intensity from being 0.
* Test for mon_ prefix
* Replace LIXA_ with mon_
* deal with pseudo monsters
* Check for prefix in vanilla monster during data load
* better cpp
* fix hardcoded ids
---------
Co-authored-by: Fris0uman <fris0uman@users.noreply.github.com>
* Convert integer parsing test to use normal TEST_CASEs
* Rename test name too similar to another
* Test to enforce normalized test names
* Normalize TEST_CASE names (scripted)
It turns out that a lot of loading code depends on
the availability of certain damage types.
I see two ways to resolve this:
1) Juggle the loading order of JSON types so that damage
types always load first.
2) Add deferred processing for every type with inline
damage type definitions.
I went with option 2, which is better but still
not great since new code that loads damage/resistance
definitions would need to also call finalize_damage_map
in the finalizing stage. Option 1 would cause problems
for mods, especially because the load order would matter.
None of this can be done piecemeal, it has to all be ripped
out in one go unless we want commits that don't compile
on their own.
* Basics all working
* debug info and formatting
* missed a UI append
* UI improvements and serialization
* linting
* remove some suggested stuff
Co-Authored-By: Paul Fenwick <12072+pjf@users.noreply.github.com>
Co-Authored-By: BevapDin <5095435+BevapDin@users.noreply.github.com>
* Update src/player_display.cpp
Co-authored-by: Paul Fenwick <github@pjf.id.au>
* Update src/debug_menu.cpp
Co-authored-by: BevapDin <tho_ki@gmx.de>
* consolidated RDA function
* think this is everything
* few final test suit things
* Update src/character.h
* set it closer to 100 per day
* open up the health test
* test fixes
* Apply suggestions from code review
* clang fixes
* mega robustify this test
* Update tests/stomach_contents_test.cpp
* try this for the test
* Apply suggestions from code review
Co-authored-by: Paul Fenwick <12072+pjf@users.noreply.github.com>
Co-authored-by: BevapDin <5095435+BevapDin@users.noreply.github.com>
Co-authored-by: Paul Fenwick <github@pjf.id.au>
Co-authored-by: BevapDin <tho_ki@gmx.de>
Our string_id constants were a mixture of temporaries, locals, and
globals. Pull them all out as globals, for consistency and efficiency.
The efficiency comes from the fact that each string_id instance caches
its respective int_id, and sharing one instance means that value need
not be recomputed.
* Effect test
* Tested, doc updated
Fungal spores and per venom works
* Have cake, eat it
Martial arts' funcionality is protected from intensity-based removal, docs updated
Co-authored-by: actual-nh <74678550+actual-nh@users.noreply.github.com>
Catch2 provides a customization point for converting our types to
strings by specializing the StringMaker template.
We have some specializations in stringmaker.h, but this feature was only
working intermittently. I finally figured out that was due to an ODR
violation. The test files that didn't include stringmaker.h were
compiling a different specialization than the ones that did.
Re-jig the test includes so that any file including catch.hpp also
includes stringmaker.h, thereby ensuring that the custom
specializations are used everywhere and there is no ODR violation.
I achieved this by adding a new cata_catch.h header and making all
existing headers include catch.hpp via the new header.
Add an effect impacting absorbtion and adding vitamin gain for use in
testing. Also, add the necessary vitamins to be impacted.
Add a food with high quantities of a vitamin to test the absorbtion.
Add an effect with varying levels of fatality, to test fatality of
effects.
Test character's vitamins were not previously being cleared, so make
sure to do that.
It feels a little unsafe to hang onto pointers of monsters that you may
be killing and keep doing things with them, but it appears to work so
I'll live with it.
* Change _ctype.h and __locale to cctype and clocale
* Change _wctype.h to cwctype in game.cpp
* Change __functional_base to functional
* Remove libcxx internal headers
* Remove UNIX system headers
* Fix clang-tidy error with -nostdinc++
The max_effective_intensity value for effects was not correctly limiting
the effect's scaling_mods as documented.
This commit adds:
- effect::get_max_effective_intensity() - get protected variable
- effect::get_effective_intensity() - get capped intensity level
- Use get_effective_intensity() when calculating scaling_mods
- Document the intensity fields a little better
- Add test case and test data for intended behavior
Fixes#45397
Includes test cases focused on `effect` class functions, including:
- High-level: decay (invoked by Creature::process_effects)
- Duration: get_duration, set_duration, get_max_duration
- Permanence: is_permanent, pause_effect, unpause_effect
- Display: disp_name, get_speed_name, disp_short_desc
- Intensity: get_intensity, set_intensity, mod_intensity
- Body parts: get_bp, set_bp
- Modifiers: get_mod, get_amount
Example behaviors exercised:
- simple class initialization test
- minimum / maximum intensity level
- intensity tracks duration for duration-related effects
- decay reduces duration until the effect is removed
- displayed names can vary based on intensity
- pause and unpause effect permanence
- switch grab effect body part back and forth
Some related JSON attributes:
- "name": [ "A", "B", "C"] // multiple intensity names
- "speed_name": "@-name" // as shown in the @ menu
- "base_mods": [ ... ] // fixed mod to stats, healing, etc.
- "scaling_mods": [ ... ] // intensity-based mods to stats, etc.
- "int_dur_factor": time // for duration-based intensity
Includes some JSON test data to use for data-dependent checks.