Пример #1
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        // increase speed
        if (increasedSpeed != 0)
        {
            abilityObject.GetComponent <AbilityMover>().speed *= (1 + increasedSpeed);
        }

        // increase duration
        if (increasedDuration != 0)
        {
            abilityObject.GetComponent <DestroyAfterDuration>().duration *= (1 + increasedDuration);
        }

        // slightly randomise target location
        if (inaccuracy)
        {
            targetLocation += new Vector3(Random.Range(-1f, 1f), 0, Random.Range(-1f, 1f)) * 0.25f * Vector3.Distance(location, targetLocation);
        }

        // add extra projectiles
        if (extraProjectiles != 0)
        {
            ExtraProjectiles extraProjectilesObject = abilityObject.GetComponent <ExtraProjectiles>();
            if (extraProjectilesObject == null)
            {
                extraProjectilesObject = abilityObject.AddComponent <ExtraProjectiles>(); extraProjectilesObject.numberOfExtraProjectiles = 0;
            }
            extraProjectilesObject.numberOfExtraProjectiles += extraProjectiles;
        }

        // add pierce change
        if (targetsToPierce > 0)
        {
            Pierce pierce = abilityObject.GetComponent <Pierce>();
            if (pierce == null)
            {
                pierce = abilityObject.AddComponent <Pierce>(); pierce.objectsToPierce = 0;
            }
            pierce.objectsToPierce += targetsToPierce;
        }

        if (increasedDamage != 0)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.increaseAllDamage(increasedDamage);
                //holder.addBaseDamage(DamageType.FIRE, holder.getBaseDamage(DamageType.FIRE) * increasedDamage);
            }
        }

        if (homing)
        {
            HomingMovement component = abilityObject.AddComponent <HomingMovement>();
            component.changeFacingDirection = true;
        }


        return(abilityObject);
    }
Пример #2
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        // add an explosion
        if (addExplosion)
        {
            abilityObject.AddComponent <CreateAbilityObjectOnDeath>().abilityToInstantiate = AbilityIDList.getAbility(AbilityID.fireballAoe);
        }

        // add extra projectiles
        if (extraProjectiles != 0 && !fireInSequence)
        {
            ExtraProjectiles extraProjectilesObject = abilityObject.GetComponent <ExtraProjectiles>();
            if (extraProjectilesObject == null)
            {
                extraProjectilesObject = abilityObject.AddComponent <ExtraProjectiles>(); extraProjectilesObject.numberOfExtraProjectiles = 0;
            }
            extraProjectilesObject.numberOfExtraProjectiles += extraProjectiles;
        }

        // add pierce change
        if (targetsToPierce > 0)
        {
            Pierce pierce = abilityObject.GetComponent <Pierce>();
            if (pierce == null)
            {
                pierce = abilityObject.AddComponent <Pierce>(); pierce.objectsToPierce = 0;
            }
            pierce.objectsToPierce += targetsToPierce;
        }

        // add chance to create explosion on hit
        if (chanceToCreateExplosionOnHit > 0)
        {
            ChanceToCreateAbilityObjectOnNewEnemyHit ctcaooneh = abilityObject.AddComponent <ChanceToCreateAbilityObjectOnNewEnemyHit>();
            ctcaooneh.chance               = chanceToCreateExplosionOnHit;
            ctcaooneh.spawnAtHit           = true;
            ctcaooneh.abilityToInstantiate = AbilityIDList.getAbility(AbilityID.fireballAoe);
        }

        // add chance to ignite
        if (igniteChance > 0)
        {
            ChanceToApplyStatusOnEnemyHit chanceTo = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            chanceTo.chance       = igniteChance;
            chanceTo.statusEffect = StatusEffectList.getEffect(StatusEffectID.Ignite);
        }
        if (additionalIgnite)
        {
            ApplyStatusOnEnemyHit component = abilityObject.AddComponent <ApplyStatusOnEnemyHit>();
            component.statusEffect = StatusEffectList.getEffect(StatusEffectID.Ignite);
        }

        if (increasedDamage != 0)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.increaseAllDamage(increasedDamage);
                //holder.addBaseDamage(DamageType.FIRE, holder.getBaseDamage(DamageType.FIRE) * increasedDamage);
            }
        }

        // reduce hit damage
        if (reduceBaseDamageBy80Percent)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                for (int i = 0; i < holder.baseDamageStats.damage.Count; i++)
                {
                    holder.baseDamageStats.damage[i] = new DamageStatsHolder.DamageTypesAndValues(holder.baseDamageStats.damage[i].damageType, holder.baseDamageStats.damage[i].value * 0.2f);
                }
            }
        }

        if (chanceForDoubleDamage > 0)
        {
            float rand = Random.Range(0f, 1f);
            if (rand < chanceForDoubleDamage)
            {
                foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
                {
                    for (int i = 0; i < holder.baseDamageStats.damage.Count; i++)
                    {
                        holder.addBaseDamage(holder.baseDamageStats.damage[i].damageType, holder.getBaseDamage(holder.baseDamageStats.damage[i].damageType));
                    }
                }
            }
        }

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

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

        if (homing)
        {
            abilityObject.AddComponent <HomingMovement>();
        }


        return(abilityObject);
    }
