CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.11k stars 4.11k forks source link

Effect on Conditions that add "PERMANENT" effects instead add 1 turn effects #51953

Closed robob27 closed 2 years ago

robob27 commented 2 years ago

Describe the bug

There are 2 effect on conditions that add effects with a duration of "PERMANENT" to the character in effect_on_condition.json:

  {
    "type": "effect_on_condition",
    "id": "scenario_infected",
    "eoc_type": "SCENARIO_SPECIFIC",
    "effect": [
      { "u_add_effect": "infected", "intensity": 1, "duration": "PERMANENT", "target_part": "RANDOM" },
      { "assign_mission": "MISSION_INFECTED_START_FIND_ANTIBIOTICS" }
    ]
  },
  {
    "type": "effect_on_condition",
    "id": "scenario_fungal_infection",
    "eoc_type": "SCENARIO_SPECIFIC",
    "effect": [ { "u_add_effect": "fungus", "intensity": 1, "duration": "PERMANENT", "target_part": "RANDOM" } ]
  },

These do not currently work as expected. For both effects, they are removed after the very first step the character takes. By changing the duration to something like "1000 minutes", this no longer happens.

Steps To Reproduce

Note: These steps will not reproduce the error in the current experimental due to Scenario Specific EOCs not actually getting applied to the character due to another bug. After #51938 is merged (which causes the effects to get applied initially) this bug will become apparent. With this in mind:

  1. Create a new character with the Fungal Infection or Infected scenario after the above PR is merged or make the changes locally for testing
  2. Don't move, check character info, observe infected or itchy
  3. Move, observe infected or itchy is gone

Expected behavior

I expect that the infections will last some non-insignificant amount of time.

Screenshots

No response

Versions and configuration

OS: Windows

OS Version: 10.0 2009 Game Version: c29036d [64-bit]

Graphics Version: Tiles

Game Language: System language []

Mods loaded: [ Dark Days Ahead [dda], Disable NPC Needs [no_npc_food], Bionic Professions [package_bionic_professions] ]

Additional context

The version info above is kinda irrelevant because as I mentioned the bug isn't really testable in those versions without applying some changes, but I just wanted to confirm it was present in 8c3ee3a64c559638c1ebb355b912be3ccc77952c and doesn't appear to have been fixed by other changes since.

ZhilkinSerg commented 2 years ago

Is it reproducible via dialogs?

robob27 commented 2 years ago

@ZhilkinSerg just to confirm do you mean if I apply infection or fungal infection via debug menu?

Edit: If so, just tested and no, the same thing does not happen if I manually apply a fungal infection with a duration of 1 and permanent = true on myself via debug. This seems to only impact the effect_on_condition side of it.

ZhilkinSerg commented 2 years ago

No, u_add_effect function in NPC dialogs - https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/NPCs.md#character-effects--mutations

ZhilkinSerg commented 2 years ago

If permanent effects in scenario eocs work fine in https://github.com/CleverRaven/Cataclysm-DDA/releases/tag/cdda-experimental-2021-09-21-0417, I would assume it happened after #51773 and it does not like zero duration even for permanent effects now, so it might need to be changed to 1_seconds instead of 0_turns here:

https://github.com/CleverRaven/Cataclysm-DDA/blob/716276e9e558eda51f7b556ba1caf6b01a67c6c2/src/npctalk.cpp#L1698-L1700

robob27 commented 2 years ago

Thanks! I wasn't sure of a great way to test that off the top of my head. That does seem like the issue.

robob27 commented 2 years ago

I tested this again in the latest experimental with both the infected and fungal infection scenario and was unable to reproduce. Seems like it got fixed elsewhere. Closing.