Example #1
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);
    }
Example #2
0
 public Resurrection(Resurrection other)
 {
     fMaxHealthModifier = other.fMaxHealthModifier;
     bZombify           = other.bZombify;
     slotToRes          = other.slotToRes;
     resPFX             = other.resPFX;
     resSound           = other.resSound;
 }
Example #3
0
    public void RecalculateHealths()
    {
        for (int i = 0; i < (int)MinionSlotType.NUM_MINION_SLOT_TYPES; i++)
        {
            MinionSlotType slotType = (MinionSlotType)i;
            RecalculateHealths(slotType);
        }

        bHasTriggeredVolatileYet = false;
    }
Example #4
0
 public Minion CreateMinion(MinionSlotType slotType, int hashCode)
 {
     foreach (MinionTemplate template in GetMinionList(slotType))
     {
         if (template.GetHashCode() == hashCode)
         {
             return(CreateMinion(template));
         }
     }
     return(null);
 }
Example #5
0
 public void AddComboToGroup(MinionSlotType slotType, int iAmount)
 {
     for (int i = 0; i < slotType.GetNumSlots(); i++)
     {
         Minion minion = minions [(int)slotType.GetFirst() + i];
         if (minion != null && (minion.template.canCombo || minion.template.bDeathtoll))
         {
             for (int j = 0; j < iAmount; j++)
             {
                 minion.template.IncrementCombo(Core.GetLevel().playerActors [(int)slotType.GetFirst() + i]);
             }
         }
     }
 }
Example #6
0
    public static int GetNumSlots(this MinionSlotType slotType)
    {
        switch (slotType)
        {
        case MinionSlotType.MELEE:
            return(2);

        case MinionSlotType.SUPPORT:
            return(3);

        case MinionSlotType.RANGED:
            return(2);
        }
        return(0);
    }
Example #7
0
    public static MinionSlot GetFirst(this MinionSlotType slotType)
    {
        switch (slotType)
        {
        case MinionSlotType.MELEE:
            return(MinionSlot.MELEE_1);

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

        case MinionSlotType.RANGED:
            return(MinionSlot.RANGED_1);
        }
        return(MinionSlot.NUM_MINION_SLOTS);
    }
Example #8
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];
    }
Example #9
0
    public List <MinionTemplate> GetMinionList(MinionSlotType eSlotType)
    {
        switch (eSlotType)
        {
        case MinionSlotType.MELEE:
            return(meleeList);

        case MinionSlotType.SUPPORT:
            return(supportList);

        case MinionSlotType.RANGED:
            return(rangedList);
        }
        return(null);
    }
Example #10
0
    public void HealGroup(MinionSlotType slotType, float fAmount)
    {
        float fTotalMultiplier = 0.0f;

        for (int i = 0; i < slotType.GetNumSlots(); i++)
        {
            Minion minion = minions [(int)slotType.GetFirst() + i];
            fTotalMultiplier += (1.0f + minion.GetBuff(Stat.HEAL_MULTIPLIER));
        }
        fTotalMultiplier /= slotType.GetNumSlots();

        float fAmountToHeal = Mathf.Clamp(fAmount * fTotalMultiplier, 0.0f, afGroupMaxHealths [(int)slotType] - afGroupHealths [(int)slotType]);

        afGroupHealths [(int)slotType] += fAmountToHeal;

        Core.IncrementStat("HEALTH_HEALED", Mathf.FloorToInt(fAmountToHeal));
    }
Example #11
0
    public void SetComparisonType(MinionSlotType slotType)
    {
        if (currentRoster == null)
        {
            Debug.Assert(false, "Trying to edit null roster!");
            return;
        }

        for (int i = 0; i < slotType.GetNumSlots(); i++)
        {
            comparisonBlocks [i].gameObject.SetActive(true);
            comparisonBlocks [i].SetMinion(currentRoster.minions [(int)(slotType.GetFirst()) + i].template, (MinionSlot)((int)(slotType.GetFirst()) + i));
        }
        for (int i = slotType.GetNumSlots(); i < 3; i++)
        {
            comparisonBlocks [i].gameObject.SetActive(false);
        }

        currentlyComparing = slotType;
    }
Example #12
0
    public bool IsAnyoneAlive(MinionSlotType slotType)
    {
        if (Core.GetLevel() == null)
        {
            return(false);
        }

        bool bAnyoneAlive = false;

        for (int i = 0; i < slotType.GetNumSlots(); i++)
        {
            Actor_Player player = Core.GetLevel().playerActors [(int)slotType.GetFirst() + i];
            //Debug.Assert(player == null || player.minion != null);
            if (player != null && player.minion != null && player.minion.fCurrentHealth > 0.0f)
            {
                bAnyoneAlive = true;
            }
        }

        return(bAnyoneAlive);
    }
Example #13
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();
    }
Example #14
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);
    }
Example #15
0
    public bool ShouldApply(Element element, MinionSlotType type, bool bZombie, bool bEnemy)
    {
        if (targetSelfOnly)
        {
            return(false);
        }

        if (targetEnemies != bEnemy)
        {
            return(false);
        }

        if (targetOnlyZombies && !bZombie)
        {
            return(false);
        }

        switch (type)
        {
        case MinionSlotType.MELEE:
            if (!targetMelee)
            {
                return(false);
            }
            break;

        case MinionSlotType.SUPPORT:
            if (!targetSupport)
            {
                return(false);
            }
            break;

        case MinionSlotType.RANGED:
            if (!targetRanged)
            {
                return(false);
            }
            break;
        }

        switch (element)
        {
        case Element.PHYSICAL:
            return(targetPhysical);

        case Element.HOLY:
            return(targetHoly);

        case Element.UNHOLY:
            return(targetUnholy);

        case Element.EARTH:
            return(targetEarth);

        case Element.AIR:
            return(targetAir);

        case Element.FIRE:
            return(targetFire);

        case Element.WATER:
            return(targetWater);

        case Element.NO_ELEMENT:
            return(targetNoElement);
        }

        return(false);
    }
Example #16
0
 public void SetSlotType(MinionSlotType type)
 {
     attackerType = type;
 }