Jump to content
  • 0
Sign in to follow this  
ushas

[435] Defences are not properly lowered from low attribute scores

Question

The BB fighter has average Dexterity and Perception, both 10. When he suffers a reduction of any of this two, the resulting value of the Reflex defence is by 1 point higher than it should be. I did some tests with different builds and spells -- and it looks like this issue holds for all the defences modified by the low sum of connected attributes.

The picture below shows different characters suffering by the bug:
Low_Attributes.jpg

For example, the first character has:
Deflection 25, Fortitude 19, Reflex 19, Will 19
-> Should have:
Deflection 24, Fortitude 18, Reflex 18, Will 18
and so on with others...

How to reproduce:
A) either, by putting Hobbled or similar effect on BB fighter -- the reflex defence will be off;
B) or create a new character from any of those in the picture above or similar (sum of two attributes modifying the tested defence to be < 20);


[comments]
According to several tests with different setups, the bug seems to occur only when the summed modifier from attributes is negative regardless to its value.

It's like the game does something like this for Deflection:
modifier = (Per - 10) + (Res - 10)
if (modifier < 0)  --> deflection = deflection + modifier +1
else                   --> deflection = deflection + modifier

And for Reflex defence (and similarly for For. and Will):
modifier = (Per - 10)*2 + (Dex - 10)*2
if (modifier < 0)  --> reflex = reflex + modifier +1
else                   --> reflex = reflex + modifier
 

Did some basic tests with attacking the corresponding defence and it seems the numbers are the same (wrong) in the combat log.

Leveling up also doesn't help with the issue.

 

Note: The first two character sheets also show the bug with bigger fonts (130%). The longer Background descriptions don't fit the sheet size. 

 

Share this post


Link to post
Share on other sites

11 answers to this question

Recommended Posts

  • 0

For example, the first character has:

Deflection 25, Fortitude 19, Reflex 19, Will 19

-> Should have:

Deflection 24, Fortitude 18, Reflex 18, Will 18

and so on with others...

I don't see what the problem is.

 

+10 Might = 10 Fort

+9 Con = 9 Fort 

 

10+9 = 19

 

Am I missing something?

Share this post


Link to post
Share on other sites
  • 0

For Reflex, Fortitude and Will, there is +2 / -2 modifier to the corresponding defence per point of attribute above / below 10. And at lvl 1 the character will have the base 20 For / Ref / Will, without taking into account modifiers, if I recall correctly.

 

So if you look at the first sheet, there is already written +0 For from Mig = 10 and -2 For from Con = 9, then it should be For = 20 + 0 - 2 = 18.

 

Of course, the description and my estimation may be wrong. But your calculation would not work for the last character at all. As he has negative defences;)

Share this post


Link to post
Share on other sites
  • 0

A while ago, there was a +0.5 added in the code for Fort/Ref/Will defenses. When I get home I'll check it to see if it's still there - that may be the cause if it's rounded up/down by 1.

Share this post


Link to post
Share on other sites
  • 0

A while ago, there was a +0.5 added in the code for Fort/Ref/Will defenses. When I get home I'll check it to see if it's still there - that may be the cause if it's rounded up/down by 1.

 

Oh no, I'm being haunted by rounding demon... ;(

 

Thanks, Sensuki, much appreciated if you can catch it.

Share this post


Link to post
Share on other sites
  • 0

16 = 13   (-3)  --

17 = 15   (-2)  2

18 = 17   (-1)  2

19 = 19   (0)   2

20 = 20   (0 )  1

21 = 22   (+1)  2

22 = 24   (+2)  2

23 = 26   (+3)  2

24 = 28   (+4)  2

25 = 30   (+5)  2

Edited by Bazy

Share this post


Link to post
Share on other sites
  • 0

Yeah it's the +0.5 from v301 or whatever hahah

 

