Talk:Weak Spotter: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 2: Line 2:
: Many of the weapon skill effects, such as this one, are hard-coded into either <code>XRL.World.Parts.MissileWeapon</code> or <code>XRL.World.Parts.Combat</code>. The game performs skill checks in the flow of combat code to adjust critical hit chance and similar details.
: Many of the weapon skill effects, such as this one, are hard-coded into either <code>XRL.World.Parts.MissileWeapon</code> or <code>XRL.World.Parts.Combat</code>. The game performs skill checks in the flow of combat code to adjust critical hit chance and similar details.
:[[User:Egocarib|Egocarib]] ([[User talk:Egocarib|talk]]) 14:02, 8 January 2021 (UTC)
:[[User:Egocarib|Egocarib]] ([[User talk:Egocarib|talk]]) 14:02, 8 January 2021 (UTC)
I found the relevant code under the file you mentioned. It's this.
      int num1 = 0;
      if (this.ParentObject.HasPart("ModMasterwork"))
      {
        ModMasterwork part = this.ParentObject.GetPart("ModMasterwork") as ModMasterwork;
        num1 += part.Bonus;
      }
      if (this.Skill == "Pistol" && Owner.HasSkill("Pistol_WeakSpotter"))
        num1 = num1 == 0 ? 1 : (1 + num1) * 2;
      if (NaturalHitResult + num1 >= 20)
        State1 = true;
It seems to say, after you get weakspotter, if no masterwork mod, add 1 to crit chance, if do have masterwork mod, crit chance is (1+1)*2, which is 4? if i'm reading this right, this wiki is wrong, wiki says it should be +2, instead of +3

Revision as of 21:48, 8 January 2021

I'm trying to mod this, but Pistol_WeakSpotter under XRL.World.Parts.Skill is just a dummy entry without any relevant code.

Many of the weapon skill effects, such as this one, are hard-coded into either XRL.World.Parts.MissileWeapon or XRL.World.Parts.Combat. The game performs skill checks in the flow of combat code to adjust critical hit chance and similar details.
Egocarib (talk) 14:02, 8 January 2021 (UTC)


I found the relevant code under the file you mentioned. It's this.

     int num1 = 0;
     if (this.ParentObject.HasPart("ModMasterwork"))
     {
       ModMasterwork part = this.ParentObject.GetPart("ModMasterwork") as ModMasterwork;
       num1 += part.Bonus;
     }
     if (this.Skill == "Pistol" && Owner.HasSkill("Pistol_WeakSpotter"))
       num1 = num1 == 0 ? 1 : (1 + num1) * 2;
     if (NaturalHitResult + num1 >= 20)
       State1 = true;

It seems to say, after you get weakspotter, if no masterwork mod, add 1 to crit chance, if do have masterwork mod, crit chance is (1+1)*2, which is 4? if i'm reading this right, this wiki is wrong, wiki says it should be +2, instead of +3