private void SetupSkills()
        {
            // I use the SideLoader to do the preliminary setup (clone existing skill, change ID / name / etc..)

            SetupTranscendence();

            SummonSkeleton.SetupSummon();

            NoxiousTendrils.SetupTendrils();

            LifeRitual.SetupFrenzy();

            DeathRitual.SetupDetonate();

            PlagueAura.SetupPlagueAura();
        }
Esempio n. 2
0
        // skill setup called from SkillManager
        #region Tendrils Skill Setup
        public static void SetupTendrils()
        {
            // ============== setup base skill ==============

            var tendrils = ResourcesPrefabManager.Instance.GetItemPrefab(8890100) as AttackSkill;

            // setup skill
            tendrils.CastModifier           = Character.SpellCastModifier.Mobile; // can move while casting but movement speed is 0.3x
            tendrils.MobileCastMovementMult = 0.3f;

            // clear existing effects
            SideLoader.Helpers.UnityHelpers.DestroyChildren(tendrils.transform);

            // ============= normal effects =============== //

            // create new effects
            var effects = new GameObject("Effects");

            effects.transform.parent = tendrils.transform;

            // add our custom PlagueAura proximity condition component (INVERT = TRUE, we DONT want the aura on these effects).
            var auraCondition1 = effects.AddComponent <PlagueAuraProximityCondition>();

            auraCondition1.ProximityDist           = 2.5f;
            auraCondition1.RequiredActivatedItemID = 8999050;
            auraCondition1.Invert = true;

            // create the Tendrils effect, a custom class derived from ShootProjectile
            NoxiousTendrils shootTendrils = effects.AddComponent <NoxiousTendrils>();
            var             orig          = ResourcesPrefabManager.Instance.GetItemPrefab(8300292).transform.Find("Effects").GetComponent <ShootProjectile>();

            At.CopyFields(shootTendrils, orig, null, true);

            shootTendrils.SyncType = SyncTypes.Everyone;

            // disable clone target before cloning it
            var origProjectile = shootTendrils.BaseProjectile.gameObject;

            origProjectile.SetActive(false);
            var projectileObj = Instantiate(origProjectile);

            DontDestroyOnLoad(projectileObj);
            //projectileObj.SetActive(true);

            projectileObj.name = "NoxiousTendrils";

            // get the actual Projectile component from our new Projectile Object, and set our "BaseProjectile" to this component
            var projectile = projectileObj.GetComponent <RaycastProjectile>();

            shootTendrils.BaseProjectile     = projectile;
            shootTendrils.IntanstiatedAmount = 8; // 2 per character, potential 3 summoned skeletons, so 8 total subeffects needed.

            projectile.Lifespan       = 0.75f;
            projectile.DisableOnHit   = false;
            projectile.EndMode        = Projectile.EndLifeMode.LifetimeOnly;
            projectile.HitEnemiesOnly = true;

            // sound play
            if (projectileObj.GetComponentInChildren <SoundPlayer>() is SoundPlayer lightPlayer)
            {
                lightPlayer.Sounds = new List <GlobalAudioManager.Sounds> {
                    GlobalAudioManager.Sounds.SFX_FireThrowLight
                };
            }

            // heal on hit
            if (projectile.GetComponentInChildren <AffectHealthParentOwner>() is AffectHealthParentOwner heal)
            {
                heal.AffectQuantity = NecromancerBase.settings.ShootTendrils_Heal_NoPlagueAura;
            }

            // change damage and hit effects
            var hit = projectile.transform.Find("HitEffects").gameObject;

            hit.GetComponent <PunctualDamage>().Damages   = NecromancerBase.settings.ShootTendrils_Damage_NoPlagueAura;
            hit.GetComponent <PunctualDamage>().Knockback = NecromancerBase.settings.ShootTendrils_Knockback_NoPlagueAura;
            var comp = hit.AddComponent <AddStatusEffectBuildUp>();

            comp.Status       = ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Curse");
            comp.BuildUpValue = 25;

            // adjust visuals
            foreach (ParticleSystem ps in projectileObj.GetComponentsInChildren <ParticleSystem>())
            {
                var m = ps.main;
                m.startColor = Color.green;
                m.startSize  = new ParticleSystem.MinMaxCurve(0.05f, 0.09f);
            }

            // ================= plague aura interaction effects ===============

            var plagueEffectsObj = new GameObject("Effects");

            plagueEffectsObj.transform.parent = tendrils.transform;

            // add our custom PlagueAura proximity condition component
            var auraCondition2 = plagueEffectsObj.AddComponent <PlagueAuraProximityCondition>();

            auraCondition2.ProximityDist           = 2.5f;
            auraCondition2.RequiredActivatedItemID = 8999050;
            auraCondition2.Invert = false;

            // add our custom ShootTendrils component
            NoxiousTendrils strongTendrils = plagueEffectsObj.AddComponent <NoxiousTendrils>();

            At.CopyFields(strongTendrils, orig, null, true);

            // clone the projectile
            origProjectile.SetActive(false);
            var strongProjObj = Instantiate(origProjectile);

            DontDestroyOnLoad(strongProjObj);
            origProjectile.SetActive(true);

            strongProjObj.name = "StrongNoxiousTendrils";
            var strongProj = strongProjObj.GetComponent <RaycastProjectile>();

            strongTendrils.BaseProjectile     = strongProj;
            strongTendrils.IntanstiatedAmount = 8;

            strongProj.Lifespan       = 0.75f;
            strongProj.DisableOnHit   = false;
            strongProj.EndMode        = Projectile.EndLifeMode.LifetimeOnly;
            strongProj.HitEnemiesOnly = true;

            // sound play
            if (strongProjObj.GetComponentsInChildren <SoundPlayer>() is SoundPlayer[] strongPlayers && strongPlayers.Count() > 0)
            {
                foreach (SoundPlayer player in strongPlayers)
                {
                    player.Sounds = new List <GlobalAudioManager.Sounds> {
                        GlobalAudioManager.Sounds.SFX_SKILL_ElemantalProjectileWind_Shot
                    };
                }
            }
            // heal on hit
            if (strongProj.GetComponentInChildren <AffectHealthParentOwner>() is AffectHealthParentOwner strongHeal)
            {
                //DestroyImmediate(heal);
                strongHeal.AffectQuantity = NecromancerBase.settings.ShootTendrils_Heal_InsideAura;
            }

            // change damage and hit effects.
            var strongHit = strongProj.transform.Find("HitEffects").gameObject;

            strongHit.GetComponent <PunctualDamage>().Damages   = NecromancerBase.settings.ShootTendrils_Damage_InsideAura;
            strongHit.GetComponent <PunctualDamage>().Knockback = NecromancerBase.settings.ShootTendrils_Knockback_InsideAura;
            comp              = strongHit.AddComponent <AddStatusEffectBuildUp>();
            comp.Status       = ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Curse");
            comp.BuildUpValue = 60;

            // adjust visuals
            foreach (ParticleSystem ps in strongProjObj.GetComponentsInChildren <ParticleSystem>())
            {
                var m = ps.main;
                m.startColor = Color.green;
                m.startSize  = new ParticleSystem.MinMaxCurve(0.12f, 0.20f);
            }
        }