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); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { VoidRiftMutator voidRiftMutator = Comp <VoidRiftMutator> .GetOrAdd(abilityObject); voidRiftMutator.increasedDamage = voidRift_increasedDamage; voidRiftMutator.increasedRadius = voidRift_increasedRadius; voidRiftMutator.timeRotChance = voidRift_timeRotChance; voidRiftMutator.increasesDamageTaken = voidRift_increasesDamageTaken; voidRiftMutator.increasesDoTDamageTaken = voidRift_increasesDoTDamageTaken; voidRiftMutator.increasedStunChance = voidRift_increasedStunChance; voidRiftMutator.moreDamageAgainstStunned = voidRift_moreDamageAgainstStunned; voidRiftMutator.igniteChance = voidRift_igniteChance; voidRiftMutator.moreDamageAgainstIgnited = voidRift_damageAgainstIgnited; voidRiftMutator.moreDamageAgainstTimeRotting = voidRift_damageAgainstTimeRotting; if (voidRift_noGrowth) { voidRiftMutator.areaGainOnNearbyDeath = 0f; voidRiftMutator.damageGainOnNearbyDeath = 0f; } else { voidRiftMutator.areaGainOnNearbyDeath *= (1 + voidRift_increasedAreaGrowth); voidRiftMutator.damageGainOnNearbyDeath *= (1 + voidRift_increasedDamageGrowth); } if (dealsDamage) { SphereCollider col = abilityObject.AddComponent <SphereCollider>(); col.radius = 0.3f; col.isTrigger = true; } if (increasedDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(increasedDamage); } } if (movementSpeedOnCast != 0) { TaggedStatsHolder.Stat stat = new TaggedStatsHolder.Stat(Tags.Properties.Movespeed); stat.increasedValue = movementSpeedOnCast; Buff buff = new Buff(stat, 4f); statBuffs.addBuff(buff); } if (orbitsCaster) { SpiralMovement movement = abilityObject.AddComponent <SpiralMovement>(); movement.outwardDistance = 2f + increasedOrbitDistance; movement.angleChangedPerSecond = 180f; movement.constantVelocity = SpiralMovement.ConstantType.AngularVelocity; movement.centreOnCaster = true; movement.offsetFromTransform = new Vector3(0, 1, 0); movement.outwardSpeed = 0f; movement.randomStartAngle = true; } if (castsAbyssalOrb) { CastAtRandomPointAfterDuration component = abilityObject.AddComponent <CastAtRandomPointAfterDuration>(); component.ability = Ability.getAbility(AbilityID.abyssalOrb); component.radius = 5f; component.limitCasts = false; component.duration = 3f / (1f + increasedAbyssalOrbFrequency); } if (voidEruptionOnDeath) { CreateAbilityObjectOnDeath component = abilityObject.AddComponent <CreateAbilityObjectOnDeath>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.voidEruption); component.aimingMethod = CreateAbilityObjectOnDeath.AimingMethod.Random; } if (increasedDuration != 0) { DestroyAfterDuration dad = abilityObject.GetComponent <DestroyAfterDuration>(); if (dad) { dad.duration *= (1 + increasedDuration); } } return(abilityObject); }