Example #1
0
 public void GainManaOnKill(Ability _ability, GameObject target)
 {
     if (percentManaGainedOnKill > 0 && (_ability == ability || _ability == AbilityIDList.getAbility(AbilityID.glacier1) ||
                                         _ability == AbilityIDList.getAbility(AbilityID.glacier2) || _ability == AbilityIDList.getAbility(AbilityID.glacier3)))
     {
         mana.gainMana(percentManaGainedOnKill * mana.maxMana);
     }
 }
Example #2
0
 public void onCrit(Ability _ability, GameObject target)
 {
     if (_ability == ability)
     {
         if (manaOnCrit != 0)
         {
             if (mana)
             {
                 mana.gainMana(manaOnCrit);
             }
         }
     }
 }
    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 giveMana(GameObject enemy)
 {
     if (creatorMana)
     {
         creatorMana.gainMana(manaOnHit);
     }
 }
Example #5
0
 public void OnHit(Ability _ability, GameObject target)
 {
     if (mana && manaOnHitChance > 0 && _ability == ability)
     {
         float rand = Random.Range(0f, 1f);
         if (rand < manaOnHitChance)
         {
             mana.gainMana(manaOnHit);
         }
     }
 }
 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);
         }
     }
 }
Example #7
0
 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);
         }
     }
 }
Example #8
0
    public void giveMana(GameObject hit)
    {
        if (hit == creator && creatorMana)
        {
            creatorMana.gainMana(manaOnHit);

            if (destroyAfterCollidingWithCreator)
            {
                SelfDestroyer dest = GetComponent <SelfDestroyer>();
                if (dest)
                {
                    if (destructionDelay == 0)
                    {
                        dest.die();
                    }
                    else
                    {
                        gameObject.AddComponent <DestroyAfterDuration>().duration = destructionDelay;
                    }
                }
            }
        }
    }
Example #9
0
    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();
            }
        }
    }