コード例 #1
0
        public List <Monster> GetRandomMonsters(int count)
        {
            List <MonsterTitle> monsterTitles = GetAllMonsterTitles();
            List <MonsterName>  monsterNames  = GetAllMonsterNames();
            List <MonsterModel> monsterModels = GetAllMonsterModels();

            Random r = new Random();

            List <Monster> randomMonsters = new List <Monster>();

            for (int i = 0; i < count; i++)
            {
                MonsterTitle randomMonsterTitle = monsterTitles[r.Next(monsterTitles.Count - 1)];
                MonsterName  randomMonsterName  = monsterNames[r.Next(monsterNames.Count - 1)];
                MonsterModel randomMonsterModel = monsterModels[r.Next(monsterModels.Count - 1)];

                int monsterId = Int32.Parse("" + randomMonsterModel.MonsterModelId + randomMonsterTitle.MonsterTitleId + randomMonsterName.MonsterNameId);
                Console.WriteLine(monsterId);

                Monster m = new Monster(monsterId, randomMonsterModel, randomMonsterTitle, randomMonsterName);

                randomMonsters.Add(m);
            }

            return(randomMonsters);
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:RidderRedderApi.Models.Monster"/> class.
 /// </summary>
 /// <param name="monsterId">Monster identifier.</param>
 /// <param name="monsterModel">Monster model.</param>
 /// <param name="monsterTitle">Monster title.</param>
 /// <param name="monsterName">Monster name.</param>
 public Monster(int monsterId, MonsterModel monsterModel, MonsterTitle monsterTitle, MonsterName monsterName)
 {
     MonsterId    = monsterId;
     MonsterModel = monsterModel;
     MonsterTitle = monsterTitle;
     MonsterName  = monsterName;
 }
コード例 #3
0
    void GetEnemyProperty(Monster m, int titleIndex)
    {
        GetEnemyProperty(m);
        MonsterTitle mt = LoadTxt.GetMonsterTitle(titleIndex);

        enemy.name          += "[" + mt.title + "]";
        enemy.hp            *= 1.0f + mt.hpBonus;
        enemyMaxHp           = enemy.hp;
        enemy.atk           *= 1.0f + mt.atkBonus;
        enemy.def           *= 1.0f + mt.defBonus;
        enemy.dodge         *= 1.0f + mt.dodgeBonus;
        enemy.speed         *= (1.0f + mt.speedBonus);
        enemy.castSpeedBonus = mt.attSpeedBonus;
    }
コード例 #4
0
    public static MonsterTitle GetMonsterTitle(int mtId)
    {
        string[][]   strs = ReadTxt.ReadText("monster_title");
        MonsterTitle mt   = new MonsterTitle();

        for (int i = 0; i < strs.Length - 1; i++)
        {
            mt.id = int.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 0));
            if (mt.id != mtId)
            {
                continue;
            }
            mt.title         = ReadTxt.GetDataByRowAndCol(strs, i + 1, 1);
            mt.hpBonus       = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 2));
            mt.atkBonus      = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 3));
            mt.defBonus      = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 4));
            mt.attSpeedBonus = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 5));
            mt.speedBonus    = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 6));
            mt.dodgeBonus    = float.Parse(ReadTxt.GetDataByRowAndCol(strs, i + 1, 7));
            return(mt);
        }
        Debug.Log("没有找到怪物后缀--" + mtId);
        return(new MonsterTitle());
    }