Author Topic: Damage calculation?  (Read 1797 times)

ChupaReaper

  • Guest
Damage calculation?
« on: 16 May 2010, 22:06:52 »
How is damaged calculated:
What is attack-strentgh and attack-var? My guess is either strentgh is either the maximum damage or the base amount and var is either the minimum or how much attack damage varies from strentgh? Also how does armor work, does it just shield that much damage or does it multiply in some way? I know how the multipliers work though.
« Last Edit: 16 May 2010, 22:09:59 by ChupaReaper »

jda

  • Guest
Re: Damage calculation?
« Reply #1 on: 16 May 2010, 22:50:20 »
It's calculatet in three steps:

1. attack strentgh = base damage
attack var = variation up and down off damage
E.g. AS=100 and AV=20 will make a damage of 80 to 120 (this is what you see when you hover over the attack command of your unit ingame).

2. Attack-type / Armor multipliers (defined in the techtree, not the faction!, XML, e.g. magitech.xml):
Say the above gave you, in a particular strike, 94 Damage.
Say the multiplier for the attack type (say piercing) and the target unit's armor (say organic) is 1.25, you get 94 x 1.25 = 117.5, say 118 (don't know if / how roundups are made).

3. Say the attacked unit's armor value = 30:
118-30 = 88 This is how much HP the target will loose.

P.s.: Apparently, if the resulting value is less than 1, the target will loose 1 HP. See silnarm's post (reply #6 in this thread).

EDIT: Edited for clarity sake.
EDIT 2: Update following silnarm's clarification on minimum 1 HP loss on the unit attacked.
« Last Edit: 18 May 2010, 12:41:57 by jda »

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Damage calculation?
« Reply #2 on: 17 May 2010, 00:01:17 »
Jda got it pretty much spot on. The only caveat is that if the calculated damage is less than one, it is set to one.  If a damage calculation is required, at least 1 point of damage will be inflicted.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

jda

  • Guest
Re: Damage calculation?
« Reply #3 on: 17 May 2010, 00:17:16 »
You mean if the attacked unit has 20 armor and the attacker deals 10 damage (assume multiplier = 1.0), that attack will take off 1 HP off the attacked unit? :o

ChupaReaper

  • Guest
Re: Damage calculation?
« Reply #4 on: 17 May 2010, 00:37:54 »
Thanks for clearing that up, better make some adjustments now I think. Would it go to 1 damage if a multiplier of 0.0 was used though?

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: Damage calculation?
« Reply #5 on: 17 May 2010, 10:16:50 »
and the attack types have different multiplyers for different armors, defined in the techs xml-file.
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Damage calculation?
« Reply #6 on: 18 May 2010, 09:12:10 »
You mean if the attacked unit has 20 armor and the attacker deals 10 damage (assume multiplier = 1.0), that attack will take off 1 HP off the attacked unit? :o
Thanks for clearing that up, better make some adjustments now I think. Would it go to 1 damage if a multiplier of 0.0 was used though?

Yes, the check is made after all other calculations, it will always do one or more points of damage.

Does seem unreasonable though, I might change it to clamp at 0.
Glest Advanced Engine - Code Monkey

Timeline | Downloads