Beispiel #1
0
        public void TestLootScaling(int targetLevel)
        {
            var   pc         = player.GetComponent <PlayerCharacter>();
            float totalStats = 0;
            int   count      = 0;

            for (int i = 0; i < 100; i++)
            {
                ResetPlayer();
                pc = player.GetComponent <PlayerCharacter>();
                while (pc.GetComponent <ExperienceGainer>().level <= targetLevel)
                {
                    if (monster.GetComponent <MonsterScaler>().level != pc.GetComponent <ExperienceGainer>().level)
                    {
                        CreateMonster(pc.GetComponent <ExperienceGainer>().level);
                    }
                    if (pc.GetComponent <ExperienceGainer>().level == targetLevel)
                    {
                        count++;
                        totalStats += TotalCharacterStats(player);
                    }
                    pc.GetComponent <ExperienceGainer>().GainXP(monster.GetComponent <RewardGiver>().xpValue);
                    var roll = Random.Range(0, 1f);
                    if (roll <= 0.2f)
                    {
                        var item = RewardGiver.GenerateItem(targetLevel);
                        EquipItemIfWanted(item);
                    }
                }
            }
            var average = totalStats / count / 6;

            Debug.Log(average);
        }
Beispiel #2
0
    private void AddItem()
    {
        var item = RewardGiver.GenerateItem(PlayerCharacter.GetAverageLevel());

        if (item is Equipment)
        {
            goods.Add(item);
        }
    }
Beispiel #3
0
        public IEnumerator TestAllLootScaling()
        {
            var yieldCounter = 0;

            for (int i = 1; i <= 1; i++)
            {
                Debug.Log("----------");
                Debug.Log(i.ToString());
                float totalStats = 0;
                int   count      = 0;
                for (int j = 0; j < 100; j++)
                {
                    Debug.Log("Player number " + (j + 1).ToString());
                    ResetPlayer();
                    var pc = player.GetComponent <PlayerCharacter>();
                    while (pc.GetComponent <ExperienceGainer>().level <= i)
                    {
                        yieldCounter++;
                        if (monster == null || monster.GetComponent <MonsterScaler>().level != pc.GetComponent <ExperienceGainer>().level)
                        {
                            CreateMonster(pc.GetComponent <ExperienceGainer>().level);
                        }
                        if (pc.GetComponent <ExperienceGainer>().level == i)
                        {
                            count++;
                            totalStats += TotalCharacterStats(player);
                        }
                        pc.GetComponent <ExperienceGainer>().GainXP(monster.GetComponent <RewardGiver>().xpValue);
                        var roll = Random.Range(0, 1f);
                        if (roll <= 0.2f)
                        {
                            var item = RewardGiver.GenerateItem(i);
                            EquipItemIfWanted(item);
                        }
                        if (yieldCounter >= 1000)
                        {
                            yieldCounter = 0;
                            yield return(null);
                        }
                    }
                }
                var average = totalStats / count / 6;
                Debug.Log(average);
            }
        }