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; if (addedVoidDamage > 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.addBaseDamage(DamageType.VOID, addedVoidDamage); } } if (increasedDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(increasedDamage); } } if (increasedRadius != 0) { foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>()) { cod.increasedRadius = increasedRadius; cod.increasedHeight = increasedRadius; } foreach (CapsuleCollider col in abilityObject.GetComponents <CapsuleCollider>()) { col.height *= (1 + increasedRadius); col.radius *= (1 + increasedRadius); } } if (timeRotChance > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.TimeRot); newComponent.chance = timeRotChance; } if (increasedStunChance != 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.increasedStunChance += increasedStunChance; } } 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 (moreDamageAgainstFullHealth != 0) { // create the conditional DamageConditionalEffect conditionalEffect = new DamageConditionalEffect(); FullHealthConditional conditional = new FullHealthConditional(); conditionalEffect.conditional = conditional; conditionalEffect.effect = new DamageEffectMoreDamage(moreDamageAgainstFullHealth); // add the conditional to all damage stats holders foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.conditionalEffects.Add(conditionalEffect); } } if (moreDamageAgainstDamaged != 0) { // create the conditional DamageConditionalEffect conditionalEffect = new DamageConditionalEffect(); DamagedConditional conditional = new DamagedConditional(); conditionalEffect.conditional = conditional; conditionalEffect.effect = new DamageEffectMoreDamage(moreDamageAgainstDamaged); // add the conditional to all damage stats holders foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.conditionalEffects.Add(conditionalEffect); } } if (cullPercent > 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.cullPercent += cullPercent; } } return(abilityObject); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { if (voidRiftAtStart) { CreateAbilityObjectOnStart component = abilityObject.AddComponent <CreateAbilityObjectOnStart>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.voidRift); component.createAtStartLocation = true; } if (voidRiftAtEnd) { CreateAbilityObjectOnDeath component = abilityObject.AddComponent <CreateAbilityObjectOnDeath>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.voidRift); } if (voidRiftAtStart || voidRiftAtEnd) { VoidRiftMutator mut = abilityObject.AddComponent <VoidRiftMutator>(); mut.increasedDamage = increasedDamage; mut.increasedRadius = increasedRadius; mut.increasedStunChance = increasedStunChance; mut.increasesDoTDamageTaken = increasesDoTDamageTaken; mut.timeRotChance = timeRotChance; mut.increasesDamageTaken = increasesDamageTaken; } // apply stats on cooldown float cooldown = getCooldown(); StatBuffs buffs = GetComponent <StatBuffs>(); if (!buffs) { buffs = gameObject.AddComponent <StatBuffs>(); } foreach (TaggedStatsHolder.TaggableStat stat in statsWhileOnCooldown) { TaggedStatsHolder.TaggableStat newStat = new TaggedStatsHolder.TaggableStat(stat); buffs.addTaggedBuff(new TaggedBuff(newStat, cooldown)); } // apply stats on use float duration = 2 + additionalSecondsBack; foreach (TaggedStatsHolder.TaggableStat stat in statOnUse) { TaggedStatsHolder.TaggableStat newStat = new TaggedStatsHolder.TaggableStat(stat); buffs.addTaggedBuff(new TaggedBuff(newStat, duration)); } if (noHealthRestoration || noManaRestoration) { ReturnCasterToOlderPosition component = abilityObject.GetComponent <ReturnCasterToOlderPosition>(); if (noHealthRestoration) { component.restoreHealth = false; } if (noManaRestoration) { component.restoreMana = false; } } if (healsOrDamagesAtRandom && health) { float rand = Random.Range(0f, 1f); if (rand < 0.8f) { health.Heal((health.maxHealth - health.currentHealth) * healOrDamagePercent); } else { health.HealthDamage(health.currentHealth * healOrDamagePercent); } } return(abilityObject); }
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); }