Пример #1
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        if (voidRiftAtStart)
        {
            CreateAbilityObjectOnStart component = abilityObject.AddComponent <CreateAbilityObjectOnStart>();
            component.abilityToInstantiate  = Ability.getAbility(AbilityID.voidRift);
            component.createAtStartLocation = true;
        }

        if (voidRiftAtEnd)
        {
            CreateAbilityObjectOnDeath component = abilityObject.AddComponent <CreateAbilityObjectOnDeath>();
            component.abilityToInstantiate = Ability.getAbility(AbilityID.voidRift);
        }

        if (voidRiftAtStart || voidRiftAtEnd)
        {
            VoidRiftMutator mut = abilityObject.AddComponent <VoidRiftMutator>();
            mut.increasedDamage         = increasedDamage;
            mut.increasedRadius         = increasedRadius;
            mut.increasedStunChance     = increasedStunChance;
            mut.increasesDoTDamageTaken = increasesDoTDamageTaken;
            mut.timeRotChance           = timeRotChance;
            mut.increasesDamageTaken    = increasesDamageTaken;
        }

        // apply stats on cooldown
        float     cooldown = getCooldown();
        StatBuffs buffs    = GetComponent <StatBuffs>();

        if (!buffs)
        {
            buffs = gameObject.AddComponent <StatBuffs>();
        }
        foreach (TaggedStatsHolder.TaggableStat stat in statsWhileOnCooldown)
        {
            TaggedStatsHolder.TaggableStat newStat = new TaggedStatsHolder.TaggableStat(stat);
            buffs.addTaggedBuff(new TaggedBuff(newStat, cooldown));
        }

        // apply stats on use
        float duration = 2 + additionalSecondsBack;

        foreach (TaggedStatsHolder.TaggableStat stat in statOnUse)
        {
            TaggedStatsHolder.TaggableStat newStat = new TaggedStatsHolder.TaggableStat(stat);
            buffs.addTaggedBuff(new TaggedBuff(newStat, duration));
        }

        if (noHealthRestoration || noManaRestoration)
        {
            ReturnCasterToOlderPosition component = abilityObject.GetComponent <ReturnCasterToOlderPosition>();
            if (noHealthRestoration)
            {
                component.restoreHealth = false;
            }
            if (noManaRestoration)
            {
                component.restoreMana = false;
            }
        }

        if (healsOrDamagesAtRandom && health)
        {
            float rand = Random.Range(0f, 1f);
            if (rand < 0.8f)
            {
                health.Heal((health.maxHealth - health.currentHealth) * healOrDamagePercent);
            }
            else
            {
                health.HealthDamage(health.currentHealth * healOrDamagePercent);
            }
        }

        return(abilityObject);
    }
