Beispiel #1
0
        public BattleForm(PlayerFighter c)
        {
            InitializeComponent();

            currplayer1 = c;
            aif         = new AIFighter(currplayer1.Level);

            currbattle = new Battle(currplayer1, aif);

            atcat.Click += action;
            dodge.Click += action;
            block.Click += action;



            namlvlai.Text = aif.Name + "\nLevel " + aif.Level;
            namelvl.Text  = currplayer1.Name + "\nLevel " + currplayer1.Level;

            pturn = currbattle.BattleStart();
            changeturn(pturn);
            string fm = "`s speed allows him to attack first!";

            if (pturn == 2)
            {
                fm = currplayer1.Name + fm;
            }
            else
            {
                fm = aif.Name + fm;
            }
            battlelog.Text         = currbattle.Message;
            battlelog.Text        += DateTime.Now.ToString("HH:mm:ss") + ": " + fm + Environment.NewLine;
            battlelog.TextChanged += tb_scrldwn;
        }
Beispiel #2
0
 public Battle(PlayerFighter p, AIFighter a)
 {
     fp        = new PlayerFighter(p);
     sp        = a;
     speeddif  = 0;
     prevturn  = 0;
     durp1     = fp.Durability;
     durp2     = sp.Durability;
     battleend = false;
     message   = DateTime.Now.ToString("HH:mm:ss") + ": Battle starts: " + fp.Name + " vs " + sp.Name + Environment.NewLine;
 }
Beispiel #3
0
        public static string choseact(AIFighter f, int role)
        {
            string a = "Attack";

            if (role == 0)
            {
                a = "Countrattack";
                int    chance = f.Str + f.Agility + f.Agility + f.Str;
                Random x      = new Random();
                int    chose  = x.Next(0, chance + 1);
                if (chose > f.Str + f.Agility && chose <= f.Str + f.Agility + f.Agility)
                {
                    a = "Dodge";
                }
                else if (chose > f.Str + f.Agility + f.Agility)
                {
                    a = "Block";
                }
            }

            return(a);
        }