Пример #3
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        if (extraProjectiles > 0 && !spiralMovement)
        {
            foreach (DamageEnemyOnHit component in abilityObject.GetComponents <DamageEnemyOnHit>())
            {
                component.canDamageSameEnemyAgain = false;
            }
        }

        if (chains > 0)
        {
            ChainOnHit chain = abilityObject.AddComponent <ChainOnHit>();
            chain.chainsRemaining          = chains;
            chain.abilityToChain           = ability;
            chain.range                    = 8f;
            chain.destroyAfterChainAttempt = true;
            chain.cannotHitSame            = true;
            chain.offset                   = new Vector3(0f, 1.2f, 0f);
        }

        if (chains > 0 || hasChained)
        {
            // add a copy of this mutator to the ability object, but remove the chains (because it will chain anyway), the increased damage to first enemy hit, and the on cast stuff
            HammerThrowMutator newMutator = Comp <HammerThrowMutator> .GetOrAdd(abilityObject);

            newMutator.chains            = 0;
            newMutator.increasedDamage   = increasedDamage;
            newMutator.extraProjectiles  = 0;
            newMutator.armourShredChance = 0f;

            newMutator.noPierce = noPierce;
            newMutator.chanceForDoubleDamage    = chanceForDoubleDamage;
            newMutator.increasedDamage          = increasedDamage;
            newMutator.moreDamageAgainstStunned = moreDamageAgainstStunned;

            newMutator.spiralMovement = false;

            newMutator.aoeVoidDamage          = aoeVoidDamage;
            newMutator.increasedAoEBaseDamage = increasedAoEBaseDamage;

            newMutator.increasedProjectileSpeed = increasedProjectileSpeed;
            newMutator.increasedStunChance      = increasedStunChance;
            newMutator.moreDamage = moreDamage;
            newMutator.noReturn   = true;
            newMutator.canDamageSameEnemyAgain = false;
            newMutator.hasChained = true;
        }

        if (noReturn)
        {
            DestroyAfterDuration        dad       = abilityObject.GetComponent <DestroyAfterDuration>();
            ReturnToCasterAfterDuration component = abilityObject.GetComponent <ReturnToCasterAfterDuration>();
            component.duration = 10000f;
            if (spiralMovement)
            {
                dad.duration = 6f;
            }
            else
            {
                dad.duration = 2.5f;
            }
            if (!hasChained)
            {
                abilityObject.AddComponent <DestroyOnInanimateCollison>();
                ReturnOnInanimateCollision ret = abilityObject.GetComponent <ReturnOnInanimateCollision>();
                if (ret)
                {
                    Destroy(ret);
                }
            }
        }

        // aoe void damage
        if (aoeVoidDamage)
        {
            foreach (Transform child in abilityObject.GetComponentsInChildren <Transform>(true))
            {
                if (child.name == "aura")
                {
                    child.gameObject.SetActive(true);
                }
            }
            RepeatedlyDamageEnemiesWithinRadius repeatDamage = abilityObject.GetComponent <RepeatedlyDamageEnemiesWithinRadius>();
            if (repeatDamage == null)
            {
                repeatDamage = abilityObject.AddComponent <RepeatedlyDamageEnemiesWithinRadius>();
            }
            if (repeatDamage.baseDamageStats.damage == null)
            {
                repeatDamage.baseDamageStats.damage = new List <DamageStatsHolder.DamageTypesAndValues>();
            }
            repeatDamage.addBaseDamage(DamageType.VOID, 6f * (1 + increasedAoEBaseDamage));
            repeatDamage.damageInterval = 0.5f;
            repeatDamage.radius         = 1.5f;
            repeatDamage.baseDamageStats.addedDamageScaling = 0.2f;
            repeatDamage.tags.Add(Tags.AbilityTags.AoE);
            repeatDamage.tags.Add(Tags.AbilityTags.Throwing);
            repeatDamage.tags.Add(Tags.AbilityTags.DoT);
        }

        // add extra projectiles
        if (extraProjectiles != 0)
        {
            ExtraProjectiles extraProjectilesObject = abilityObject.GetComponent <ExtraProjectiles>();
            if (extraProjectilesObject == null)
            {
                extraProjectilesObject = abilityObject.AddComponent <ExtraProjectiles>(); extraProjectilesObject.numberOfExtraProjectiles = 0;
            }
            extraProjectilesObject.numberOfExtraProjectiles += extraProjectiles;
            if (projectileNova)
            {
                extraProjectilesObject.angle = 144f;
                if (extraProjectiles >= 6)
                {
                    extraProjectilesObject.angle = 160;
                }
            }
        }

        // remove pierce
        if (noPierce && chains <= 0 && !hasChained)
        {
            Pierce pierce = abilityObject.GetComponent <Pierce>();
            if (pierce == null)
            {
                pierce = abilityObject.AddComponent <Pierce>(); pierce.objectsToPierce = 0;
            }
            if (chains <= 0 && !hasChained)
            {
                abilityObject.AddComponent <DestroyOnFailingToPierceEnemy>();
            }
        }

        // add chance to shred armour
        if (armourShredChance > 0)
        {
            ChanceToApplyStatusOnEnemyHit chanceTo = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            chanceTo.chance       = armourShredChance;
            chanceTo.statusEffect = StatusEffectList.getEffect(StatusEffectID.ArmourShred);
        }

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

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

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

        if (chanceForDoubleDamage > 0)
        {
            float rand = Random.Range(0f, 1f);
            if (rand < chanceForDoubleDamage)
            {
                foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
                {
                    for (int i = 0; i < holder.baseDamageStats.damage.Count; i++)
                    {
                        holder.addBaseDamage(holder.baseDamageStats.damage[i].damageType, holder.getBaseDamage(holder.baseDamageStats.damage[i].damageType));
                    }
                }
            }
        }

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

        if (increasedProjectileSpeed != 0)
        {
            AbilityMover mover = abilityObject.GetComponent <AbilityMover>();
            mover.speed *= (1 + increasedProjectileSpeed);
        }

        if (spiralMovement)
        {
            SpiralMovement spira = abilityObject.AddComponent <SpiralMovement>();
            spira.constantVelocity      = SpiralMovement.ConstantType.BothAreMaxima;
            spira.tangentialVelocity    = 5.3f * (1 + increasedProjectileSpeed);
            spira.angleChangedPerSecond = 157f * (1 + increasedProjectileSpeed);
            spira.outwardSpeed          = 1.15f;
            spira.outwardDistance       = 0.6f;

            AbilityMover mover = abilityObject.GetComponent <AbilityMover>();
            mover.speed = 0;

            if (centreOnCaster)
            {
                spira.centreOnCaster      = true;
                spira.offsetFromTransform = new Vector3(0f, 1.2f, 0f);
            }

            if (extraProjectiles > 0)
            {
                spira.randomStartAngle = true;
            }
        }



        return(abilityObject);
    }
