Esempio n. 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);
            }
        }
    }
Esempio n. 2
0
 public static void Postfix(BattleEndWindow __instance)
 {
     if (!Main.enabled || !Main.settings.showInStory)
     {
         return;
     }
     Changer.ChangeObjectsName(__instance.battleBootyHolder, "ItemNumberText");
 }
Esempio n. 3
0
 private static void Postfix(BattleEndWindow __instance)
 {
     if (!Main.on)
     {
         return;
     }
     Utils.ButtonConfirm(__instance.closeBattleEndWindowButton);
 }
Esempio n. 4
0
    private void CalculateExpGain(BattleEndWindow battleEndWindow)
    {
        double multiplier = System.Math.Pow(1.08f, survivalLoopCount);

        if (perfectBonus)
        {
            multiplier *= 1.15f;
        }
        gainedExpThisLoop = (int)(stageInfo.baseExperience * (multiplier));
        gainedExp        += gainedExpThisLoop;
    }
Esempio n. 5
0
    private void CalculateItemFragmentDrops(BattleEndWindow battleEndWindow)
    {
        double multiplier = System.Math.Pow(1.10f, survivalLoopCount);

        if (perfectBonus)
        {
            multiplier *= 1.25f;
        }
        int minDrop = (int)(stageInfo.consumableDropCountMin * multiplier);
        int maxDrop = (int)(stageInfo.consumableDropCountMax * multiplier);

        gainedFragmentsThisLoop = Random.Range(minDrop, maxDrop + 1);
        gainedFragments        += gainedFragmentsThisLoop;
    }
Esempio n. 6
0
    private void AddConsumableDrops(BattleEndWindow battleEndWindow)
    {
        // Get Consumables
        int consumableDrops = Random.Range(stageInfo.consumableDropCountMin, stageInfo.consumableDropCountMax + 1);
        Dictionary <ConsumableType, int> consumablesCount = new Dictionary <ConsumableType, int>();

        for (int i = 0; i < consumableDrops; i++)
        {
            ConsumableType consumable = GameManager.Instance.GetRandomConsumable();
            GameManager.Instance.PlayerStats.consumables[consumable]++;
            if (!consumablesCount.ContainsKey(consumable))
            {
                consumablesCount.Add(consumable, 0);
            }
            consumablesCount[consumable]++;
        }

        foreach (KeyValuePair <ConsumableType, int> keyValue in consumablesCount)
        {
            battleEndWindow.AddToBodyText(keyValue.Key.ToString() + " +" + keyValue.Value + "\n");
        }
    }
Esempio n. 7
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);
        }
    }
Esempio n. 8
0
    public void EndBattle(bool victory)
    {
        StageManager.Instance.BattleManager.ProjectilePool.ReturnAll();
        foreach (EnemyActor enemy in currentEnemyList)
        {
            enemy.DisableActor();
            EnemyPool.ReturnToPool(enemy);
        }
        enemiesSpawned = 0;
        currentEnemyList.Clear();
        StopAllCoroutines();
        battleEnded = true;
        GameManager.Instance.isInBattle = false;
        BattleEndWindow battleEndWindow = UIManager.Instance.BattleUICanvas.GetComponentInChildren <BattleEndWindow>(true);

        battleEndWindow.isVictory = victory;

        if (victory)
        {
            if (survivalLoopCount == 0)
            {
                GameManager.Instance.PlayerStats.AddToStageClearCount(stageInfo.idName);
                if (playerHealth == STARTING_LIFE)
                {
                    perfectBonus = true;
                }
            }
            else
            {
                perfectBonus = false;
            }

            battleEndWindow.ShowVictoryWindow();

            CalculateExpGain(battleEndWindow);
            CalculateItemFragmentDrops(battleEndWindow);

            //AddConsumableDrops(battleEndWindow);
            AddEquipmentDrops(battleEndWindow);
            AddArchetypeDrops(battleEndWindow);
        }
        else
        {
            battleEndWindow.ShowLoseWindow();

            gainedExpThisLoop       = gainedExp / -2;
            gainedExp              /= 2;
            gainedFragmentsThisLoop = gainedFragments / -2;
            gainedFragments        /= 2;

            if (gainedArchetypeItems.Count > 0)
            {
                int numToRemove = System.Math.Max(gainedArchetypeItems.Count / 2, 1);
                for (int i = 0; i < numToRemove; i++)
                {
                    gainedArchetypeItems.RemoveAt(Random.Range(0, gainedArchetypeItems.Count));
                }
            }

            if (gainedEquipment.Count > 0)
            {
                int numToRemove = System.Math.Max(gainedEquipment.Count / 2, 1);
                for (int i = 0; i < numToRemove; i++)
                {
                    gainedEquipment.RemoveAt(Random.Range(0, gainedEquipment.Count));
                }
            }
        }

        battleEndWindow.SetExpGainValues(gainedExp, gainedExpThisLoop);
        battleEndWindow.SetFragGainValues(gainedFragments, gainedFragmentsThisLoop);
        battleEndWindow.UpdateExpString();
        battleEndWindow.UpdateFragString();

        if (gainedArchetypeItems.Count > 0)
        {
            string gainedArchetypesString           = "Archetypes:\n";
            Dictionary <string, int> archetypeCount = new Dictionary <string, int>();
            foreach (ArchetypeItem archetypeItem in gainedArchetypeItems)
            {
                if (!archetypeCount.ContainsKey(archetypeItem.Name))
                {
                    archetypeCount.Add(archetypeItem.Name, 0);
                }
                archetypeCount[archetypeItem.Name]++;
            }

            foreach (KeyValuePair <string, int> archetypeEntry in archetypeCount)
            {
                gainedArchetypesString += "<indent=10%>" + archetypeEntry.Key + " x" + archetypeEntry.Value + "</indent>\n";
            }

            gainedArchetypesString += '\n';

            battleEndWindow.AddToBodyText(gainedArchetypesString);
        }

        if (gainedEquipment.Count > 0)
        {
            string gainEquipString = "Equipment:\n";
            Dictionary <EquipmentBase, int> equipmentCount = new Dictionary <EquipmentBase, int>();
            foreach (Equipment equipment in gainedEquipment)
            {
                if (!equipmentCount.ContainsKey(equipment.Base))
                {
                    equipmentCount.Add(equipment.Base, 0);
                }
                equipmentCount[equipment.Base]++;
            }

            foreach (KeyValuePair <EquipmentBase, int> equipEntry in equipmentCount)
            {
                if (equipEntry.Key is UniqueBase)
                {
                    gainEquipString += "<indent=10%><color=#ff7d28>" + equipEntry.Key.LocalizedName + "</color> x" + equipEntry.Value + "</indent>\n";
                }
                else
                {
                    gainEquipString += "<indent=10%>" + equipEntry.Key.LocalizedName + " x" + equipEntry.Value + "</indent>\n";
                }
            }

            battleEndWindow.AddToBodyText(gainEquipString);
        }
    }