Esempio n. 1
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        if (additionalDuration > 0)
        {
            DestroyAfterDuration durationObject = abilityObject.GetComponent <DestroyAfterDuration>();
            if (durationObject != null)
            {
                durationObject.duration += additionalDuration;
            }
        }

        // increase the strength of the pull
        if (pullMultiplier != 1)
        {
            RepeatedlyPullEnemiesWithinRadius pull = abilityObject.GetComponent <RepeatedlyPullEnemiesWithinRadius>();
            if (pull)
            {
                pull.distanceMultiplier = 1 - (1 - pull.distanceMultiplier) * pullMultiplier;
            }
        }

        if (increasedBasePhysicalDamage > 0)
        {
            foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>())
            {
                damage.addBaseDamage(DamageType.PHYSICAL, damage.getBaseDamage(DamageType.PHYSICAL) * increasedBasePhysicalDamage);
            }
        }

        if (fireTornado)
        {
            // change the vfx
            foreach (Transform t in abilityObject.transform)
            {
                if (t.name == "TornadoVFX")
                {
                    t.gameObject.SetActive(false);
                }
                if (t.name == "Tornado_Fire")
                {
                    t.gameObject.SetActive(true);
                }
            }
            // change the damage to fire
            foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>())
            {
                damage.addBaseDamage(DamageType.FIRE, damage.getBaseDamage(DamageType.PHYSICAL));
                damage.addBaseDamage(DamageType.PHYSICAL, -damage.getBaseDamage(DamageType.PHYSICAL));
            }
        }

        if (castsLightning)
        {
            RepeatedlyCastAtNearestEnemyWithinRadius cast = abilityObject.AddComponent <RepeatedlyCastAtNearestEnemyWithinRadius>();
            cast.abilityToCast = AbilityIDList.getAbility(AbilityID.lesserLightning);
            cast.castInterval  = lightningInterval;
            cast.radius        = lightningRange;
        }

        if (stationary)
        {
            abilityObject.GetComponent <UnityEngine.AI.NavMeshAgent>().speed = 0f;
            Destroy(abilityObject.GetComponent <RandomNavmeshMovement>());
        }

        if (attaches)
        {
            Destroy(abilityObject.GetComponent <UnityEngine.AI.NavMeshAgent>());
            Destroy(abilityObject.GetComponent <RandomNavmeshMovement>());
            AttachToCreatorOnCreation component = abilityObject.AddComponent <AttachToCreatorOnCreation>();
            component.replaceExistingBuff = false;
            component.displacement        = new Vector3(0, 1f, 0);
        }

        if (leavesStormOrbs)
        {
            CastAtRandomPointAfterDuration cast = abilityObject.AddComponent <CastAtRandomPointAfterDuration>();
            cast.ability    = Ability.getAbility(AbilityID.delayedStormOrb);
            cast.duration   = 1f / (1 + increasedStormOrbFrequency);
            cast.radius     = 0.5f;
            cast.limitCasts = false;
        }

        if (ignitesInAoe)
        {
            CastAfterDuration cad = abilityObject.AddComponent <CastAfterDuration>();
            cad.ability    = Ability.getAbility(AbilityID.invisibleIgniteNova);
            cad.interval   = 1f / (1 + increasedIgniteFrequency);
            cad.limitCasts = false;
        }

        if (movementSpeedOnCast != 0 || manaRegenOnCast != 0 || attackAndCastSpeedOnCast != 0)
        {
            float buffDuration = 2f * (1 + increasedBuffDuration);
            if (movementSpeedOnCast != 0)
            {
                statBuffs.addBuff(buffDuration, Tags.Properties.Movespeed, 0, movementSpeedOnCast, null, null, null, "tornadoMovementSpeed");
            }
            if (manaRegenOnCast != 0)
            {
                statBuffs.addBuff(buffDuration, Tags.Properties.ManaRegen, 0, manaRegenOnCast, null, null, null, "tornadoManaRegen");
            }
            if (attackAndCastSpeedOnCast != 0)
            {
                statBuffs.addBuff(buffDuration, Tags.Properties.AttackSpeed, 0, attackAndCastSpeedOnCast, null, null, null, "tornadoAttackSpeed");
                statBuffs.addBuff(buffDuration, Tags.Properties.CastSpeed, 0, attackAndCastSpeedOnCast, null, null, null, "tornadoCastSpeed");
            }
        }

        return(abilityObject);
    }
