Exemplo n.º 1
0
        private void ProcessMonsterDeath(IActor actor)
        {
            if (actor is null)
            {
                throw new ArgumentNullException(nameof(actor));
            }

            if (actor.Person is not MonsterPerson monsterPerson)
            {
                return;
            }

            var monsterScheme = monsterPerson.Scheme;

            var dropSchemes = GetMonsterDropTables(monsterScheme);

            var loot = new DropTableLoot(dropSchemes, _dropResolver);

            var staticObject = new StaticObject(actor.Node, loot.Purpose, default);

            staticObject.AddModule <IPropContainer>(loot);

            if (loot.Content.CalcActualItems().Any())
            {
                StaticObjectManager.Add(staticObject);
            }

            if (ScoreManager != null)
            {
                ScoreManager.CountMonsterDefeat(monsterPerson);
            }
        }
Exemplo n.º 2
0
        private void ActorState_Dead(object sender, EventArgs e)
        {
            var actor = _actorManager.Items.Single(x => x.State == sender);

            Map.ReleaseNode(actor.Node, actor);
            _actorManager.Remove(actor);
            actor.State.Dead -= ActorState_Dead;

            if (actor.Person is MonsterPerson monsterPerson)
            {
                var monsterScheme = monsterPerson.Scheme;

                var dropSchemes = GetMonsterDropTables(monsterScheme);

                var loot = new DropTableLoot(actor.Node, dropSchemes, _dropResolver);

                if (loot.Content.CalcActualItems().Any())
                {
                    _propContainerManager.Add(loot);
                }
            }
        }
Exemplo n.º 3
0
        private void ProcessMonsterDeath(IActor actor)
        {
            if (!(actor.Person is MonsterPerson monsterPerson))
            {
                return;
            }

            var monsterScheme = monsterPerson.Scheme;

            var dropSchemes = GetMonsterDropTables(monsterScheme);

            var loot = new DropTableLoot(actor.Node, dropSchemes, _dropResolver);

            if (loot.Content.CalcActualItems().Any())
            {
                _propContainerManager.Add(loot);
            }

            if (ScoreManager != null)
            {
                ScoreManager.CountMonsterDefeat(monsterPerson);
            }
        }