OpenXcom Forum
Modding => Released Mods => XPiratez => Topic started by: Eddie on February 21, 2016, 03:23:59 pm
-
Edit: I made a spreadsheet that you can use to calculate melee damage for your gals. Type in your gals stats and see what is the best weapon for her. If you think my formulas are not correct, please discuss here.
Melee weapon damage is complicated enough that you need a spreadsheet to do it quickly. But I got a bit confused what the actual damage formulas are. What gives me trouble is the "ToStun" and "ToHealth" modifiers. Is that damage added or is the existing damage split?
Example Handle:
It has a "ToHealth: 0.15" modifier and does stun damage. Is the damage
StunDamage + (HealthDamage=Stundamage*0.15)
or
StunDamage*(1-0.15) + (HealthDamage=Stundamage*0.15)?
In the second case, what happens when the ToHealth modifier is >1?
And what about resistances and armour in all this? Are resistances applied to damage types seperately? Is armour applied to each damage type or the total?
Bottom line, can someone give me the correct formula please?
-
Code ref: https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Savegame/BattleUnit.cpp#L1131
Stun damage are are independent to health damage except that both are based on power of hit (something like `weapon_damage * random - armor`).
`ToHealth: 1.0` Mean whole power value will be applied to health (if 0 then nothing will change, if < 0 then unit will grain health).
Same for stun.
Examples:
ToHealth: 1.0
ToStun: 0.25
This behavior of normal weapon.
ToHealth: 0.0
ToStun: 1.0
This is behavior of stun rod.
if value is greater than 1.0 then simply unit will lose or grain more health/stun e.g. with weapon damage 1 and to health 100.0 then you can instant kill all unarmed units but unit with armor will not get any damage (because power after armor subtraction is less than zero).
btw I see I f*** up stun damage in stun rod a bit. In normal version it get always 100% of power but in extended it have random value from 0 to current power value (like normal weapons).
Sorry for all deaths that caused by stun not working as intended.
-
Yup, Yankes - Stun Rod is a bit messed up. Is there an error in the code you posted? Should it be
ToHealth
ToStun
-
Yup, Yankes - Stun Rod is a bit messed up. Is there an error in the code you posted? Should it be
ToHealth
ToStun
Error I mention is in extended exe. Its handles bit different stun damage in stun road than nightly version.
And in my previous post I incorrectly repeated that names in examples as you pointed out. This is different thing to previous one.
-
btw I see I f*** up stun damage in stun rod a bit. In normal version it get always 100% of power but in extended it have random value from 0 to current power value (like normal weapons).
Sorry for all deaths that caused by stun not working as intended.
Doesn't matter, my Cattle Prod has forced 0-200% damage rolls anyway.
-
and then rolled again. Whole point was normal weapons do random stun damage aside from damage range e.g. when you do 100 damage to unit it could do form 0 to 25 stun damage (aside from 100 damage to health). In normal OXC when you hit someone with 132 damage stun rod (item can do damage from 0 to 200) it will do 132 stun damage, but if you do with exactly same item in OXCE value will be in 0 to 132 range.
In 3.0 it will be fixed. While I doing that I decide to expand a bit handling of damage types. Each "ToSomething" property will have "RandomProperty" witch will how calculate final change of stat. Something like:
each psi-attack reduce morale by 20 and have random chance to reduce hp by 0 to 5.
-
(https://cdn.meme.am/instances/62537690.jpg)
-
Ok, lets see if I read the code correctly...
Example 1: Ball Bat
Lets say it does 40 damage on a hit, type is stun. I hit a target with armour 20, so 20 actual stun damage is dealt. Now the Ball Bat has "ToHealth=0.75", so in addition to the 20 stun damage the bat does 20*0.75=15 damage to health.
Example 2: Plastersteel Pipe
Lets say it does 30 damage on a hit, type is concussion (type 3, HE in vanilla). I hit a target with armour 20, so 10 damage to health is dealt. Now the pipe has "ToStun=1.5", so in addition to the 10 damage to health the pipe should do 10*1.5=15 stun damage. But since "ToStun" is rolled, it does 0-15 stun damage, so an average of 7.5.
Edit: If I read the code correctly, "ToStun" ignores any stun resistances the target might have if it's not totally immune to stun damage. Also, no resistances in the "ToHealth" damage, and no bleeding.
-
Edit: If I read the code correctly, "ToStun" ignores any stun resistances the target might have if it's not totally immune to stun damage. Also, no resistances in the "ToHealth" damage, and no bleeding.
It is exactly as I want it. It allows to custom-tailor new damage types from the existing ones; like resistance to stub bomb being different than resistance to handle, and different from resistance to electricity etc.
-
Exactly what Dioxine said, stun resistance is to stun damage type not to `ToStun` property.
-
I made a spreadsheet with the formulas for melee weapons (early game) and added it to the first post. Please discuss here if you think my formulas are not correct.