public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { if (chanceForChainingIceNova > 0) { float rand2 = Random.Range(0f, 1f); if (rand2 < chanceForChainingIceNova) { CreateAbilityObjectOnNewEnemtHit newComponent = abilityObject.AddComponent <CreateAbilityObjectOnNewEnemtHit>(); newComponent.abilityToInstantiate = AbilityIDList.getAbility(AbilityID.delayerForChainingIceNova); } } if (chillChance > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Chill); newComponent.chance = chillChance; } if (addedCritChance != 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.critChance += addedCritChance; } } if (addedCritMultiplier != 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.critMultiplier += addedCritMultiplier; } } if (canTarget) { abilityObject.AddComponent <StartsAtTarget>(); } if (ignites) { ApplyStatusOnEnemyHit apply = abilityObject.AddComponent <ApplyStatusOnEnemyHit>(); apply.statusEffect = StatusEffectList.getEffect(StatusEffectID.Ignite); } if (increasedDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(increasedDamage); } } return(abilityObject); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { if (increasedDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(increasedDamage); } } if (chanceToShock > 0) { ChanceToApplyStatusOnEnemyHit ctasoeh = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); ctasoeh.chance = chanceToShock; ctasoeh.statusEffect = StatusEffectList.getEffect(StatusEffectID.Shock); } return(abilityObject); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { 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 (necrotic) { // replace vfx CreateOnDeath cod = abilityObject.GetComponent <CreateOnDeath>(); if (cod && cod.objectsToCreateOnDeath != null && cod.objectsToCreateOnDeath.Count > 0) { cod.objectsToCreateOnDeath[0] = new CreateOnDeath.GameObjectHolder(PrefabList.getPrefab("NecroticBloodSplatterOnDeathVFX")); } // convert damage foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.convertAllDamageOfType(DamageType.PHYSICAL, DamageType.NECROTIC); } } if (chanceToPoison > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Poison); newComponent.chance = chanceToPoison; } if (armourReductionChance > 0 && Random.Range(0f, 1f) < armourReductionChance) { DebuffOnEnemyHit component = abilityObject.AddComponent <DebuffOnEnemyHit>(); if (reducesDarkProtectionInstead) { if (armourReductionStacks) { component.addDebuffToList(Tags.Properties.DarkProtection, armourReduction, 0f, null, null, 4f * (1 + increasedArmourDebuffDuration)); } else { component.addDebuffToList(Tags.Properties.DarkProtection, armourReduction, 0f, null, null, 4f * (1 + increasedArmourDebuffDuration), null, "blood splatter armour reduction"); } } else { if (armourReductionStacks) { component.addDebuffToList(Tags.Properties.Armour, armourReduction, 0f, null, null, 4f * (1 + increasedArmourDebuffDuration)); } else { component.addDebuffToList(Tags.Properties.Armour, armourReduction, 0f, null, null, 4f * (1 + increasedArmourDebuffDuration), null, "blood splatter armour reduction"); } } } if (minionBuffs != null && minionBuffs.Count > 0) { string buffName = "blood splatter buff"; BuffOnAllyHit component = abilityObject.AddComponent <BuffOnAllyHit>(); component.onlyApplyToCreatorsMinions = true; for (int i = 0; i < minionBuffs.Count; i++) { string fullBuffName = buffName + minionBuffs[i].property; foreach (Tags.AbilityTags _tag in minionBuffs[i].tagList) { fullBuffName += _tag; } component.addBuffToList(minionBuffs[i].property, minionBuffs[i].addedValue, minionBuffs[i].increasedValue, minionBuffs[i].moreValues, minionBuffs[i].quotientValues, 4f, minionBuffs[i].tagList, fullBuffName); } } if (increasedStunChance != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.increasedStunChance += increasedStunChance; } } // increase damage based on the number of minions float realIncreasedDamage = increasedDamage; if (increasedDamagePerMinion != 0) { if (references && references.creator) { SummonTracker tracker = references.creator.GetComponent <SummonTracker>(); if (tracker && tracker.summons != null) { realIncreasedDamage += increasedDamagePerMinion * tracker.summons.Count; } } } if (realIncreasedDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(realIncreasedDamage); } } 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); }
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); }
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); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { // choose the nova type if (canIceNova || canFireNova || canLightningNova) { int randMax = 0; if (canIceNova) { randMax++; } if (canFireNova) { randMax++; } if (canLightningNova) { randMax++; } float rand = Random.Range(0f, randMax); if (rand < 1f) { if (canIceNova) { abilityObject = instantiateIceNova(abilityObject, location, targetLocation); } else if (canFireNova) { abilityObject = instantiateFireNova(abilityObject, location, targetLocation); } else { abilityObject = instantiateLightningNova(abilityObject, location, targetLocation); } } else if (rand < 2f) { if (canFireNova && canIceNova) { abilityObject = instantiateFireNova(abilityObject, location, targetLocation); } else { abilityObject = instantiateLightningNova(abilityObject, location, targetLocation); } } else { abilityObject = instantiateLightningNova(abilityObject, location, targetLocation); } } if (chanceForChainingIceNova > 0) { float rand2 = Random.Range(0f, 1f); if (rand2 < chanceForChainingIceNova) { CreateAbilityObjectOnNewEnemtHit newComponent = abilityObject.AddComponent <CreateAbilityObjectOnNewEnemtHit>(); newComponent.abilityToInstantiate = AbilityIDList.getAbility(AbilityID.delayerForChainingIceNova); } } if (chillChance > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Chill); newComponent.chance = chillChance; } if (shockChance > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Shock); newComponent.chance = shockChance; } if (igniteChance > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Ignite); newComponent.chance = igniteChance; } if (addedCritChance != 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.critChance += addedCritChance; } } if (chanceToAttachSparkCharge > 0) { ChanceToCreateAbilityObjectOnNewEnemyHit newComponent = abilityObject.AddComponent <ChanceToCreateAbilityObjectOnNewEnemyHit>(); newComponent.spawnAtHit = true; newComponent.chance = chanceToAttachSparkCharge; newComponent.abilityToInstantiate = AbilityIDList.getAbility(AbilityID.sparkCharge); } if (addedCritMultiplier != 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.critMultiplier += addedCritMultiplier; } } if (canTarget) { abilityObject.AddComponent <StartsAtTarget>(); } if (increasedDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(increasedDamage); } } if (moreDamageAgainstFullHealth != 0) { // create the conditional DamageConditionalEffect conditionalEffect = new DamageConditionalEffect(); conditionalEffect.conditional = new FullHealthConditional(); conditionalEffect.effect = new DamageEffectMoreDamage(moreDamageAgainstFullHealth); // add the conditional to all damage stats holders foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.conditionalEffects.Add(conditionalEffect); } } if (increasedRadius != 0) { foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>()) { cod.increasedRadius = increasedRadius; } foreach (CapsuleCollider col in abilityObject.GetComponents <CapsuleCollider>()) { col.height *= (1 + increasedRadius); col.radius *= (1 + increasedRadius); } } return(abilityObject); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { if (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); }
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); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { if (convertToCold) { foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>()) { cod.objectsToCreateOnDeath.Clear(); cod.objectsToCreateOnDeath.Add(new CreateOnDeath.GameObjectHolder(PrefabList.getPrefab("QuickIceCircleVFX"))); } 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 (igniteChance > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Ignite); if (convertToCold) { newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Chill); } newComponent.chance = igniteChance; } return(abilityObject); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { // DoT on cast buff if (statBuffs) { statBuffs.addBuff(4f, Tags.Properties.Damage, 0, increasedDotDamageOnCast, null, null, dotTag, "sacrifice dot on cast bug"); } if (boneNovaChance > 0 && (!mana || mana.currentMana > 0) && (boneNovaChance >= 1 || boneNovaChance > (Random.Range(0f, 1f)))) { // nova trigger CreateAbilityObjectOnDeath component = abilityObject.AddComponent <CreateAbilityObjectOnDeath>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.boneNova); component.failsIfFailedAbility = true; component.offset = boneNovaOffset; // nova mutator BoneNovaMutator mutator = abilityObject.AddComponent <BoneNovaMutator>(); mutator.increasedSpeed = nova_increasedSpeed; mutator.pierces = nova_pierces; mutator.increasedDamage = nova_increasedDamage; mutator.increasedStunChance = nova_increasedStunChance; mutator.bleedChance = nova_bleedChance; mutator.addedCritChance = nova_addedCritChance; mutator.addedCritMultiplier = nova_addedCritMultiplier; mutator.cone = false; mutator.dontAttach = true; mutator.dontMoveToTarget = true; mutator.randomAngles = false; mutator.noVFX = true; mutator.moreDamageAgainstBleeding = nova_moreDamageAgainstBleeding; } if (bloodWraithChance > 0 && (bloodWraithChance >= 1 || bloodWraithChance > Random.Range(0f, 1f))) { // wraith trigger CreateAbilityObjectOnDeath component = abilityObject.AddComponent <CreateAbilityObjectOnDeath>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.summonBloodWraith); component.failsIfFailedAbility = true; // wraith mutator BloodWraithMutator mutator = abilityObject.AddComponent <BloodWraithMutator>(); mutator.statList.AddRange(bloodWraithStats); mutator.increasedSize = increasedBloodWraithSize; } 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); } } // increase radius float totalIncreasedArea = increasedArea; if (increasedArea != 0 || increasedAreaWith3OrMoreMinions != 0) { // calculate total increased area if (increasedAreaWith3OrMoreMinions != 0 && tracker && tracker.summons != null && tracker.summons.Count >= 3) { totalIncreasedArea += increasedAreaWith3OrMoreMinions; } // calculate increased radius float increasedRadius = Mathf.Sqrt(totalIncreasedArea + 1) - 1;; // apply increased radius if (increasedRadius != 0) { foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>()) { cod.increasedRadius = increasedRadius; cod.increasedHeight = increasedRadius; } foreach (SphereCollider col in abilityObject.GetComponents <SphereCollider>()) { col.radius *= (1 + increasedRadius); } foreach (CapsuleCollider col in abilityObject.GetComponents <CapsuleCollider>()) { col.radius *= (1 + increasedRadius); col.height *= (1 + increasedRadius); } } } if (chanceToIgnite > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Ignite); newComponent.chance = chanceToIgnite; } if (addedFireDamage > 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.addBaseDamage(DamageType.FIRE, addedFireDamage); } } if (increasedStunChance != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.increasedStunChance += increasedStunChance; } } // increase damage based on the number of minions float realIncreasedDamage = increasedDamage; if (increasedDamagePerMinion != 0) { if (tracker && tracker.summons != null) { realIncreasedDamage += increasedDamagePerMinion * tracker.summons.Count; } } // increased damage if the minion has more health if (increasedDamageIfDetonatedMinionHasMoreHealth != 0 && tracker) { // get the likely target Summoned targetMinion = tracker.getNearestMinion(targetLocation); if (targetMinion) { // check if it has more health BaseHealth minionHealth = targetMinion.getBaseHealth(); if (minionHealth && baseStats && baseStats.myHealth && minionHealth.currentHealth > baseStats.myHealth.currentHealth) { realIncreasedDamage += increasedDamageIfDetonatedMinionHasMoreHealth; } } } // more damage if you only have one minion if (increasedDamageWithOneMinion != 0) { if (tracker && tracker.numberOfMinions() == 1) { realIncreasedDamage += increasedDamageWithOneMinion; } } // increase damage if (realIncreasedDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(realIncreasedDamage); } } // chaining (mutator needs to be updated) if (chainsBetweenMinions) { CreateAbilityObjectOnNewAllyHit component = abilityObject.AddComponent <CreateAbilityObjectOnNewAllyHit>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.sacrifice); component.onlyHitCreatorMinions = true; component.aimTowardsHit = true; SacrificeMutator mutator = abilityObject.AddComponent <SacrificeMutator>(); mutator.nova_increasedSpeed = nova_increasedSpeed; mutator.nova_pierces = nova_pierces; mutator.nova_increasedDamage = nova_increasedDamage; mutator.nova_increasedStunChance = nova_increasedStunChance; mutator.nova_bleedChance = nova_bleedChance; mutator.nova_addedCritChance = nova_addedCritChance; mutator.nova_addedCritMultiplier = nova_addedCritMultiplier; mutator.nova_moreDamageAgainstBleeding = nova_moreDamageAgainstBleeding; mutator.boneNovaChance = boneNovaChance; mutator.moreDamageAgainstBleeding = moreDamageAgainstBleeding; mutator.increasedStunChance = increasedStunChance; mutator.chanceToIgnite = chanceToIgnite; mutator.addedFireDamage = addedFireDamage; mutator.bloodWraithChance = bloodWraithChance; mutator.bloodWraithStats = new List <TaggedStatsHolder.TaggableStat>(); mutator.bloodWraithStats.AddRange(bloodWraithStats); mutator.increasedBloodWraithSize = increasedBloodWraithSize; mutator.chainsBetweenMinions = true; // snap shot the damage increase and area increase mutator.increasedDamage = realIncreasedDamage; mutator.increasedArea = totalIncreasedArea; } return(abilityObject); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { 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; } 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 (increasesDamageTaken > 0 || increasesDoTDamageTaken > 0) { DebuffOnEnemyHit doeh = abilityObject.AddComponent <DebuffOnEnemyHit>(); if (increasesDamageTaken > 0) { doeh.addDebuffToList(Tags.Properties.DamageTaken, 0f, -increasesDamageTaken, new List <float>(), new List <float>(), 4f); } if (increasesDoTDamageTaken > 0) { List <Tags.AbilityTags> tagList = new List <Tags.AbilityTags>(); tagList.Add(Tags.AbilityTags.DoT); doeh.addDebuffToList(Tags.Properties.DamageTaken, 0f, -increasesDoTDamageTaken, new List <float>(), new List <float>(), 4f, tagList); } } 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 (leaveDelayed) { CreateAbilityObjectOnDeath component = abilityObject.AddComponent <CreateAbilityObjectOnDeath>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.delayedShieldRushEnd); DelayedShieldRushEndMutator mutator = abilityObject.AddComponent <DelayedShieldRushEndMutator>(); mutator.increasedDamage = increasedDamage + delayIncreasedDamage; mutator.increasedRadius = increasedRadius + delayIncreasedRadius; mutator.timeRotChance = timeRotChance + delayTimeRotChance; mutator.increasesDamageTaken = increasesDamageTaken + delayIncreasesDamageTaken; mutator.increasesDoTDamageTaken = increasesDoTDamageTaken + delayIncreasesDoTDamageTaken; mutator.increasedStunChance = increasedStunChance + delayIncreasedStunChance; mutator.addedCritMultiplier = addedCritMultiplier + delayAddedCritMultiplier; mutator.addedCritChance = addedCritChance + delayAddedCritChance; mutator.leaveDelayed = false; mutator.increasedDelayLength = increasedDelayLength; mutator.addedVoidDamage = addedVoidDamage; } return(abilityObject); }
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); }
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); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { if (splatterChance > 0 && (!mana || mana.currentMana > 0) && (splatterChance >= 1 || splatterChance > (Random.Range(0f, 1f)))) { // splatter trigger CreateAbilityObjectOnDeath component = abilityObject.AddComponent <CreateAbilityObjectOnDeath>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.bloodSplatter); // splatter mutator BloodSplatterMutator mutator = abilityObject.AddComponent <BloodSplatterMutator>(); mutator.increasedRadius = splatter_increasedRadius; mutator.increasedDamage = splatter_increasedDamage; mutator.chanceToPoison = splatter_chanceToPoison; mutator.armourReductionChance = splatter_armourReductionChance; mutator.armourReduction = splatter_armourReduction; mutator.armourReductionStacks = splatter_armourReductionStacks; mutator.increasedArmourDebuffDuration = splatter_increasedArmourDebuffDuration; mutator.increasedDamagePerMinion = splatter_increasedDamagePerMinion; mutator.minionBuffs = splatter_minionBuffs; mutator.reducesDarkProtectionInstead = splatter_reducesDarkProtectionInstead; mutator.necrotic = necrotic; } if (necrotic) { // replace vfx CreateOnDeath cod = abilityObject.GetComponent <CreateOnDeath>(); if (cod && cod.objectsToCreateOnDeath != null && cod.objectsToCreateOnDeath.Count > 0) { cod.objectsToCreateOnDeath[0] = new CreateOnDeath.GameObjectHolder(PrefabList.getPrefab("NecroticRipBloodOnDeathVFX")); } // convert damage foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.convertAllDamageOfType(DamageType.PHYSICAL, DamageType.NECROTIC); } } if (targetsAlliesInstead) { // change the damage component to hit allies (only hits minions by default) DamageEnemyOnHit damageComponent = abilityObject.GetComponent <DamageEnemyOnHit>(); DamageAllyOnHit component = abilityObject.AddComponent <DamageAllyOnHit>(); component.baseDamageStats = damageComponent.baseDamageStats; damageComponent.deactivate(); Destroy(damageComponent); // make sure it still creates a blood orb CreateResourceReturnAbilityObjectOnEnemyHit component2 = abilityObject.GetComponent <CreateResourceReturnAbilityObjectOnEnemyHit>(); component2.hitsAlliesInstead = true; // change the targetting MoveToNearestEnemyOnCreation moveComponent = abilityObject.GetComponent <MoveToNearestEnemyOnCreation>(); if (moveComponent) { moveComponent.moveToAllyInstead = true; } } 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 (addedHealthGained != 0 || increasedHealthGained != 0 || manaGained != 0 || convertHealthToWard || necrotic) { CreateResourceReturnAbilityObjectOnEnemyHit component = abilityObject.GetComponent <CreateResourceReturnAbilityObjectOnEnemyHit>(); // check if this behaviour needs to be removed if (increasedHealthGained < -1 && manaGained <= 0) { component.deactivated = true; } // if it does not then change its values else { component.health += addedHealthGained; component.health *= (1 + increasedHealthGained); if (increasedHealthGainedPerAttunement != 0) { component.health *= (1 + baseStats.GetStatValue(Tags.Properties.Attunement) * increasedHealthGainedPerAttunement); } component.mana += manaGained; if (convertHealthToWard) { component.ward = component.health; component.health = 0; } if (necrotic) { component.abilityObject = Ability.getAbility(AbilityID.necroticReturn); } } } if (increasedStunChance != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.increasedStunChance += increasedStunChance; } } // increase damage based on the number of minions float realIncreasedDamage = increasedDamage; if (increasedDamagePerMinion != 0) { if (tracker && tracker.summons != null) { realIncreasedDamage += increasedDamagePerMinion * tracker.summons.Count; } } if (realIncreasedDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(realIncreasedDamage); } } 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); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { // increasedDamageToFirstEnemyHit is removed for additional chains, so it can be applied without checks if (increasedDamage != 0 || increasedDamageToFirstEnemyHit != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(increasedDamage + increasedDamageToFirstEnemyHit); } } if (chains > 0) { ChainOnHit chain = abilityObject.AddComponent <ChainOnHit>(); chain.chainsRemaining = chains; chain.abilityToChain = ability; // 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 LightningBlastMutator newMutator = abilityObject.AddComponent <LightningBlastMutator>(); newMutator.chains = 0; increasedDamageToFirstEnemyHit = 0; newMutator.increasedDamage = increasedDamage; newMutator.lightningStrikeChance = lightningStrikeChance; newMutator.chanceToBlind = chanceToBlind; // add the increased damage per chain newMutator.increasedDamage += increasedDamagePerChain; // add increased damage to last enemy hit if appropriate if (chain.chainsRemaining == 0) { newMutator.increasedDamage += increasedDamageToLastEnemy; } } // on cast stuff if (lightningProtectionOnCast != 0 || elementalProtectionOnCast != 0) { Buff buff = new Buff(); TaggedStatsHolder.Stat stat = new TaggedStatsHolder.Stat(Tags.Properties.LightningProtection); stat.addedValue = (lightningProtectionOnCast + elementalProtectionOnCast) * (1 + increasedProtectionOnCast); buff.stat = stat; buff.remainingDuration = 3 * (1 + increasedProtectionDuration); statBuffs.addBuff(buff); } if (elementalProtectionOnCast != 0) { Buff buff = new Buff(); TaggedStatsHolder.Stat stat = new TaggedStatsHolder.Stat(Tags.Properties.ColdProtection); stat.addedValue = (elementalProtectionOnCast) * (1 + increasedProtectionOnCast); buff.stat = stat; buff.remainingDuration = 3 * (1 + increasedProtectionDuration); statBuffs.addBuff(buff); } if (elementalProtectionOnCast != 0) { Buff buff = new Buff(); TaggedStatsHolder.Stat stat = new TaggedStatsHolder.Stat(Tags.Properties.FireProtection); stat.addedValue = (elementalProtectionOnCast) * (1 + increasedProtectionOnCast); buff.stat = stat; buff.remainingDuration = 3 * (1 + increasedProtectionDuration); statBuffs.addBuff(buff); } if (wardOnCast != 0) { float rand = Random.Range(0f, 1f); if (rand < wardOnCastChance) { protectionClass.currentWard += wardOnCast; } } if (lightningDamageOnCast != 0) { List <Tags.AbilityTags> tags = new List <Tags.AbilityTags>(); tags.Add(Tags.AbilityTags.Lightning); TaggedStatsHolder.TaggableStat stat = new TaggedStatsHolder.TaggableStat(Tags.Properties.Damage, tags); stat.increasedValue = lightningDamageOnCast; TaggedBuff buff = new TaggedBuff(); buff.stat = stat; buff.remainingDuration = 3 * (1 + increasedDamageBuffDuration); statBuffs.addTaggedBuff(buff); } if (increasedStunChance != 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.increasedStunChance += increasedStunChance; } } // maybe cast lightning too if (lightningStrikeChance > 0) { float rand = Random.Range(0f, 1f); if (rand <= lightningStrikeChance) { AbilityObjectConstructor aoc = GetComponent <AbilityObjectConstructor>(); if (aoc) { aoc.constructAbilityObject(AbilityIDList.getAbility(AbilityID.lightning), targetLocation, targetLocation); } } } // maybe blind if (chanceToBlind > 0) { ChanceToApplyStatusOnEnemyHit ctasoeh = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); ctasoeh.chance = chanceToBlind; ctasoeh.statusEffect = StatusEffectList.getEffect(StatusEffectID.Blind); } return(abilityObject); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { if (chanceToBleed > 0) { ChanceToApplyStatusOnEnemyHit chanceTo = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); chanceTo.chance = chanceToBleed; chanceTo.statusEffect = StatusEffectList.getEffect(StatusEffectID.Bleed); } if (chanceToPlague > 0) { ChanceToApplyStatusOnEnemyHit chanceTo = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); chanceTo.chance = chanceToPlague; chanceTo.statusEffect = StatusEffectList.getEffect(StatusEffectID.Plague); } if (chanceToBlindingPoison > 0) { ChanceToApplyStatusOnEnemyHit chanceTo = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); chanceTo.chance = chanceToBlindingPoison; chanceTo.statusEffect = StatusEffectList.getEffect(StatusEffectID.BlindingPoison); } if (chanceToShredArmour > 0) { ChanceToApplyStatusOnEnemyHit chanceTo = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); chanceTo.chance = chanceToShredArmour; chanceTo.statusEffect = StatusEffectList.getEffect(StatusEffectID.ArmourShred); } if (poisonSpitChance > 0) { float rand = Random.Range(0f, 1f); if (rand < poisonSpitChance) { if (!usingAbility) { usingAbility = GetComponent <UsingAbility>(); } if (usingAbility) { usingAbility.UseAbility(AbilityIDList.getAbility(AbilityID.poisonSpit), targetLocation + new Vector3(0, -1.1f, 0), false, false); } } } if (increasedHitDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(increasedHitDamage); //holder.addBaseDamage(DamageType.PHYSICAL, holder.getBaseDamage(DamageType.PHYSICAL) * increasedDamage); } } if (addedCritChance != 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.critChance += addedCritChance; } } if (cullPercent > 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.cullPercent += cullPercent; } } if (moreDamageAgainstBlinded != 0) { // create the conditional DamageConditionalEffect conditionalEffect = new DamageConditionalEffect(); HasStatusEffectConditional conditional = new HasStatusEffectConditional(); conditional.statusEffect = StatusEffectID.Blind; conditionalEffect.conditional = conditional; conditionalEffect.effect = new DamageEffectMoreDamage(moreDamageAgainstBlinded); // add the conditional to all damage stats holders foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.conditionalEffects.Add(conditionalEffect); } } if (moreDamageAgainstPoisonBlinded != 0) { // create the conditional DamageConditionalEffect conditionalEffect = new DamageConditionalEffect(); HasStatusEffectConditional conditional = new HasStatusEffectConditional(); conditional.statusEffect = StatusEffectID.BlindingPoison; conditionalEffect.conditional = conditional; conditionalEffect.effect = new DamageEffectMoreDamage(moreDamageAgainstPoisonBlinded); // add the conditional to all damage stats holders foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.conditionalEffects.Add(conditionalEffect); } } if (dodgeRatingOnAttack != 0 || poisonDamageOnAttack != 0 || dotDamageOnAttack != 0) { StatBuffs statBuffs = GetComponent <StatBuffs>(); if (statBuffs == null) { statBuffs = gameObject.AddComponent <StatBuffs>(); } if (dodgeRatingOnAttack != 0) { statBuffs.addBuff(4f, Tags.Properties.DodgeRating, dodgeRatingOnAttack, 0, null, null); } if (poisonDamageOnAttack != 0) { List <Tags.AbilityTags> tagList = new List <Tags.AbilityTags>(); tagList.Add(Tags.AbilityTags.Poison); statBuffs.addBuff(4f, Tags.Properties.Damage, 0, poisonDamageOnAttack, null, null, tagList); } if (dotDamageOnAttack != 0) { List <Tags.AbilityTags> tagList = new List <Tags.AbilityTags>(); tagList.Add(Tags.AbilityTags.DoT); statBuffs.addBuff(4f, Tags.Properties.Damage, 0, dotDamageOnAttack, null, null, tagList); } } return(abilityObject); }
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) { 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; } 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 (igniteChance > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Ignite); newComponent.chance = igniteChance; } if (increasesDamageTaken > 0 || increasesDoTDamageTaken > 0) { DebuffOnEnemyHit doeh = abilityObject.AddComponent <DebuffOnEnemyHit>(); if (increasesDamageTaken > 0) { doeh.addDebuffToList(Tags.Properties.DamageTaken, 0f, -increasesDamageTaken, new List <float>(), new List <float>(), 4f); } if (increasesDoTDamageTaken > 0) { List <Tags.AbilityTags> tagList = new List <Tags.AbilityTags>(); tagList.Add(Tags.AbilityTags.DoT); doeh.addDebuffToList(Tags.Properties.DamageTaken, 0f, -increasesDoTDamageTaken, new List <float>(), new List <float>(), 4f, tagList); } } if (increasedStunChance != 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.increasedStunChance += increasedStunChance; } } 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 (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 (moreDamageAgainstTimeRotting != 0) { // create the conditional DamageConditionalEffect conditionalEffect = new DamageConditionalEffect(); HasStatusEffectConditional conditional = new HasStatusEffectConditional(); conditional.statusEffect = StatusEffectID.TimeRot; conditionalEffect.conditional = conditional; conditionalEffect.effect = new DamageEffectMoreDamage(moreDamageAgainstTimeRotting); // add the conditional to all damage stats holders foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.conditionalEffects.Add(conditionalEffect); } } 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; 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) { // Leech on cast buff if (statBuffs) { statBuffs.addBuff(4f, Tags.Properties.PercentLifeLeech, 0, physLeechOnCast, null, null, physTag, "marrow shards phys leech on cast buff"); if (tracker && tracker.numberOfMinions() == 2) { statBuffs.addBuff(2f, Tags.Properties.CriticalChance, 0, critChanceOnCast, null, null, physTag, "marrow shards phys leech on cast buff"); } } if (createsSplintersAtEnd) { // nova trigger(s) CreateAbilityObjectOnDeath component = abilityObject.AddComponent <CreateAbilityObjectOnDeath>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.boneNova); component.failsIfFailedAbility = true; component.offset = boneNovaOffset; component.aimingMethod = CreateAbilityObjectOnDeath.AimingMethod.TravelDirection; // nova mutator BoneNovaMutator mutator = abilityObject.AddComponent <BoneNovaMutator>(); mutator.increasedSpeed = nova_increasedSpeed; mutator.pierces = true; mutator.increasedDamage = nova_increasedDamage; mutator.increasedStunChance = nova_increasedStunChance; mutator.bleedChance = nova_bleedChance; mutator.addedCritChance = nova_addedCritChance; mutator.addedCritMultiplier = nova_addedCritMultiplier; mutator.cone = true; mutator.randomAngles = true; mutator.noVFX = true; mutator.dontAttach = true; mutator.dontMoveToTarget = true; mutator.moreDamageAgainstBleeding = nova_moreDamageAgainstBleeding; } if (returnHealthChance != 0 && returnHealthChance > (Random.Range(0f, 1f))) { CreateResourceReturnAbilityObjectOnEnemyHit component = abilityObject.AddComponent <CreateResourceReturnAbilityObjectOnEnemyHit>(); component.abilityObject = Ability.getAbility(AbilityID.bloodReturn); component.health = healthReturned; if (manaReturnChance != 0 && manaReturnChance > (Random.Range(0f, 1f))) { component.mana = manaReturned; } } if (increasedHealthCost != 0) { DamageCreatorOnCreation component = abilityObject.GetComponent <DamageCreatorOnCreation>(); if (component) { component.flatDamage *= (1 + increasedHealthCost); component.percentCurrentHealthTaken *= (1 + increasedHealthCost); } } if (doesntPierce) { Comp <Pierce> .GetOrAdd(abilityObject).objectsToPierce = 0; abilityObject.AddComponent <DestroyOnFailingToPierceEnemy>(); } if (endsAtTargetPoint) { if (!abilityObject.GetComponent <LocationDetector>()) { abilityObject.AddComponent <LocationDetector>(); } DestroyAfterDurationAfterReachingTargetLocation component = abilityObject.AddComponent <DestroyAfterDurationAfterReachingTargetLocation>(); component.duration = 0f; } if (increasedDuration != 0) { DestroyAfterDuration dad = abilityObject.GetComponent <DestroyAfterDuration>(); dad.duration *= 1 + increasedDuration; } 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); } } if (chanceToBleed > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Bleed); newComponent.chance = chanceToBleed; } if (chanceToShredArmour > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.ArmourShred); newComponent.chance = chanceToShredArmour; } if (increasedStunChance != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.increasedStunChance += increasedStunChance; } } // increase damage based on the number of minions float realIncreasedDamage = increasedDamage; if (increasedDamagePerMinion != 0) { if (tracker && tracker.summons != null) { realIncreasedDamage += increasedDamagePerMinion * tracker.summons.Count; } } // more damage if you only have one minion if (increasedDamageWithOneMinion != 0) { if (tracker && tracker.numberOfMinions() == 1) { realIncreasedDamage += increasedDamageWithOneMinion; } } if (increasedDamageFromMinionDrain != 0 && tracker && tracker.summons != null && tracker.summons.Count > 0) { // choose a minion to drain BaseHealth minionHealth = tracker.summons[Random.Range(0, tracker.summons.Count - 1)].GetComponent <BaseHealth>(); if (minionHealth) { // gain extra damage realIncreasedDamage += increasedDamageFromMinionDrain; // create a death vfx Instantiate(spiritEscapePrefab).transform.position = minionHealth.transform.position + spiritEscapeOffset; // kill the minion minionHealth.HealthDamage(minionHealth.currentHealth + 1); } } // increase damage if (realIncreasedDamage != 0 || moreDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(realIncreasedDamage); if (moreDamage != 0) { holder.increaseAllDamage(moreDamage); } } } if (damagesMinions) { DamageEnemyOnHit deoh = abilityObject.GetComponent <DamageEnemyOnHit>(); if (deoh) { DamageCreatorMinionOnHit component = abilityObject.AddComponent <DamageCreatorMinionOnHit>(); component.baseDamageStats = deoh.baseDamageStats; if (doesntPierce) { abilityObject.GetComponent <DestroyOnFailingToPierceEnemy>().alsoDestroyOnFailingToPierceCreatorMinion(); } } } return(abilityObject); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { if (addedVoidDamage > 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.addBaseDamage(DamageType.VOID, addedVoidDamage); } } if (timeRotChance > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.TimeRot); newComponent.chance = timeRotChance; } if (igniteChance > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Ignite); newComponent.chance = igniteChance; } if (addedCritChance != 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.critChance += addedCritChance; } } if (chanceToAttachSparkCharge > 0) { ChanceToCreateAbilityObjectOnNewEnemyHit newComponent = abilityObject.AddComponent <ChanceToCreateAbilityObjectOnNewEnemyHit>(); newComponent.spawnAtHit = true; newComponent.chance = chanceToAttachSparkCharge; newComponent.abilityToInstantiate = AbilityIDList.getAbility(AbilityID.sparkCharge); } if (addedCritMultiplier != 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.critMultiplier += addedCritMultiplier; } } if (increasedDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(increasedDamage); } } if (moreDamageAgainstFullHealth != 0) { // create the conditional DamageConditionalEffect conditionalEffect = new DamageConditionalEffect(); conditionalEffect.conditional = new FullHealthConditional(); conditionalEffect.effect = new DamageEffectMoreDamage(moreDamageAgainstFullHealth); // add the conditional to all damage stats holders foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.conditionalEffects.Add(conditionalEffect); } } if (moreDamageAgainstTimeRotting != 0) { // create the conditional DamageConditionalEffect conditionalEffect = new DamageConditionalEffect(); HasStatusEffectConditional conditional = new HasStatusEffectConditional(); conditional.statusEffect = StatusEffectID.TimeRot; conditionalEffect.conditional = conditional; conditionalEffect.effect = new DamageEffectMoreDamage(moreDamageAgainstTimeRotting); // add the conditional to all damage stats holders foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.conditionalEffects.Add(conditionalEffect); } } if (increasedRadius > 0) { foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>()) { cod.increasedRadius = increasedRadius; } foreach (CapsuleCollider col in abilityObject.GetComponents <CapsuleCollider>()) { col.height *= (1 + increasedRadius); col.radius *= (1 + increasedRadius); } } return(abilityObject); }
public GameObject constructAbilityObject(Ability ability, Vector3 location, Vector3 targetLocation, GameObject overridePrefab = null, bool InheritSharedHitDetector = true) { // create the ability object GameObject abilityObject = null; if (overridePrefab == null) { // if there is no override prefab instantiate the ability's ability prefab abilityObject = Instantiate(ability.abilityPrefab, location, Quaternion.Euler(targetLocation - location)); } else // othewise instrantiate the override prefab { abilityObject = Instantiate(overridePrefab, location, Quaternion.Euler(targetLocation - location)); } // apply the relevant mutator if this entity has one if (mutatorManager) { mutators = mutatorManager.getMutators(ability); if (mutators != null) { foreach (AbilityMutator mutator in mutators) { abilityObject = mutator.Mutate(abilityObject, location, targetLocation); if (mutator.changeLocation) { targetLocation = mutator.newLocation; } if (mutator.changeTargetLocation) { targetLocation = mutator.newTargetLocation; } } } } // move the ability object if necessary foreach (DefineStartLocation defineStartLocation in abilityObject.GetComponents <DefineStartLocation>()) { if (defineStartLocation.active) { defineStartLocation.setLocation(location, targetLocation); // the direction from the cast point needs to be maintained if (defineStartLocation.maintainDirectionFromCastPoint()) { targetLocation = abilityObject.transform.position + targetLocation - location; } } } // initialise a location detector if necessary LocationDetector locationDetector = abilityObject.GetComponent <LocationDetector>(); if (locationDetector) { locationDetector.startLocation = abilityObject.transform.position; locationDetector.targetLocation = targetLocation; } // rotate the ability object abilityObject.transform.LookAt(targetLocation); // give the ability object its alignment AlignmentManager abilityAlignmentManager = abilityObject.GetComponent <AlignmentManager>(); if (!abilityAlignmentManager) { abilityAlignmentManager = abilityObject.AddComponent <AlignmentManager>(); } abilityAlignmentManager.alignment = myAlignmentManager.alignment; // give the ability object its creation references CreationReferences abilityCreationReferences = abilityObject.GetComponent <CreationReferences>(); if (!abilityCreationReferences) { abilityCreationReferences = abilityObject.AddComponent <CreationReferences>(); } abilityCreationReferences.thisAbility = ability; abilityCreationReferences.locationCreatedFrom = location; // if this an ability object then the creator is this objects creator, otherwise the creator is this object if (myCreationReferences && GetComponent <AbilityObjectIndicator>()) { abilityCreationReferences.creator = myCreationReferences.creator; } else { abilityCreationReferences.creator = gameObject; } // check whether there should be a shared hit detector HitDetector abilityHitDetector = abilityObject.GetComponent <HitDetector>(); if (abilityHitDetector) { SharedHitDetector sharedHitDetector = null; if (myHitDetector && myHitDetector.sharedHitDetector && InheritSharedHitDetector) { sharedHitDetector = myHitDetector.sharedHitDetector; } // create a shared hit detector else if (ability.sharedHitDetector) { GameObject newGameObject = new GameObject(); sharedHitDetector = newGameObject.AddComponent <SharedHitDetector>(); sharedHitDetector.gameObject.AddComponent <SelfDestroyer>(); sharedHitDetector.name = abilityObject.name + "'s shared hit detector"; } if (sharedHitDetector != null && !abilityHitDetector.cannotHaveSharedhitDetector) { abilityHitDetector.sharedHitDetector = sharedHitDetector; } } // build the damage stats for each damage stats holder foreach (DamageStatsHolder damageStatsHolder in abilityObject.GetComponents <DamageStatsHolder>()) { damageStatsHolder.damageStats = DamageStats.buildDamageStats(damageStatsHolder, GetComponent <TaggedStatsHolder>()); } // attach any on hit status appliers if this ability deals damage on hit if (myTaggedStatsHolder && abilityObject.GetComponent <DamageEnemyOnHit>() && !abilityObject.GetComponent <CannotApplyAdditionalStatuses>()) { ChanceToApplyStatusOnEnemyHit applier; float poisonChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.PoisonChance, ability.useTags); if (poisonChance > 0) { applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); applier.statusEffect = StatusEffectList.getEffect(StatusEffectID.Poison); applier.chance = poisonChance; applier.canApplyToSameEnemyAgain = false; } float igniteChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.IgniteChance, ability.useTags); if (igniteChance > 0) { applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); applier.statusEffect = StatusEffectList.getEffect(StatusEffectID.Ignite); applier.chance = igniteChance; applier.canApplyToSameEnemyAgain = false; } float chillChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.ChillChance, ability.useTags); if (chillChance > 0) { applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); applier.statusEffect = StatusEffectList.getEffect(StatusEffectID.Chill); applier.chance = chillChance; applier.canApplyToSameEnemyAgain = false; } float slowChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.SlowChance, ability.useTags); if (slowChance > 0) { applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); applier.statusEffect = StatusEffectList.getEffect(StatusEffectID.Slow); applier.chance = slowChance; applier.canApplyToSameEnemyAgain = false; } float blindChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.BlindChance, ability.useTags); if (blindChance > 0) { applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); applier.statusEffect = StatusEffectList.getEffect(StatusEffectID.Blind); applier.chance = blindChance; applier.canApplyToSameEnemyAgain = false; } float bleedChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.BleedChance, ability.useTags); if (bleedChance > 0) { applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); applier.statusEffect = StatusEffectList.getEffect(StatusEffectID.Bleed); applier.chance = bleedChance; applier.canApplyToSameEnemyAgain = false; } float shockChance = myTaggedStatsHolder.GetStatValue(Tags.Properties.ShockChance, ability.useTags); if (shockChance > 0) { applier = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); applier.statusEffect = StatusEffectList.getEffect(StatusEffectID.Shock); applier.chance = shockChance; applier.canApplyToSameEnemyAgain = false; } } // if the ability has an ability object constructor give it a tagged stats holder with your tagged stats if (myTaggedStatsHolder && abilityObject.GetComponent <RequiresTaggedStats>()) { TaggedStatsHolder holder = abilityObject.GetComponent <TaggedStatsHolder>(); if (holder == null) { holder = abilityObject.AddComponent <TaggedStatsHolder>(); } holder.simpleStats.AddRange(myTaggedStatsHolder.simpleStats); holder.taggedStats.AddRange(myTaggedStatsHolder.taggedStats); } // set the direction if there is an ability mover if (abilityObject.GetComponent <AbilityMover>()) { abilityObject.GetComponent <AbilityMover>().positionDelta = Vector3.Normalize(targetLocation - location); // if the ability object defines its own start direction then let it if (abilityObject.GetComponent <DefineStartDirection>()) { abilityObject.GetComponent <DefineStartDirection>().setDirection(); } } // run any on creation methods foreach (OnCreation component in abilityObject.GetComponents <OnCreation>()) { if (component.runOnCreation) { component.onCreation(); } } // invoke the event if (abilityObjectCreatedEvent != null) { abilityObjectCreatedEvent.Invoke(ability, abilityObject); } return(abilityObject); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { if (addedCritMultiplier != 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.critMultiplier += addedCritMultiplier; } } 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; } foreach (CapsuleCollider col in abilityObject.GetComponents <CapsuleCollider>()) { col.height *= (1 + increasedRadius); col.radius *= (1 + increasedRadius); } } if (bleedChance > 0) { ChanceToApplyStatusOnEnemyHit newComponent = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); newComponent.statusEffect = StatusEffectList.getEffect(StatusEffectID.Bleed); newComponent.chance = bleedChance; } if (increasedStunChance != 0) { foreach (DamageStatsHolder damage in abilityObject.GetComponents <DamageStatsHolder>()) { damage.baseDamageStats.increasedStunChance += increasedStunChance; } } if (moreDamageAgainstFullHealth != 0) { // create the conditional DamageConditionalEffect conditionalEffect = new DamageConditionalEffect(); conditionalEffect.conditional = new FullHealthConditional(); conditionalEffect.effect = new DamageEffectMoreDamage(moreDamageAgainstFullHealth); // add the conditional to all damage stats holders foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.conditionalEffects.Add(conditionalEffect); } } return(abilityObject); }
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); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { if (noChain) { CreateAbilityObjectOnNewEnemtHit component = abilityObject.GetComponent <CreateAbilityObjectOnNewEnemtHit>(); if (component) { component.active = false; } } if (pullsOnHit) { DestroyAfterDuration dad = abilityObject.GetComponent <DestroyAfterDuration>(); if (dad) { dad.duration = 0.1f; } RepeatedlyPullEnemiesWithinRadius component = abilityObject.AddComponent <RepeatedlyPullEnemiesWithinRadius>(); component.distanceMultiplier = 0.92f / (1 + increasedPullStrength); component.limitDistanceToMax = false; component.interval = 0.02f; component.radius = 4f * (1 + increasedRadius); } if (increasedRadius != 0) { foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>()) { cod.increasedRadius = increasedRadius; cod.increasedHeight = increasedRadius; } foreach (CapsuleCollider col in abilityObject.GetComponents <CapsuleCollider>()) { col.height *= (1 + increasedRadius); col.radius *= (1 + increasedRadius); } } if (increasedDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(increasedDamage); } } if (stacks) { ApplyStatusOnEnemyHit component = abilityObject.GetComponent <ApplyStatusOnEnemyHit>(); component.statusEffect = StatusEffectList.getEffect(StatusEffectID.StackingAbyssalDecay); } if (speedDebuff != 0 || armourDebuff != 0 || dotTakenDebuff != 0) { DebuffOnEnemyHit component = Comp <DebuffOnEnemyHit> .GetOrAdd(abilityObject); if (speedDebuff != 0) { List <float> speedDebuffList = new List <float>(); speedDebuffList.Add(speedDebuff * (1 + increasedDebuffStrength)); component.addDebuffToList(Tags.Properties.AttackSpeed, 0f, 0f, speedDebuffList, null, 4f * (1 + increasedDebuffDuration), null, "AbyssalEchoesDebuffAttackSpeed"); component.addDebuffToList(Tags.Properties.CastSpeed, 0f, 0f, speedDebuffList, null, 4f * (1 + increasedDebuffDuration), null, "AbyssalEchoesDebuffCastSpeed"); component.addDebuffToList(Tags.Properties.Movespeed, 0f, 0f, speedDebuffList, null, 4f * (1 + increasedDebuffDuration), null, "AbyssalEchoesDebuffMoveSpeed"); } if (armourDebuff != 0) { component.addDebuffToList(Tags.Properties.Movespeed, armourDebuff * (1 + increasedDebuffStrength), 0f, null, null, 4f * (1 + increasedDebuffDuration), null, "AbyssalEchoesDebuffArmour"); } if (dotTakenDebuff != 0) { if (dotTakenDebuffStacks) { component.addDebuffToList(Tags.Properties.DamageTaken, 0f, -dotTakenDebuff, null, null, 4f); } else { component.addDebuffToList(Tags.Properties.DamageTaken, 0f, -dotTakenDebuff, null, null, 4f, null, "AbyssalEchoesDebuffDoTTaken"); } } } return(abilityObject); }
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) { 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 (damageBuff != 0) { BuffOnAllyHit boah = abilityObject.AddComponent <BuffOnAllyHit>(); boah.addBuffToList(Tags.Properties.Damage, 0, damageBuff, null, null, 4 * (1 + increasedBuffDuration), null, "Entangling Roots Damage Buff"); } if (poisonChanceToWolves != 0) { BuffOnAllyHit boah = abilityObject.AddComponent <BuffOnAllyHit>(); boah.onlyApplyToMinionFromAbility = true; boah.requiredAbility = AbilityIDList.getAbility(AbilityID.summonWolf); boah.addBuffToList(Tags.Properties.PoisonChance, 0, poisonChanceToWolves, null, null, 4 * (1 + increasedBuffDuration), null, "Entangling Roots Poison Buff"); } if (bleedchanceToBears != 0) { BuffOnAllyHit boah = abilityObject.AddComponent <BuffOnAllyHit>(); boah.onlyApplyToMinionFromAbility = true; boah.requiredAbility = AbilityIDList.getAbility(AbilityID.summonBear); boah.addBuffToList(Tags.Properties.BleedChance, 0, bleedchanceToBears, null, null, 4 * (1 + increasedBuffDuration), null, "Entangling Roots Bleed Buff"); BuffOnAllyHit boah2 = abilityObject.AddComponent <BuffOnAllyHit>(); boah2.onlyApplyToMinionFromAbility = true; boah2.requiredAbility = AbilityIDList.getAbility(AbilityID.summonSerpent); boah2.addBuffToList(Tags.Properties.BleedChance, 0, bleedchanceToBears, null, null, 4 * (1 + increasedBuffDuration), null, "Entangling Roots Bleed Buff"); } if (castSpeedToSpriggans != 0) { BuffOnAllyHit boah = abilityObject.AddComponent <BuffOnAllyHit>(); boah.onlyApplyToMinionFromAbility = true; boah.requiredAbility = AbilityIDList.getAbility(AbilityID.summonSpriggan); boah.addBuffToList(Tags.Properties.CastSpeed, 0, castSpeedToSpriggans, null, null, 4 * (1 + increasedBuffDuration), null, "Entangling Roots Cast Buff"); } if (healSpriggans) { HealAlliesOnHit component = abilityObject.AddComponent <HealAlliesOnHit>(); component.onlyApplyToMinionFromAbility = true; component.requiredAbility = AbilityIDList.getAbility(AbilityID.summonSpriggan); component.healAmount = 100000; } // initial melee hit if (!meleeScalingInitialHit) { foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>()) { cod.objectsToCreateOnDeath.Clear(); } foreach (DamageEnemyOnHit damage in abilityObject.GetComponents <DamageEnemyOnHit>()) { damage.baseDamageStats.damage.Clear(); damage.baseDamageStats.addedDamageScaling = 0; Destroy(damage); abilityObject.AddComponent <CannotApplyAdditionalStatuses>(); } } else { 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 (alwaysStuns) { StunEnemyOnHit component = abilityObject.AddComponent <StunEnemyOnHit>(); component.duration = 0.8f; } } return(abilityObject); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { // add chance to create ice vortex if (chanceToCreateIceVortex > 0) { float rand = Random.Range(0f, 1f); if (rand < chanceToCreateIceVortex) { float rand2 = Random.Range(0f, 1f); if (rand2 < chanceForSuperIceVortex) { abilityObject.AddComponent <CreateAbilityObjectOnDeath>().abilityToInstantiate = AbilityIDList.getAbility(AbilityID.superIceVortex); } else { abilityObject.AddComponent <CreateAbilityObjectOnDeath>().abilityToInstantiate = AbilityIDList.getAbility(AbilityID.iceVortex); } } } // add chance to chill if (chillChance > 0) { ChanceToApplyStatusOnEnemyHit chanceTo = abilityObject.AddComponent <ChanceToApplyStatusOnEnemyHit>(); chanceTo.chance = chillChance; chanceTo.statusEffect = StatusEffectList.getEffect(StatusEffectID.Chill); } if (increasedDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(increasedDamage); //holder.addBaseDamage(DamageType.FIRE, holder.getBaseDamage(DamageType.FIRE) * increasedDamage); } } 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 (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; } } return(abilityObject); }
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); }