public int CalculateDefense(DefenseType defenseType, AttackBase attack, GameObject enemy, bool isSecondary)
    {
        int num = (this.Level - 1) * AttackData.Instance.DefensePerLevel;
        switch (defenseType)
        {
            case DefenseType.Deflect:
            {
                num += this.Deflect;
                num += (int) (this.StatBonusDeflection + 0.5f);
                Equipment equip = base.gameObject.GetComponent<Equipment>();
                num += this.GetShieldDeflectBonus(equip);
                if ((enemy != null) && this.IsEnemyDistant(enemy))
                {
                    num += this.DistantEnemyBonus;
                }
                bool veilPiercing = false;
                if ((attack != null) && (attack is AttackRanged))
                {
                    veilPiercing = (attack as AttackRanged).VeilPiercing;
                }
                if (!veilPiercing)
                {
                    num += this.VeilDeflectionBonus;
                }
                break;
            }
            //////////////////////// PROBLEM RIGHT HERE /////////////////////////////
            case DefenseType.Fortitude:
                num += this.Fortitude;
                num += (int) ((GetStatDefenseTypeBonus(this.Might) + GetStatDefenseTypeBonus(this.Constitution)) + 0.5f);
                break;
            //////////////////////// PROBLEM RIGHT HERE /////////////////////////////
            case DefenseType.Reflex:
            {
                num += this.Reflex;
                num += (int) ((GetStatDefenseTypeBonus(this.Dexterity) + GetStatDefenseTypeBonus(this.Perception)) + 0.5f);
                Equipment equipment = base.gameObject.GetComponent<Equipment>();
                num += this.GetShieldReflexBonus(equipment);
                if ((enemy != null) && this.IsEnemyDistant(enemy))
                {
                    num += this.DistantEnemyBonus;
                }
                break;
            }
            //////////////////////// PROBLEM RIGHT HERE /////////////////////////////
            case DefenseType.Will:
                num += this.Will;
                num += (int) ((GetStatDefenseTypeBonus(this.Intellect) + GetStatDefenseTypeBonus(this.Resolve)) + 0.5f);
                break;

            case DefenseType.None:
                break;

            default:
                num += 50;
                break;
        }
        if (attack != null)
        {
            num += this.GetDefenseBonus(defenseType, attack, isSecondary);
        }
        AnimationController component = base.gameObject.GetComponent<AnimationController>();
        if (component != null)
        {
            if (component.CurrentReaction == AnimationController.ReactionType.Knockdown)
            {
                num += this.WhileKnockeddownDefenseBonus;
            }
            if (component.CurrentReaction == AnimationController.ReactionType.Stun)
            {
                num += this.WhileStunnedDefenseBonus;
            }
        }
        if (this.OnDefenseAdjustment != null)
        {
            int num2 = 0;
            this.OnDefenseAdjustment(defenseType, attack, enemy, isSecondary, ref num2);
            num += num2;
        }
        return (num + ((int) this.PotD_Bonus));
    }
Those +0.5 are no longer necessary because the calculation is no longer [Attribute A + Attribute B] x 1.5.

 

The +0.5 was added because I reported a bug with the rounding for that formula. That formula has now been changed to [Attribute A + Attribute B] x 2, so the cases where you have an odd numbered attribute don't lead to a fractional number anymore.

Edited by Sensuki
  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Ha, so your effort has actually bad impact on game;)

 

But now truly, well done! You are right these are whole numbers anyway...

 

I think in C this would mean they didn't take into account negative numbers? (so it wouldn't work even in that original calculation):

int(+3+0.5) -> 3

int(-3+0.5) -> -2

 

So it doesn't show any problems for positive sums of modifiers from attributes, but for the negative ones yes...

But I'm never sure about this things. This is C#?

Share this post


Link to post
Share on other sites
  • 0

Also the same with the Deflection modifier, I guess?

num += (int) (this.StatBonusDeflection + 0.5f);
  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Bumping for BBv480.

 

If it's useful, I would like to add that the wrong negative modifier of defences from the sum of attributes doesn't only influence party members, but also enemies. In several instances, as a result of this issue they have a higher defence than should or the defence number isn't lowered enough by used debuff ability/spell.
-> So this time it also works against the player.

 

 

For example, Stone Beetle & BB Rogue ability Blinding strike:

 

On PoD difficulty Stone beetle has this attributes and defences:
Dexterity: 8, Perception: 12, Resolve:  12

Deflection: 56, Reflex: 47

 

Now we can see that in the beginning the modifiers from attributes aren't negative and thus probably working right (+0 to Refl from sum of Dex & Per, +4 to Defl from sum of Per & Res).

 

Blinding strike gives Blinded affliction:
-25 accuracy, -4 Perception, -2 Move speed, -20 Reflex, -20 Deflection

 

When the enemy is affected by the debuff, the modifier from the sum of Dexterity and Perception becomes negative:

[ ( Per - 10 ) * 2  +  ( Dex - 10 ) * 2 ]   =  -8 to Reflex

So the new Reflex number should be 47 - 20 - 8 = 19.

 

But the resulting Reflex defence used in game is 1 point higher.  For example, see the scenario of three attack following each other in game:
Stone_Beetle.jpg
Deflection: 32
Reflex: 20

Share this post


Link to post
Share on other sites
Sign in to follow this  

×
×
  • Create New...