private void Btn_NewEnemy_Click(object sender, EventArgs e) { if (!_npc.IsDead()) { MessageBox.Show("You can't engage a new enemy until you defeated your current enemy!"); } else { Tb_Dungeon.Clear(); ShowNewEnemy(); } }
private void Btn_PlayerAttack_Click(object sender, EventArgs e) { Tb_Dungeon.Clear(); if (!_player.IsDead() && !_npc.IsDead()) { int npcDamage = _npc.Attack(); int playerDamage = _player.Attack(); _npc.DecreaseHealth(playerDamage); _player.DecreaseHealth(npcDamage); Tb_Dungeon.AppendText(Story.FightingNPC(_player, _npc, playerDamage, npcDamage)); Lbl_ShowHealth.Text = _player.Health.ToString(); if (_npc.IsDead()) { Tb_Dungeon.AppendText(Environment.NewLine + "You have defeated " + _npc.Name + Environment.NewLine + "You are rewarded with " + _npc.ExperienceDrop + " experience."); _player.ExperienceGain(_npc.ExperienceDrop); Pb_Experience.Value += _npc.ExperienceDrop; if (Pb_Experience.Value == Pb_Experience.Maximum) { Pb_Experience.Value = 0; RefreshMenu(); } } else { Tb_Dungeon.AppendText(Environment.NewLine + _npc.Name + "'s current health: " + _npc.Health); } } else { MessageBox.Show("There is no enemy to attack."); } }