Beispiel #1
0
 static void CharacterBody_RecalculateStats(Action <RoR2.CharacterBody> orig, CharacterBody self)
 {
     orig(self);
     if (self.inventory)
     {
         if (self.inventory.GetItemCount(itemDef) is int count && count > 0)
         {
             CritStorage critStorage = self.gameObject.GetComponent <CritStorage>();
             if (!critStorage)
             {
                 critStorage = self.gameObject.AddComponent <CritStorage>();
             }
             critStorage.crit = self.crit;
             self.crit        = 10 / Mathf.Pow(2, count - 1);
         }
     }
 }
 void hook_CharacterBody_RecalculateStats(On.RoR2.CharacterBody.orig_RecalculateStats orig, CharacterBody self)
 {
     orig(self);
     if (self.inventory)
     {
         if (self.inventory.GetItemCount(this.ItemIndex) is int count && count > 0)
         {
             CritStorage critStorage = self.gameObject.GetComponent <CritStorage>();
             if (!critStorage)
             {
                 critStorage = self.gameObject.AddComponent <CritStorage>();
             }
             critStorage.crit = self.crit;
             self.crit        = 10 / Mathf.Pow(2, count - 1);
         }
     }
 }