Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   King`s Bounty: Warriors of the North (http://forum.fulqrumpublishing.com/forumdisplay.php?f=206)
-   -   Bugfixes (http://forum.fulqrumpublishing.com/showthread.php?t=35494)

Razorflame 10-31-2012 07:50 PM

Quote:

Originally Posted by Bhruic (Post 475737)
Ok, time for someone to fact check me here, because if I'm reading this correctly, I'm very confused:
Code:

      iskrit = ( kritProbRnd < kritProb )
      if iskrit then
        if receiver_human and not receiver_glot then
          kritProb = kritProb - skill_power("weakness_lore", 2)
          if kritProbRnd < kritProb then
            iskrit = false
            is_weakness_lore = true
          end
        end
      end

Basically, what this is doing it checking if someone made a critical hit. kritProb is the chance of performing a critical hit, kritProbRnd is a random number from 0-99.

Now, if I'm understanding this right, if a critical hit was made (kritProbRnd is less than kritProb), it then subtracts the value from "weakness_lore", which is the Sense Weakness skill. However, let's assume that you don't have the Sense Weakness skill. Shouldn't skill_power("weakness_lore", 2) return 0? And if that's the case, then kritProb = kritProb - skill_power("weakness_lore", 2) becomes kritProb = kritProb - 0, or kritProb = kritProb. In which case the second if kritProbRnd < kritProb then is guarunteed to also be true because kritProb hasn't changed. Which means that iskrit should automatically be set false, and the game should think Sense Weakness kicked in.

Even worse, I'm sitting here and I can't remember if I've actually had the enemy perform a critical hit on me. It could be my memory letting me down, or it could be that you can't actually get a critical hit on your troops until you take the Sense Weakness skill. Unfortunately I can't set up a test case for "enemy performs a critical hit". So have I mis-analyzed the code? Can anyone without the Sense Weakness skill verify that they've taken (not given) a critical hit?


ah i also was wondering that since sometimes i got a msg about sense weakness
and i was like wtf i don't have that skill tagged


i thought it maybe was a viking ability or something

but seeing this
this is just a bad write up fix plz:D

Bhruic 10-31-2012 07:56 PM

Quote:

Originally Posted by Razorflame (Post 475764)
ah i also was wondering that since sometimes i got a msg about sense weakness
and i was like wtf i don't have that skill tagged


i thought it maybe was a viking ability or something

but seeing this
this is just a bad write up fix plz:D

It's an easy fix, but I just want to verify that I'm not misreading it first.

camelotcrusade 10-31-2012 08:17 PM

I don't think I've been critted now that you mention. And I actually think we see the sense weakness text come up when we should have been critted but we aren't.

Just last night the AI cast DOOM on my wolves (ermahgerd attack the summons?!!) and when they were hit by the enemy they were not criticaled. I did see the sense weakness appear in the text, though.

Does that help?

Bhruic 10-31-2012 08:22 PM

Quote:

Originally Posted by camelotcrusade (Post 475778)
I don't think I've been critted now that you mention. And I actually think we see the sense weakness text come up when we should have been critted but we aren't.

Just last night the AI cast DOOM on my wolves (ermahgerd attack the summons?!!) and when they were hit by the enemy they were not criticaled. I did see the sense weakness appear in the text, though.

Does that help?

Yup. Ha. And people were complaining about spells/rage not doing critical hits. The poor enemy wasn't getting crits for anything!

camelotcrusade 10-31-2012 08:52 PM

Oh dear. Double facepalm.

So how should we bug this one? Sense Weakness prevents critical hits from enemies? It's kind of a whopper if we are understanding this correctly.

Edit: Attempt at an entry.
  • Sense Weakness bug appears to prevent enemy critical hits: A look at the sense weakness code (link to thread) reveals an error where sense weakness is effectively preventing enemies from inflicting critical hits - but only if you don't have any ranks in the skill. When they would normally inflict a crit you instead see a "sense weakness" mention in the combat log and the crit is averted. Some players are also reporting they never been hit with a crit.

I'll just replace what I have in the thread now with this.

Zechnophobe 10-31-2012 09:30 PM

Code:

   
 iskrit = ( kritProbRnd < kritProb )
      if iskrit then
        if receiver_human and not receiver_glot then
          kritProb = kritProb - skill_power("weakness_lore", 2)
          if kritProbRnd < kritProb then
            iskrit = true
          else
            iskrit = false
            is_weakness_lore = true
          end
        end
      end

Logic was just all topsy turvy. They intend to check IF IT IS STILL A CRIT, but instead of letting it be a crit, they instead cancel it. I believe the above should fix it unless I'm misremembering lua 'else' syntax.

camelotcrusade 10-31-2012 09:39 PM

Nice, Zechnophobe. I'll link to it once it's confirmed and Bhruic adds it to the summary. Too bad getting crit isn't easy to test. You almost need to keep a save near a hero who casts doom.

Bhruic 10-31-2012 09:57 PM

Quote:

Originally Posted by Zechnophobe (Post 475817)
Code:

   
 iskrit = ( kritProbRnd < kritProb )
      if iskrit then
        if receiver_human and not receiver_glot then
          kritProb = kritProb - skill_power("weakness_lore", 2)
          if kritProbRnd < kritProb then
            iskrit = true
          else
            iskrit = false
            is_weakness_lore = true
          end
        end
      end

Logic was just all topsy turvy. They intend to check IF IT IS STILL A CRIT, but instead of letting it be a crit, they instead cancel it. I believe the above should fix it unless I'm misremembering lua 'else' syntax.

Well, what they were trying to do is check if Sense Weakness would prevent it from being a crit. Which they did correctly. Unfortunately what they didn't do is consider the case where you didn't have Sense Weakness.

Your code does mostly fix it, but I already posted a different fix in the main post. Both do roughly the same thing but different ways. The main point is that it should be working correctly now.

Zechnophobe 10-31-2012 10:04 PM

Quote:

Originally Posted by Bhruic (Post 475828)
Well, what they were trying to do is check if Sense Weakness would prevent it from being a crit. Which they did correctly. Unfortunately what they didn't do is consider the case where you didn't have Sense Weakness.

Your code does mostly fix it, but I already posted a different fix in the main post. Both do roughly the same thing but different ways. The main point is that it should be working correctly now.

Heh, the 'correct' way to fix it is actually just make the operand be >= in that second check, which I realized after I just saw my silly solution again.

Bhruic 10-31-2012 10:09 PM

Quote:

Originally Posted by Zechnophobe (Post 475832)
Heh, the 'correct' way to fix it is actually just make the operand be >= in that second check, which I realized after I just saw my silly solution again.

That'd involve less steps, certainly. I think mine's slightly more elegant in that it requires less steps if you don't have Sense Weakness. Of course, I might be biased. ;)


All times are GMT. The time now is 11:42 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.