示例#1
0
        public void MonsterDefeated(MonsterBattleEntity monster, RPGMessageBuilder message)
        {
            IBattleEntity attacker = Actors.FirstOrDefault(a => a is PlayerBattleEntity);

            BattleReward reward = attacker?.Reward(monster);

            if (reward != null)
            {
                message?.BattleActor(attacker).Text(" has killed ").BattleActor(monster).Text(" and receives ").Experience(reward.XP).Text(" and ").Gold(reward.Gold).Text(".");

                if (reward.Item != null)
                {
                    message?.BattleActor(attacker).Text(" finds ").Item(reward.Item).Text(" in the remains.");
                }
            }

            lock (actors)
                actors.Remove(monster);
        }