PDA

View Full Version : Where is the K coefficient please?


shinyhalo
01-11-2008, 11:08 PM
The manuals describes the formula for calculating damage as:

M(damage) = (Attack Skill / Defense Skill) * (Current hitpoints / Initial hitpoints) * K

I have looked but I can't find K.

Is K always the same?

For that matter, I can only seem to find half of the above formula in battle.script Is there a cleanly written version of the whole formula anywhere in the data files?

Thanks

bman654
01-11-2008, 11:27 PM
Well, the damage is some-what random so I would say that K is not always the same but is some random distribution.

shinyhalo
01-11-2008, 11:53 PM
Well, the damage is some-what random so I would say that K is not always the same but is some random distribution.

So I can't find K because it's not written as a single, fixed constant, but instead as another formula(random distribution). Interesting possibility. I have seen some "random damage" type formulas.

shinyhalo
01-17-2008, 04:33 PM
Well, I've been changing a bunch of numbers in battle.script and testing after each one, but I can't seem to figure it out.

I'm trying to multiply the damage units do to each other by 5 without altering the Attack/Defense ratio.

Obviously, if I just multiplied their Attack by 5 in UnitTypes.csv, I'd get more damage but that would throw the Attack/Defense values out of balance.

Any ideas on how to multiply the final casualty numbers by 5?

bman654
01-17-2008, 05:01 PM
Look in ApplyAttackToDetachment() at the variable randomisedCasualties. This appears to be the damage done to the unit. Note: damage is health and each unit has 15 little guys and each of those little guys has health. So "15" damage may only mean 1 little guy dies.

But anyway, there is a for() loop near the end of the function that goes from 0 to randomisedCasualties and applies the damage to the unit. Just before this for() loop, try multiplying randomisedCasualties by 5 and it should have the effect you want.

shinyhalo
01-17-2008, 08:59 PM
Heh, sweet. Thanks!
I changed:

averageCasualties = AttackAverageOfDistribution(targetDetachment, role, attackAction, currentAttackCount);

to

averageCasualties = 5 * AttackAverageOfDistribution(targetDetachment, role, attackAction, currentAttackCount);

and changed
--local maximumDeviation = 2;
to
--local maximumDeviation = 10;

Tests show the damage is both increased and the Attack/Ratio is preserved, but I'm not sure if the random deviation +/- also got a 5x bump. It's not critical anyway.

bman654
01-18-2008, 12:41 AM
lines that have '--' in them are just comments and do not do anything.