Exemplo n.º 1
0
        public EActResults Interract(Creature _creature, LiveMapCell _liveMapCell)
        {
            var tuple = World.TheWorld.GetRemoteActivation(MechanismId);

            tuple.Item1.RemoteActivation(_creature, tuple.Item2);
            return(EActResults.DONE);
        }
Exemplo n.º 2
0
		public SplatterDropper(WorldLayer _layer, LiveMapCell _from, int _strength, FColor _color, LiveMapCell _to): base(EALNouns.NONE, _layer, 0)
		{
			m_strenght = _strength;
			m_color = _color;

			var d = _to.PathMapCoords - _from.PathMapCoords;
			World.TheWorld.CreatureManager.AddCreature(this, _from.WorldCoords, _from.LiveCoords, _layer);
			m_path = _from.LiveCoords.GetLineToPoints(_from.LiveCoords + d * 10).ToList();
		}
Exemplo n.º 3
0
        public SplatterDropper(WorldLayer _layer, LiveMapCell _from, int _strength, FColor _color, LiveMapCell _to) : base(EALNouns.NONE, _layer, 0)
        {
            m_strenght = _strength;
            m_color    = _color;

            var d = _to.PathMapCoords - _from.PathMapCoords;

            World.TheWorld.CreatureManager.AddCreature(this, _from.WorldCoords, _from.LiveCoords, _layer);
            m_path = _from.LiveCoords.GetLineToPoints(_from.LiveCoords + d * 10).ToList();
        }
Exemplo n.º 4
0
		public EActResults Close(Creature _creature, LiveMapCell _liveMapCell)
		{
			var door = new ClosedDoor(Material);
			door.SetLockType(m_eLockType);
			_liveMapCell.Thing = door;
			if (_creature.IsAvatar)
			{
				MessageManager.SendXMessage(this, new XMessage(EALTurnMessage.CREATURE_CLOSES_IT, _creature, this));
				//MessageManager.SendMessage(this, this[EPadej.IMEN] + " закрыта.");
			}
			return EActResults.DONE;
		}
Exemplo n.º 5
0
 public static bool IsLockedFor(this Essence _essence, LiveMapCell _cell, Creature _creature)
 {
     if (_essence == null)
     {
         return(false);
     }
     if (_essence.IsFake())
     {
         _essence = _cell.ResolveFakeThing(_creature);
     }
     return(_essence is ICanbeOpened && ((ICanbeOpened)_essence).ELockType != ELockType.OPEN);
 }
Exemplo n.º 6
0
 public static bool CanBeClosed(this Essence _essence, LiveMapCell _cell, Creature _creature)
 {
     if (!(_essence is Thing))
     {
         return(false);
     }
     if (_essence.IsFake())
     {
         _essence = _cell.ResolveFakeThing(_creature);
     }
     return(_essence is ICanbeClosed && ((ICanbeClosed)_essence).ELockType == ELockType.OPEN);
 }
Exemplo n.º 7
0
		public EActResults Open(Creature _creature, LiveMapCell _liveMapCell)
		{
			var door = new OpenDoor(Material);
			door.SetLockType(m_eLockType);
			_liveMapCell.Thing = door;

			if (_creature.IsAvatar)
			{
				MessageManager.SendXMessage(this, new XMessage(EALTurnMessage.CREATURE_OPENS_IT, _creature, this));
			}
			return EActResults.DONE;
		}
Exemplo n.º 8
0
        public EActResults Open(Creature _creature, LiveMapCell _liveMapCell)
        {
            var door = new OpenDoor(Material);

            door.SetLockType(m_eLockType);
            _liveMapCell.Thing = door;

            if (_creature.IsAvatar)
            {
                MessageManager.SendXMessage(this, new XMessage(EALTurnMessage.CREATURE_OPENS_IT, _creature, this));
            }
            return(EActResults.DONE);
        }
Exemplo n.º 9
0
		public Missile(WorldLayer _layer, LiveMapCell _from, int _speed, Item _ammo, LiveMapCell _to)
			: base(_ammo.ENoun, _layer, _speed)
		{
			Ammo = _ammo;
			var d = (_to.PathMapCoords - _from.PathMapCoords)*10;
			if(d.Lenght>32)
			{
				d = d*31/(int)d.Lenght;
			}
			World.TheWorld.CreatureManager.AddCreature(this, _from.WorldCoords, _from.LiveCoords, _layer);
			m_path = _from.LiveCoords.GetLineToPoints(_from.LiveCoords + d).ToList();
			m_light = new LightSource(10, new FColor(2f, 1f, 0.8f, 0.4f));
		}
