private void OnOpponentKilled(object sender, System.EventArgs e) { _messageBroker.RaiseMessage(""); _messageBroker.RaiseMessage($"You defeated the {_opponent.Name}!"); _messageBroker.RaiseMessage($"You receive {_opponent.RewardExperiencePoints} experience points."); _player.AddExperience(_opponent.RewardExperiencePoints); _messageBroker.RaiseMessage($"You receive {_opponent.Gold} gold."); _player.ReceiveGold(_opponent.Gold); foreach (GameItem gameItem in _opponent.Inventory.Items) { _messageBroker.RaiseMessage($"You receive one {gameItem.Name}."); if (_player.Inventory.Items.Count >= 12) { _messageBroker.RaiseMessage($"You have no space for {gameItem.Name}. Go to the trader and sell something."); break; } else { _player.AddItemToInventory(gameItem); } } OnCombatVictory?.Invoke(this, new CombatVictoryEventArgs()); }
private void OnOpponentKilled(object sender, System.EventArgs e) { _messageBroker.RaiseMessage(""); _messageBroker.RaiseMessage($"You defeated the {_opponent.Name}!"); _messageBroker.RaiseMessage($"You receive {_opponent.RewardExperiencePoints} experience points."); _player.AddExperience(_opponent.RewardExperiencePoints); _messageBroker.RaiseMessage($"You receive {_opponent.Gold} gold."); _player.ReceiveGold(_opponent.Gold); foreach (var gameItem in _opponent.Inventory.Items) { _messageBroker.RaiseMessage($"You received one {gameItem.Name}."); _player.AddItemToInventory(gameItem); } OnCombatVictory?.Invoke(this, new CombatVictoryEventArgs()); }