Esempio n. 2
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        if (castsLightning)
        {
            RepeatedlyCastAtNearestEnemyWithinRadius cast = abilityObject.AddComponent <RepeatedlyCastAtNearestEnemyWithinRadius>();
            cast.abilityToCast = AbilityIDList.getAbility(AbilityID.furyLeapLightning);
            cast.castInterval  = lightningInterval;
            cast.radius        = 3f;
        }

        if (movespeedOnLanding != 0)
        {
            BuffCreatorOnDeath buff = abilityObject.AddComponent <BuffCreatorOnDeath>();
            abilityObject.AddComponent <BuffCreatorOnDeath>().addBuffToList(Tags.Properties.Movespeed, 0f, movespeedOnLanding, null, null, 3f, null, "FuryLeapMoveSpeed");
        }

        if (attackAndCastSpeedOnLanding != 0)
        {
            BuffCreatorOnDeath buff = abilityObject.AddComponent <BuffCreatorOnDeath>();
            buff.addBuffToList(Tags.Properties.AttackSpeed, 0f, attackAndCastSpeedOnLanding, null, null, 3f, null, "FuryLeapAttackSpeed");
            buff.addBuffToList(Tags.Properties.CastSpeed, 0f, attackAndCastSpeedOnLanding, null, null, 3f, null, "FuryLeapCastSpeed");
        }

        if (eligiblePetsJumpToo)
        {
            SummonTracker summonTracker = GetComponent <SummonTracker>();
            if (summonTracker)
            {
                foreach (Summoned summon in summonTracker.summons)
                {
                    if (summon.GetComponent <CanJump>() && summon.GetComponent <UsingAbility>() && summon.GetComponent <StateController>() &&
                        summon.GetComponent <StateController>().currentState&& summon.GetComponent <StateController>().currentState.priority < 60)
                    {
                        summon.GetComponent <UsingAbility>().UseAbility(AbilityIDList.getAbility(AbilityID.furyLeap), targetLocation, false, false);
                    }
                }
            }
        }

        FuryLeapAoeMutator flam = abilityObject.AddComponent <FuryLeapAoeMutator>();

        flam.increasedDamage             = increasedDamage;
        flam.increasedRadius             = increasedRadius;
        flam.increasedStunChance         = increasedStunChance;
        flam.moreDamageAgainstFullHealth = moreDamageAgainstFullHealth;
        flam.addedCritMultiplier         = addedCritMultiplier;

        if (chanceToPull > 0)
        {
            float rand = Random.Range(0f, 1f);
            if (rand < chanceToPull)
            {
                abilityObject.AddComponent <CreateAbilityObjectOnDeath>().abilityToInstantiate = AbilityIDList.getAbility(AbilityID.bigPull);
            }
        }

        if (chanceToSummonVinesAtStart > 0)
        {
            float rand = Random.Range(0f, 1f);
            if (rand < chanceToSummonVinesAtStart)
            {
                GetComponent <UsingAbility>().UseAbility(AbilityIDList.getAbility(AbilityID.summonVines), transform.position, false, false);
            }
        }

        if (chanceToSummonVinesAtEnd > 0)
        {
            float rand = Random.Range(0f, 1f);
            if (rand < chanceToSummonVinesAtStart)
            {
                abilityObject.AddComponent <CreateAbilityObjectOnDeath>().abilityToInstantiate = AbilityIDList.getAbility(AbilityID.summonVines);
            }
        }

        return(abilityObject);
    }