Exemplo n.º 10
0
        public EActResults Close(Creature _creature, LiveMapCell _liveMapCell)
        {
            var door = new ClosedDoor(Material);

            door.SetLockType(m_eLockType);
            _liveMapCell.Thing = door;
            if (_creature.IsAvatar)
            {
                MessageManager.SendXMessage(this, new XMessage(EALTurnMessage.CREATURE_CLOSES_IT, _creature, this));
                //MessageManager.SendMessage(this, this[EPadej.IMEN] + " закрыта.");
            }
            return(EActResults.DONE);
        }
Exemplo n.º 11
0
        public Missile(WorldLayer _layer, LiveMapCell _from, int _speed, Item _ammo, LiveMapCell _to)
            : base(_ammo.ENoun, _layer, _speed)
        {
            Ammo = _ammo;
            var d = (_to.PathMapCoords - _from.PathMapCoords) * 10;

            if (d.Lenght > 32)
            {
                d = d * 31 / (int)d.Lenght;
            }
            World.TheWorld.CreatureManager.AddCreature(this, _from.WorldCoords, _from.LiveCoords, _layer);
            m_path  = _from.LiveCoords.GetLineToPoints(_from.LiveCoords + d).ToList();
            m_light = new LightSource(10, new FColor(2f, 1f, 0.8f, 0.4f));
        }
Exemplo n.º 12
0
        public EActResults Open(Creature _creature, LiveMapCell _liveMapCell)
        {
            if (ELockType != ELockType.OPEN)
            {
                MessageManager.SendXMessage(this, new XMessage(EALTurnMessage.CREATURE_OPENS_IT, _creature, this));
                ELockType = ELockType.OPEN;

                var collection = GetItems(_creature);
                if (collection.Any)
                {
                    //обязать по любасу показать диалог выбора предметов
                    _creature.AddActToPool(new TakeAct(), true, collection.Items, _liveMapCell.LiveCoords);
                }
                else
                {
                    MessageManager.SendXMessage(this, new XMessage(EALTurnMessage.CONTAINER_IS_EMPTY, _creature, this));
                }

                return(EActResults.DONE);
            }
            throw new NotImplementedException();
        }
Exemplo n.º 13
0
		public EActResults Open(Creature _creature, LiveMapCell _liveMapCell)
		{
			if (ELockType != ELockType.OPEN)
			{
				MessageManager.SendXMessage(this, new XMessage(EALTurnMessage.CREATURE_OPENS_IT, _creature, this));
				ELockType = ELockType.OPEN;

				var collection = GetItems(_creature);
				if (collection.Any)
				{
					//обязать по любасу показать диалог выбора предметов
					_creature.AddActToPool(new TakeAct(), true, collection.Items, _liveMapCell.LiveCoords);
				}
				else
				{
					MessageManager.SendXMessage(this, new XMessage(EALTurnMessage.CONTAINER_IS_EMPTY, _creature, this));
				}

				return EActResults.DONE;
			}
			throw new NotImplementedException();
		}
Exemplo n.º 14
0
		public EssenceDescriptor(Essence _essence, LiveMapCell _cell, IContainer _container, Creature _creature)
		{
			m_creature = _creature;
			if (_essence is IFaked)
			{
				if (_container != null)
				{
					if (_essence is Item)
					{
						_essence = _container.ResolveFakeItem(_creature, (FakedItem)_essence);
					}
					else
					{
						throw new NotImplementedException("Как так?");
					}
				}
				else if(_cell!=null)
				{
					if (_essence is Item)
					{
						_essence = _cell.ResolveFakeItem(_creature, (FakedItem)_essence);
					}
					else if (_essence is Thing)
					{
						_essence = _cell.ResolveFakeThing(_creature);
					}
					
				}
				else
				{
					throw new NotImplementedException("Как так?");
				}
				
			}
			Essence = _essence;
			LiveCoords = _cell!=null?_cell.LiveCoords:null;
			Container = _container;
		}
Exemplo n.º 15
0
	    public LiveMap()
		{
			m_visibilityManager = new LosManager(AVATAR_SIGHT);

			Blocks = new LiveMapBlock[SIZE_IN_BLOCKS,SIZE_IN_BLOCKS];
			Cells = new LiveMapCell[SIZE_IN_CELLS,SIZE_IN_CELLS];

			CenterLiveBlock = Point.Zero;

			{
				var blockIds = new List<Point>();
				for (var i = 0; i < SIZE_IN_BLOCKS; i++) for (var j = 0; j < SIZE_IN_BLOCKS; j++) blockIds.Add(new Point(i, j));
				m_blockIds = blockIds.ToArray();
			}

			for (var index = 0; index < m_blockIds.Length; index++)
			{
				var id = m_blockIds[index];
				Blocks[id.X, id.Y] = new LiveMapBlock(this, id, index);
			}

			PathFinder = new PathFinder(SIZE_IN_CELLS);
		}