Пример #4
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        if (cone || randomAngles)
        {
            ExtraProjectiles component = abilityObject.GetComponent <ExtraProjectiles>();
            if (randomAngles)
            {
                component.randomAngles = true;
            }
            if (cone)
            {
                component.angle = 38f;
            }
        }

        if (increasedSpeed != 0)
        {
            AbilityMover component = abilityObject.GetComponent <AbilityMover>();
            if (component)
            {
                component.speed *= 1 + increasedSpeed;
            }
        }

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

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

        if (bleedChance > 0)
        {
            ChanceToApplyStatusOnEnemyHit chanceTo = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            chanceTo.chance       = bleedChance;
            chanceTo.statusEffect = StatusEffectList.getEffect(StatusEffectID.Bleed);
        }

        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 (moreDamageAgainstBleeding != 0)
        {
            // create the conditional
            DamageConditionalEffect    conditionalEffect = new DamageConditionalEffect();
            HasStatusEffectConditional conditional       = new HasStatusEffectConditional();
            conditional.statusEffect      = StatusEffectID.Bleed;
            conditionalEffect.conditional = conditional;
            conditionalEffect.effect      = new DamageEffectMoreDamage(moreDamageAgainstBleeding);
            // add the conditional to all damage stats holders
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.baseDamageStats.conditionalEffects.Add(conditionalEffect);
            }
        }

        return(abilityObject);
    }
