static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); KeepRunning = true; while (KeepRunning) { KeepRunning = false; Game = new JoshorInterface(); Application.Run(Game); } }
public void Fight(Monster enemy, Player player, Weapon equipt, JoshorInterface myInterface) { // Create the Dice objects Dice attack = new Dice(20); Dice damage = new Dice(6); while (enemy.IsDead != true && player.IsDead != true) { _attackResult = attack.DiceResult; myInterface.rtbEnv.Text += "Your attack with your " + myInterface.cboWeapons.Text + ": " + AttackResults + Environment.NewLine; if (AttackResults >= enemy.AC) { myInterface.rtbEnv.Text += "You hit the " + enemy.Name + Environment.NewLine; _damageResult = damage.DiceResult; myInterface.rtbEnv.Text += "You did " + DamageResults + " points of damage." + Environment.NewLine; enemy.CurrentHitPoints -= DamageResults; myInterface.rtbEnv.Text += enemy.Name + " has " + enemy.CurrentHitPoints + " hitpoints left" + Environment.NewLine; if (enemy.CurrentHitPoints <= 0) { myInterface.rtbEnv.Text += "The " + enemy.Name + " is dead!" + Environment.NewLine; enemy.IsDead = true; player.xp += enemy.Exp; player.gold += enemy.Gold; break; } } else { myInterface.rtbEnv.Text += "You Missed your attack!" + Environment.NewLine; } _attackResult = attack.DiceResult; myInterface.rtbEnv.Text += enemy.Name + " attacks you: " + AttackResults + Environment.NewLine; if (AttackResults > player.ac) { myInterface.rtbEnv.Text += "The " + enemy.Name + " hits you!" + Environment.NewLine; _damageResult = damage.DiceResult; myInterface.rtbEnv.Text += "The " + enemy.Name + " did " + DamageResults + " points of damage." + Environment.NewLine; player.CurrentHitPoints -= DamageResults; myInterface.rtbEnv.Text += "You have " + player.CurrentHitPoints + " hitpoints left." + Environment.NewLine; myInterface.lblDisplayHP.Text = player.CurrentHitPoints.ToString(); if (player.CurrentHitPoints <= 0) { myInterface.rtbEnv.Text += "You are dead!" + Environment.NewLine; player.IsDead = true; break; } } else { myInterface.rtbEnv.Text += "The " + enemy.Name + " missed you!" + Environment.NewLine; } Round++; } myInterface.rtbEnv.Text += "The fight took " + Round + " rounds to finish." + Environment.NewLine; }
public static void Restart() { Game = new JoshorInterface(); Game.Show(); }
JoshorInterface JoshorInterface; // To give this form access to JoshorInterface public MobInterface(JoshorInterface passed) { InitializeComponent(); this.JoshorInterface = passed; }