示例#1
0
        private float Voidheart30PercentTimebomb(On.RoR2.HealthComponent.orig_Heal orig, RoR2.HealthComponent self, float amount, RoR2.ProcChainMask procChainMask, bool nonRegen)
        {
            var InventoryCount = GetCount(self.body);

            if (self.body && InventoryCount > 0)
            {
                if (self.combinedHealth <= self.fullCombinedHealth * Mathf.Clamp((voidHeartBaseTickingTimeBombHealthThreshold + (voidHeartAdditionalTickingTimeBombHealthThreshold * InventoryCount - 1)), voidHeartBaseTickingTimeBombHealthThreshold, voidHeartMaxTickingTimeBombHealthThreshold) &&
                    //This check is for the timer to determine time since spawn, at <= 10f it'll only activate after the tenth second
                    self.GetComponent <VoidHeartPrevention>().internalTimer >= 7f)
                {
                    RoR2.DamageInfo damageInfo = new RoR2.DamageInfo();
                    damageInfo.crit             = false;
                    damageInfo.damage           = amount;
                    damageInfo.force            = Vector3.zero;
                    damageInfo.position         = self.transform.position;
                    damageInfo.procChainMask    = procChainMask;
                    damageInfo.procCoefficient  = 0f;
                    damageInfo.damageColorIndex = DamageColorIndex.Default;
                    damageInfo.damageType       = DamageType.Generic;
                    self.TakeDamage(damageInfo);
                    return(orig(self, 0, procChainMask, nonRegen));
                }
            }
            return(orig(self, amount, procChainMask, nonRegen));
        }
示例#2
0
 private float HealthComponent_Heal(On.RoR2.HealthComponent.orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen)
 {
     //_logger.LogMessage($"Heal: regen: {nonRegen}");
     if (nonRegen)
     {
         if (GetCount(self.body) > 0)
         {
             //timothy: 0.25f chance = 0.0025% chance. 25f = 25% chance. got it?
             if (Util.CheckRoll(cfgChance.Value, self.body.master))
             {
                 var itemCount  = self.body.inventory.GetItemCount(ItemDef);
                 var multiplier = 1f + cfgMultiplier.Value + cfgMultiplierPerStack.Value * (itemCount - 1);
                 var oldHeal    = amount;
                 amount *= multiplier;
                 _logger.LogMessage($"roll won: {oldHeal} -> {amount}");
             }
             else
             {
                 _logger.LogMessage("roll failed");
             }
         }
     }
     return(orig(self, amount, procChainMask, nonRegen));
 }