Пример #1
0
 public Path(Point _start, Point _end, Map _map)
 {
     start = _start;
     end = _end;
     map = _map;
     random = new Random();
 }
Пример #2
0
 public override UndoCommand Run(Map map, Point attacked_point)
 {
     if(!CanAttack(map, attacked_point))
         return null;
     map.CreateNode(new UnavailableNodeFactory(), attacked_point);
     return new UndoRemoveNodeCommand(attacked_point);
 }
Пример #3
0
 public override UndoCommand Run(Map map, Point attacked_point)
 {
     if (!CanAttack(map, attacked_point))
         return null;
     ProgramNode attacked_node = map.GetNode<ProgramNode>(attacked_point);
     Program attacked_program = attacked_node.Program;
     IncreaseProgramSpeed(attacked_program, Speed);
     return null;
 }
Пример #4
0
 public override UndoCommand Run(Map map, Point attacked_point)
 {
     if (!CanAttack(map, attacked_point))
         return null;
     ProgramNode attacked_node = map.GetNode<ProgramNode>(attacked_point);
     Program attacked_program = attacked_node.Program;
     IEnumerable<ProgramNode> removed_nodes = DamageProgram(map, attacked_node, Strength);
     return new UndoDamageCommand(removed_nodes);
 }
Пример #5
0
 public override bool CanAttack(Map map, Point attacked_point)
 {
     if (!map.NodeIsType<ProgramNode>(attacked_point))
         return false;
     ProgramNode attacked_node = (ProgramNode)map.GetNode(attacked_point);
     if (map.CurrentPlayer != null && attacked_node.Player == map.CurrentPlayer)
         return false;
     return true;
 }
Пример #6
0
 public override bool Run(Map map)
 {
     return command.Run(map, attacked_point) != null;
 }
Пример #7
0
 public override bool CanAttack(Map map, Point attacked_point)
 {
     if (!map.NodeIsType<ProgramNode>(attacked_point))
         return false;
     return true;
 }
Пример #8
0
 public override bool CanAttack(Map map, Point attacked_point)
 {
     return map.GetNode(attacked_point).GetType() == typeof(AvailableNode);
 }
Пример #9
0
 public override bool Run(Map map)
 {
     return map.AddProgramNodes(_removed_nodes);
 }
Пример #10
0
 public abstract bool Run(Map map);
Пример #11
0
 public UndoCommand RunCommand(Map map, Point attacked_point, string command_name)
 {
     if (has_run_command || !HasCommand(command_name))
         return null;
     UndoCommand retval = GetCommand(command_name).Run(map, attacked_point);
     if (retval != null)
     {
         retval.MovesLeft = Moves.MovesLeft;
         Moves.DecreaseMovesLeft(Moves.MovesLeft);
         has_run_command = true;
     }
     return retval;
 }
Пример #12
0
 public bool CanAttack(Map map, Point attacked_point, string command_name)
 {
     if (has_run_command || !HasCommand(command_name))
         return false;
     return GetCommand(command_name).CanAttack(map, attacked_point);
 }
Пример #13
0
 public bool RunUndoCommand(Map map, UndoCommand command)
 {
     if (command == null)
         return false;
     bool retval = command.Run(map);
     if (retval)
     {
         Moves.DecreaseMovesLeft(Moves.MovesLeft); // to make sure Moves left is zero
         Moves.IncreaseMovesLeft(command.MovesLeft);
         has_run_command = false;
     }
     return retval;
 }
Пример #14
0
 public Server(Map map)
 {
     _map = map;
     _children = new List<Server>();
     _id = Guid.NewGuid();
     _parents = new List<Server>();
 }