Пример #5
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        if (increasedSpeed != 0)
        {
            AbilityMover component = abilityObject.GetComponent <AbilityMover>();
            if (component)
            {
                component.speed *= 1 + increasedSpeed;
            }
        }

        if (convertToCold)
        {
            foreach (Transform child in abilityObject.transform)
            {
                if (child.name == "SharpnelVFX")
                {
                    child.gameObject.SetActive(false);
                }
                if (child.name == "IceSharpnelVFX")
                {
                    child.gameObject.SetActive(true);
                }
            }
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.addBaseDamage(DamageType.COLD, holder.getBaseDamage(DamageType.FIRE));
                holder.addBaseDamage(DamageType.FIRE, -holder.getBaseDamage(DamageType.FIRE));
            }
            foreach (ConstantRotation rot in abilityObject.GetComponents <ConstantRotation>())
            {
                rot.degreesPerSecond = 0f;
            }
        }

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

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

        if (moreDamageInstances != null && moreDamageInstances.Count > 0)
        {
            float moreDamage = 1f;
            foreach (float instance in moreDamageInstances)
            {
                moreDamage *= 1 + instance;
            }

            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.increaseAllDamage(moreDamage - 1);
            }
        }

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

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

        if (addedProjectiles != 0)
        {
            ExtraProjectiles component = abilityObject.GetComponent <ExtraProjectiles>();
            if (component)
            {
                component.numberOfExtraProjectiles += addedProjectiles;
            }
        }

        if (pierces)
        {
            Pierce pierce = abilityObject.GetComponent <Pierce>();
            if (pierce == null)
            {
                pierce = abilityObject.AddComponent <Pierce>(); pierce.objectsToPierce = 0;
            }
            pierce.objectsToPierce += 10000;
        }

        return(abilityObject);
    }
