public void UpdateAbility(MoveTypes m, int cd, Locks l) { int i = (int)m; abs[i].Locked = l; abs[i].Cooldown = cd; }
public static bool verifyMove(Line firstLine, Line secondLine, MoveTypes currentMove) { if (firstLine.GetPoints() == null || firstLine.GetPoints().Count <= 2) { return(false); } Vector2 first = firstLine.GetPoints().First(); Vector2 last = firstLine.GetPoints().Last(); bool singleLineDrawn = secondLine == null || secondLine.GetPoints() == null || secondLine.GetPoints().Count <= 2; if (singleLineDrawn) { switch (currentMove) { case MoveTypes.UP: return(IsUp(first, last)); case MoveTypes.DOWN: return(IsDown(first, last)); case MoveTypes.LEFT: return(IsLeft(first, last)); case MoveTypes.RIGHT: return(IsRight(first, last)); } } else { switch (currentMove) { case MoveTypes.UP_UP: return(IsUp(first, last) && IsUp(secondLine.GetPoints().First(), secondLine.GetPoints().Last())); case MoveTypes.DOWN_DOWN: return(IsDown(first, last) && IsDown(secondLine.GetPoints().First(), secondLine.GetPoints().Last())); case MoveTypes.LEFT_LEFT: return(IsLeft(first, last) && IsLeft(secondLine.GetPoints().First(), secondLine.GetPoints().Last())); case MoveTypes.RIGHT_RIGHT: return(IsRight(first, last) && IsRight(secondLine.GetPoints().First(), secondLine.GetPoints().Last())); case MoveTypes.UP_DOWN: return(IsUp(first, last) && IsDown(secondLine.GetPoints().First(), secondLine.GetPoints().Last())); case MoveTypes.DOWN_UP: return(IsDown(first, last) && IsUp(secondLine.GetPoints().First(), secondLine.GetPoints().Last())); case MoveTypes.LEFT_RIGHT: return(IsLeft(first, last) && IsRight(secondLine.GetPoints().First(), secondLine.GetPoints().Last())); case MoveTypes.RIGHT_LEFT: return(IsRight(first, last) && IsLeft(secondLine.GetPoints().First(), secondLine.GetPoints().Last())); } } return(false); }
public Movement(Block target, MoveTypes move, float probability) { this.Target = target; this.Move = move; this.Probability = probability; this.isGuess = true; }
public Movement(Block target, MoveTypes move) { this.Target = target; this.Move = move; this.isGuess = false; this.Probability = 1.0f; }
public Move(Square from, Square to, MoveTypes type = MoveTypes.Normal) : this() { From = from; To = to; Type = type; }
public void TestAllBasicMove() { Square expectedFrom = Squares.a2; Square expectedTo = Squares.h8; var expectedPromotionPiece = PieceTypes.Queen; const MoveTypes expectedMoveType = MoveTypes.Promotion; // full move spectrum var move = Move.Create(expectedFrom, expectedTo, MoveTypes.Promotion, expectedPromotionPiece); var actualFrom = move.FromSquare(); var actualTo = move.ToSquare(); var actualPromotionPiece = move.PromotedPieceType(); var actualEMoveType = move.MoveType(); // test promotion status Assert.True(move.IsPromotionMove()); Assert.True(move.IsQueenPromotion()); // test squares Assert.Equal(expectedFrom, actualFrom); Assert.Equal(expectedTo, actualTo); // test promotion pieces Assert.Equal(expectedPromotionPiece, actualPromotionPiece); // move type Assert.True(move.IsQueenPromotion()); Assert.True(move.IsPromotionMove()); Assert.Equal(expectedMoveType, actualEMoveType); Assert.False(move.IsCastlelingMove()); Assert.False(move.IsEnPassantMove()); }
public void clone(Maneuver other) { name = other.name; mod_string = other.mod_string; move_type = other.move_type; modifiers = new Dictionary<string, float>(other.modifiers); }
public void DoMove(MoveTypes moveType) { switch (moveType) { case MoveTypes.Up: position.y++; break; case MoveTypes.Down: position.y--; break; case MoveTypes.Left: position.x--; break; case MoveTypes.Right: position.x++; break; default: throw new ArgumentOutOfRangeException(nameof(moveType), moveType, null); } UpdatePosition(); }
private void MakeLock(MoveTypes m) { int mIndex = (int)m; int cd = cooldowns[mIndex]; Locks l = Locks.OPEN; if (cd >= 3) { l = Locks.HECKA; } else { int iPoint = starting_index; if (moves.Count > 3) { iPoint = starting_index + 3; } else { iPoint = starting_index + moves.Count; } if (iPoint < 0) { iPoint = 0; } cd = cHistory[iPoint][mIndex]; outcool = cHistory[iPoint]; if (cd > 0) { l = Locks.CLOSED; } } abMaster.UpdateAbility(m, cd, l); }
public void clone(Maneuver other) { name = other.name; mod_string = other.mod_string; move_type = other.move_type; modifiers = new Dictionary <string, float>(other.modifiers); }
public void Zero_is_returned_with_scissors_rock() { _player1 = MoveTypes.Scissors; _player2 = MoveTypes.Rock; Execute(); _winnerIndex.Should().Equal(1); }
public void One_is_returned_with_rock_paper() { _player1 = MoveTypes.Rock; _player2 = MoveTypes.Paper; Execute(); _winnerIndex.Should().Equal(1); }
public void Zero_is_returned_with_paper_rock() { _player1 = MoveTypes.Paper; _player2 = MoveTypes.Rock; Execute(); _winnerIndex.Should().Equal(0); }
public void One_is_returned_with_paper_scissors() { _player1 = MoveTypes.Paper; _player2 = MoveTypes.Scissors; Execute(); _winnerIndex.Should().Equal(1); }
public void Minus_1_is_returned_if_both_do_scissor() { _player1 = MoveTypes.Scissors; _player2 = MoveTypes.Scissors; Execute(); _winnerIndex.Should().Equal(Game.DrawPlayerIndex); }
public void One_is_returned_with_rock_scissors() { _player1 = MoveTypes.Rock; _player2 = MoveTypes.Scissors; Execute(); _winnerIndex.Should().Equal(0); }
public void Zero_is_returned_with_scissors_paper() { _player1 = MoveTypes.Scissors; _player2 = MoveTypes.Paper; Execute(); _winnerIndex.Should().Equal(0); }
public void DoMovePlayer(string id, MoveTypes moveType) { var player = _players.FirstOrDefault(x => x.Id == id); if (player != null) { player.DoMove(moveType); } }
/** * Take all cards from talon and put them back in the stock */ public void ReplinishStock(MoveTypes moveType = MoveTypes.NORMAL) { SnapManager talonSnapManager = talon.GetComponentInChildren <SnapManager>(); Card[] talonCards = talonSnapManager.GetCardSet(); if (DEBUG_MODE) { Debug.Log("Cards in talon:"); } // Need to iterate in reverse order so that the cards are drawn from the stock in the same order as before for (int i = talonCards.Length - 1; i >= 0; i--) { Card card = talonCards[i]; // Remove from talon card.transform.parent = null; // Move the card position from the talon to the stock card.transform.position = new Vector3( m_stockPile.position.x, m_stockPile.position.y, card.transform.position.z ); // Rotate the card to be face down again card.Flip(false); // Add the card to the stock card.transform.parent = m_stockPile; // Flip the first card from the stock pile over to the talon automatically if (i == 0) { // Don't track this move card.MoveTo(m_talonPile, null, MoveTypes.INCOGNITO); // Need to manually flip card because of not tracking if (card.IsFaceDown()) { card.Flip(); } } } // Track replinish event if (moveType.Equals(MoveTypes.NORMAL)) { Move move = new Move(); move.SetSpecial(true); Event ev = new Event(); ev.SetType(Event.EventType.REPLINISH); move.AddEvent(ev); AddMove(move, MoveTypes.NORMAL); } }
public void After_first_move_moves_are_to_beat_the_previous_one(MoveTypes previous, MoveTypes expected) { _tacticalPlayer.Moves.Add(previous); Execute(); _randomGenerator.Verify(r => r.GetMove(), Times.Never); _result.Should().Equal(expected); }
//protected int maxMoveAmount; // Max number of moves the piece can move each turn //protected string allowedMoveType; // [UP, DOWN, LEFT, RIGHT UDLR, DIAGONAL, ALL, CUSTOM] //protected Vector2 customMove; // Change in the (x, y) or (y, x) positions for the custom move ((2, 1) == Normal chess horse), ((0, 0) == No customMove) //protected string customMoveOrder; // [XY, YX, BOTH, NONE] which order the vector can be used. ((XY) == Only x, y), ((YX) == Only y, x), ((BOTH) == Both x, y and y, x), ((NONE) == there's no customMove) #endregion Old // Base_Piece() Constructor public Base_Piece(Texture2D texture, float xPos, float yPos, Color colorOverlay, int maxMoveAmount, MoveTypes allowedMoveType, float customMoveX, float customMoveY, CustomMoveOrders customMoveOrder, PieceType pieceType) : base(texture, xPos, yPos, colorOverlay) { this.maxMoveAmount = maxMoveAmount; this.allowedMoveType = allowedMoveType; this.customMove.X = customMoveX; this.customMove.Y = customMoveY; this.customMoveOrder = customMoveOrder; this.pieceType = pieceType; }
public MoveStep(MoveTypes moveType, DataFormats dataFormat, Position position, string velocity, string accel, string blend) { MoveType = moveType; DataFormat = dataFormat; Position = position; Accel = accel; Velocity = velocity; Blend = blend; }
public bool Get_ContainMoveType(MoveTypes mType) { for (int i = 0; i < minos.Count; i++) { if (minos[i].MoveType == mType) { return(true); } } return(false); }
static void DoStep(PatternHierarchyModel[] nextStepPrimaries) { var nextSteps = new List <NextStepInfo>(); for (Int32 isd = 0; isd < nextStepPrimaries.Count(); isd++) { Console.WriteLine("\tStep {0} {1} of {2}", nextStepPrimaries[0].HerarchyLevel, isd + 1, nextStepPrimaries.Count()); CubeModel cubeStartingPoint = Logic.Create(XyzCubeTypes.OrangeWhiteBlue); Logic.SetCubeState(cubeStartingPoint, nextStepPrimaries[isd].ConnectedPattern); String normalizedPattern = PatternLogic.GetCubePattern(cubeStartingPoint); Parallel.For(1, 28, (Int32 iMove) => // for (var iMove = 1; iMove < 28; iMove++) { CubeModel cubeClone = Logic.CloneCube(cubeStartingPoint); MoveTypes moveType = (MoveTypes)iMove; Logic.RunMove(cubeClone, moveType); //Debug.Write("moveType:" + moveType); String cubeCloneRaw = PatternLogic.GetCubePattern(cubeClone); String cubeClonedNormalized = PatternLogic.GetFirstPatternAlphabetically(cubeCloneRaw); String relationship = Logic.Convert(moveType); String reverseRelationship = Logic.Convert(Logic.Reverse(moveType)); lock (nextSteps) { var nextStep = nextSteps.FirstOrDefault(x => x.PrimaryPatternId == nextStepPrimaries[isd].ConnectedPatternId && x.ConnectedPattern == cubeClonedNormalized); if (nextStep == default) { SqlHierarchyId patternHierarchyHid = SqlHierarchyId.Parse($"{nextStepPrimaries[isd].PatternHierarchyHid}{iMove}/"); nextSteps.Add(new NextStepInfo( patternHierarchyHid, nextStepPrimaries[isd].ConnectedPatternId, '|' + relationship + '|', '|' + reverseRelationship + '|', cubeClonedNormalized)); } else { nextStep.Relationship += relationship + '|'; nextStep.ReverseRelationship = '|' + reverseRelationship + nextStep.ReverseRelationship; } } //Console.WriteLine("\t\tMove {0}", iMove); } ); } SaveStep(nextSteps); }
public Move(MoveTypes moveType, byte cardPlayed) { _moveType = moveType; if (IsACard(cardPlayed)) { _cardPlayed = cardPlayed; } else { throw new UnparseableCardException("Attempted to create Move class with invalid card played.", cardPlayed); } }
public static MoveTypes randomMove(MoveTypes exlude, int difficulty) { MoveTypes nextMoveValue = exlude; while (exlude == nextMoveValue) { Array values = Enum.GetValues(typeof(MoveTypes)); System.Random random = new System.Random(); int maxValue = difficulty > 0 ? values.Length : 4; nextMoveValue = (MoveTypes)values.GetValue(random.Next(maxValue)); } return(nextMoveValue); }
/** * Process undo and redo move actions */ private void ProcessMoveAction(MoveTypes moveType) { bool undoAction = moveType.Equals(MoveTypes.UNDO); CustomStack <Move> targetMoves = undoAction ? m_moves : m_undoneMoves; CustomStack <Move> altMoves = undoAction ? m_undoneMoves : m_moves; // Pop the last move from the moves list/stack Move move = targetMoves.Pop(); if (move.IsSpecial()) { // Special moves should only have one event Event ev = move.GetEvents()[0]; ev.Reverse(); // Swap the event type for proper redo Event.EventType evType = ev.GetEventType(); Event.EventType newEvType = Event.EventType.NONE; switch (evType) { case Event.EventType.REPLINISH: newEvType = Event.EventType.DEPLINISH; break; case Event.EventType.DEPLINISH: newEvType = Event.EventType.REPLINISH; break; } ev.SetType(newEvType); m_blocked = false; } else { // Take precedence over events in the move (execute them first) List <Event> events = move.GetEvents(); foreach (Event evt in events) { // Reverse the event evt.Reverse(); } // Perform the move; don't want to track changes so that undone moves are managed through here move.GetTopCard().MoveTo(undoAction ? move.GetPreviousParent() : move.GetNextParent(), move.GetCards(), moveType); } // Add the move to the redo stack altMoves.Push(move); }
// Returns whether an ability is on cooldown(now) (true is available to use) public bool CurrCooldown(MoveTypes m) { int index = 0; if (moves.Count >= 3) { index = starting_index + 3; } else { index = starting_index + moves.Count; } Debug.Log(cHistory.Count + " : count + index : " + index); return(cHistory[index][(int)m] > 0 ? false : true); //return (cooldowns[(int)m] < 3 ? cHistory[cHistory.Count - 1][(int)m] == 0 : false); }
public ANPCObject(PigTypes pigType, SpriteGenerator sprites, Vector2 beginPosition, Dictionary <TextTypes, SpriteFont> spriteFonts, MoveTypes moveTypes) { text = new EnemyText(spriteFonts); switch (pigType) { case PigTypes.Standard: this.sprites = sprites.GetSpritePig(12); break; default: break; } Positie = beginPosition; this.MovementType = moveTypes; CheckSprites(); }
private void rewardMoveType(Move move) { var type = moveType(move, WTM()); var nIndex = Array.IndexOf(MoveTypes, type); if (nIndex < 0) { throw new PositionException($"Could not find the {type} MoveType"); } else if (nIndex > 0) { MoveTypes.Place(0, nIndex); } // // New ordering inherited by subsequent children: // MoveTypeOrdering = Compress(MoveTypes); }
public static string MoveTypeToString(MoveTypes moveType, bool isLeftMove) { switch (moveType) { case MoveTypes.UP: return(isLeftMove ? "UP" : ""); case MoveTypes.UP_UP: return("UP"); case MoveTypes.UP_DOWN: return(isLeftMove ? "UP" : "DOWN"); case MoveTypes.DOWN_UP: return(isLeftMove ? "DOWN" : "UP"); case MoveTypes.DOWN: return(isLeftMove ? "DOWN" : ""); case MoveTypes.DOWN_DOWN: return("DOWN"); case MoveTypes.LEFT: return(isLeftMove ? "LEFT" : ""); case MoveTypes.LEFT_LEFT: return("LEFT"); case MoveTypes.RIGHT: return(isLeftMove ? "RIGHT" : ""); case MoveTypes.RIGHT_RIGHT: return("Right"); case MoveTypes.LEFT_RIGHT: return(isLeftMove ? "LEFT" : "RIGHT"); case MoveTypes.RIGHT_LEFT: return(isLeftMove ? "RIGHT" : "LEFT"); } return(""); }
/** * */ public void AddMove(Move move, MoveTypes moveType) { switch (moveType) { case MoveTypes.NORMAL: m_moves.Push(move); // Clear the redo stack if there are moves in it. m_undoneMoves.Clear(); break; case MoveTypes.REDO: m_moves.Push(move); break; case MoveTypes.UNDO: m_undoneMoves.Push(move); break; } }
//type-dependant constructors public Move(Point movpoint_init, MoveTypes movtype_init) { movPoint = movPoint = movpoint_init; moveType = movtype_init; ensidePoint = Point.Empty; rookPoint = Point.Empty; newrookPoint = Point.Empty; } //Standard
/// <summary> /// Checks if a movetype is available. /// </summary> /// <param name="moveType"></param> /// <returns></returns> private bool IsFlagSet(MoveTypes moveType) { return (moveType & this.MoveType) == moveType; }
/// <summary> /// ignores pathfinding to reach the target /// </summary> public MoveResult MoveToDirect(Vector3 position) { _movementType = MoveTypes.Direct; if (_lastRequestedMoveTargetPosition != position) { _moveResult = MoveResult.Moving; _pathToTarget = new List<Vector3> {position}; _lastRequestedMoveTargetPosition = position; } return _moveResult; }
public void StopMovement() { _movementType = MoveTypes.Direct; _pathToTarget = new List<Vector3> {transform.position}; _moveResult = MoveResult.ReachedTarget; SetAnimatorSpeed(NotMoving); }
public MoveResult FleeFrom(Vector3 position) { _movementType = MoveTypes.FleePathing; if (_lastRequestedMoveTargetPosition != position) { _pathToTarget.Clear(); _moveResult = MoveResult.Preparing; _lastRequestedMoveTargetPosition = position; if (!RequestFleePath(position)) { _lastRequestedMoveTargetPosition = transform.position; } } return _moveResult; }
{ movPoint = movPoint = movpoint_init; moveType = movtype_init; ensidePoint = Point.Empty; rookPoint = Point.Empty; newrookPoint = Point.Empty; } //Standard public Move(Point movpoint_init, MoveTypes movtype_init, Point ensidepoint_init) { movPoint = movPoint = movpoint_init; moveType = movtype_init; ensidePoint = ensidepoint_init; rookPoint = Point.Empty; newrookPoint = Point.Empty; } //En Passant
{ movPoint = movPoint = movpoint_init; moveType = movtype_init; ensidePoint = ensidepoint_init; rookPoint = Point.Empty; newrookPoint = Point.Empty; } //En Passant public Move(Point movpoint_init, MoveTypes movtype_init, Point rookpoint_init, Point newrookpoint_init) { movPoint = movPoint = movpoint_init; moveType = movtype_init; ensidePoint = Point.Empty; rookPoint = rookpoint_init; newrookPoint = newrookpoint_init; } //Castle
public Dictionary<string, float> modifiers = new Dictionary<string, float>(); //this is for modifiers like speed or turning public void reset() { name = null; move_type = MoveTypes.forward; popup = null; }