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

Hallucinations effect "hallu" broken #57097

Open
Maleclypse opened this issue Apr 24, 2022 · 5 comments
Open

Hallucinations effect "hallu" broken #57097

Maleclypse opened this issue Apr 24, 2022 · 5 comments
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Items: Food / Vitamins Comestibles and drinks Mechanics: Character / Player Character / Player mechanics (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@Maleclypse
Copy link
Member

Describe the bug

Take Pink tab or any other item that causes effect hallucinations and nothing will happen.

Steps to reproduce

Spawn pink tab
Take pink tab
Wait an hour and watch nothing happen

Expected behavior

Hallucinations to occur

Screenshots

No response

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.19043.1645 (21H1)
  • Game Version: 0.F-7546-gd510958e633 [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    No Fungal Growth [no_fungal_growth],
    Bionic Professions [package_bionic_professions],
    Xedra Evolved [xedra_evolved]
    ]

Additional context

No response

@Maleclypse Maleclypse added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Apr 24, 2022
@Maleclypse Maleclypse added this to Confirmed release blockers in 0.G Stable Tracker via automation Apr 24, 2022
@Maleclypse Maleclypse moved this from Confirmed release blockers to Suggested release blockers in 0.G Stable Tracker Apr 24, 2022
@dseguin
Copy link
Member

dseguin commented Apr 24, 2022

Tested in 45671a0

Spawned and took a couple of pink tabs, hallucinated monster spawned after a short while:

hallu
hallu_msg

But after trying with just one, nothing happens after an hour 🤔

Edit: Turns out it's because the duration you get from just one tab is below 30% of the max duration (comedownTime)

} else if( dur > comedownTime && dur < peakTime ) {
// Full symptoms
u.mod_per_bonus( -2 );
u.mod_int_bonus( -1 );
u.mod_dex_bonus( -2 );
u.add_miss_reason( _( "Dancing fractals distract you." ), 2 );
u.mod_str_bonus( -1 );
if( u.is_avatar() && one_in( 50 ) ) {
g->spawn_hallucination( u.pos() + tripoint( rng( -10, 10 ), rng( -10, 10 ), 0 ) );
}

(duration from 1 tab = 3600, max duration = 21600)

@Maleclypse Maleclypse removed this from Suggested release blockers in 0.G Stable Tracker Apr 24, 2022
@Maleclypse
Copy link
Member Author

"Edit: Turns out it's because the duration you get from just one tab is below 30% of the max duration (comedownTime)" That seems super limiting but I'm not sure if it needs to be changed.

@dseguin
Copy link
Member

dseguin commented Apr 24, 2022

Not sure either, but the "max duration" is actually hardcoded, and it looks like it comes from a time where 1 turn = 6 seconds:

// TODO: Redo this to allow for variable durations
// Time intervals are drawn from the old ones based on 3600 (6-hour) duration.
constexpr int maxDuration = 21600;
constexpr int comeupTime = static_cast<int>( maxDuration * 0.9 );
constexpr int noticeTime = static_cast<int>( comeupTime + ( maxDuration - comeupTime ) / 2 );
constexpr int peakTime = static_cast<int>( maxDuration * 0.8 );
constexpr int comedownTime = static_cast<int>( maxDuration * 0.3 );

I guess a naive solution would be to increase the duration that the pink tab gives you (anything above 6480 should be enough):

"effects": [ { "id": "hallu", "duration": 3600 } ]

@tonezdinny
Copy link

I followed the steps provided and tried different amounts of dosages and did not get any hallucinations. I did get alerts of physical feelings such as nausea but I never encountered any hallucinations. I tried everything from 3 pink tabs all the way up to 6 pink tabs never came across any hallucinations.

Versions and configuration

OS: MacOS
OS Version: Monterey 12.1
Game Version: 0.F-3 [64-bit]
Graphics Version: Tiles
Game Language: System language []
Mods loaded: [
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
No Fungal Growth [no_fungal_growth],
Bionic Professions [package_bionic_professions],
Xedra Evolved [xedra_evolved]
]

@Maleclypse Maleclypse added (S2 - Confirmed) Bug that's been confirmed to exist [C++] Changes (can be) made in C++. Previously named `Code` Items: Food / Vitamins Comestibles and drinks Mechanics: Character / Player Character / Player mechanics and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility labels May 4, 2022
@Maleclypse
Copy link
Member Author

{
    // TODO: Redo this to allow for variable durations
    // Time intervals are drawn from the old ones based on 3600 (6-hour) duration.
    constexpr int maxDuration = 21600;
    constexpr int comeupTime = static_cast<int>( maxDuration * 0.9 );
    constexpr int noticeTime = static_cast<int>( comeupTime + ( maxDuration - comeupTime ) / 2 );
    constexpr int peakTime = static_cast<int>( maxDuration * 0.8 );
    constexpr int comedownTime = static_cast<int>( maxDuration * 0.3 );
    const int dur = to_turns<int>( it.get_duration() );
    // Baseline
    if( dur == noticeTime ) {
        u.add_msg_if_player( m_warning, _( "You feel a little strange." ) );
    } else if( dur == comeupTime ) {
        // Coming up
        if( one_in( 2 ) ) {
            u.add_msg_if_player( m_warning, _( "The world takes on a dreamlike quality." ) );
        } else if( one_in( 3 ) ) {
            u.add_msg_if_player( m_warning, _( "You have a sudden nostalgic feeling." ) );
        } else if( one_in( 5 ) ) {
            u.add_msg_if_player( m_warning, _( "Everything around you is starting to breathe." ) );
        } else {
            u.add_msg_if_player( m_warning, _( "Something feels very, very wrong." ) );
        }
    } else if( dur > peakTime && dur < comeupTime ) {
        if( u.stomach.contains() > 0_ml && ( one_in( 1200 ) || x_in_y( u.vomit_mod(), 300 ) ) ) {
            u.add_msg_if_player( m_bad, _( "You feel sick to your stomach." ) );
            u.mod_hunger( -2 );
            if( one_in( 6 ) ) {
                u.vomit();
            }
        }
        if( u.is_npc() && one_in( 1200 ) ) {
            static const std::array<std::string, 4> npc_hallu = {{
                    translate_marker( "\"I think it's starting to kick in.\"" ),
                    translate_marker( "\"Oh God, what's happening?\"" ),
                    translate_marker( "\"Of course… it's all fractals!\"" ),
                    translate_marker( "\"Huh?  What was that?\"" )
                }
            };

            ///\EFFECT_STR_NPC increases volume of hallucination sounds (NEGATIVE)

            ///\EFFECT_INT_NPC decreases volume of hallucination sounds
            int loudness = 20 + u.str_cur - u.int_cur;
            loudness = ( loudness > 5 ? loudness : 5 );
            loudness = ( loudness < 30 ? loudness : 30 );
            sounds::sound( u.pos(), loudness, sounds::sound_t::speech, _( random_entry_ref( npc_hallu ) ),
                           false, "speech",
                           loudness < 15 ? ( u.male ? "NPC_m" : "NPC_f" ) : ( u.male ? "NPC_m_loud" : "NPC_f_loud" ) );
        }
    } else if( dur == peakTime ) {
        // Visuals start
        u.add_msg_if_player( m_bad, _( "Fractal patterns dance across your vision." ) );
        u.add_effect( effect_visuals, time_duration::from_turns( peakTime - comedownTime ) );
    } else if( dur > comedownTime && dur < peakTime ) {
        // Full symptoms
        u.mod_per_bonus( -2 );
        u.mod_int_bonus( -1 );
        u.mod_dex_bonus( -2 );
        u.add_miss_reason( _( "Dancing fractals distract you." ), 2 );
        u.mod_str_bonus( -1 );
        if( u.is_avatar() && one_in( 50 ) ) {
            g->spawn_hallucination( u.pos() + tripoint( rng( -10, 10 ), rng( -10, 10 ), 0 ) );
        }
    } else if( dur == comedownTime ) {
        if( one_in( 42 ) ) {
            u.add_msg_if_player( _( "Everything looks SO boring now." ) );
        } else {
            u.add_msg_if_player( _( "Things are returning to normal." ) );
        }
    }
}```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Items: Food / Vitamins Comestibles and drinks Mechanics: Character / Player Character / Player mechanics (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

No branches or pull requests

3 participants