Example #1
0
 // Token: 0x060018FC RID: 6396 RVA: 0x00077EF8 File Offset: 0x000760F8
 private void ProcessHits(List <OverlapAttack.OverlapInfo> hitList)
 {
     if (hitList.Count == 0)
     {
         return;
     }
     for (int i = 0; i < hitList.Count; i++)
     {
         OverlapAttack.OverlapInfo overlapInfo = hitList[i];
         if (this.hitEffectPrefab)
         {
             EffectManager.instance.SimpleImpactEffect(this.hitEffectPrefab, overlapInfo.hitPosition, -hitList[i].pushDirection, true);
         }
         SurfaceDefProvider component = hitList[i].hurtBox.GetComponent <SurfaceDefProvider>();
         if (component && component.surfaceDef)
         {
             SurfaceDef objectSurfaceDef = SurfaceDefProvider.GetObjectSurfaceDef(hitList[i].hurtBox.collider, hitList[i].hitPosition);
             if (objectSurfaceDef)
             {
                 if (objectSurfaceDef.impactEffectPrefab)
                 {
                     EffectManager.instance.SpawnEffect(objectSurfaceDef.impactEffectPrefab, new EffectData
                     {
                         origin   = overlapInfo.hitPosition,
                         rotation = ((overlapInfo.pushDirection == Vector3.zero) ? Quaternion.identity : Util.QuaternionSafeLookRotation(overlapInfo.pushDirection)),
                         color    = objectSurfaceDef.approximateColor,
                         scale    = 2f
                     }, true);
                 }
                 if (objectSurfaceDef.impactSoundString != null && objectSurfaceDef.impactSoundString.Length != 0)
                 {
                     Util.PlaySound(objectSurfaceDef.impactSoundString, hitList[i].hurtBox.gameObject);
                 }
             }
         }
     }
     if (NetworkServer.active)
     {
         OverlapAttack.PerformDamage(this.attacker, this.inflictor, this.damage, this.isCrit, this.procChainMask, this.procCoefficient, this.damageColorIndex, this.damageType, this.forceVector, this.pushAwayForce, hitList);
         return;
     }
     OverlapAttack.outgoingMessage.attacker         = this.attacker;
     OverlapAttack.outgoingMessage.inflictor        = this.inflictor;
     OverlapAttack.outgoingMessage.damage           = this.damage;
     OverlapAttack.outgoingMessage.isCrit           = this.isCrit;
     OverlapAttack.outgoingMessage.procChainMask    = this.procChainMask;
     OverlapAttack.outgoingMessage.procCoefficient  = this.procCoefficient;
     OverlapAttack.outgoingMessage.damageColorIndex = this.damageColorIndex;
     OverlapAttack.outgoingMessage.damageType       = this.damageType;
     OverlapAttack.outgoingMessage.forceVector      = this.forceVector;
     OverlapAttack.outgoingMessage.pushAwayForce    = this.pushAwayForce;
     Util.CopyList <OverlapAttack.OverlapInfo>(hitList, OverlapAttack.outgoingMessage.overlapInfoList);
     GameNetworkManager.singleton.client.connection.SendByChannel(71, OverlapAttack.outgoingMessage, QosChannelIndex.defaultReliable.intVal);
 }
 public static void HandleOverlapAttackHits(NetworkMessage netMsg)
 {
     netMsg.ReadMessage <OverlapAttack.OverlapAttackMessage>(OverlapAttack.incomingMessage);
     OverlapAttack.PerformDamage(OverlapAttack.incomingMessage.attacker, OverlapAttack.incomingMessage.inflictor, OverlapAttack.incomingMessage.damage, OverlapAttack.incomingMessage.isCrit, OverlapAttack.incomingMessage.procChainMask, OverlapAttack.incomingMessage.procCoefficient, OverlapAttack.incomingMessage.damageColorIndex, OverlapAttack.incomingMessage.damageType, OverlapAttack.incomingMessage.forceVector, OverlapAttack.incomingMessage.pushAwayForce, OverlapAttack.incomingMessage.overlapInfoList);
 }
Example #3
0
        private bool FireSwordOnMelee(On.RoR2.OverlapAttack.orig_Fire orig, RoR2.OverlapAttack self, List <RoR2.HealthComponent> hitResults)
        {
            var owner = self.inflictor;

            if (owner)
            {
                var body = owner.GetComponent <RoR2.CharacterBody>();
                if (body)
                {
                    var InventoryCount = GetCount(body);
                    if (InventoryCount > 0)
                    {
                        if (body.healthComponent.combinedHealthFraction >= 1)
                        {
                            Vector3 HitPositionSums = Vector3.zero;
                            if (self.overlapList.Count > 0)
                            {
                                for (int i = 0; i < self.overlapList.Count; i++)
                                {
                                    HitPositionSums += self.overlapList[i].hitPosition;
                                }

                                HitPositionSums /= self.overlapList.Count;
                            }
                            else
                            {
                                HitPositionSums += body.corePosition;
                            }
                            var inputBank = body.inputBank;

                            var cooldownHandler = owner.GetComponent <SwordCooldownHandlerIDunno>();
                            if (!cooldownHandler)
                            {
                                cooldownHandler = owner.AddComponent <SwordCooldownHandlerIDunno>();
                            }

                            if (!cooldownHandler.MeleeTracker.ContainsKey(self))
                            {
                                cooldownHandler.MeleeTracker.Add(self, 0);
                                var newProjectileInfo = new FireProjectileInfo();
                                newProjectileInfo.owner              = self.inflictor;
                                newProjectileInfo.projectilePrefab   = SwordProjectile;
                                newProjectileInfo.speedOverride      = 100.0f;
                                newProjectileInfo.damage             = body.damage * baseSwordDamageMultiplier + (body.damage * additionalSwordDamageMultiplier * (InventoryCount - 1));
                                newProjectileInfo.damageTypeOverride = null;
                                newProjectileInfo.damageColorIndex   = DamageColorIndex.Default;
                                newProjectileInfo.procChainMask      = default(ProcChainMask);
                                newProjectileInfo.position           = HitPositionSums;
                                newProjectileInfo.rotation           = RoR2.Util.QuaternionSafeLookRotation(inputBank ? inputBank.aimDirection : body.transform.forward);

                                try
                                {
                                    RecursionPrevention = true;
                                    RoR2.Projectile.ProjectileManager.instance.FireProjectile(newProjectileInfo);
                                }
                                finally
                                {
                                    RecursionPrevention = false;
                                }
                            }
                        }
                    }
                }
            }
            return(orig(self, hitResults));
        }