Beispiel #1
0
        public RPGGameModel()
        {
            Random = new Random();
            Board = new Board();
            Hero = new Actor();
            Hero.Name = "Nameless Hero";
            Hero.Location = Board.GetStartPoint();
            Hero.HP = 200;
            Hero.EP = 10;

            Monster = new Actor();
            Monster.Name = "A Monstor";
            Monster.HP = 200;
            Monster.EP = 30;
            Location l = new Location(Random.Next(0, Board.GetWidth()), Random.Next(0, Board.GetHeight()));
            while(!Board.IsEmpty(l))
            {
                l = new Location(Random.Next(0, Board.GetWidth()), Random.Next(0, Board.GetHeight()));
            }
            Monster.Location= l;
        }
Beispiel #2
0
        public int Attack(Actor opp)
        {
            int ap = random.Next(0, EP);
            if (opp.HP < ap) ap = opp.HP;
            opp.HP -= ap;
            EP += (int)Math.Floor(((float)ap) * ((float)random.Next(0, 100) / 100.0));

            HP -= opp.EP;
            return EP;
        }