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 OnEnemyKilled(object sender, System.EventArgs e) { _messageBroker.RaiseMessage($"{_enemy.Name} is dead"); _messageBroker.RaiseMessage($"You get {_enemy.RewardExp} exp"); _messageBroker.RaiseMessage($"You get {_enemy.Credits} credits"); _player.ReciveCredits(_enemy.Credits); foreach (Item lootItem in _enemy.Inventory.Items) { _player.AddItemToInventory(lootItem); _messageBroker.RaiseMessage($"You get {lootItem.Name} from corpse"); } _player.AddExp(_enemy.RewardExp); OnVictory?.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()); }