Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        CreationReferences references = GetComponent <CreationReferences>();

        if (references)
        {
            creator = references.creator;
        }
        mover = GetComponent <AbilityMover>();
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     // get references
     mover            = GetComponent <AbilityMover>();
     locationDetector = GetComponent <LocationDetector>();
     // set the current direction to the start direction
     currentDirection = locationDetector.targetLocation - locationDetector.startLocation;
     // randomise at start
     if (timeToRandomise == TimeToRandomise.Start)
     {
         randomiseDirection(maximumAngleChange);
     }
     // prepare to randomise initialy if using direction mode
     index = directionChangeInterval;
 }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     abilityMover = GetComponent <AbilityMover>();
     centre       = transform.position;
     if (centreOnCaster)
     {
         CreationReferences references = GetComponent <CreationReferences>();
         if (references && references.creator)
         {
             centreOnTransform = true;
             centreTransform   = references.creator.transform;
         }
     }
     if (randomStartAngle)
     {
         yRot = Random.Range(0, 360);
     }
 }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        abilityMover = GetComponent <AbilityMover>();

        locationDetector = GetComponent <LocationDetector>();
        AlignmentManager alignmentManager = GetComponent <AlignmentManager>();

        if (locationDetector && alignmentManager)
        {
            Alignment alignment = alignmentManager.alignment;
            if (alignment)
            {
                List <Transform> possibleTargets = new List <Transform>();
                foreach (BaseHealth health in BaseHealth.all)
                {
                    if (health.alignmentManager && alignment.foes.Contains(health.alignmentManager.alignment) && health.currentHealth > 0)
                    {
                        possibleTargets.Add(health.transform);
                    }
                }

                Vector3 position = locationDetector.targetLocation;
                targetPosition = position;
                float distance       = 0f;
                float targetDistance = 0f;

                foreach (Transform possibleTarget in possibleTargets)
                {
                    distance       = Vector3.Distance(position, possibleTarget.position);
                    targetDistance = Vector3.Distance(position, targetPosition);
                    if ((target == null || distance < targetDistance) && distance < maxDistanceFromTarget)
                    {
                        targetPosition = possibleTarget.position;
                        target         = possibleTarget;
                    }
                }

                if (target)
                {
                    targetGo = target.gameObject;
                }
            }
        }
    }
Ejemplo n.º 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 (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);
            }
        }

        return(abilityObject);
    }
Ejemplo n.º 6
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);
    }
Ejemplo n.º 7
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);
    }
Ejemplo n.º 8
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);
    }
Ejemplo n.º 9
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        if (chains > 0)
        {
            ChainOnHit chain = abilityObject.AddComponent <ChainOnHit>();
            chain.chainsRemaining = chains;
            chain.abilityToChain  = ability;
            chain.range           = 8f;
            chain.cannotHitSame   = true;
            chain.destroyAfterSuccessfulChainAttempt = 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
            DarkBladeMutator newMutator = abilityObject.AddComponent <DarkBladeMutator>();
            newMutator.chains            = 0;
            newMutator.increasedDamage   = increasedDamage;
            newMutator.armourShredChance = 0f;

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

            newMutator.increasedProjectileSpeed = increasedProjectileSpeed;
            newMutator.increasedStunChance      = increasedStunChance;
            newMutator.hasChained = true;
        }

        // 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 (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);
        }


        return(abilityObject);
    }
Ejemplo n.º 10
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        // check if the explosion needs to be removed
        if (removeExplosion)
        {
            CreateAbilityObjectOnDeath[] components = abilityObject.GetComponents <CreateAbilityObjectOnDeath>();
            for (int i = 0; i < components.Length; i++)
            {
                if (components[i].abilityToInstantiate == AbilityIDList.getAbility(AbilityID.lightningExplosion))
                {
                    Destroy(components[i]);
                    components[i].deactivate();
                }
            }
        }
        // explosion only stuff
        else
        {
            if (increasedExplosionDamage != 0 || explosionChanceToShock != 0)
            {
                LightningExplosionMutator mut = abilityObject.AddComponent <LightningExplosionMutator>();
                mut.increasedDamage = increasedExplosionDamage;
                mut.chanceToShock   = explosionChanceToShock;
            }

            if (explodesAtTarget)
            {
                abilityObject.GetComponent <DestroyAfterDuration>().duration = 1.5f;
                if (!abilityObject.GetComponent <LocationDetector>())
                {
                    abilityObject.AddComponent <LocationDetector>();
                }
                DestroyAfterDurationAfterReachingTargetLocation component = abilityObject.AddComponent <DestroyAfterDurationAfterReachingTargetLocation>();
                component.duration = 0f;
            }

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

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

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

        if (removePull)
        {
            PullComponent[] pullComponents = abilityObject.GetComponents <PullComponent>();
            for (int i = 0; i < pullComponents.Length; i++)
            {
                Destroy(pullComponents[i]);
            }
        }

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

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

        if (!usingAbility)
        {
            usingAbility = GetComponent <UsingAbility>();
        }

        // casting stuff
        if (lightningAegisChance > 0 && usingAbility)
        {
            if (lightningAegisChance >= Random.Range(0f, 1f))
            {
                usingAbility.UseAbility(AbilityIDList.getAbility(AbilityID.lightningAegis), transform.position, false, false);
            }
        }

        if (knockBackOnCastChance > 0 && usingAbility)
        {
            if (knockBackOnCastChance >= Random.Range(0f, 1f))
            {
                usingAbility.UseAbility(AbilityIDList.getAbility(AbilityID.knockBack), transform.position, false, false);
            }
        }


        return(abilityObject);
    }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     mover            = GetComponent <AbilityMover>();
     detector         = GetComponent <LocationDetector>();
     previousPosition = transform.position;
 }
