Пример #1
0
        private void move(int xmod, int ymod)
        {
            int[] pos = whereAmI();
            int   x   = pos[0];
            int   y   = pos[1];

            char next_step = map[x + xmod, y + ymod];

            try
            {
                if (next_step == '.')
                {
                    map[x + xmod, y + ymod] = '@';
                    map[x, y] = '.';
                }
                else if (next_step == '&')
                {
                    Ork o = new Ork();
                    if (mapFight(this.p, o))
                    {
                        map[x + xmod, y + ymod] = '@';
                        map[x, y] = '.';
                    }
                }
                else if (next_step == 'g')
                {
                    Goblin o = new Goblin();
                    if (mapFight(this.p, o))
                    {
                        map[x + xmod, y + ymod] = '@';
                        map[x, y] = '.';
                    }
                }
                else if (next_step == 'h')
                {
                    p.hp         += 50;
                    this.message += "Kaptál healt újult erővel térhetsz vissza a csata mezőre! Az életerőd: " + p.hp;
                }
                else if (next_step == 'x')
                {
                    this.message += "Sikeresen kijutottál az első labirintusból! Gratulálok!";
                    on_x          = true;
                    on_x          = true;
                }
                else
                {
                    this.message += "Falba ütköztél!";
                }
            }
            catch (IndexOutOfRangeException e)
            {
                this.message += "Elérted a pálya szélét!";
            }
        }
Пример #2
0
        private void move(int xmod, int ymod)
        {
            int[] pos = whereAmI();
            int   x   = pos[0];
            int   y   = pos[1];

            char next_step = map[x + xmod, y + ymod];

            try
            {
                if (next_step == '.')
                {
                    map[x + xmod, y + ymod] = '@';
                    map[x, y] = '.';
                }
                else if (next_step == '&')
                {
                    Ork o = new Ork();
                    if (mapFight(this.p, o))
                    {
                        map[x + xmod, y + ymod] = '@';
                        map[x, y] = '.';
                    }
                }
                else if (next_step == 'g')
                {
                    Goblin o = new Goblin();
                    if (mapFight(this.p, o))
                    {
                        map[x + xmod, y + ymod] = '@';
                        map[x, y] = '.';
                    }
                }
                else if (next_step == 'x')
                {
                    this.message   += "Kijutottál a labirintusból! Gratulálok!";
                    this.GameIsOver = true;
                }
                else
                {
                    this.message += "Falba ütköztél!";
                }
            }
            catch (IndexOutOfRangeException e)
            {
                this.message += "Elérted a pálya szélét!";
            }
        }