Пример #6
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        // return a channelled fireball object if this is channelled
        if (channelled)
        {
            Destroy(abilityObject);
            abilityObject = Instantiate(Ability.getAbility(AbilityID.channelledFireball).abilityPrefab, location, Quaternion.Euler(targetLocation - location));

            // change the mutator on the new abilityObject
            FireballMutator mut = Comp <FireballMutator> .GetOrAdd(abilityObject);

            mut.extraProjectiles             = extraProjectiles;
            mut.addExplosion                 = addExplosion;
            mut.chanceToCreateExplosionOnHit = chanceToCreateExplosionOnHit;
            mut.igniteChance                 = igniteChance;
            mut.targetsToPierce              = targetsToPierce;
            mut.reduceBaseDamageBy80Percent  = reduceBaseDamageBy80Percent;
            mut.increasedCastSpeed           = increasedCastSpeed;
            mut.chanceForDoubleDamage        = chanceForDoubleDamage;
            mut.fireAddedAsLightning         = fireAddedAsLightning;
            mut.increasedDamage              = increasedDamage;
            mut.moreDamageAgainstIgnited     = moreDamageAgainstIgnited;
            mut.moreDamageAgainstChilled     = moreDamageAgainstChilled;
            mut.homing            = homing;
            mut.freeWhenOutOfMana = freeWhenOutOfMana;
            mut.alwaysFree        = alwaysFree;
            mut.increasedSpeed    = increasedSpeed;
            mut.increasedDuration = increasedDuration;
            mut.inaccuracy        = inaccuracy;

            // some are always false
            mut.channelled     = false;
            mut.fireInSequence = false;

            // this will be the channelled fireball object
            mut.channelledFireballObject = true;

            // return the new ability object and do not change it further
            return(abilityObject);
        }

        // disable shared hit detector for channelling
        if (channelledFireballObject)
        {
            foreach (HitDetector detector in abilityObject.GetComponents <HitDetector>())
            {
                detector.cannotHaveSharedhitDetector = true;
            }
        }

        // add an explosion
        if (addExplosion)
        {
            abilityObject.AddComponent <CreateAbilityObjectOnDeath>().abilityToInstantiate = AbilityIDList.getAbility(AbilityID.fireballAoe);
        }

        // increase speed
        if (increasedSpeed != 0)
        {
            abilityObject.GetComponent <AbilityMover>().speed *= (1 + increasedSpeed);
        }

        // increase duration
        if (increasedDuration != 0)
        {
            abilityObject.GetComponent <DestroyAfterDuration>().duration *= (1 + increasedDuration);
        }

        // slightly randomise target location
        if (inaccuracy)
        {
            targetLocation += new Vector3(Random.Range(-1f, 1f), 0, Random.Range(-1f, 1f)) * 0.25f * Vector3.Distance(location, targetLocation);
        }

        // add extra projectiles
        if (extraProjectiles != 0 && !fireInSequence)
        {
            ExtraProjectiles extraProjectilesObject = abilityObject.GetComponent <ExtraProjectiles>();
            if (extraProjectilesObject == null)
            {
                extraProjectilesObject = abilityObject.AddComponent <ExtraProjectiles>(); extraProjectilesObject.numberOfExtraProjectiles = 0;
            }
            extraProjectilesObject.numberOfExtraProjectiles += extraProjectiles;
        }

        // add pierce change
        if (targetsToPierce > 0)
        {
            Pierce pierce = abilityObject.GetComponent <Pierce>();
            if (pierce == null)
            {
                pierce = abilityObject.AddComponent <Pierce>(); pierce.objectsToPierce = 0;
            }
            pierce.objectsToPierce += targetsToPierce;
        }

        // add chance to create explosion on hit
        if (chanceToCreateExplosionOnHit > 0)
        {
            ChanceToCreateAbilityObjectOnNewEnemyHit ctcaooneh = abilityObject.AddComponent <ChanceToCreateAbilityObjectOnNewEnemyHit>();
            ctcaooneh.chance               = chanceToCreateExplosionOnHit;
            ctcaooneh.spawnAtHit           = true;
            ctcaooneh.abilityToInstantiate = AbilityIDList.getAbility(AbilityID.fireballAoe);
        }

        // add chance to ignite
        if (igniteChance > 0)
        {
            ChanceToApplyStatusOnEnemyHit chanceTo = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            chanceTo.chance       = igniteChance;
            chanceTo.statusEffect = StatusEffectList.getEffect(StatusEffectID.Ignite);
        }

        if (increasedDamage != 0)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.increaseAllDamage(increasedDamage);
                //holder.addBaseDamage(DamageType.FIRE, holder.getBaseDamage(DamageType.FIRE) * increasedDamage);
            }
        }

        // reduce hit damage
        if (reduceBaseDamageBy80Percent)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                for (int i = 0; i < holder.baseDamageStats.damage.Count; i++)
                {
                    holder.baseDamageStats.damage[i] = new DamageStatsHolder.DamageTypesAndValues(holder.baseDamageStats.damage[i].damageType, holder.baseDamageStats.damage[i].value * 0.2f);
                }
            }
        }

        if (chanceForDoubleDamage > 0)
        {
            float rand = Random.Range(0f, 1f);
            if (rand < chanceForDoubleDamage)
            {
                foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
                {
                    for (int i = 0; i < holder.baseDamageStats.damage.Count; i++)
                    {
                        holder.addBaseDamage(holder.baseDamageStats.damage[i].damageType, holder.getBaseDamage(holder.baseDamageStats.damage[i].damageType));
                    }
                }
            }
        }

        if (fireAddedAsLightning > 0)
        {
            abilityObject.GetComponentInChildren <DisableOnStart>().active = false;
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.addBaseDamage(DamageType.LIGHTNING, holder.getBaseDamage(DamageType.FIRE) * fireAddedAsLightning);
            }
        }

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

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

        if (homing)
        {
            abilityObject.AddComponent <HomingMovement>();
        }


        return(abilityObject);
    }
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        // add extra projectiles
        if (extraProjectiles != 0)
        {
            ExtraProjectiles extraProjectilesObject = abilityObject.GetComponent <ExtraProjectiles>();
            if (extraProjectilesObject == null)
            {
                extraProjectilesObject = abilityObject.AddComponent <ExtraProjectiles>(); extraProjectilesObject.numberOfExtraProjectiles = 0;
            }
            extraProjectilesObject.numberOfExtraProjectiles += extraProjectiles;
        }

        // add pierce
        if (targetsToPierce > 0)
        {
            Pierce pierce = abilityObject.GetComponent <Pierce>();
            if (pierce == null)
            {
                pierce = abilityObject.AddComponent <Pierce>(); pierce.objectsToPierce = 0;
            }
            pierce.objectsToPierce += targetsToPierce;
        }

        // increased projectile speed
        if (increasedSpeed != 0)
        {
            AbilityMover am = abilityObject.GetComponent <AbilityMover>();
            am.speed *= (1 + increasedSpeed);
        }

        if (chanceForDoubleDamage > 0)
        {
            float rand = Random.Range(0f, 1f);
            if (rand < chanceForDoubleDamage)
            {
                foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
                {
                    for (int i = 0; i < holder.baseDamageStats.damage.Count; i++)
                    {
                        holder.addBaseDamage(holder.baseDamageStats.damage[i].damageType, holder.getBaseDamage(holder.baseDamageStats.damage[i].damageType));
                    }
                }
            }
        }

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

        if (chanceToShredArmour > 0)
        {
            ChanceToApplyStatusOnEnemyHit chanceTo = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            chanceTo.chance       = chanceToShredArmour;
            chanceTo.statusEffect = StatusEffectList.getEffect(StatusEffectID.ArmourShred);
        }

        if (chanceToPoison > 0)
        {
            ChanceToApplyStatusOnEnemyHit chanceTo = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            chanceTo.chance       = chanceToPoison;
            chanceTo.statusEffect = StatusEffectList.getEffect(StatusEffectID.Poison);
        }

        if (singleProjectile)
        {
            ExtraProjectiles extraProjectiles = abilityObject.GetComponent <ExtraProjectiles>();
            if (extraProjectiles)
            {
                extraProjectiles.numberOfExtraProjectiles = 0;
            }
        }
        else if (reducedSpread != 0)
        {
            ExtraProjectiles extraProjectiles = abilityObject.GetComponent <ExtraProjectiles>();
            if (extraProjectiles)
            {
                extraProjectiles.angle -= reducedSpread;
                if (extraProjectiles.angle < 0)
                {
                    extraProjectiles.angle = 0;
                }
            }
        }

        if (firstProjectileIsAccurate)
        {
            RandomiseDirection rd = abilityObject.GetComponent <RandomiseDirection>();
            if (rd)
            {
                rd.maximumAngleChange = 0;
            }
        }

        if (homing)
        {
            abilityObject.AddComponent <HomingMovement>();
        }

        return(abilityObject);
    }
