private void button1_Click(object sender, EventArgs e) { if (button1.Text == "Eat fruit") { Random rnd = new Random(); int x = rnd.Next(1, 4); if (x == 1) { des.Text = "The fruit appears to do nothing"; } if (x == 2) { des.Text = "The fruit makes you feel much better. You heal 2 damage."; hel = hel + 2; Health.Text = "" + hel; } if (x == 3) { des.Text = "The fruit makes you feel horrible. You take 2 damage"; hel = hel - 2; Health.Text = "" + hel; if (hel <= 0) { Lose xd = new Lose(); xd.Show(); Hide(); } } } }
private void button3_Click(object sender, EventArgs e) { if (button3.Text == "Dodge") { Random rnd = new Random(); int Dodge = rnd.Next(1, 10); int x = Dodge + agil; if (x < 8) { des.Text = "You weren't able to Dodge his attack and take one damage."; hel = hel - 1; Health.Text = "" + hel; if (hel <= 0) { Lose xd = new Lose(); xd.Show(); Hide(); } button1.Text = "Attack"; button2.Text = ""; button3.Text = ""; } else { des.Text = "You dodged his attack."; button1.Text = "Attack"; button2.Text = ""; button3.Text = ""; } } }
//it reloads the corresponding page depending on if the user got the question correct or wrong private void Reload_Tick(object sender, EventArgs e) { Reload.Enabled = true; Reload.Start(); if (txtAnswer.Text == "Correct!") { if (reloadcounter > 0) { reloadcounter--; if (reloadcounter == 3) { txtAnswer.Text = ("Reloading..."); var form2 = new Game(); form2.Show(); this.Hide(); } } } if (txtAnswer.Text == "Wrong!") { if (reloadcounter > 0) { reloadcounter--; if (reloadcounter == 3) { var form1 = new Lose(); form1.Show(); this.Hide(); } } } if (txtAnswer.Text == "Time's Out!") { if (reloadcounter > 0) { reloadcounter--; if (reloadcounter == 3) { var form1 = new Lose(); form1.Show(); this.Hide(); } } } }
public override void Update(GameResult e) { if (_repository == null) { return; } Lose evnt = e as Lose; if (evnt == null) { return; } Player p = _repository.FindPlayerByID(e.Player); _repository.AddExp(p, _gainer.Gain()); }
private void button2_Click(object sender, EventArgs e) { if (button2.Text == "Block") { Random rnd = new Random(); int Block = rnd.Next(1, 10); int x = Block + strength; if (x < 12) { des.Text = "You weren't able to block his attack and take one damage."; hel = hel - 1; Health.Text = "" + hel; if (hel <= 0) { Lose xd = new Lose(); xd.Show(); Hide(); } button1.Text = "Attack"; button2.Text = ""; button3.Text = ""; } else { des.Text = "You blocked his attack."; button1.Text = "Attack"; button2.Text = ""; button3.Text = ""; } } if (button2.Text == "Dreams") { des.Text = "The oni says wrong answer and prepare to DIE! He swings his giant club\n at you!"; button1.Text = ""; button2.Text = "Block"; button3.Text = "Dodge"; } }
private void button2_Click(object sender, EventArgs e) { if (button2.Text == "Continue To Next Room") { bathhouse xd = new bathhouse(hel, agil, stel, strength, per, intel, CName.Text, Class.Text); xd.Show(); Hide(); } if (button2.Text == "Block") { Random rnd = new Random(); int Block = rnd.Next(1, 10); int x = Block + strength; if (x < 8) { des.Text = "You weren't able to block his attack and take one damage."; hel = hel - 1; Health.Text = "" + hel; if (hel <= 0) { Lose xd = new Lose(); xd.Show(); Hide(); } button1.Text = "Attack"; button2.Text = ""; button3.Text = ""; } else { des.Text = "You blocked his attack."; button1.Text = "Attack"; button2.Text = ""; button3.Text = ""; } } }