Exemple #1
0
        private void ProjectileManager_FireProjectile_FireProjectileInfo(On.RoR2.Projectile.ProjectileManager.orig_FireProjectile_FireProjectileInfo orig, RoR2.Projectile.ProjectileManager self, RoR2.Projectile.FireProjectileInfo fireProjectileInfo)
        {
            var component = fireProjectileInfo.projectilePrefab.GetComponent <ProjectileDamage>();

            if (component)
            {
                var component2 = fireProjectileInfo.projectilePrefab.GetComponent <ProjectileController>();
                var value1     = component2 ? component2.procCoefficient : 1;
                component.damageType = ProcDamageType(fireProjectileInfo.owner, itemDef, component.damageType, damageType, value1, BatteryBullets_ProcCoefficient, BatteryBullets_ProcCoefficientStack);
            }
            orig(self, fireProjectileInfo);
        }
        private void ProjectileManager_FireProjectile_FireProjectileInfo(On.RoR2.Projectile.ProjectileManager.orig_FireProjectile_FireProjectileInfo orig, RoR2.Projectile.ProjectileManager self, RoR2.Projectile.FireProjectileInfo fireProjectileInfo)
        {
            var component = fireProjectileInfo.projectilePrefab.GetComponent <ProjectileDamage>();

            if (component)
            {
                var component2 = fireProjectileInfo.projectilePrefab.GetComponent <ProjectileController>();
                var value1     = component2 ? component2.procCoefficient : 1;
                component.damageType = ShockRoll(fireProjectileInfo.owner, component.damageType, value1);
            }
            orig(self, fireProjectileInfo);
        }
Exemple #3
0
        private void FireTheSwordOnProjectiles(On.RoR2.Projectile.ProjectileManager.orig_FireProjectile_FireProjectileInfo orig, RoR2.Projectile.ProjectileManager self, FireProjectileInfo fireProjectileInfo)
        {
            if (!RecursionPrevention && !BlacklistedProjectiles.Contains(fireProjectileInfo.projectilePrefab.name))
            {
                var projectileOwner = fireProjectileInfo.owner;
                if (projectileOwner)
                {
                    var body = projectileOwner.GetComponent <RoR2.CharacterBody>();
                    if (body)
                    {
                        var InventoryCount = GetCount(body);
                        if (InventoryCount > 0)
                        {
                            if (body.healthComponent.combinedHealthFraction >= 1)
                            {
                                var newProjectileInfo = fireProjectileInfo;
                                newProjectileInfo.owner              = projectileOwner;
                                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(RoR2.ProcChainMask);

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