Пример #1
0
 public void SetMinion(MinionTemplate template, MinionSlot setSlot = MinionSlot.NUM_MINION_SLOTS)
 {
     slot = setSlot;
     if (template == null)
     {
         background.sprite = emptyBackground;
         title.text        = "";
         desc.text         = "";
         health.text       = "";
     }
     else
     {
         background.sprite = elementalBackgrounds [(int)template.element];
         title.text        = LocalizationManager.GetLoc(template.unlocName);
         desc.text         = LocalizationManager.GetLoc(template.unlocDesc);
         if (template.GetSlotType() == MinionSlotType.SUPPORT)
         {
             health.text = "-";
         }
         else
         {
             string hpString = LocalizationManager.GetLoc("HP");
             health.text = string.Format(hpString, Mathf.FloorToInt(template.fMaxHealth));
         }
     }
 }
Пример #2
0
    public bool HoverMinion(int index)
    {
        MinionSlotType slotType = ((MinionSlot)index).GetSlotType();

        if (dragDropSelection != null && dragDropSelection.GetSlotType() != slotType)
        {
            return(false);
        }

        if (currentlyComparing != slotType)
        {
            SetComparisonType(slotType);
        }

        int subIndex = index - (int)slotType.GetFirst();

        for (int i = 0; i < 3; i++)
        {
            comparisonBlocks [i].SetHighlighted(i == subIndex);
        }

        hoveringOverMinion = (MinionSlot)index;

        return(true);
    }
Пример #3
0
    public void UnhoverMinion()
    {
        for (int i = 0; i < 3; i++)
        {
            comparisonBlocks [i].SetHighlighted(false);
        }

        hoveringOverMinion = MinionSlot.NUM_MINION_SLOTS;
    }
Пример #4
0
    protected void RangedAttackPlayer(Actor_Enemy attacker, Damage damage, MinionSlot slot = MinionSlot.NUM_MINION_SLOTS)
    {
        float fDamageDealt = Core.GetCurrentRoster().RangedAttack(attacker, damage, slot);

        if (attacker != null)
        {
            attacker.OnDealtDamage(fDamageDealt);
        }
    }
Пример #5
0
    private void KillMinion(MinionSlot slot)
    {
        //Minion minionToKill = minions [(int)slot];

        // Kill player actor. They can take their time and do animations or whatever
        Core.GetLevel().KillPlayerActor(slot);
        // Remove the minion from the minion pool
        //Core.GetPlayerProfile().pool.Remove(minionToKill);
        // Remove the minion from the current roster
        //minions[(int)slot] = null;
        // Now destroy the minion
        //Destroy(minionToKill.gameObject);
    }
Пример #6
0
    public Minion SetMinion(MinionSlot slot, MinionTemplate template)
    {
        Minion minion = Core.GetMinionTemplateManager().CreateMinion(template);

        minion.transform.SetParent(transform);
        minion.transform.localPosition = Vector3.zero;
        minion.slot = slot;

        minions [(int)slot] = minion;
        RecalculateHealths();
        bDirty = true;

        return(minion);
    }
Пример #7
0
    public void RecalculateHealths(MinionSlotType slotType)
    {
        afGroupMaxHealths [(int)slotType] = 0.0f;

        for (int j = 0; j < slotType.GetNumSlots(); j++)
        {
            MinionSlot slot = (MinionSlot)((int)slotType.GetFirst() + j);
            if (minions [(int)slot] != null)
            {
                afGroupMaxHealths [(int)slotType] += minions [(int)slot].fMaxHealthPostBuffs;
            }
        }

        afGroupHealths [(int)slotType] = afGroupMaxHealths [(int)slotType];
    }
Пример #8
0
    public static MinionSlotType GetSlotType(this MinionSlot slot)
    {
        switch (slot)
        {
        case MinionSlot.MELEE_1:
        case MinionSlot.MELEE_2:
            return(MinionSlotType.MELEE);

        case MinionSlot.SUPPORT_1:
        case MinionSlot.SUPPORT_2:
        case MinionSlot.SUPPORT_3:
            return(MinionSlotType.SUPPORT);

        case MinionSlot.RANGED_1:
        case MinionSlot.RANGED_2:
            return(MinionSlotType.RANGED);
        }
        return(MinionSlotType.NUM_MINION_SLOT_TYPES);
    }
Пример #9
0
    private void KillGroup(MinionSlotType slotType)
    {
        foreach (Actor_Player actor in Core.GetLevel().playerActors)
        {
            actor.minion.template.TriggerBuff(slotType == MinionSlotType.MELEE ? BuffTrigger.PLAYER_MELEE_DIED : BuffTrigger.PLAYER_RANGED_DIED, null);
        }

        List <Resurrection> resList = Core.GetLevel().singleUseResurrections;

        for (int i = 0; i < resList.Count; i++)
        {
            Resurrection res = resList [i];
            if (res.slotToRes == slotType)
            {
                resList.RemoveAt(i);

                Core.GetAudioManager().PlayResSFX(res.resSound);

                // Do achievements
                Core.TriggerAchievement("BACK_FROM_THE_DEAD");
                Core.IncrementStat("NUM_RESURRECTIONS", 2);
                if (bHasThreeResurrectsAvailable)
                {
                    bool bLastResUsed = true;
                    foreach (Resurrection check in resList)
                    {
                        if (check.slotToRes == slotType)
                        {
                            bLastResUsed = false;
                        }
                    }
                    if (bLastResUsed)
                    {
                        Core.TriggerAchievement("AND_HERE_TO_STAY");
                    }
                }

                for (int j = 0; j < slotType.GetNumSlots(); j++)
                {
                    MinionSlot slot = (MinionSlot)((int)slotType.GetFirst() + j);
                    minions [(int)slot].fMaxHealthPreBuffs  *= res.fMaxHealthModifier;
                    minions [(int)slot].fMaxHealthPostBuffs *= res.fMaxHealthModifier;
                    minions [(int)slot].isZombified          = true;

                    // Play PFX
                    PFX_DebuffIcon pfx = Instantiate <PFX_DebuffIcon>(res.resPFX);
                    pfx.transform.SetParent(Core.GetLevel().playerActors [(int)slot].transform);
                    pfx.transform.localPosition = new Vector3(0.0f, 0.0f, -0.25f);
                    pfx.Init(true);
                }

                RecalculateHealths(slotType);

                return;
            }
        }

        for (int i = 0; i < slotType.GetNumSlots(); i++)
        {
            MinionSlot slot = (MinionSlot)((int)slotType.GetFirst() + i);
            KillMinion(slot);
        }

        Core.GetLevel().PlayerLost();
    }
