public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { if (dontAttach) { AttachToNearestAllyOnCreation component = abilityObject.GetComponent <AttachToNearestAllyOnCreation>(); component.runOnCreation = false; } if (dontMoveToTarget) { StartsAtTarget component = abilityObject.GetComponent <StartsAtTarget>(); component.active = false; } if (noVFX) { CreateOnDeath cod = abilityObject.GetComponent <CreateOnDeath>(); if (cod) { cod.objectsToCreateOnDeath.Clear(); } } BoneNovaProjectileMutator mutator = abilityObject.AddComponent <BoneNovaProjectileMutator>(); mutator.increasedSpeed = increasedSpeed; mutator.pierces = pierces; mutator.increasedDamage = increasedDamage; mutator.increasedStunChance = increasedStunChance; mutator.bleedChance = bleedChance; mutator.addedCritChance = addedCritChance; mutator.addedCritMultiplier = addedCritMultiplier; mutator.cone = cone; mutator.randomAngles = randomAngles; mutator.moreDamageAgainstBleeding = moreDamageAgainstBleeding; 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); }