Exemplo n.º 16
0
 public EssenceDescriptor(Essence _essence, LiveMapCell _cell, IContainer _container, Creature _creature)
 {
     m_creature = _creature;
     if (_essence is IFaked)
     {
         if (_container != null)
         {
             if (_essence is Item)
             {
                 _essence = _container.ResolveFakeItem(_creature, (FakedItem)_essence);
             }
             else
             {
                 throw new NotImplementedException("Как так?");
             }
         }
         else if (_cell != null)
         {
             if (_essence is Item)
             {
                 _essence = _cell.ResolveFakeItem(_creature, (FakedItem)_essence);
             }
             else if (_essence is Thing)
             {
                 _essence = _cell.ResolveFakeThing(_creature);
             }
         }
         else
         {
             throw new NotImplementedException("Как так?");
         }
     }
     Essence    = _essence;
     LiveCoords = _cell != null?_cell.LiveCoords:null;
     Container  = _container;
 }
Exemplo n.º 17
0
 public EActResults Interract(Creature _creature, LiveMapCell _liveMapCell)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 18
0
		public EActResults Interract(Creature _creature, LiveMapCell _liveMapCell)
		{
			throw new NotImplementedException();
		}
Exemplo n.º 19
0
		public EActResults Interract(Creature _creature, LiveMapCell _liveMapCell)
		{
			var tuple = World.TheWorld.GetRemoteActivation(MechanismId);
			tuple.Item1.RemoteActivation(_creature, tuple.Item2);
			return EActResults.DONE;
		}
Exemplo n.º 20
0
	    public override float GetFogColorMultiplier(LiveMapCell _liveCell) { return _liveCell.DungeonFogColorMultiplier; }
Exemplo n.º 21
0
 public virtual float GetFogColorMultiplier(LiveMapCell _liveCell)
 {
     return(_liveCell.FogColorMultiplier);
 }
Exemplo n.º 22
0
        protected EActResults Find(Creature _creature, Func <Essence, LiveMapCell, bool> _predicate, out LiveMapCell _liveMapCell)
        {
            _liveMapCell = null;

            var list = new List <Point>();

            foreach (var point in Point.NearestDPoints)
            {
                var cc = _creature[point];
                if (cc.Thing != null && _predicate(cc.Thing, cc))
                {
                    list.Add(point);
                }
                else if (cc.GetAllAvailableItemDescriptors <Thing>(_creature).Any(_descriptor => _predicate(_descriptor.Essence, cc)))
                {
                    list.Add(point);
                }
            }
            if (_creature.GetBackPackItems().Any(_descriptor => _predicate(_descriptor.Essence, null)))
            {
                list.Add(Point.Zero);
            }

            var coords = list.Distinct().ToList();

            if (GetParameter <Point>().Any())
            {
                coords = coords.Intersect(GetParameter <Point>()).ToList();
            }

            if (!coords.Any())
            {
                return(EActResults.QUICK_FAIL);
            }
            if (coords.Count() > 1)
            {
                MessageManager.SendMessage(this, new AskMessageNg(this, EAskMessageType.ASK_DIRECTION));
                return(EActResults.NEED_ADDITIONAL_PARAMETERS);
            }
            _liveMapCell = _creature[coords.First()];
            return(EActResults.NONE);
        }
Exemplo n.º 23
0
        protected EActResults FindCreature(Creature _creature, Func <Creature, LiveMapCell, bool> _predicate, out LiveMapCell _liveMapCell)
        {
            _liveMapCell = null;

            var list = new List <Point>();

            foreach (var point in Point.NearestDPoints)
            {
                var cc = _creature[point];
                if (cc.Creature != null && _predicate(cc.Creature, cc))
                {
                    list.Add(point);
                }
            }

            var coords = list.Distinct().ToList();

            if (GetParameter <Point>().Any())
            {
                coords = coords.Intersect(GetParameter <Point>()).ToList();
            }

            if (!coords.Any())
            {
                return(EActResults.QUICK_FAIL);
            }
            if (coords.Count() > 1)
            {
                MessageManager.SendMessage(this, new AskMessageNg(this, EAskMessageType.ASK_DIRECTION));
                return(EActResults.NEED_ADDITIONAL_PARAMETERS);
            }
            _liveMapCell = _creature[coords.First()];
            return(EActResults.NONE);
        }
Exemplo n.º 24
0
	    public virtual float GetFogColorMultiplier(LiveMapCell _liveCell) { return _liveCell.FogColorMultiplier; }
Exemplo n.º 25
0
 public override float GetFogColorMultiplier(LiveMapCell _liveCell)
 {
     return(_liveCell.DungeonFogColorMultiplier);
 }