Esempio n. 1
0
        ////// Private Methods //////

        void InflictFreezeOrStun(int count, SetStateOnHurt ssoh, DamageReport report, bool isStun)
        {
            if (!report.victim.isInFrozenState)
            {
                if (isStun)
                {
                    if (ssoh.canBeStunned)
                    {
                        ssoh.SetStun(1f);
                    }
                }
                else
                {
                    if (ssoh.canBeFrozen)
                    {
                        ssoh.SetFrozen(2f * report.damageInfo.procCoefficient);
                    }
                }
            }
            report.victim.TakeDamage(new DamageInfo {
                attacker         = report.attacker,
                crit             = report.damageInfo.crit,
                damage           = ((float)(count - 1) * procStackDamage + procBaseDamage) * report.attackerBody.damage,
                damageColorIndex = DamageColorIndex.Item,
                damageType       = DamageType.Generic,
                force            = Vector3.zero,
                inflictor        = report.damageInfo.inflictor,
                position         = report.damageInfo.position,
                procChainMask    = report.damageInfo.procChainMask,
                procCoefficient  = 0f
            });
        }
Esempio n. 2
0
        // Token: 0x06002B71 RID: 11121 RVA: 0x000B73F4 File Offset: 0x000B55F4
        protected override void AddDebuff(CharacterBody body)
        {
            SetStateOnHurt component = body.healthComponent.GetComponent <SetStateOnHurt>();

            if (component != null)
            {
                component.SetStun(-1f);
            }
            if (FirePlantSonicBoom.hitEffectPrefab)
            {
                EffectManager.SpawnEffect(FirePlantSonicBoom.hitEffectPrefab, new EffectData
                {
                    origin = body.corePosition
                }, true);
            }
            if (base.healthComponent)
            {
                HealOrb healOrb = new HealOrb();
                healOrb.origin           = body.corePosition;
                healOrb.target           = base.healthComponent.body.mainHurtBox;
                healOrb.healValue        = FirePlantSonicBoom.healthFractionPerHit * base.healthComponent.fullHealth;
                healOrb.overrideDuration = UnityEngine.Random.Range(0.3f, 0.6f);
                OrbManager.instance.AddOrb(healOrb);
            }
            Util.PlaySound(FirePlantSonicBoom.impactSoundString, base.gameObject);
        }
Esempio n. 3
0
        public override void Effect(GlobalEventManager globalEventManager, DamageInfo damageInfo, GameObject victim, int itemCount)
        {
            SetStateOnHurt HurtStat = victim.GetComponent <SetStateOnHurt>();

            if (HurtStat)
            {
                HurtStat.SetStun(2f);
            }
        }
Esempio n. 4
0
        // Token: 0x06002B6A RID: 11114 RVA: 0x000B72F0 File Offset: 0x000B54F0
        protected virtual void AddDebuff(CharacterBody body)
        {
            body.AddTimedBuff(BuffIndex.Weak, this.slowDuration);
            SetStateOnHurt component = body.healthComponent.GetComponent <SetStateOnHurt>();

            if (component == null)
            {
                return;
            }
            component.SetStun(-1f);
        }
Esempio n. 5
0
        private void OnHitEnemy_On(HooksCore.RoR2.GlobalEventManager.OnHitEnemy.Orig orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
        {
            orig(self, damageInfo, victim);
            if (damageInfo.procCoefficient <= 0f || damageInfo.rejected || !NetworkServer.active || !damageInfo.attacker)
            {
                return;
            }
            CharacterBody body = damageInfo.attacker.GetComponent <CharacterBody>();

            if (!body)
            {
                return;
            }
            Inventory inventory = body.inventory;

            if (!inventory)
            {
                return;
            }
            Int32 stunCount = inventory.GetItemCount(ItemIndex.StunChanceOnHit);

            if (stunCount <= 0)
            {
                return;
            }
            Single sqCoef = Mathf.Sqrt(damageInfo.procCoefficient);

            if (!RoR2.Util.CheckRoll(RoR2.Util.ConvertAmplificationPercentageIntoReductionPercentage(sqCoef * 5f * stunCount), body.master))
            {
                return;
            }
            SetStateOnHurt stateOnHurt = victim.GetComponent <SetStateOnHurt>();

            if (!stateOnHurt)
            {
                return;
            }
            stateOnHurt.SetStun(sqCoef * 2f);
        }