Example #1
0
        internal static void Die(Monster deadMonster, ICombatant attacker)
        {
            // To prevent accidentally forgetting to place the call to EarnXP in each monster subclass
            // it was placed in this method with a requirement to pass the attacker.
            if (monsters.Remove(deadMonster))
            {
                CombatManager.AppendDeathMessage("You have killed the " + deadMonster.EntityName + ".");
                deadMonster.DropLoot();

                // Because loot is visible if the tile is revealed, this will explain why you can see it when the hero is blind.
                if (InventoryEffectManager.HeroBlind)
                {
                    DungeonGameEngine.ProcessMessageQueue(false, "You hear the " + deadMonster.EntityName + " drop something.");
                }
            }
            else
            {
                throw new ArgumentOutOfRangeException("Dead monster was not in the monsters list.");
            }
            attacker.EarnXP(deadMonster._XP);
        }