Example #1
0
    private void SelectMonsterTypes()
    {
        if (info == null)
        {
            return;
        }

        monStats = new MonStat[info.numMon];
        int[] monsterColumns = new int[info.numMon];
        for (int i = 0; i < info.numMon; ++i)
        {
            monsterColumns[i] = -1;
        }

        for (int i = 0; i < info.numMon; ++i)
        {
            int index;
            do
            {
                index = Random.Range(0, info.monsters.Count);
            }while (System.Array.IndexOf(monsterColumns, index) != -1);
            monsterColumns[i] = index;
            monStats[i]       = MonStat.Find(info.monsters[index]);
        }
    }
Example #2
0
 static SuperUnique()
 {
     foreach (var row in sheet)
     {
         row.monStat = MonStat.Find(row.monStatId);
         row.name    = Translation.Find(row.nameStr);
         map.Add(row.superUnique, row);
     }
 }
Example #3
0
    public static Character SpawnMonster(string id, Vector3 pos, Transform parent = null)
    {
        MonStat monStat = MonStat.Find(id);

        if (monStat == null)
        {
            Debug.LogWarning("Monster id not found: " + id);
            return(null);
        }
        return(SpawnMonster(monStat, pos, parent));
    }
Example #4
0
    static bool CreateObject(SpawnPreset obj, int x, int y, int level, Transform root)
    {
        var pos = Iso.MapToWorld(x - 2, y - 2);

        if (obj.type == 2)
        {
            if (obj.objectId >= ObjectInfo.sheet.Count)
            {
                return(false);
            }
            ObjectInfo objectInfo   = ObjectInfo.sheet[obj.objectId];
            var        staticObject = World.SpawnObject(objectInfo, pos, parent: root);
            staticObject.modeName = obj.mode;
            return(true);
        }
        else
        {
            string      monPreset   = MonPreset.Find(obj.act, obj.id);
            MonStat     monStat     = null;
            SuperUnique superUnique = null;

            if (monPreset != null)
            {
                monStat = MonStat.Find(monPreset);
                if (monStat == null)
                {
                    superUnique = SuperUnique.Find(monPreset);
                }
            }
            else
            {
                monStat = MonStat.sheet[obj.id];
            }

            if (monStat != null)
            {
                World.SpawnMonster(monStat, pos, root);
                return(true);
            }

            if (superUnique != null)
            {
                var monster = World.SpawnMonster(superUnique.monStat, pos, root);
                monster.gameObject.name = superUnique.nameStr;
                monster.title           = superUnique.name;
                monster.level           = level;
                int minionCount = Random.Range(superUnique.minGrp, superUnique.maxGrp + 1);
                for (int i = 0; i < minionCount; ++i)
                {
                    var minion = World.SpawnMonster(superUnique.monStat, pos, root);
                    minion.level = level;
                }
                return(true);
            }

            if (obj.id == 10)
            {
                // Fallens
                for (int i = 0; i < 4; ++i)
                {
                    World.SpawnMonster("fallen1", pos, root);
                }
                return(true);
            }

            if (obj.id == 11)
            {
                // Fallen shaman + fallens
                Spawn(MonStat.Find("fallenshaman1"), x, y, level, root);
                for (int i = 0; i < 4; ++i)
                {
                    var fallen = World.SpawnMonster("fallen1", pos, root);
                    fallen.level = level;
                }
                return(true);
            }

            if (obj.id == 27)
            {
                // Fallen shaman
                Spawn(MonStat.Find("fallenshaman1"), x, y, level, root);
                return(true);
            }

            return(false);
        }
    }