public void Move_from_directional_input(Keys key, CmdDirection direction) { Queue(key); Cmd = _strategy.GetCommand(__being); Assert.That(Cmd.Action, Is.EqualTo(CmdAction.Direction)); Assert.That(Cmd.Direction, Is.EqualTo(direction)); }
public Command(CmdAction action, CmdDirection direction, IItem item = null, IUsable usable = null) { Action = action; Direction = direction; Item = item; Usable = usable; }
public void Direction_commands_take_time(CmdDirection direction, int tickOff) { player.MoveTo((2, 2)); var cmd = new Command(CmdAction.Direction, direction, null); _controls.CommandBeing(player, cmd); __schedule.Received().AddAgent(player, tickOff); }
public void Direction_commands_change_location(CmdDirection direction, int newX, int newY) { var newCoord = new Coord(newX, newY); player.MoveTo((2, 2)); var cmd = new Command(CmdAction.Direction, direction, null); _controls.CommandBeing(player, cmd); Assert.That(player.GetPosition(), Is.EqualTo(newCoord)); var mapPosition = _gameState.Map.BeingMap.GetPosition(player); Assert.That(mapPosition, Is.EqualTo(newCoord)); }
public void Moving_to_unwalkable_tile_does_nothing(CmdDirection direction) { __describer.Describe("").ReturnsForAnyArgs("a wall"); player.MoveTo((3, 2)); player.IsPlayer = true; var cmd = new Command(CmdAction.Direction, direction, null); _controls.CommandBeing(player, cmd); var curPosition = player.GetPosition(); Assert.That(curPosition, Is.EqualTo(new Coord(3, 2))); __messager.Received().WriteLineIfPlayer(player, "I can't walk through a wall."); }
public Command(ScsiCommandCode code, byte cdbsize, IntPtr buffer, int bufsize, CmdDirection dir, int timeout) { m_cdb = new byte[cdbsize]; m_cdb[0] = (byte)code; m_buffer_size = bufsize; if (bufsize == 0) { m_buffer = IntPtr.Zero; } else { m_delete_buffer = false; m_buffer = buffer; } m_dir = dir; m_timeout = timeout; }
private Command Direction(IBeing being, CmdDirection dir) { var newPosition = Controls.CoordInDirection(being.GetPosition(), dir); var targetRot = gameState.Map.RotMap.GetItem(newPosition); if (targetRot != null) { //0.1.STORY increase impact--this is an early landmark in the story if (!Story.HasClearedRot) { rotDirection = dir; Messager.WriteLine("The filth covering the ground sets my teeth on edge. I'm growling."); return(NextStepIs(Direction_decide_to_Clear_Rot, "Am I going after this stuff bare-handed? ", being)); } } return(FinishedCommand(CmdAction.Direction, dir)); }
public Command(ScsiCommandCode code, byte cdbsize, int bufsize, CmdDirection dir, int timeout) { Debug.Assert(bufsize < UInt16.MaxValue); m_cdb = new byte[cdbsize]; m_cdb[0] = (byte)code; m_buffer_size = bufsize; if (bufsize == 0) m_buffer = IntPtr.Zero; else { m_delete_buffer = true; m_buffer = Marshal.AllocHGlobal(bufsize); RtlZeroMemory(m_buffer, bufsize); } m_dir = dir; m_timeout = timeout; }
public Command(ScsiCommandCode code, byte cdbsize, int bufsize, CmdDirection dir, int timeout) { Debug.Assert(bufsize < UInt16.MaxValue); m_cdb = new byte[cdbsize]; m_cdb[0] = (byte)code; m_buffer_size = bufsize; if (bufsize == 0) { m_buffer = IntPtr.Zero; } else { m_delete_buffer = true; m_buffer = Marshal.AllocHGlobal(bufsize); RtlZeroMemory(m_buffer, bufsize); } m_dir = dir; m_timeout = timeout; }
public Command Direction_decide_to_Clear_Rot(AsciiKey press, IBeing being) { // Decision mechanic: hit 'y', or travel in a direction // towards rot (in which case, the decision direction will // be the attack direction, even if different from the original // direction). Any other response cancels move/attack. bool affirm = press.Key == Keys.Y; if (!affirm) { var dir = DirectionOf(press); if (dir != CmdDirection.None) { var dirCoord = Controls.CoordInDirection(being.GetPosition(), dir); var dirRot = gameState.Map.RotMap.GetItem(dirCoord); affirm = (dirRot != null); if (affirm) { rotDirection = dir; } } } if (affirm) { Story.HasClearedRot = true; WriteLine("Yes. Now."); Log.Info("Decided to clear Rot."); return(FinishedCommand(CmdAction.Direction, rotDirection)); } else { return(CancelMultiStep("Not yet.")); } }
public Coord CoordInDirection(Coord start, CmdDirection direction) { int newX = start.X; int newY = start.Y; if (direction.HasFlag(CmdDirection.North)) { newY--; } if (direction.HasFlag(CmdDirection.South)) { newY++; } if (direction.HasFlag(CmdDirection.West)) { newX--; } if (direction.HasFlag(CmdDirection.East)) { newX++; } return(newX, newY); }
public Command(ScsiCommandCode code, byte cdbsize, IntPtr buffer, int bufsize, CmdDirection dir, int timeout) { m_cdb = new byte[cdbsize]; m_cdb[0] = (byte)code; m_buffer_size = bufsize; if (bufsize == 0) m_buffer = IntPtr.Zero; else { m_delete_buffer = false; m_buffer = buffer; } m_dir = dir; m_timeout = timeout; }
public virtual void ApplyTo(Coord position, IControlPanel controls, ILogWindow output, CmdDirection direction) { //output.Add($"Can't use a {Name} on {tile.TileType} to my {direction}."); }
private Command FinishedCommand(CmdAction action, CmdDirection direction, IItem item = null, IUsable usable = null) { nextStep = null; return(new Command(action, direction, item, usable)); }