public override Dictionary <MapSquare, MapSquare.Interactable> GetValidInputSquares() { Dictionary <MapSquare, MapSquare.Interactable> inputSquares = new Dictionary <MapSquare, MapSquare.Interactable>(); if (targets.Count == 0) { MapSquare frontSquare = startSquare.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Forward, startFacingDirection)); KeyValuePair <MapSquare, MapSquare.Interactable> temp; temp = GetInteractable(frontSquare); inputSquares.Add(temp.Key, temp.Value); temp = GetInteractable(frontSquare.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Left, startFacingDirection))); inputSquares.Add(temp.Key, temp.Value); temp = GetInteractable(frontSquare.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Right, startFacingDirection))); inputSquares.Add(temp.Key, temp.Value); } else { foreach (Tools.Direction direction in new Tools.Direction[] { Tools.Direction.NorthEast, Tools.Direction.NorthWest, Tools.Direction.SouthEast, Tools.Direction.SouthWest }) { MapSquare square = targets.Peek().mapSquare.GetNeighbour(direction); if (square && square.unit && Tools.UnitIsEnemy(square.unit) && !targets.Contains(square.unit)) { inputSquares.Add(square, MapSquare.Interactable.ActiveChoice); } else if (square) { inputSquares.Add(square, MapSquare.Interactable.InactiveChoice); } } } return(inputSquares); }
public virtual void AttemptMove(Tools.Direction direction) { if (CanMove(direction)) { ChangeSquare(mapSquare.GetNeighbour(direction), direction); } else { mapSquare.GetNeighbour(direction).FailedEnteringSquare(this); } }
private MapSquare[] GetEndNeighbours() { MapSquare[] endNeighbours = new MapSquare[2]; MapSquare temp = unit.mapSquare; //for(int i = 0; i < actions.Count; i++) //{ // if (unit.CanMove(startFacing)) // temp = temp.GetNeighbour(startFacing); //} endNeighbours[0] = temp.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Left, startFacingDirection)); endNeighbours[1] = temp.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Right, startFacingDirection)); return(endNeighbours); }
public override void ExecuteCard() { foreach (Tools.Direction dir in new Tools.Direction[] { Tools.Direction.NorthEast, Tools.Direction.NorthWest, Tools.Direction.SouthEast, Tools.Direction.SouthWest }) { MapSquare temp = startSquare; for (int i = 0; i < level; i++) { if (temp.HasNeighbour(dir)) { temp = temp.GetNeighbour(dir); if (temp.unit && Tools.UnitIsEnemy(temp.unit)) { actions.Push(new DamageAction(unit, cardColor, temp.unit)); } } else { break; } } } base.ExecuteCard(); }
public override void ExecuteCard() { Tools.Direction[] directions = { Tools.Direction.North, Tools.Direction.East, Tools.Direction.West, Tools.Direction.South }; foreach (Tools.Direction direction in directions) { MapSquare temp = GameMaster.Instance.currentPlayer.character.mapSquare; while (temp.HasNeighbour(direction)) { temp = temp.GetNeighbour(direction); if (temp.unit != null && temp.unit is Champion) { temp.unit.TakeDamage(); } } } base.ExecuteCard(); }
public override void Input(MapSquare inputSquare) { MapSquare temp = unit.mapSquare; Tools.Direction moveDirection = Tools.GetDirectionFromFacing(moveFacing, startFacingDirection); while (temp != inputSquare) { if (unit.CanMove(moveDirection)) { doneMoves++; } else { doneMoves = minMaxMoves.Item2; } temp = temp.GetNeighbour(moveDirection); actions.Push(new MoveAction(unit, moveDirection)); } }
protected Dictionary <MapSquare, MapSquare.Interactable> GetInputsForOneDirection(Tools.Direction targetDirection) { Dictionary <MapSquare, MapSquare.Interactable> directionInputSquares = new Dictionary <MapSquare, MapSquare.Interactable>(); MapSquare temp = unit.mapSquare.GetNeighbour(targetDirection); encounteredUntenterableSquare = false; for (int i = 1; i <= minMaxMoves.Item2 - doneMoves; i++) { if (temp != null) { if (encounteredUntenterableSquare) { directionInputSquares.Add(temp, MapSquare.Interactable.InactiveChoice); } else if (i + doneMoves < minMaxMoves.Item1) { directionInputSquares.Add(temp, MapSquare.Interactable.NonfinalChoice); } else if (i + doneMoves <= minMaxMoves.Item2) { directionInputSquares.Add(temp, MapSquare.Interactable.ActiveChoice); if (!temp.CanEnterSquare(unit, targetDirection)) { encounteredUntenterableSquare = true; } } temp = temp.GetNeighbour(targetDirection); } else { break; } } return(directionInputSquares); }
public override void ExecuteCard() { List <Unit> targets = new List <Unit>(); for (int i = 0; i < level; i++) { MapSquare temp = startSquare.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Forward, startFacingDirection)); while (temp) { if (temp.unit && !targets.Contains(temp.unit)) { if (Tools.UnitIsEnemy(temp.unit)) { actions.Push(new DamageAction(unit, cardColor, temp.unit)); targets.Add(temp.unit); } break; } temp = temp.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Forward, startFacingDirection)); } } base.ExecuteCard(); }
private Queue <MapSquare> GetTargetSquares() { Queue <MapSquare> targetSquares = new Queue <MapSquare>(); MapSquare temp = startSquare; for (int i = 0; i < 2; i++) { temp = temp.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Forward, startFacingDirection)); if (temp) { targetSquares.Enqueue(temp); } } for (int i = 1; i < level; i++) { if (temp) { if (!targetSquares.Contains(temp)) { targetSquares.Enqueue(temp); } if (temp.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Right, startFacingDirection))) { targetSquares.Enqueue(temp.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Right, startFacingDirection))); } if (temp.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Left, startFacingDirection))) { targetSquares.Enqueue(temp.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Left, startFacingDirection))); } temp = temp.GetNeighbour(Tools.GetDirectionFromFacing(Tools.Facing.Forward, startFacingDirection)); } } return(targetSquares); }