Esempio n. 1
0
        static void InitLevel3()
        {
            Rogue.level_target = "目标:消灭Boss!";
            Rogue.AddMonster(3, 3, Rogue.random.Next(1, 3), 10);
            Rogue.AddMonster(15, 20, Rogue.random.Next(1, 3), 10);
            Rogue.AddMonster(20, 1, Rogue.random.Next(2, 4), 10);
            Monster boss1 = Rogue.AddMonster(Rogue.map_width / 2, Rogue.map_height - 1, 90);

            boss1.attack = 8;

            Merchant merchant = new Merchant("尖嘴猴腮的胖子", 200);

            merchant.SetPos(Rogue.map_width - 1, Rogue.map_height - 1);
            Rogue.npcs[MapPos(merchant.x, merchant.y)] = merchant;

            Rogue.onMonsterDead = (Monster monster) =>
            {
                if (monster.id == 202)
                {
                    Rogue.OnStageClear();
                    return(true);
                }

                if (monster == boss1)
                {
                    merchant.SetState(2);
                    return(true);
                }

                MonsterDropMoney(monster);

                int pos = Rogue.RandPos();
                int x, y;
                MapXY(pos, out x, out y);
                if (Rogue.player.level < 9 && Rogue.player.money < 100)
                {
                    Rogue.AddMonster(x, y, Rogue.player.level + 2, (Rogue.player.level + 1) * 10);
                }

                return(true);
            };
        }
Esempio n. 2
0
        static void InitLevel4()
        {
            Rogue.level_target = "找到正真的公主";

            Rogue.AddMonster(13, 0, 1);


            Rogue.AddMonster(8, 5, 3);
            Rogue.AddMonster(21, 5, 12, 100);
            Rogue.AddMonster(8, 10, 80, 100);
            //Rogue.AddMonster(21, 10, 13);

            Rogue.AddMonster(21, 8, 1000);
            Rogue.AddMonster(8, 8, 90);

            for (int i = 0; i < 9; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(i, 6);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 0; i < 5; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(8, i);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 0; i < 9; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(i, 9);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 11; i < 15; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(8, i);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 21; i < 27; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(i, 6);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 28; i < 30; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(i, 6);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 21; i < 30; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(i, 9);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 0; i < 5; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(21, i);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }
            for (int i = 11; i < 15; i++)
            {
                Walls wall = new Walls();
                wall.SetPos(21, i);
                Rogue.walls[MapPos(wall.x, wall.y)] = wall;
            }


            Walls walls = new Walls();

            walls.SetPos(21, 7);
            Rogue.walls[MapPos(walls.x, walls.y)] = walls;

            Walls walls2 = new Walls();

            walls2.SetPos(8, 7);
            Rogue.walls[MapPos(walls2.x, walls.y)] = walls2;


            OldMan oldman = new OldMan("传说中的人物", 101);

            oldman.SetPos(0, 0);
            Rogue.npcs[MapPos(oldman.x, oldman.y)] = oldman;

            Merchant merchant = new Merchant("奇怪的东西", 201);

            merchant.SetPos(21, 10);//21
            Rogue.npcs[MapPos(merchant.x, merchant.y)] = merchant;

            Merchant merchant2 = new Merchant("商人", 200);

            merchant2.SetPos(Rogue.map_width - 1, 0);
            Rogue.npcs[MapPos(merchant2.x, merchant2.y)] = merchant2;

            Princess gongzhu = new Princess("美丽善良的公主", 300);

            gongzhu.SetPos(Rogue.map_width - 1, 7);
            Rogue.princess[MapPos(gongzhu.x, gongzhu.y)] = gongzhu;

            Princess2 gongzhu2 = new Princess2("邪恶的公主", 300);

            gongzhu2.SetPos(0, 7);
            Rogue.princess[MapPos(gongzhu2.x, gongzhu2.y)] = gongzhu2;

            Dabaojian equipment = new Dabaojian("宝剑", 300);

            equipment.SetPos(Rogue.map_width - 1, Rogue.map_height - 1);
            Rogue.equipments[MapPos(equipment.x, equipment.y)] = equipment;

            Monster boss1 = Rogue.AddMonster(0, Rogue.map_height - 1, 140);

            boss1.attack = 50;



            Rogue.onMonsterDead = (Monster monster) =>
            {
                if (Rogue.monsters.Count() <= 1)
                {
                    Rogue.OnStageClear();
                }

                if (monster == boss1)
                {
                    merchant.SetState(2);
                    return(true);
                }



                MonsterDropMoney(monster);
                int pos = Rogue.RandPos2();
                int x, y;
                MapXY(pos, out x, out y);
                if (Rogue.player.level < 2)
                {
                    Rogue.AddMonster(x, y, Rogue.player.level + 1);
                }

                return(true);
            };
        }
Esempio n. 3
0
        static void Map_save()
        {
            FileStream   fs   = new FileStream("../../map2.txt", FileMode.Open, FileAccess.Read);
            StreamReader read = new StreamReader(fs, Encoding.Default);
            string       strReadline;
            int          y = 0;

            while ((strReadline = read.ReadLine()) != null)
            {
                Console.WriteLine(strReadline);
                for (int x = 0; x < strReadline.Length; ++x)
                {
                    if (strReadline[x] == '#')
                    {
                        Walls wall = new Walls();
                        wall.SetPos(x, y);
                        Rogue.walls[MapPos(wall.x, wall.y)] = wall;
                    }
                    if (strReadline[x] == '$')
                    {
                        Money monry = new Money(100);
                        monry.SetPos(x, y);
                        Rogue.moneys [MapPos(monry.x, monry.y)] = monry;
                    }
                    if (strReadline[x] == '!')
                    {
                        Rogue.AddMonster(x, y, 1);
                    }
                    if (strReadline[x] == '8')
                    {
                        Rogue.AddMonster(x, y, 160, 100);
                    }
                    if (strReadline[x] == '%')
                    {
                        Yaoshi yaoshi = new Yaoshi();
                        yaoshi.SetPos(x, y);
                        Rogue.yaoshis[MapPos(yaoshi.x, yaoshi.y)] = yaoshi;
                    }
                    if (strReadline[x] == '=')
                    {
                        Door door = new Door();
                        door.SetPos(x, y);
                        Rogue.doors[MapPos(door.x, door.y)] = door;
                    }
                    if (strReadline[x] == '^')
                    {
                        Trap trap = new Trap();
                        trap.SetPos(x, y);
                        Rogue.traps[MapPos(trap.x, trap.y)] = trap;
                    }
                    if (strReadline[x] == '*')
                    {
                        Trap trap = new Trap();
                        trap.SetPos(x, y);
                        Rogue.trap2s[MapPos(trap.x, trap.y)] = trap;
                    }
                    if (strReadline[x] == '@')
                    {
                        OldMan oldman = new OldMan("公主", 101);
                        oldman.SetPos(x, y);
                        Rogue.npcs[MapPos(oldman.x, oldman.y)] = oldman;
                    }
                    if (strReadline[x] == '&')
                    {
                        Merchant merchant2 = new Merchant("商人", 200);
                        merchant2.SetPos(x, y);
                        Rogue.npcs[MapPos(merchant2.x, merchant2.y)] = merchant2;
                    }
                }
                y += 1;
                // strReadline即为按照行读取的字符串
            }

            /*Guanka guanka1 = new Guanka(Rogue.monsters, Rogue.npcs, Rogue.walls, Rogue.equipments, Rogue.princess, Rogue.traps, Rogue.doors, Rogue.yaoshis
             * , Rogue.trap2s, Rogue.loutis_d, Rogue.loutis_u);*/
        }