示例#1
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        if (chanceForChainingIceNova > 0)
        {
            float rand2 = Random.Range(0f, 1f);
            if (rand2 < chanceForChainingIceNova)
            {
                CreateAbilityObjectOnNewEnemtHit newComponent = abilityObject.AddComponent <CreateAbilityObjectOnNewEnemtHit>();
                newComponent.abilityToInstantiate = AbilityIDList.getAbility(AbilityID.delayerForChainingIceNova);
            }
        }

        if (chillChance > 0)
        {
            ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Chill);
            newComponent.chance       = chillChance;
        }

        if (addedCritChance != 0)
        {
            foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>())
            {
                damage.baseDamageStats.critChance += addedCritChance;
            }
        }

        if (addedCritMultiplier != 0)
        {
            foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>())
            {
                damage.baseDamageStats.critMultiplier += addedCritMultiplier;
            }
        }

        if (canTarget)
        {
            abilityObject.AddComponent <StartsAtTarget>();
        }

        if (ignites)
        {
            ApplyStatusOnEnemyHit apply = abilityObject.AddComponent <ApplyStatusOnEnemyHit>();
            apply.statusEffect = StatusEffectList.getEffect(StatusEffectID.Ignite);
        }

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

        return(abilityObject);
    }
示例#2
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        // choose the nova type
        if (canIceNova || canFireNova || canLightningNova)
        {
            int randMax = 0;
            if (canIceNova)
            {
                randMax++;
            }
            if (canFireNova)
            {
                randMax++;
            }
            if (canLightningNova)
            {
                randMax++;
            }
            float rand = Random.Range(0f, randMax);
            if (rand < 1f)
            {
                if (canIceNova)
                {
                    abilityObject = instantiateIceNova(abilityObject, location, targetLocation);
                }
                else if (canFireNova)
                {
                    abilityObject = instantiateFireNova(abilityObject, location, targetLocation);
                }
                else
                {
                    abilityObject = instantiateLightningNova(abilityObject, location, targetLocation);
                }
            }
            else if (rand < 2f)
            {
                if (canFireNova && canIceNova)
                {
                    abilityObject = instantiateFireNova(abilityObject, location, targetLocation);
                }
                else
                {
                    abilityObject = instantiateLightningNova(abilityObject, location, targetLocation);
                }
            }
            else
            {
                abilityObject = instantiateLightningNova(abilityObject, location, targetLocation);
            }
        }

        if (chanceForChainingIceNova > 0)
        {
            float rand2 = Random.Range(0f, 1f);
            if (rand2 < chanceForChainingIceNova)
            {
                CreateAbilityObjectOnNewEnemtHit newComponent = abilityObject.AddComponent <CreateAbilityObjectOnNewEnemtHit>();
                newComponent.abilityToInstantiate = AbilityIDList.getAbility(AbilityID.delayerForChainingIceNova);
            }
        }

        if (chillChance > 0)
        {
            ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Chill);
            newComponent.chance       = chillChance;
        }

        if (shockChance > 0)
        {
            ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Shock);
            newComponent.chance       = shockChance;
        }

        if (igniteChance > 0)
        {
            ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Ignite);
            newComponent.chance       = igniteChance;
        }

        if (addedCritChance != 0)
        {
            foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>())
            {
                damage.baseDamageStats.critChance += addedCritChance;
            }
        }

        if (chanceToAttachSparkCharge > 0)
        {
            ChanceToCreateAbilityObjectOnNewEnemyHit newComponent = abilityObject.AddComponent <ChanceToCreateAbilityObjectOnNewEnemyHit>();
            newComponent.spawnAtHit           = true;
            newComponent.chance               = chanceToAttachSparkCharge;
            newComponent.abilityToInstantiate = AbilityIDList.getAbility(AbilityID.sparkCharge);
        }

        if (addedCritMultiplier != 0)
        {
            foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>())
            {
                damage.baseDamageStats.critMultiplier += addedCritMultiplier;
            }
        }

        if (canTarget)
        {
            abilityObject.AddComponent <StartsAtTarget>();
        }

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

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

        if (increasedRadius != 0)
        {
            foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>())
            {
                cod.increasedRadius = increasedRadius;
            }
            foreach (CapsuleCollider col in abilityObject.GetComponents <CapsuleCollider>())
            {
                col.height *= (1 + increasedRadius);
                col.radius *= (1 + increasedRadius);
            }
        }

        return(abilityObject);
    }
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        if (noChain)
        {
            CreateAbilityObjectOnNewEnemtHit component = abilityObject.GetComponent <CreateAbilityObjectOnNewEnemtHit>();
            if (component)
            {
                component.active = false;
            }
        }

        if (pullsOnHit)
        {
            DestroyAfterDuration dad = abilityObject.GetComponent <DestroyAfterDuration>();
            if (dad)
            {
                dad.duration = 0.1f;
            }
            RepeatedlyPullEnemiesWithinRadius component = abilityObject.AddComponent <RepeatedlyPullEnemiesWithinRadius>();
            component.distanceMultiplier = 0.92f / (1 + increasedPullStrength);
            component.limitDistanceToMax = false;
            component.interval           = 0.02f;
            component.radius             = 4f * (1 + increasedRadius);
        }

        if (increasedRadius != 0)
        {
            foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>())
            {
                cod.increasedRadius = increasedRadius;
                cod.increasedHeight = increasedRadius;
            }
            foreach (CapsuleCollider col in abilityObject.GetComponents <CapsuleCollider>())
            {
                col.height *= (1 + increasedRadius);
                col.radius *= (1 + increasedRadius);
            }
        }

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

        if (stacks)
        {
            ApplyStatusOnEnemyHit component = abilityObject.GetComponent <ApplyStatusOnEnemyHit>();
            component.statusEffect = StatusEffectList.getEffect(StatusEffectID.StackingAbyssalDecay);
        }

        if (speedDebuff != 0 || armourDebuff != 0 || dotTakenDebuff != 0)
        {
            DebuffOnEnemyHit component = Comp <DebuffOnEnemyHit> .GetOrAdd(abilityObject);

            if (speedDebuff != 0)
            {
                List <float> speedDebuffList = new List <float>();
                speedDebuffList.Add(speedDebuff * (1 + increasedDebuffStrength));
                component.addDebuffToList(Tags.Properties.AttackSpeed, 0f, 0f, speedDebuffList, null, 4f * (1 + increasedDebuffDuration), null, "AbyssalEchoesDebuffAttackSpeed");
                component.addDebuffToList(Tags.Properties.CastSpeed, 0f, 0f, speedDebuffList, null, 4f * (1 + increasedDebuffDuration), null, "AbyssalEchoesDebuffCastSpeed");
                component.addDebuffToList(Tags.Properties.Movespeed, 0f, 0f, speedDebuffList, null, 4f * (1 + increasedDebuffDuration), null, "AbyssalEchoesDebuffMoveSpeed");
            }
            if (armourDebuff != 0)
            {
                component.addDebuffToList(Tags.Properties.Movespeed, armourDebuff * (1 + increasedDebuffStrength), 0f, null, null, 4f * (1 + increasedDebuffDuration), null, "AbyssalEchoesDebuffArmour");
            }
            if (dotTakenDebuff != 0)
            {
                if (dotTakenDebuffStacks)
                {
                    component.addDebuffToList(Tags.Properties.DamageTaken, 0f, -dotTakenDebuff, null, null, 4f);
                }
                else
                {
                    component.addDebuffToList(Tags.Properties.DamageTaken, 0f, -dotTakenDebuff, null, null, 4f, null, "AbyssalEchoesDebuffDoTTaken");
                }
            }
        }

        return(abilityObject);
    }