Ejemplo n.º 12
0
 // Use this for initialization
 void Start()
 {
     abilityMover = GetComponent <AbilityMover>();
 }
Ejemplo n.º 13
0
    public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation)
    {
        // if this is a meteor shower
        if (additionalMeteors > 0)
        {
            Destroy(abilityObject);

            abilityObject = Instantiate(AbilityIDList.getAbility(AbilityID.meteorShower).abilityPrefab);
            abilityObject.transform.position = location;
            CastAtRandomPointAfterDuration meteorCaster = abilityObject.GetComponent <CastAtRandomPointAfterDuration>();
            meteorCaster.duration       /= (1 + increasedMeteorFrequency);
            meteorCaster.remainingCasts += additionalMeteors;
            meteorCaster.radius         *= (1 + increasedShowerRadius);

            if (line)
            {
                StartsAtTarget sat = meteorCaster.GetComponent <StartsAtTarget>();
                if (sat)
                {
                    sat.active = false;
                    Destroy(sat);
                }
                AbilityMover mover = Comp <AbilityMover> .GetOrAdd(abilityObject);

                mover.SetDirection(targetLocation - location);
                mover.speed         = 10 * (1 + increasedShowerRadius);
                meteorCaster.radius = 0;
                StartsTowardsTarget stt = abilityObject.AddComponent <StartsTowardsTarget>();
                stt.distance       = 1f;
                stt.addWeaponRange = false;
            }

            // create a mutator on the meteor shower object
            MeteorMutator newMutator = abilityObject.AddComponent <MeteorMutator>();



            // variables for all damage
            newMutator.moreDamageInstances = moreDamageInstances;

            // meteor variables (except use all mana)
            newMutator.increasedFallSpeed     = increasedFallSpeed;
            newMutator.increasedCastSpeed     = increasedCastSpeed;
            newMutator.shrapnelChance         = shrapnelChance;
            newMutator.increasedShrapnelSpeed = increasedShrapnelSpeed;
            newMutator.shrapnelPierces        = shrapnelPierces;
            newMutator.replaceFireCircle      = replaceFireCircle;

            // aoe variables
            newMutator.moreDamageAgainstFullHealth = moreDamageAgainstFullHealth;
            newMutator.increasedShrapnelDamage     = increasedShrapnelDamage;
            newMutator.increasedStunChance         = increasedStunChance;
            newMutator.moreDamageInstances         = new List <float>();
            newMutator.moreDamageInstances.AddRange(moreDamageInstances);

            // apply mana variable once for all meteors
            if (usesAllMana && myMana)
            {
                float totalCost = myMana.getManaCost(ability);
                totalCost += myMana.currentMana;

                float proportion = totalCost / myMana.maxMana;
                newMutator.moreDamageInstances.Add(proportion * 2);

                myMana.currentMana = 0;
            }

            return(abilityObject);
        }


        // if this is a regular meteor

        // apply aoe variables
        MeteorAoEMutator aoeMutator = abilityObject.AddComponent <MeteorAoEMutator>();

        aoeMutator.moreDamageAgainstFullHealth = moreDamageAgainstFullHealth;
        aoeMutator.increasedStunChance         = increasedStunChance;
        aoeMutator.moreDamageInstances         = new List <float>();
        aoeMutator.moreDamageInstances.AddRange(moreDamageInstances);


        // meteor variables

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

        MeteorShrapnelMutator shrapnelMutator = null;

        if (shrapnelChance > 0)
        {
            float rand = Random.Range(0f, 1f);
            if (rand < shrapnelChance)
            {
                CreateAbilityObjectOnDeath caood = abilityObject.AddComponent <CreateAbilityObjectOnDeath>();
                caood.abilityToInstantiate = AbilityIDList.getAbility(AbilityID.meteorShrapnel);
                caood.createAtTarget       = true;
                caood.offset    = -caood.GetComponent <LocationDetector>().targetLocationOffset;
                shrapnelMutator = abilityObject.AddComponent <MeteorShrapnelMutator>();
                shrapnelMutator.increasedDamage     = increasedShrapnelDamage;
                shrapnelMutator.increasedSpeed      = increasedShrapnelSpeed;
                shrapnelMutator.pierces             = shrapnelPierces;
                shrapnelMutator.increasedStunChance = increasedStunChance;
                shrapnelMutator.moreDamageInstances = new List <float>();
                shrapnelMutator.moreDamageInstances.AddRange(moreDamageInstances);
            }
        }

        if (replaceFireCircle)
        {
            CreateAtTargetLocationOnCreation component = abilityObject.GetComponent <CreateAtTargetLocationOnCreation>();
            if (component)
            {
                component.objectsToCreate.Clear();
                GameObject prefab = PrefabList.getPrefab("EnemyMeteorCircle");
                if (prefab)
                {
                    CreateAtTargetLocationOnCreation.GameObjectHolder holder = new CreateAtTargetLocationOnCreation.GameObjectHolder();
                    holder.gameObject          = prefab;
                    holder.destroyWhenThisDies = true;
                    component.objectsToCreate.Add((holder));
                }
            }
        }

        if (usesAllMana && myMana)
        {
            float totalCost = myMana.getManaCost(ability);
            totalCost += myMana.currentMana;

            float proportion = totalCost / myMana.maxMana;

            aoeMutator.moreDamageInstances.Add(proportion * 2);
            if (shrapnelMutator)
            {
                shrapnelMutator.moreDamageInstances.Add(proportion * 2);
            }

            myMana.currentMana = 0;
        }


        return(abilityObject);
    }
