Author Topic: Let's make Pain Killer useful  (Read 5720 times)

Offline Vakrug

  • Colonel
  • ****
  • Posts: 320
    • View Profile
Re: Let's make Pain Killer useful
« Reply #15 on: September 26, 2022, 06:53:28 pm »
`lostHealth` variable is local for that function and is not remembered anywhere.
Oh, come on... lostHealth = getBaseStats()->health - _health; I don't see the declaration of "getBaseStats" and "_health" here, so I assume they are taken from "soldier" object. So the game does keep track of lostHealth by keeping track of "current health" and "maximal health".
The main concern is about _moraleRestored...
« Last Edit: September 26, 2022, 06:55:44 pm by Vakrug »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: Let's make Pain Killer useful
« Reply #16 on: September 26, 2022, 06:56:57 pm »
Oh, come on... lostHealth = getBaseStats()->health - _health; I don't see the declaration of "getBaseStats" and "_health" here, so I assume they are taken from "soldier" object. So the game does keep track of lostHealth by keeping track of "current health" and "maximal health".

Dude, do you really want to argue with an openxcom developer about openxcom source code?

`getBaseStats()->health` is a constant (usually), but `_health` can easily change. Once you heal up your soldier, both will have the same value and lostHealth will be zero. I.e. the game lost all information it ever had about it, i.e. it is not tracked.
« Last Edit: September 26, 2022, 06:59:01 pm by Meridian »

Offline Vakrug

  • Colonel
  • ****
  • Posts: 320
    • View Profile
Re: Let's make Pain Killer useful
« Reply #17 on: September 26, 2022, 08:03:31 pm »
Dude, do you really want to argue with an openxcom developer about openxcom source code?
At this moment it is more an argue about ability to make logical conclusions using facts provided. Pain Killer do works, right? It restores some morale and do it only once (before another plasma beam hit), right? So game does keep track of Pain Killer usage. Otherwise either Pain Killer would not work completely or it would be possible to restore morale multiple times.

`getBaseStats()->health` is a constant (usually), but `_health` can easily change. Once you heal up your soldier, both will have the same value and lostHealth will be zero. I.e. the game lost all information it ever had about it, i.e. it is not tracked.
Yes, this is a problem, but not really big problem. According to formula provided, if a soldier somehow gets healed completely it cannot recover morale with Pain Killer, because info about damage take is lost indeed. And info about pain is lost as well. But in most cases a soldier after healing will still have diminished health. So it would be possible to recover some lost morale (but not all) lost during damage taken. And after that nothing would prevent gaining morale through shooting bad guys, because there is no more pain.

I really don't want to change anything in how right now morale gets retracted or how it gets back after using Pain Killer. I want to change how morale gets added by shooting aliens.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: Let's make Pain Killer useful
« Reply #18 on: September 26, 2022, 08:40:08 pm »
At this moment it is more an argue about ability to make logical conclusions using facts provided.

The facts you have are incomplete.
That's why I tried to make it clearer (for you and for everybody else reading).

So I say it again: It is a fact that xcom/openxcom does not keep track of "pain".

Pain Killer do works, right? It restores some morale and do it only once (before another plasma beam hit), right? So game does keep track of Pain Killer usage. Otherwise either Pain Killer would not work completely or it would be possible to restore morale multiple times.

This is correct.

But keeping track of "Pain Killer usage" is NOT the same as keeping track of "Pain".
And even keeping track of "Pain Killer usage" is only indirect (via keeping track of "Morale restored so far").

Yes, this is a problem, but not really big problem. According to formula provided, if a soldier somehow gets healed completely it cannot recover morale with Pain Killer, because info about damage take is lost indeed. And info about pain is lost as well. But in most cases a soldier after healing will still have diminished health. So it would be possible to recover some lost morale (but not all) lost during damage taken. And after that nothing would prevent gaining morale through shooting bad guys, because there is no more pain.

True.

Or in other words: "the game does not keep track of pain" :)

I really don't want to change anything in how right now morale gets retracted or how it gets back after using Pain Killer. I want to change how morale gets added by shooting aliens.

I don't want to change anything either.
I just wanted to make clear that the game doesn't keep track of pain, that's all.

Offline Vakrug

  • Colonel
  • ****
  • Posts: 320
    • View Profile
Re: Let's make Pain Killer useful
« Reply #19 on: September 26, 2022, 09:27:19 pm »
And even keeping track of "Pain Killer usage" is only indirect (via keeping track of "Morale restored so far").
If that means that _moraleRestored variable gets altered even when morale goes up by shooting aliens, then I admit that my idea is screwed. But if not, then
Or in other words: "the game does not keep track of pain" :)
In the end it all boils down to definition of a word "pain".
Your definition is "morale, that is substracted by damage".
My definition is "morale, that is added by Pain Killer usage".
Your definition is correct.
My definition is how "pain" is actually tracked by the game.
There is less "pain" in my definition. But there is enough "pain" to make Pain Killer useful if implemented as morale cap. At least for a proof of concept reasons.
« Last Edit: September 26, 2022, 09:39:02 pm by Vakrug »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: Let's make Pain Killer useful
« Reply #20 on: September 26, 2022, 09:53:30 pm »
I tried, but I give up.
Forget I said anything.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11728
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Let's make Pain Killer useful
« Reply #21 on: September 27, 2022, 10:14:59 am »
Sorry about the derailment. Dioxine and I are both still interested in modifying this part of vanilla, so please still consider it.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Let's make Pain Killer useful
« Reply #22 on: September 27, 2022, 12:05:05 pm »
In what exactly way? Best would be some "user story" example how you like to it work.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9099
    • View Profile
Re: Let's make Pain Killer useful
« Reply #23 on: September 27, 2022, 12:10:34 pm »
Also, if the requirement is different from Vakrug's, please open a new thread.

(just so that we can mark it later as [DONE] without causing confusion)

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11728
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Let's make Pain Killer useful
« Reply #24 on: September 27, 2022, 04:12:41 pm »
Also, if the requirement is different from Vakrug's, please open a new thread.

(just so that we can mark it later as [DONE] without causing confusion)

All right, here it is: https://openxcom.org/forum/index.php/topic,10786.0.html

In what exactly way? Best would be some "user story" example how you like to it work.

I hope the new thread sheds some light on this; if not, feel free to ask for clarification (here or on Matrix).