Exemplo n.º 1
0
        private void Battle(Channel channel, RPGPlayer p1, RPGPlayer p2)
        {
            var       battlereport = "Battle between **" + p1.name + "** (" + p1.health + ") and **" + p2.name + "** (" + p2.health + ")!\n";
            RPGPlayer p3;

            for (int i = 0; (p1.health > 0 && p2.health > 0) && i < 30; i++)
            {
                var ws = MyBot.rng.Next((int)(p1.weaponskill + p2.weaponskill));
                if (ws < p1.weaponskill)
                {
                    int damage = (int)((MyBot.rng.Next(100, 200) * p1.damage) / 100);
                    p2.AddHealth(-damage);
                    battlereport += "\n**" + p1.name + "** attacked for **" + damage + "**";
                }
                p3 = p1;
                p1 = p2;
                p2 = p3;
                //Console.WriteLine(p1.name + ": " + p1.health + " | " + p2.name + " : " + p2.health);
            }
            if (p1.health <= 0)
            {
                battlereport += "\n\nThe battle is over, **" + p2.name + "** (" + p2.health + ") laughs while walking away from **" + p1.name + "**'s corpse";
            }
            else
            {
                battlereport += "\n\nThe battle lasted long, both players are exhausted. They agree on a draw *this time*\n"
                                + "Healthreport: **" + p1.name + "** (" + p1.health + "), **" + p2.name + "** (" + p2.health + ")";
            }
            channel.SendMessage(battlereport);
        }
Exemplo n.º 2
0
        public RPGPlayer GetPlayerData(Discord.User u)
        {
            foreach (RPGPlayer p in players)
            {
                if (p.id == u.Id)
                {
                    p.UpdateName(u.Name);
                    return(p);
                }
            }
            RPGPlayer player = new RPGPlayer(u);

            players.Add(player);
            return(player);
        }
Exemplo n.º 3
0
 private void Battle(Channel channel, RPGPlayer p, RPGMonster m)
 {
     rpgchannel.SendMessage("Battle between **" + p.name + "** and a monster!\nNothing happened :/");
 }
Exemplo n.º 4
0
 public int CompareTo(RPGPlayer other)
 {
     return(exp.CompareTo(other.exp));
 }