Пример #1
0
    private void AddEquipmentDrops(BattleEndWindow battleEndWindow)
    {
        //Get Equipment
        int   additionalDrops   = (int)(survivalLoopCount / 5);
        float rarityBoost       = 1 + (0.25f * survivalLoopCount);
        float nonStageEpicBoost = 1 + (0.4f * survivalLoopCount);
        float stageEpicBoost    = 1 + (0.25f * survivalLoopCount * 5);
        float affixLevelSkew    = 1.2f + (survivalLoopCount * 0.1f);
        int   equipmentDrops    = Random.Range(stageInfo.equipmentDropCountMin + additionalDrops, stageInfo.equipmentDropCountMax + 1 + additionalDrops);

        WeightList <RarityType> nonStageDropRarity = new WeightList <RarityType>();

        nonStageDropRarity.Add(RarityType.UNCOMMON, (int)(BASE_UNCOMMON_DROP_WEIGHT / rarityBoost));
        nonStageDropRarity.Add(RarityType.RARE, (int)(BASE_RARE_DROP_WEIGHT * rarityBoost));
        nonStageDropRarity.Add(RarityType.EPIC, (int)(BASE_EPIC_DROP_WEIGHT * nonStageEpicBoost));
        nonStageDropRarity.Add(RarityType.UNIQUE, (int)(BASE_UNIQUE_DROP_WEIGHT * nonStageEpicBoost));

        WeightList <RarityType> stageDropRarity = new WeightList <RarityType>();

        stageDropRarity.Add(RarityType.UNCOMMON, (int)(BASE_UNCOMMON_DROP_WEIGHT_STAGE_DROP / rarityBoost));
        stageDropRarity.Add(RarityType.RARE, (int)(BASE_RARE_DROP_WEIGHT_STAGE_DROP * rarityBoost));
        stageDropRarity.Add(RarityType.EPIC, (int)(BASE_EPIC_DROP_WEIGHT_STAGE_DROP * stageEpicBoost));

        if (stageInfo.equipmentDropList.Count == 0)
        {
            int boostedRarityDrops = System.Math.Max(equipmentDrops / 2, 1);
            for (int i = 0; i < equipmentDrops; i++)
            {
                RarityType rarity;
                if (i < boostedRarityDrops)
                {
                    rarity = stageDropRarity.ReturnWeightedRandom();
                }
                else
                {
                    rarity = nonStageDropRarity.ReturnWeightedRandom();
                }
                AddNonStagePoolDrop(affixLevelSkew, rarity);
            }
        }
        else
        {
            WeightList <string> weightList = Helpers.CreateWeightListFromWeightBases(stageInfo.equipmentDropList);
            int dropsFromStagePool         = System.Math.Max(equipmentDrops / 2, 1);
            for (int i = 0; i < dropsFromStagePool; i++)
            {
                string baseId = weightList.ReturnWeightedRandom();
                var    equip  = Equipment.CreateEquipmentFromBase(ResourceManager.Instance.GetEquipmentBase(baseId), stageLevel + survivalLoopCount);
                RollEquipmentRarity(equip, stageDropRarity.ReturnWeightedRandom(), affixLevelSkew);
                gainedEquipment.Add(equip);
            }

            for (int i = 0; i < equipmentDrops - dropsFromStagePool; i++)
            {
                RarityType rarity = nonStageDropRarity.ReturnWeightedRandom();
                AddNonStagePoolDrop(affixLevelSkew, rarity);
            }
        }
    }
Пример #2
0
    public UniqueBase GetRandomUniqueBase(int ilvl, GroupType?group = null, EquipSlotType?slot = null)
    {
        if (uniqueList == null)
        {
            LoadUniques();
        }

        WeightList <UniqueBase> possibleUniqueList = new WeightList <UniqueBase>();

        foreach (UniqueBase unique in uniqueList.Values)
        {
            if (group != null && unique.group != group)
            {
                continue;
            }

            if (slot != null && unique.equipSlot != slot)
            {
                continue;
            }

            if (unique.dropLevel <= ilvl)
            {
                possibleUniqueList.Add(unique, unique.spawnWeight);
            }
        }
        if (possibleUniqueList.Count == 0)
        {
            return(null);
        }
        return(possibleUniqueList.ReturnWeightedRandom());
    }
