// Token: 0x06001009 RID: 4105 RVA: 0x00050060 File Offset: 0x0004E260
        public void UsePotion()
        {
            ProcChainMask procChainMask = default(ProcChainMask);

            procChainMask.AddProc(ProcType.LunarPotionActivation);
            this.Heal(this.potionReserve, procChainMask, true);
        }
 // Token: 0x0600100A RID: 4106 RVA: 0x0005008D File Offset: 0x0004E28D
 public float HealFraction(float fraction, ProcChainMask procChainMask)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Single RoR2.HealthComponent::HealFraction(System.Single, RoR2.ProcChainMask)' called on client");
         return(0f);
     }
     return(this.Heal(fraction * this.fullHealth, procChainMask, true));
 }
Beispiel #3
0
 private void IceEliteChanges(On.RoR2.HealthComponent.orig_TakeDamage orig, RoR2.HealthComponent self, RoR2.DamageInfo damageInfo)
 {
     RoR2.CharacterBody characterBody = null;
     if (damageInfo.attacker)
     {
         characterBody = damageInfo.attacker.GetComponent <RoR2.CharacterBody>();
     }
     if (damageInfo.damage > 0)
     {
         if (characterBody)
         {
             RoR2.CharacterMaster master = characterBody.master;
             if (master && master.inventory)
             {
                 if (damageInfo.procCoefficient > 0f)
                 {
                     if (characterBody.GetBuffCount(Resources.Load <BuffDef>("buffdefs/AffixWhite")) > 0)
                     {
                         self.body.AddTimedBuff(FreezingBlood.buffIndex, 2f * damageInfo.procCoefficient);
                         if (self.body.GetBuffCount(FreezingBlood.buffIndex) >= 10)
                         {
                             self.body.ClearTimedBuffs(FreezingBlood.buffIndex);
                             RoR2.CharacterBody component     = damageInfo.attacker.GetComponent <RoR2.CharacterBody>();
                             RoR2.ProcChainMask procChainMask = damageInfo.procChainMask;
                             int     AffixWhiteStack          = master.inventory.GetItemCount(AspectsToItems.AspectsToItems.NewDefsList.Find(x => x.name == "AffixWhite").itemIndex);
                             Vector3 position          = damageInfo.position;
                             float   damageCoefficient = 10f + 10f * AffixWhiteStack;
                             if (AffixWhiteStack == 0)
                             {
                                 damageCoefficient = 20f;
                             }
                             float           damage2     = RoR2.Util.OnHitProcDamage(component.damage, component.damage, damageCoefficient);
                             RoR2.DamageInfo damageInfo2 = new RoR2.DamageInfo
                             {
                                 damage           = damage2,
                                 damageColorIndex = DamageColorIndex.Item,
                                 damageType       = DamageType.Generic,
                                 attacker         = damageInfo.attacker,
                                 crit             = damageInfo.crit,
                                 force            = Vector3.zero,
                                 inflictor        = null,
                                 position         = position,
                                 procChainMask    = procChainMask,
                                 procCoefficient  = 1f
                             };
                             RoR2.EffectManager.SimpleImpactEffect(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/IceCullExplosion"), position, Vector3.up, true);
                             self.TakeDamage(damageInfo2);
                         }
                     }
                 }
             }
         }
     }
     orig(self, damageInfo);
 }
 // Token: 0x06001025 RID: 4133 RVA: 0x00051244 File Offset: 0x0004F444
 private void FixedUpdate()
 {
     this.timer -= Time.fixedDeltaTime;
     if (this.timer <= 0f)
     {
         this.timer = 0.2f;
         if (this.reserve > 0f)
         {
             float num = Mathf.Min(this.healthComponent.fullHealth * this.healthFractionToRestorePerSecond * 0.2f, this.reserve);
             this.reserve -= num;
             ProcChainMask procChainMask = default(ProcChainMask);
             procChainMask.AddProc(ProcType.RepeatHeal);
             this.healthComponent.Heal(num, procChainMask, true);
         }
     }
 }
 // Token: 0x060017D8 RID: 6104 RVA: 0x00067B08 File Offset: 0x00065D08
 private static void PerformDamage(GameObject attacker, GameObject inflictor, float damage, bool isCrit, ProcChainMask procChainMask, float procCoefficient, DamageColorIndex damageColorIndex, DamageType damageType, Vector3 forceVector, float pushAwayForce, List <OverlapAttack.OverlapInfo> hitList)
 {
     for (int i = 0; i < hitList.Count; i++)
     {
         OverlapAttack.OverlapInfo overlapInfo = hitList[i];
         if (overlapInfo.hurtBox)
         {
             HealthComponent healthComponent = overlapInfo.hurtBox.healthComponent;
             if (healthComponent)
             {
                 DamageInfo damageInfo = new DamageInfo();
                 damageInfo.attacker         = attacker;
                 damageInfo.inflictor        = inflictor;
                 damageInfo.force            = forceVector + pushAwayForce * overlapInfo.pushDirection;
                 damageInfo.damage           = damage;
                 damageInfo.crit             = isCrit;
                 damageInfo.position         = overlapInfo.hitPosition;
                 damageInfo.procChainMask    = procChainMask;
                 damageInfo.procCoefficient  = procCoefficient;
                 damageInfo.damageColorIndex = damageColorIndex;
                 damageInfo.damageType       = damageType;
                 damageInfo.ModifyDamageInfo(overlapInfo.hurtBox.damageModifier);
                 healthComponent.TakeDamage(damageInfo);
                 GlobalEventManager.instance.OnHitEnemy(damageInfo, healthComponent.gameObject);
                 GlobalEventManager.instance.OnHitAll(damageInfo, healthComponent.gameObject);
             }
         }
     }
 }
Beispiel #6
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));
        }
        // Token: 0x06001008 RID: 4104 RVA: 0x0004FE58 File Offset: 0x0004E058
        public float Heal(float amount, ProcChainMask procChainMask, bool nonRegen = true)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Single RoR2.HealthComponent::Heal(System.Single, RoR2.ProcChainMask, System.Boolean)' called on client");
                return(0f);
            }
            if (!this.alive || amount <= 0f)
            {
                return(0f);
            }
            float           num             = this.health;
            CharacterMaster characterMaster = null;
            Inventory       inventory       = null;
            bool            flag            = false;

            if (this.body)
            {
                if (this.body.HasBuff(BuffIndex.RepairMode))
                {
                    amount *= 3f;
                }
                characterMaster = this.body.master;
                if (characterMaster)
                {
                    inventory = characterMaster.inventory;
                    if (inventory && inventory.currentEquipmentIndex == EquipmentIndex.LunarPotion && !procChainMask.HasProc(ProcType.LunarPotionActivation))
                    {
                        this.potionReserve += amount;
                        return(amount);
                    }
                    if (nonRegen && !procChainMask.HasProc(ProcType.CritHeal) && Util.CheckRoll(this.body.critHeal, characterMaster))
                    {
                        procChainMask.AddProc(ProcType.CritHeal);
                        flag = true;
                    }
                }
            }
            if (flag)
            {
                amount *= 2f;
            }
            if (this.increaseHealingCount > 0)
            {
                amount *= 1f + (float)this.increaseHealingCount;
            }
            if (nonRegen && this.repeatHealComponent && !procChainMask.HasProc(ProcType.RepeatHeal))
            {
                this.repeatHealComponent.healthFractionToRestorePerSecond = 0.1f / (float)this.repeatHealCount;
                this.repeatHealComponent.AddReserve(amount * (float)(1 + this.repeatHealCount), this.fullHealth);
                return(0f);
            }
            this.Networkhealth = Mathf.Min(this.health + amount, this.fullHealth);
            if (nonRegen)
            {
                HealthComponent.SendHeal(base.gameObject, amount, flag);
                if (inventory && !procChainMask.HasProc(ProcType.HealNova))
                {
                    int itemCount = inventory.GetItemCount(ItemIndex.NovaOnHeal);
                    if (itemCount > 0)
                    {
                        this.devilOrbHealPool = Mathf.Min(this.devilOrbHealPool + amount * (float)itemCount, this.fullCombinedHealth);
                    }
                }
            }
            if (flag)
            {
                GlobalEventManager.instance.OnCrit(this.body, characterMaster, amount / this.fullHealth * 10f, procChainMask);
            }
            if (nonRegen)
            {
                Action <HealthComponent, float> action = HealthComponent.onCharacterHealServer;
                if (action != null)
                {
                    action(this, amount);
                }
            }
            return(this.health - num);
        }
 // Token: 0x06001952 RID: 6482 RVA: 0x00079349 File Offset: 0x00077549
 public static void Write(this NetworkWriter writer, ProcChainMask procChainMask)
 {
     writer.Write(procChainMask.mask);
 }