Ejemplo n.º 14
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 == "VolcanicOrbVFX")
                {
                    child.gameObject.SetActive(false);
                }
                if (child.name == "FrozenOrbVFX")
                {
                    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 (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>())
            {
                cod.objectsToCreateOnDeath.Clear();
                //cod.objectsToCreateOnDeath.Add(new CreateOnDeath.GameObjectHolder(PrefabList.getPrefab("QuickIceCircleVFX")));
            }
        }

        ShrapnelMutator shrapMut = abilityObject.AddComponent <ShrapnelMutator>();

        shrapMut.increasedDamage          = increasedShrapnelDamage;
        shrapMut.increasedSpeed           = increasedShrapnelSpeed;
        shrapMut.increasedStunChance      = increasedShrapnelStunChance;
        shrapMut.convertToCold            = convertToCold;
        shrapMut.pierces                  = shrapnelPierces;
        shrapMut.chillChance              = chillChance;
        shrapMut.moreDamageInstances      = moreDamageInstances;
        shrapMut.moreDamageAgainstChilled = moreShrapnelDamageAgainstChilled;
        shrapMut.addedProjectiles         = addedShrapnelProjectiles;


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

        if (increasedDuration != 0 || baseDurationis2)
        {
            DestroyAfterDuration dad = abilityObject.GetComponent <DestroyAfterDuration>();
            if (dad)
            {
                if (baseDurationis2)
                {
                    dad.duration = 2f + (1f * increasedDuration);
                }
                else
                {
                    dad.duration *= (1f + increasedDuration);
                }
            }
        }

        if (leavesExplosion)
        {
            CreateAbilityObjectOnDeath component = abilityObject.AddComponent <CreateAbilityObjectOnDeath>();
            component.abilityToInstantiate = AbilityIDList.getAbility(AbilityID.fireCircle);
            component.offset = new Vector3(0f, -1f, 0f);

            FireCircleMutator circleMut = abilityObject.AddComponent <FireCircleMutator>();
            circleMut.chillChance     = chillChance;
            circleMut.convertToCold   = convertToCold;
            circleMut.igniteChance    = explosionIgniteChance;
            circleMut.increasedDamage = increasedExplosionDamage;
        }

        if (delayedExpolosionAtStart)
        {
            CastAfterDuration component = abilityObject.AddComponent <CastAfterDuration>();
            component.ability        = AbilityIDList.getAbility(AbilityID.delayedFireCircle);
            component.limitCasts     = true;
            component.remainingCasts = 1;
            component.age            = 10f;
            component.interval       = 1f;
            component.offset         = new Vector3(0f, -1.3f, 0f);

            DelayedFireCircleMutator circleMut = abilityObject.AddComponent <DelayedFireCircleMutator>();
            circleMut.chillChance     = chillChance;
            circleMut.convertToCold   = convertToCold;
            circleMut.igniteChance    = explosionIgniteChance;
            circleMut.increasedDamage = increasedExplosionDamage;
        }

        if (leavesExplosiveGround)
        {
            CastAfterDuration cad = abilityObject.AddComponent <CastAfterDuration>();
            if (convertToCold)
            {
                cad.ability = AbilityIDList.getAbility(AbilityID.shatteringGround);
            }
            else
            {
                cad.ability = AbilityIDList.getAbility(AbilityID.explosiveGround);
            }
            cad.limitCasts = false;
            cad.interval   = 0.79f / (1f + increasedExplosiveGroundFrequency);
            cad.age        = 0.6f / (1f + increasedExplosiveGroundFrequency);
        }

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


        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);
    }