Пример #3
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="type">Affix Category to Generate</param>
    /// <param name="ilvl">Level of Target</param>
    /// <param name="targetTypeTags">List of target's tags to determine base spawn weights</param>
    /// <param name="affixBonusTypeStrings">List of strings to determine which affixes have already been applied to target</param>
    /// <param name="weightModifiers">Values to multiply base spawn weight by if they match the group tags</param>
    /// <returns></returns>
    public AffixBase GetRandomAffixBase(AffixType type, int ilvl, HashSet <GroupType> targetTypeTags, List <string> affixBonusTypeStrings, Dictionary <GroupType, float> weightModifiers = null, float affixLevelSkewFactor = 1f)
    {
        WeightList <AffixBase> possibleAffixList = GetPossibleAffixes(type, ilvl, targetTypeTags, affixBonusTypeStrings, weightModifiers, affixLevelSkewFactor);

        if (possibleAffixList.Count == 0)
        {
            return(null);
        }
        return(possibleAffixList.ReturnWeightedRandom());
    }
Пример #4
0
 public ConsumableType GetRandomConsumable()
 {
     if (consumableWeightList == null)
     {
         consumableWeightList = new WeightList <ConsumableType>();
         consumableWeightList.Add(ConsumableType.AFFIX_REROLLER, 3000);
         consumableWeightList.Add(ConsumableType.AFFIX_CRAFTER, 900);
     }
     return(consumableWeightList.ReturnWeightedRandom());
 }
Пример #5
0
    public ArchetypeBase GetRandomArchetypeBase(int ilvl)
    {
        if (archetypeList == null)
        {
            LoadArchetypes();
        }

        WeightList <ArchetypeBase> possibleArchetypeList = new WeightList <ArchetypeBase>();

        foreach (ArchetypeBase archetype in archetypeList.Values)
        {
            if (archetype.dropLevel <= ilvl)
            {
                possibleArchetypeList.Add(archetype, archetype.spawnWeight);
            }
        }
        if (possibleArchetypeList.Count == 0)
        {
            return(null);
        }
        return(possibleArchetypeList.ReturnWeightedRandom());
    }
Пример #6
0
    private void AddArchetypeDrops(BattleEndWindow battleEndWindow)
    {
        //Get Archetype
        int archetypeDrops = 1 + survivalLoopCount / 3;
        int i = 0;

        if (stageInfo.archetypeDropList.Count != 0)
        {
            WeightList <string> stageDropList = Helpers.CreateWeightListFromWeightBases(stageInfo.archetypeDropList);
            string        baseId        = stageDropList.ReturnWeightedRandom();
            ArchetypeBase archetypeBase = ResourceManager.Instance.GetArchetypeBase(baseId);
            ArchetypeItem item          = ArchetypeItem.CreateArchetypeItem(archetypeBase, stageLevel);
            gainedArchetypeItems.Add(item);
            i = 1;
        }

        for (; i < archetypeDrops; i++)
        {
            ArchetypeItem item = ArchetypeItem.CreateArchetypeItem(ResourceManager.Instance.GetRandomArchetypeBase(stageLevel + survivalLoopCount), stageLevel + survivalLoopCount);
            gainedArchetypeItems.Add(item);
        }
    }
Пример #7
0
    public EquipmentBase GetRandomEquipmentBase(int ilvl, GroupType?group = null, EquipSlotType?slot = null, float baseLevelSkew = 1f)
    {
        if (equipmentList == null)
        {
            LoadEquipment();
        }

        WeightList <EquipmentBase> possibleEquipList = new WeightList <EquipmentBase>();

        foreach (EquipmentBase equipment in equipmentList.Values)
        {
            if (group != null && equipment.group != group)
            {
                continue;
            }

            if (slot != null && equipment.equipSlot != slot)
            {
                continue;
            }

            if (equipment.dropLevel <= ilvl)
            {
                float weight = 1f;
                if (baseLevelSkew != 1f)
                {
                    weight *= Mathf.Lerp(1 / baseLevelSkew, baseLevelSkew, (float)equipment.dropLevel / ilvl);
                }

                possibleEquipList.Add(equipment, (int)(equipment.spawnWeight * weight));
            }
        }
        if (possibleEquipList.Count == 0)
        {
            return(null);
        }
        return(possibleEquipList.ReturnWeightedRandom());
    }