Пример #8
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        firstHit           = true;
        lastTargetPosition = targetLocation;

        if (movesRandomly)
        {
            RandomiseDirection component = abilityObject.AddComponent <RandomiseDirection>();
            component.maximumAngleChange      = 180f * (1 + increasedRandomisation);
            component.timeToRandomise         = RandomiseDirection.TimeToRandomise.DirectionMode;
            component.directionChangeInterval = directionChangeInterval;
            component.boundingAngle           = boundingAngle;
        }

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

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

        if (chanceToShredArmour > 0)
        {
            ChanceToApplyStatusOnEnemyHit chanceTo = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>();
            chanceTo.chance       = chanceToShredArmour;
            chanceTo.statusEffect = StatusEffectList.getEffect(StatusEffectID.ArmourShred);
        }

        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 (cullPercent > 0)
        {
            foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>())
            {
                damage.baseDamageStats.cullPercent += cullPercent;
            }
        }

        if (increasedDamage != 0)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.increaseAllDamage(increasedDamage);
                //holder.addBaseDamage(DamageType.PHYSICAL, holder.getBaseDamage(DamageType.PHYSICAL) * increasedDamage);
            }
        }

        if (addedFireDamage > 0)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.addBaseDamage(DamageType.FIRE, addedFireDamage);
            }
            // change the vfx
            abilityObject.GetComponent <CreateOnDeath>().objectsToCreateOnDeath.RemoveAt(0);
            abilityObject.GetComponent <CreateOnDeath>().add(PrefabList.getPrefab("animalSwipeVFXOrange"));
        }

        if (addedPhysicalDamage > 0)
        {
            foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>())
            {
                holder.addBaseDamage(DamageType.PHYSICAL, addedPhysicalDamage);
            }
        }

        if (slows)
        {
            AttachAttachableOnEnemyHit newComponent = abilityObject.AddComponent <AttachAttachableOnEnemyHit>();
            newComponent.attachable = AbilityIDList.getAbility(AbilityID.slow).abilityPrefab;
        }

        if (travels)
        {
            // enable the vfx on the ability object itself
            foreach (Transform child in abilityObject.transform)
            {
                if (child.name == "SwipeVFX" && addedFireDamage <= 0)
                {
                    child.gameObject.SetActive(true);
                }
                if (child.name == "SwipeVFXOrange" && addedFireDamage > 0)
                {
                    child.gameObject.SetActive(true);
                }
            }
            // disable creating the vfx on death
            abilityObject.GetComponent <CreateOnDeath>().objectsToCreateOnDeath.RemoveAt(0);
            // set duration
            abilityObject.GetComponent <DestroyAfterDuration>().duration = 0.18f * (1 + increasedDuration);
            // set speed
            abilityObject.GetComponent <AbilityMover>().speed = 12f + addedSpeed;
            // remove start towards target
            abilityObject.GetComponent <StartsTowardsTarget>().distance = 0f;

            // add extra projectiles
            if (chanceOfExtraProjectiles > 0)
            {
                float rand2 = Random.Range(0f, 1f);
                if (rand2 < chanceOfExtraProjectiles)
                {
                    ExtraProjectiles extraProjectiles = abilityObject.AddComponent <ExtraProjectiles>();
                    extraProjectiles.angle        = 180f;
                    extraProjectiles.randomAngles = true;
                }
            }
        }


        return(abilityObject);
    }
