public void giveResources(GameObject hit) { if (hit == creator) { if (creatorMana && manaOnHit != 0) { creatorMana.gainMana(manaOnHit); } if (creatorProtection && creatorProtection.healthClass && healthOnHit != 0) { creatorProtection.healthClass.Heal(healthOnHit); } if (creatorProtection && wardOnHit != 0) { creatorProtection.GainWard(wardOnHit); } if (destroyAfterCollidingWithCreator) { SelfDestroyer dest = GetComponent <SelfDestroyer>(); if (dest) { if (destructionDelay == 0) { dest.die(); } else { gameObject.AddComponent <DestroyAfterDuration>().duration = destructionDelay; } } } } }
public void giveResources() { if (creatorMana && mana != 0) { creatorMana.gainMana(mana); } if (creatorProtection) { if (health != 0 && creatorProtection.healthClass) { creatorProtection.healthClass.Heal(health); } if (ward != 0) { creatorProtection.GainWard(ward); } } }
public void giveResources(GameObject enemy) { if (creatorMana && manaOnHit != 0) { creatorMana.gainMana(manaOnHit); } if (creatorProtection) { if (healthOnHit != 0 && creatorProtection.healthClass) { creatorProtection.healthClass.Heal(healthOnHit); } if (wardOnHit != 0) { creatorProtection.GainWard(wardOnHit); } } }
public void GainWardOnKill(Ability _ability, GameObject target) { if (_ability == ability || _ability == AbilityIDList.getAbility(AbilityID.iceNova) || _ability == AbilityIDList.getAbility(AbilityID.lightningNova) || _ability == AbilityIDList.getAbility(AbilityID.fireNova)) { if (chanceToGainWardOnKill > 0) { float rand = Random.Range(0f, 1f); if (rand < chanceToGainWardOnKill && protectionClass) { protectionClass.GainWard(wardOnKill * (1 + increasedWardGained)); } } if (wardRetentionOnKill > 0) { TaggedStatsHolder.Stat newStat = new TaggedStatsHolder.Stat(Tags.Properties.WardRetention); newStat.addedValue = wardRetentionOnKill; Buff newBuff = new Buff(); newBuff.stat = newStat; newBuff.remainingDuration = 4f; newBuff.name = "Nova ward retention"; statBuffs.addBuff(newBuff); } } }
public void OnSkeletonDeath(Dying dyingComponent) { if (dyingComponent.unsummoned) { return; } // apply on skeleton death events if (healthOnSkeletonDeath != 0 && health) { health.Heal(healthOnSkeletonDeath); } if (wardOnSkeletonDeath != 0 && protectionClass) { protectionClass.GainWard(wardOnSkeletonDeath); } if (manaOnSkeletonDeath != 0 && mana) { mana.gainMana(manaOnSkeletonDeath); } // apply stats if (skeleDiedRecentlyStats != null && skeleDiedRecentlyStats.Count > 0) { TaggedBuff newBuff; for (int i = 0; i < skeleDiedRecentlyStats.Count; i++) { newBuff = new TaggedBuff(); newBuff.stat = new TaggedStatsHolder.TaggableStat(skeleDiedRecentlyStats[i]); newBuff.remainingDuration = 4f; newBuff.name = "skeleton died recently buff " + newBuff.stat.property; if (newBuff.stat.tagList != null) { foreach (Tags.AbilityTags tag in newBuff.stat.tagList) { newBuff.name += " " + tag; } } statBuffs.addTaggedBuff(newBuff); } } // heal another skeleton if (healSkeletonOnSkeletonDeath && summonTracker && skeletonAbilities != null) { skeletonHealths.Clear(); foreach (Summoned skeleton in summonTracker.getMinions(skeletonAbilities)) { if (skeleton.getBaseHealth() && skeleton.getBaseHealth().currentHealth > 0) { skeletonHealths.Add(skeleton.getBaseHealth()); } } if (skeletonHealths.Count > 0) { BaseHealth skeleToHeal = skeletonHealths[Random.Range(0, skeletonHealths.Count - 1)]; skeleToHeal.Heal(skeleToHeal.maxHealth); skeletonHealths.Clear(); } } }
void initialise() { initialised = true; // make sure there is a parent if (transform.parent == null) { return; } if (parent == null) { parent = transform.parent.gameObject; } if (parent == null) { Debug.LogError("BuffParent component has no parent"); return; } // find the parent's protection class parentProtection = parent.gameObject.GetComponent <ProtectionClass>(); if (parentProtection) { if (ward != 0) { parentProtection.GainWard(ward); } if (wardPercentage != 0 && parent.GetComponent <BaseHealth>()) { parentProtection.GainWard((wardPercentage * parent.GetComponent <BaseHealth>().maxHealth)); } } if (increasedSize != 0) { SizeManager sizeManager = parent.GetComponent <SizeManager>(); if (sizeManager) { sizeManager.increaseSize(increasedSize); } } // find the parent's base health if (lifeRegen != 0) { parentHealth = parent.GetComponent <BaseHealth>(); parentHealth.addedHealthRegenPerSecond += lifeRegen; } // find the parent's base mana if (manaCostDivider != 0) { parentMana = parent.GetComponent <BaseMana>(); parentMana.addedManaCostDivider += manaCostDivider; } // find the parent's demo ward regen if (wardRegen != 0) { parentProtection.wardRegen += wardRegen; } // find the parent's base stats if (speed != 0) { parentBaseStats = parent.GetComponent <BaseStats>(); if (parentBaseStats != null) { parentBaseStats.ChangeStatModifier(Tags.Properties.Movespeed, speed, BaseStats.ModType.ADDED); } } // find the parent's speed manager if (percentageSpeed != 0) { if (!parentBaseStats) { parentBaseStats = parent.GetComponent <BaseStats>(); } parentSpeedManager = parent.GetComponent <SpeedManager>(); if (parentSpeedManager != null && parentBaseStats != null) { parentBaseStats.ChangeStatModifier(Tags.Properties.Movespeed, percentageSpeed, BaseStats.ModType.INCREASED); } } if (reducedStunDuration != 0) { parentStunnedState = parent.gameObject.GetComponent <Stunned>(); if (parentStunnedState != null) { parentStunnedState.baseStunDuration -= reducedStunDuration; } } // apply taggedStats parentBaseStats = parent.GetComponent <BaseStats>(); if (parentBaseStats) { foreach (TaggedStatsHolder.TaggableStat stat in taggedStats) { parentBaseStats.ChangeStatModifier(stat.property, stat.addedValue, BaseStats.ModType.ADDED, stat.tagList); parentBaseStats.ChangeStatModifier(stat.property, stat.increasedValue, BaseStats.ModType.INCREASED, stat.tagList); foreach (float value in stat.moreValues) { parentBaseStats.ChangeStatModifier(stat.property, value, BaseStats.ModType.MORE, stat.tagList); } foreach (float value in stat.quotientValues) { parentBaseStats.ChangeStatModifier(stat.property, value, BaseStats.ModType.QUOTIENT, stat.tagList); } } parentBaseStats.UpdateStats(); } // update protection totals if (parentProtection) { parentProtection.UpdateProtectionTotals(); } // subscribe to a death event to remove the buffs if (GetComponent <SelfDestroyer>()) { GetComponent <SelfDestroyer>().deathEvent += removeBuffs; } }