Example #1
0
 private static void GlobalEventManager_OnHitEnemy(On.RoR2.GlobalEventManager.orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
 {
     orig(self, damageInfo, victim);
     if (damageInfo.attacker && damageInfo.attacker.GetComponent <CharacterBody>())
     {
         var attackerBody = damageInfo.attacker.GetComponent <CharacterBody>();
         if (attackerBody.HasBuff(PylonPoweredBuff.BuffDef) && !damageInfo.procChainMask.HasProc(ProcType.LoaderLightning))
         {
             float        damageValue  = Util.OnHitProcDamage(damageInfo.damage, attackerBody.damage, pylonPowerDamageCoefficient);
             LightningOrb lightningOrb = new LightningOrb();
             lightningOrb.origin           = damageInfo.position;
             lightningOrb.damageValue      = damageValue;
             lightningOrb.isCrit           = damageInfo.crit;
             lightningOrb.bouncesRemaining = pylonPowerMaxBounces;
             lightningOrb.teamIndex        = attackerBody.teamComponent ? attackerBody.teamComponent.teamIndex : TeamIndex.None;
             lightningOrb.attacker         = damageInfo.attacker;
             lightningOrb.bouncedObjects   = new List <HealthComponent>
             {
                 victim.GetComponent <HealthComponent>()
             };
             lightningOrb.procChainMask = damageInfo.procChainMask;
             lightningOrb.procChainMask.AddProc(ProcType.LoaderLightning);
             lightningOrb.procCoefficient  = 0f;
             lightningOrb.lightningType    = LightningOrb.LightningType.Loader;
             lightningOrb.damageColorIndex = DamageColorIndex.Item;
             lightningOrb.range            = pylonPowerRange;
             HurtBox hurtBox = lightningOrb.PickNextTarget(damageInfo.position);
             if (hurtBox)
             {
                 lightningOrb.target = hurtBox;
                 OrbManager.instance.AddOrb(lightningOrb);
             }
         }
     }
 }
Example #2
0
        private void GlobalEventManager_OnHitEnemy(On.RoR2.GlobalEventManager.orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
        {
            orig(self, damageInfo, victim);

            if (damageInfo.attacker && damageInfo.procCoefficient >= 1f)
            {
                CharacterBody attackerBody = damageInfo.attacker.GetComponent <CharacterBody>();
                if (attackerBody)
                {
                    if (attackerBody.HasBuff(Modules.Buffs.overchargeBuff))
                    {
                        float damageCoefficient = 0.75f;
                        float damageValue       = Util.OnHitProcDamage(damageInfo.damage, attackerBody.damage, damageCoefficient);

                        LightningOrb lightningOrb = new LightningOrb();
                        lightningOrb.origin           = damageInfo.position;
                        lightningOrb.damageValue      = damageValue;
                        lightningOrb.isCrit           = damageInfo.crit;
                        lightningOrb.bouncesRemaining = 3;
                        lightningOrb.teamIndex        = attackerBody.teamComponent.teamIndex;
                        lightningOrb.attacker         = damageInfo.attacker;
                        lightningOrb.bouncedObjects   = new List <HealthComponent>
                        {
                            victim.GetComponent <HealthComponent>()
                        };
                        lightningOrb.procChainMask = damageInfo.procChainMask;
                        lightningOrb.procChainMask.AddProc(ProcType.ChainLightning);
                        lightningOrb.procCoefficient  = 0f;
                        lightningOrb.lightningType    = LightningOrb.LightningType.Loader;
                        lightningOrb.damageColorIndex = DamageColorIndex.Default;
                        lightningOrb.range           += 6f;
                        HurtBox hurtBox = lightningOrb.PickNextTarget(damageInfo.position);
                        if (hurtBox)
                        {
                            lightningOrb.target = hurtBox;
                            OrbManager.instance.AddOrb(lightningOrb);
                        }
                    }
                }
            }
        }
Example #3
0
        // Token: 0x060012B1 RID: 4785 RVA: 0x0005BB98 File Offset: 0x00059D98
        public void BlockedDamage(DamageInfo damageInfo, float actualDamageBlocked)
        {
            this.totalDamageBlocked += actualDamageBlocked;
            LightningOrb lightningOrb = new LightningOrb();

            lightningOrb.teamIndex        = this.teamComponent.teamIndex;
            lightningOrb.origin           = damageInfo.position;
            lightningOrb.damageValue      = actualDamageBlocked * this.blockLaserDamageCoefficient;
            lightningOrb.bouncesRemaining = 0;
            lightningOrb.attacker         = damageInfo.attacker;
            lightningOrb.procCoefficient  = this.blockLaserProcCoefficient;
            lightningOrb.lightningType    = LightningOrb.LightningType.PaladinBarrier;
            HurtBox hurtBox = lightningOrb.PickNextTarget(lightningOrb.origin);

            if (hurtBox)
            {
                lightningOrb.target = hurtBox;
                lightningOrb.isCrit = Util.CheckRoll(this.characterBody.crit, this.characterBody.master);
                OrbManager.instance.AddOrb(lightningOrb);
            }
        }
Example #4
0
        public override void Effect(GlobalEventManager globalEventManager, DamageInfo damageInfo, GameObject victim, int itemCount)
        {
            CharacterBody   body              = damageInfo.attacker.GetComponent <CharacterBody>();
            CharacterBody   Attacker          = damageInfo.attacker.GetComponent <CharacterBody>();
            CharacterBody   characterBody     = victim ? victim.GetComponent <CharacterBody>() : null;
            CharacterMaster master            = Attacker.master;
            Inventory       inventory         = master.inventory;
            TeamComponent   Team              = Attacker.GetComponent <TeamComponent>();
            TeamIndex       attackerTeamIndex = Team ? Team.teamIndex : TeamIndex.Neutral;
            Vector3         aimOrigin         = Attacker.aimOrigin;


            float        damageCoefficient = 0.8f;
            float        Damage            = Util.OnHitProcDamage(damageInfo.damage, Attacker.damage, damageCoefficient);
            LightningOrb lightningOrb      = new LightningOrb();

            lightningOrb.origin           = damageInfo.position;
            lightningOrb.damageValue      = Damage;
            lightningOrb.isCrit           = damageInfo.crit;
            lightningOrb.bouncesRemaining = 2 * itemCount;
            lightningOrb.teamIndex        = attackerTeamIndex;
            lightningOrb.attacker         = damageInfo.attacker;
            lightningOrb.bouncedObjects   = new List <HealthComponent>()
            {
                victim.GetComponent <HealthComponent>()
            };
            lightningOrb.procChainMask = damageInfo.procChainMask;
            lightningOrb.procChainMask.AddProc(ProcType.ChainLightning);
            lightningOrb.procCoefficient  = 0.2f;
            lightningOrb.lightningType    = LightningOrb.LightningType.Ukulele;
            lightningOrb.damageColorIndex = DamageColorIndex.Item;
            lightningOrb.range           += 2 * itemCount;
            HurtBox hurtBox = lightningOrb.PickNextTarget(damageInfo.position);

            if (hurtBox)
            {
                lightningOrb.target = hurtBox;
                OrbManager.instance.AddOrb(lightningOrb);
            }
        }