Пример #9
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        // if this skill casts a thorn shield that casts thorn burst then different things needs to be done to it
        if (thornShield)
        {
            // switch the ability object for a thorn shield
            Destroy(abilityObject);
            abilityObject = Instantiate(AbilityIDList.getAbility(AbilityID.thornShield).abilityPrefab, location, Quaternion.Euler(targetLocation - location));

            // the thorn shield's thorn burst mutator must be given the correct values
            ThornBurstMutator thornShieldMutator = abilityObject.GetComponent <ThornBurstMutator>();
            if (thornShieldMutator)
            {
                thornShieldMutator.extraProjectilesChance        = extraProjectilesChance;
                thornShieldMutator.chanceToPoison                = chanceToPoison;
                thornShieldMutator.pierceChance                  = pierceChance;
                thornShieldMutator.reducedSpread                 = reducedSpread;
                thornShieldMutator.addedSpeed                    = addedSpeed;
                thornShieldMutator.thornShieldAiming             = thornShieldAiming;
                thornShieldMutator.addedShieldDuration           = addedShieldDuration;
                thornShieldMutator.chanceOfRecreatingThornShield = chanceOfRecreatingThornShield;
                thornShieldMutator.increasedDamage               = increasedDamage;
                thornShieldMutator.chanceToBleed                 = chanceToBleed;
                thornShieldMutator.thornShield                   = false;

                if (chanceOfRecreatingThornShield > 0)
                {
                    float rand = Random.Range(0f, 1f);
                    if (rand < chanceOfRecreatingThornShield)
                    {
                        thornShieldMutator.thisShieldRecreatesItself = true;
                    }
                    else
                    {
                        thornShieldMutator.thisShieldRecreatesItself = false;
                    }
                }
            }

            if (addedShieldDuration > 0)
            {
                if (abilityObject.GetComponent <DestroyAfterDuration>())
                {
                    abilityObject.GetComponent <DestroyAfterDuration>().duration += addedShieldDuration;
                }
            }

            // if the caster can cast on allies or this is a shield
            if (canCastOnAllies || (GetComponent <BuffParent>() && transform.parent))
            {
                abilityObject.GetComponent <AttachToCreatorOnCreation>().runOnCreation = false;
                AttachToNearestAllyOnCreation attachToAlly = abilityObject.AddComponent <AttachToNearestAllyOnCreation>();
                attachToAlly.replaceExistingBuff = false;
                attachToAlly.displacement        = abilityObject.GetComponent <AttachToCreatorOnCreation>().displacement;
                abilityObject.AddComponent <StartsAtTarget>();
            }

            return(abilityObject);
        }

        // only do this if the caster is a shield
        changeTargetLocation = false;
        if (GetComponent <BuffParent>() && transform.parent)
        {
            if (thornShieldAiming)
            {
                changeTargetLocation = true;
                newTargetLocation    = transform.position + transform.parent.forward;
            }

            if (thisShieldRecreatesItself)
            {
                thornShield = true;
                GetComponent <AbilityObjectConstructor>().constructAbilityObject(ability, location, targetLocation, null, false);
                thornShield = false;
            }

            // reduce the delay on the extra projectiles, otherwise it looks unnatural because their cast point does not move
            ExtraProjectiles extraProj = abilityObject.GetComponent <ExtraProjectiles>();
            if (extraProj)
            {
                extraProj.delayWindow = 0.05f;
            }
        }

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

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

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

        if (pierceChance > 0)
        {
            float rand = Random.Range(0f, 1f);
            if (rand < pierceChance)
            {
                Pierce pierce = abilityObject.GetComponent <Pierce>();
                if (pierce == null)
                {
                    pierce = abilityObject.AddComponent <Pierce>(); pierce.objectsToPierce = 0;
                }
                pierce.objectsToPierce += 100;
            }
        }

        if (reducedSpread != 0)
        {
            ExtraProjectiles extraProjectilesObject = abilityObject.GetComponent <ExtraProjectiles>();
            if (extraProjectilesObject == null)
            {
                extraProjectilesObject = abilityObject.AddComponent <ExtraProjectiles>(); extraProjectilesObject.numberOfExtraProjectiles = 0;
            }
            extraProjectilesObject.angle -= reducedSpread;
        }

        if (extraProjectilesChance != 0)
        {
            float rand = Random.Range(0f, 1f);
            if (rand < extraProjectilesChance)
            {
                ExtraProjectiles extraProjectilesObject = abilityObject.GetComponent <ExtraProjectiles>();
                if (extraProjectilesObject == null)
                {
                    extraProjectilesObject = abilityObject.AddComponent <ExtraProjectiles>(); extraProjectilesObject.numberOfExtraProjectiles = 0;
                }
                extraProjectilesObject.numberOfExtraProjectiles += 6;
            }
        }

        if (addedSpeed > 0)
        {
            abilityObject.GetComponent <AbilityMover>().speed += addedSpeed;
        }

        return(abilityObject);
    }