public void Start() { CreationReferences references = GetComponent <CreationReferences>(); if (references && references.creator) { BaseHealth health = references.creator.GetComponent <BaseHealth>(); if (health) { health.HealthDamage(flatDamage); health.HealthDamage(health.currentHealth * percentCurrentHealthTaken); } } }
public void OnCrit(Ability _ability, GameObject target) { if (percentCurrentHealthLostOnCrit != 0 && health) { health.HealthDamage(health.currentHealth * percentCurrentHealthLostOnCrit); } }
public void dealDamage(Ability ability, GameObject hit) { if (health) { health.HealthDamage(flatDamage + health.currentHealth * currentPercentageDamage + health.maxHealth * maxPercentageDamage); } }
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 (voidRiftAtStart) { CreateAbilityObjectOnStart component = abilityObject.AddComponent <CreateAbilityObjectOnStart>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.voidRift); component.createAtStartLocation = true; } if (voidRiftAtEnd) { CreateAbilityObjectOnDeath component = abilityObject.AddComponent <CreateAbilityObjectOnDeath>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.voidRift); } if (voidRiftAtStart || voidRiftAtEnd) { VoidRiftMutator mut = abilityObject.AddComponent <VoidRiftMutator>(); mut.increasedDamage = increasedDamage; mut.increasedRadius = increasedRadius; mut.increasedStunChance = increasedStunChance; mut.increasesDoTDamageTaken = increasesDoTDamageTaken; mut.timeRotChance = timeRotChance; mut.increasesDamageTaken = increasesDamageTaken; } // apply stats on cooldown float cooldown = getCooldown(); StatBuffs buffs = GetComponent <StatBuffs>(); if (!buffs) { buffs = gameObject.AddComponent <StatBuffs>(); } foreach (TaggedStatsHolder.TaggableStat stat in statsWhileOnCooldown) { TaggedStatsHolder.TaggableStat newStat = new TaggedStatsHolder.TaggableStat(stat); buffs.addTaggedBuff(new TaggedBuff(newStat, cooldown)); } // apply stats on use float duration = 2 + additionalSecondsBack; foreach (TaggedStatsHolder.TaggableStat stat in statOnUse) { TaggedStatsHolder.TaggableStat newStat = new TaggedStatsHolder.TaggableStat(stat); buffs.addTaggedBuff(new TaggedBuff(newStat, duration)); } if (noHealthRestoration || noManaRestoration) { ReturnCasterToOlderPosition component = abilityObject.GetComponent <ReturnCasterToOlderPosition>(); if (noHealthRestoration) { component.restoreHealth = false; } if (noManaRestoration) { component.restoreMana = false; } } if (healsOrDamagesAtRandom && health) { float rand = Random.Range(0f, 1f); if (rand < 0.8f) { health.Heal((health.maxHealth - health.currentHealth) * healOrDamagePercent); } else { health.HealthDamage(health.currentHealth * healOrDamagePercent); } } return(abilityObject); }
public void dealDamage() { health.HealthDamage(health.currentHealth * percentCurrentHealthTaken); }
public override GameObject Mutate(GameObject abilityObject, Vector3 location, Vector3 targetLocation) { float newAddedVoidDamage = addedVoidDamage; if (addedVoidReducedByAttackSpeed != 0) { float voidDamageToAdd = addedVoidReducedByAttackSpeed; if (baseStats) { List <Tags.AbilityTags> tagList = new List <Tags.AbilityTags>(); tagList.Add(Tags.AbilityTags.Melee); float increasedAttackSpeed = baseStats.GetStatValue(Tags.Properties.AttackSpeed, tagList) - 1; voidDamageToAdd *= (1 - increasedAttackSpeed); } if (voidDamageToAdd > 0) { newAddedVoidDamage += voidDamageToAdd; } } ShieldRushEndMutator mutator = abilityObject.AddComponent <ShieldRushEndMutator>(); mutator.increasedDamage = increasedDamage; mutator.increasedRadius = increasedRadius; mutator.timeRotChance = timeRotChance; mutator.increasesDamageTaken = increasesDamageTaken; mutator.increasesDoTDamageTaken = increasesDoTDamageTaken; mutator.increasedStunChance = increasedStunChance; mutator.addedCritMultiplier = addedCritMultiplier; mutator.addedCritChance = addedCritChance; mutator.leaveDelayed = leaveDelayed; mutator.increasedDelayLength = increasedDelayLength; mutator.delayIncreasedDamage = delayIncreasedDamage; mutator.delayIncreasedRadius = delayIncreasedRadius; mutator.delayTimeRotChance = delayTimeRotChance; mutator.delayIncreasesDamageTaken = delayIncreasesDamageTaken; mutator.delayIncreasesDoTDamageTaken = delayIncreasesDoTDamageTaken; mutator.delayIncreasedStunChance = delayIncreasedStunChance; mutator.delayAddedCritMultiplier = delayAddedCritMultiplier; mutator.delayAddedCritChance = delayAddedCritChance; mutator.addedVoidDamage = newAddedVoidDamage + additionalAoEAddedVoidDamage; if (newAddedVoidDamage > 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.addBaseDamage(DamageType.VOID, addedVoidDamage); } } if (moreTravelDamageAgainstFullHealth != 0) { // create the conditional DamageConditionalEffect conditionalEffect = new DamageConditionalEffect(); conditionalEffect.conditional = new FullHealthConditional(); conditionalEffect.effect = new DamageEffectMoreDamage(moreTravelDamageAgainstFullHealth); // add the conditional to all damage stats holders foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.conditionalEffects.Add(conditionalEffect); } } if (forwardVoidBeam) { CreateAbilityObjectOnStart component = abilityObject.AddComponent <CreateAbilityObjectOnStart>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.forwardVoidBeam); component.aimingMethod = CreateAbilityObjectOnStart.AimingMethod.TargetDirection; component.createAtStartLocation = true; } if (backwardsVoidBeam) { CreateAbilityObjectOnDeath component = abilityObject.AddComponent <CreateAbilityObjectOnDeath>(); component.abilityToInstantiate = Ability.getAbility(AbilityID.backwardsVoidBeam); component.aimingMethod = CreateAbilityObjectOnDeath.AimingMethod.TravelDirection; } if (returnToStart) { ReturnCasterToOlderPosition component = abilityObject.AddComponent <ReturnCasterToOlderPosition>(); component.increasePositionAgeWithAge = true; component.positionAge = 0f; component.restoreMana = restoreMana; component.additionalAgeForManaRestoration = 0.35f; component.whenToMoveCaster = ReturnCasterToOlderPosition.StartOrEnd.End; } if (percentCurrentHealthLostOnCast != 0 && health) { health.HealthDamage(health.currentHealth * percentCurrentHealthLostOnCast); } if (increasedTravelDamage != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.increaseAllDamage(increasedTravelDamage); } } if (increasedTravelStunChance != 0) { foreach (DamageStatsHolder holder in abilityObject.GetComponents <DamageStatsHolder>()) { holder.baseDamageStats.increasedStunChance += increasedStunChance; } } if (statsWhileTravelling != null && statsWhileTravelling.Count > 0) { BuffParent bp = abilityObject.GetComponent <BuffParent>(); if (!bp) { bp = abilityObject.AddComponent <BuffParent>(); } List <TaggedStatsHolder.TaggableStat> stats = new List <TaggedStatsHolder.TaggableStat>(); foreach (TaggedStatsHolder.TaggableStat stat in statsWhileTravelling) { TaggedStatsHolder.TaggableStat newStat = new TaggedStatsHolder.TaggableStat(stat); stats.Add(newStat); } bp.taggedStats.AddRange(stats); } if (increasedRadius > 0) { foreach (CreateOnDeath cod in abilityObject.GetComponents <CreateOnDeath>()) { cod.increasedRadius = increasedRadius; cod.increasedHeight = increasedRadius; } } return(abilityObject); }