Пример #10
0
    private float Attack(Actor_Enemy attacker, Damage damage, float fMod, MinionSlotType slotType, MinionSlot slot)
    {
        float fTotalDealt = 0.0f;

        float fDamage = damage.fAmount * fMod;

        if (fDamage > 0.0f)
        {
            float fTotalMultiplierFromMinions = 0.0f;
            for (int i = 0; i < slotType.GetNumSlots(); i++)
            {
                Minion minion = minions [(int)slotType.GetFirst() + i];
                if (minion != null)
                {
                    float fBuffModifier = minion.GetBuff(Stats.GetStatForDamageMultiplier(damage.GetElement()));
                    fBuffModifier += minion.GetBuff(Stat.DAMAGE_MULTIPLIER);
                    fBuffModifier += minion.GetBuff(slotType == MinionSlotType.MELEE ? Stat.DAMAGE_MULTIPLIER_MELEE : Stat.DAMAGE_MULTIPLIER_RANGED);
                    fBuffModifier += minion.GetBuff(Stat.DAMAGE_MULTIPLIER_PER_COMBO) * minion.iCombo;

                    fTotalMultiplierFromMinions += (1.0f + fBuffModifier) * Elements.GetDamageMultiplier(damage.GetElement(), minion.template.element);
                }
                else
                {
                    fTotalMultiplierFromMinions += 1.0f;
                }
            }
            float fAverageMinionMultiplier = fTotalMultiplierFromMinions / slotType.GetNumSlots();
            fDamage *= fAverageMinionMultiplier;

            fDamage *= (1.0f + Mathf.Clamp(damage.fRadius, 0.0f, 5.0f));
            if (attacker != null && attacker.minion.template.canCombo)
            {
                fDamage *= 3.0f;
            }

            float fDamageToDeal = Mathf.Min(afGroupHealths [(int)slotType], fDamage);
            if (fDamageToDeal > 0.0f)
            {
                float fParametricHealthPreDamage = afGroupHealths[(int)slotType] / afGroupMaxHealths[(int)slotType];
                afGroupHealths [(int)slotType] -= fDamageToDeal;

                float fParametricHealthPostDamage = afGroupHealths[(int)slotType] / afGroupMaxHealths[(int)slotType];
                if (!bHasTriggeredVolatileYet && fParametricHealthPreDamage > 0.25f && fParametricHealthPostDamage <= 0.25f)
                {
                    bHasTriggeredVolatileYet = true;
                    for (int i = 0; i < slotType.GetNumSlots(); i++)
                    {
                        if (minions [(int)slotType.GetFirst() + i].template.bVolatile)
                        {
                            // TODO: Play PFX
                            // Play sound
                            Core.GetLevel().KillAllEnemies();
                        }
                    }
                }

                // Do damage numbers
                Actor_Player actorHit = null;
                if (slot == MinionSlot.NUM_MINION_SLOTS)
                {
                    actorHit = Core.GetLevel().playerActors [(int)slotType.GetFirst() + Random.Range(0, slotType.GetNumSlots())];
                }
                else
                {
                    actorHit = Core.GetLevel().playerActors [(int)slot];
                }
                if (actorHit != null)
                {
                    int iDamage = Mathf.FloorToInt(fDamage);
                    actorHit.MakeDamageNumbers(iDamage, Core.GetMinionTemplateManager().playerDamage);
                }

                if (afGroupHealths [(int)slotType] <= 0.0f)
                {
                    KillGroup(slotType);
                }
                fDamage     -= fDamageToDeal;
                fTotalDealt += fDamageToDeal;

                Core.GetLevel().bHasSomeDamageBeenTaken = true;
            }
        }

        return(fTotalDealt);
    }
Пример #11
0
 public float RangedAttack(Actor_Enemy attacker, Damage damage, MinionSlot slot)
 {
     mostRecentRangedAttacker = attacker;
     return(Attack(attacker, damage, fRangedIncomingDamageModifier, MinionSlotType.RANGED, slot));
 }
Пример #12
0
 public float MeleeAttack(Actor_Enemy attacker, Damage damage, MinionSlot slot)
 {
     return(Attack(attacker, damage, fMeleeIncomingDamageModifier, MinionSlotType.MELEE, slot));
 }
Пример #13
0
 public Minion GetMinion(MinionSlot slot)
 {
     return(minions [(int)slot]);
 }
Пример #14
0
 public void KillPlayerActor(MinionSlot slot)
 {
     playerActors [(int)slot].Kill();
 }