Пример #2
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        float newAddedVoidDamage = addedVoidDamage;

        if (addedVoidReducedByAttackSpeed != 0)
        {
            float voidDamageToAdd = addedVoidReducedByAttackSpeed;
            if (baseStats)
            {
                List <Tags.AbilityTags> tagList = new List <Tags.AbilityTags>();
                tagList.Add(Tags.AbilityTags.Melee);
                float increasedAttackSpeed = baseStats.GetStatValue(Tags.Properties.AttackSpeed, tagList) - 1;
                voidDamageToAdd *= (1 - increasedAttackSpeed);
            }
            if (voidDamageToAdd > 0)
            {
                newAddedVoidDamage += voidDamageToAdd;
            }
        }


        ShieldRushEndMutator mutator = abilityObject.AddComponent <ShieldRushEndMutator>();

        mutator.increasedDamage         = increasedDamage;
        mutator.increasedRadius         = increasedRadius;
        mutator.timeRotChance           = timeRotChance;
        mutator.increasesDamageTaken    = increasesDamageTaken;
        mutator.increasesDoTDamageTaken = increasesDoTDamageTaken;
        mutator.increasedStunChance     = increasedStunChance;
        mutator.addedCritMultiplier     = addedCritMultiplier;
        mutator.addedCritChance         = addedCritChance;
        mutator.leaveDelayed            = leaveDelayed;
        mutator.increasedDelayLength    = increasedDelayLength;

        mutator.delayIncreasedDamage         = delayIncreasedDamage;
        mutator.delayIncreasedRadius         = delayIncreasedRadius;
        mutator.delayTimeRotChance           = delayTimeRotChance;
        mutator.delayIncreasesDamageTaken    = delayIncreasesDamageTaken;
        mutator.delayIncreasesDoTDamageTaken = delayIncreasesDoTDamageTaken;
        mutator.delayIncreasedStunChance     = delayIncreasedStunChance;
        mutator.delayAddedCritMultiplier     = delayAddedCritMultiplier;
        mutator.delayAddedCritChance         = delayAddedCritChance;

        mutator.addedVoidDamage = newAddedVoidDamage + additionalAoEAddedVoidDamage;

        if (newAddedVoidDamage > 0)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.addBaseDamage(DamageType.VOID, addedVoidDamage);
            }
        }

        if (moreTravelDamageAgainstFullHealth != 0)
        {
            // create the conditional
            DamageConditionalEffect conditionalEffect = new DamageConditionalEffect();
            conditionalEffect.conditional = new FullHealthConditional();
            conditionalEffect.effect      = new DamageEffectMoreDamage(moreTravelDamageAgainstFullHealth);
            // add the conditional to all damage stats holders
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.baseDamageStats.conditionalEffects.Add(conditionalEffect);
            }
        }

        if (forwardVoidBeam)
        {
            CreateAbilityObjectOnStart component = abilityObject.AddComponent <CreateAbilityObjectOnStart>();
            component.abilityToInstantiate  = Ability.getAbility(AbilityID.forwardVoidBeam);
            component.aimingMethod          = CreateAbilityObjectOnStart.AimingMethod.TargetDirection;
            component.createAtStartLocation = true;
        }

        if (backwardsVoidBeam)
        {
            CreateAbilityObjectOnDeath component = abilityObject.AddComponent <CreateAbilityObjectOnDeath>();
            component.abilityToInstantiate = Ability.getAbility(AbilityID.backwardsVoidBeam);
            component.aimingMethod         = CreateAbilityObjectOnDeath.AimingMethod.TravelDirection;
        }

        if (returnToStart)
        {
            ReturnCasterToOlderPosition component = abilityObject.AddComponent <ReturnCasterToOlderPosition>();
            component.increasePositionAgeWithAge = true;
            component.positionAge = 0f;
            component.restoreMana = restoreMana;
            component.additionalAgeForManaRestoration = 0.35f;
            component.whenToMoveCaster = ReturnCasterToOlderPosition.StartOrEnd.End;
        }

        if (percentCurrentHealthLostOnCast != 0 && health)
        {
            health.HealthDamage(health.currentHealth * percentCurrentHealthLostOnCast);
        }

        if (increasedTravelDamage != 0)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.increaseAllDamage(increasedTravelDamage);
            }
        }

        if (increasedTravelStunChance != 0)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.baseDamageStats.increasedStunChance += increasedStunChance;
            }
        }

        if (statsWhileTravelling != null && statsWhileTravelling.Count > 0)
        {
            BuffParent bp = abilityObject.GetComponent <BuffParent>();
            if (!bp)
            {
                bp = abilityObject.AddComponent <BuffParent>();
            }

            List <TaggedStatsHolder.TaggableStat> stats = new List <TaggedStatsHolder.TaggableStat>();

            foreach (TaggedStatsHolder.TaggableStat stat in statsWhileTravelling)
            {
                TaggedStatsHolder.TaggableStat newStat = new TaggedStatsHolder.TaggableStat(stat);
                stats.Add(newStat);
            }

            bp.taggedStats.AddRange(stats);
        }


        if (increasedRadius > 0)
        {
            foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>())
            {
                cod.increasedRadius = increasedRadius;
                cod.increasedHeight = increasedRadius;
            }
        }

        return(abilityObject);
    }