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

Putrid Hearts from Jabberwocks may be repeatedly activated to gain infinite mutations #5481

Open
Soadreqm opened this issue Oct 1, 2024 · 1 comment · May be fixed by #5493
Open

Putrid Hearts from Jabberwocks may be repeatedly activated to gain infinite mutations #5481

Soadreqm opened this issue Oct 1, 2024 · 1 comment · May be fixed by #5493
Labels
bug confirmed Bug that has been reproduced src changes related to source code.

Comments

@Soadreqm
Copy link
Contributor

Soadreqm commented Oct 1, 2024

Describe the bug

A putrid heart, acquired by dissecting a dead Jabberwock, may be eaten or activated to gain mutations. However, activating it doesn't consume the heart, meaning it can be activated again to mutate more.

The heart should only work once.

Steps To Reproduce

  1. spawn putrid heart
  2. apply putrid heart
  3. apply the heart again
  4. and again

Screenshots

No response

Versions and configuration

  • OS: Windows
    • OS Version: Windows 10 Pro N
  • Game Version: ed4d9fb [64-bit]
  • Graphics Version: Tiles
  • LAPI Version: 2
  • Game Language: []
  • Mods loaded: [
    Bright Nights [bn],
    Disable NPC Needs [no_npc_food],
    Simplified Nutrition [novitamins],
    No Rail Stations [No_Rail_Stations],
    Item Category Overhaul [Item_Category_Overhaul]
    ]

Additional context

No response

@Soadreqm Soadreqm added the bug label Oct 1, 2024
@IllusionDX
Copy link
Contributor

IllusionDX commented Oct 2, 2024

I tested it and the same thing happens with seeping heart, mutated arm, mutated leg, etc. Basically all the comestibles with type food and use_action mutagen

The problem is in avatar_functions.cpp in the void use_item( avatar &you, item &used ) function

A mutagen like lupine mutagen is inside a flask, so the item is glass flask, and the glass flask returns false on used.type->has_use() so the item goes here and it gets consumed

    } else if( !used.is_craft() && ( used.is_medication() || ( !used.type->has_use() &&
                                     ( used.is_food() ||
                                       used.get_contained().is_food() ||
                                       used.get_contained().is_medication() ) ) ) ) {
        you.consume( used );

But the putrid heart returns true on used.type->has_use() so it goes here instead

    } else if( used.type->has_use() ) {
        you.invoke_item( &used, used.position() );

I tried to add more checks on bool Character::invoke_item( item *used, const std::string &method, const tripoint &pt ) on character.cpp

if( used->is_tool() || used->is_food() || used->get_contained().is_food() ||
        used->is_medication() || used->get_contained().is_medication() ) {
        return consume_charges( *actually_used, charges_used );
    } else if( used->is_bionic() || used->is_deployable() || method == "place_trap" ) {
        used->detach();
        return true;
    }

And that causes it to consume charges as it should but then it doesn't show the message that says "You eat your x", and I don't know how to fix it properly

Edit: I think I got it but I'm gonna wait on another PR

@IllusionDX IllusionDX linked a pull request Oct 3, 2024 that will close this issue
4 tasks
@RoyalFox2140 RoyalFox2140 added confirmed Bug that has been reproduced src changes related to source code. labels Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed Bug that has been reproduced src changes related to source code.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants