// Placeholderför test av funktion, Story kan genereras från annan klass sedan. public void ShowNewEnemy() { _npc = _npc.GetNewEnemy(); Tb_Dungeon.AppendText("Eeek a " + _npc.Name + "!" + Environment.NewLine + Environment.NewLine + "Enemy: " + _npc.Name + Environment.NewLine + "Current health: " + _npc.Health); }
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."); } }