Ejemplo n.º 1
0
 public void onKill(Ability _ability, GameObject target)
 {
     if (snakeOnKillChance > 0 && (_ability == ability))
     {
         float rand = Random.Range(0f, 1f);
         if (rand < snakeOnKillChance)
         {
             if (!usingAbility)
             {
                 usingAbility = GetComponent <UsingAbility>();
             }
             if (usingAbility)
             {
                 usingAbility.UseAbility(AbilityIDList.getAbility(AbilityID.summonSerpent), target.transform.position, false, false);
             }
         }
     }
     if (lifeOnKill != 0 && (_ability == ability))
     {
         float rand = Random.Range(0f, 1f);
         if (rand < lifeOnKill)
         {
             if (!baseHealth)
             {
                 baseHealth = GetComponent <BaseHealth>();
             }
             if (baseHealth)
             {
                 baseHealth.Heal(lifeOnKill);
             }
         }
     }
 }
Ejemplo n.º 2
0
 public void OnKill(Ability _ability, GameObject target)
 {
     if (_ability && _ability == Ability.getAbility(AbilityID.erasingStrikeHit))
     {
         // void beams
         killsSinceUse++;
         if (killsSinceUse >= 5 && ua && voidBeamsOnkill)
         {
             killsSinceUse = -10000;
             ua.UseAbility(Ability.getAbility(AbilityID.playerVoidBeams), transform.position + transform.forward, false, false);
         }
         // stationary void beam
         if (!ua)
         {
             ua = GetComponent <UsingAbility>();
         }
         if (stationaryVoidBeamChance != 0 && ua)
         {
             if ((Random.Range(0f, 1f) < stationaryVoidBeamChance) && target)
             {
                 ua.UseAbility(Ability.getAbility(AbilityID.stationaryVoidBeam), target.transform.position, false, false);
             }
         }
         // mana and health
         if (mana && manaGainedOnKill != 0)
         {
             mana.currentMana += manaGainedOnKill; if (mana.currentMana > mana.maxMana)
             {
                 mana.currentMana = mana.maxMana;
             }
         }
         if (health && percentLifeGainedOnKill != 0 && target)
         {
             BaseHealth targetHealth = target.GetComponent <BaseHealth>();
             if (targetHealth)
             {
                 health.Heal(targetHealth.maxHealth * percentLifeGainedOnKill);
             }
         }
         // move speed
         if (movementSpeedOnKill != 0)
         {
             TaggedStatsHolder.Stat stat = new TaggedStatsHolder.Stat(Tags.Properties.Movespeed);
             stat.increasedValue = movementSpeedOnKill;
             Buff buff = new Buff(stat, 4f);
             statBuffs.addBuff(buff);
         }
     }
 }
Ejemplo n.º 3
0
    public void OnKill(Ability _ability, GameObject target)
    {
        // health on minion kill
        CreationReferences refs = target.GetComponent <CreationReferences>();

        if (refs && refs.creator == gameObject && health)
        {
            health.Heal(healthGainedOnMinionKill);
        }

        // leech on kill
        if (statBuffs)
        {
            statBuffs.addBuff(4f, Tags.Properties.PercentLifeLeech, 0, physLeechOnKill, null, null, physTag, "marrow shards phys leech on kill buff");
            statBuffs.addBuff(4f, Tags.Properties.CriticalChance, 0, critChanceOnKill, null, null, physTag, "marrow shards crit chance on kill buff");
        }
    }
Ejemplo n.º 4
0
 public void OnHit(Ability _ability, GameObject target)
 {
     if (_ability && _ability == ability)
     {
         if (health && healthGainOnHit != 0)
         {
             health.Heal(healthGainOnHit);
         }
         if (mana && manaGainOnHit != 0)
         {
             mana.currentMana += manaGainOnHit;
             if (mana.currentMana > mana.maxMana)
             {
                 mana.currentMana = mana.maxMana;
             }
         }
     }
 }
Ejemplo n.º 5
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag(PLAYER_TAG) && !isCollected)
        {
            BaseHealth playerHealth = other.gameObject.GetComponentInParent <BaseHealth>();

            if (playerHealth != null)
            {
                playerHealth.Heal(healthAmount);
                isCollected = true;

                if (source != null && healthCollectedSFX != null)
                {
                    source.clip = healthCollectedSFX;
                    source.Play();
                }

                SetVisability(false);
            }
        }
    }
Ejemplo n.º 6
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();
            }
        }
    }
Ejemplo n.º 7
0
    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);
    }