/// <summary> /// Searchs the normal moves. /// </summary> /// <param name="piece">Piece.</param> /// <param name="moves">Moves.</param> private void SearchNormalMoves(PieceData piece, MoveSet moves) { TileNode cur = node; // extend out by the range and search for more. for (int r = 0; r < piece.range; r++) { // move to next tile cur = cur.adjacent[piece.direction]; // check if current tile is one you can move to if (CheckCurrentTileMove(cur)) { moves.AddMove(node, false, cur); } // check if any more moves can be made after (not including range) if (!CheckFurtherMovement(cur)) { break; } // run checks to see if hooking is possible if (CheckHookMove(cur, piece)) { moves.AddMove(node, true, cur, cur.adjacent[hook.direction]); } } }
public void CreateMoveSet() // Just for testing { MoveSet.Add(new Attack("Downward Strike", 3)); MoveSet.Add(new Attack("Upward Strike", 3)); MoveSet.Add(new Attack("Thrust", 5)); MoveSet.Add(new Attack("ULTIMATE NOT OVERPOWERED ATTACK", 9999)); }
public void GameBoard_QueenMustPlayByFourthMoveValidMovesTest() { GameBoard b = new GameBoard(); Assert.IsNotNull(b); // Turn 1 b.Play(new Move(PieceName.WhiteSpider1, Position.Origin)); b.Play(new Move(PieceName.BlackSpider1, Position.Origin.NeighborAt(Direction.Up))); // Turn 2 b.Play(new Move(PieceName.WhiteSpider2, Position.Origin.NeighborAt(Direction.Down))); b.Play(new Move(PieceName.BlackSpider2, Position.Origin.NeighborAt(StraightLine(Direction.Up, 2)))); // Turn 3 b.Play(new Move(PieceName.WhiteSoldierAnt1, Position.Origin.NeighborAt(StraightLine(Direction.Down, 2)))); b.Play(new Move(PieceName.BlackSoldierAnt1, Position.Origin.NeighborAt(StraightLine(Direction.Up, 3)))); // Turn 4 MoveSet validMoves = b.GetValidMoves(); Assert.IsNotNull(validMoves); Assert.AreEqual(7, validMoves.Count); foreach (Move move in validMoves) { Assert.AreEqual(PieceName.WhiteQueenBee, move.PieceName); } }
public Neuromon(string name, int health, GameType type, MoveSet moveSet) { Type = type; Name = name; Health = health; MoveSet = moveSet; }
public MockAPI(MineResult result, Move move, PlayerData player, MoveSet role) { this.result = result; this.move = move; this.player = player; this.role = role; }
public void MoveSet_AddMultipleDuplicateByEnumerableTest() { Move[] movesToAdd = _validMovesSorted; MoveSet ms = new MoveSet(); Assert.IsNotNull(ms); Assert.AreEqual(0, ms.Count); ms.Add(movesToAdd); Assert.AreEqual(movesToAdd.Length, ms.Count); foreach (Move move in movesToAdd) { Assert.IsTrue(ms.Contains(move)); } ms.Add(movesToAdd); Assert.AreEqual(movesToAdd.Length, ms.Count); foreach (Move move in movesToAdd) { Assert.IsTrue(ms.Contains(move)); } }
void Start() { cc = GetComponent <PlayerController2D>(); rb = GetComponent <Rigidbody2D>(); sr = GetComponent <SpriteRenderer>(); moveset = GetComponent <MoveSet>(); input = GetComponent <InputHandler>(); anim = GetComponent <Animator>(); health = GetComponent <Health>(); audioSource = GetComponent <AudioSource>(); ailmentHandler = GetComponent <AilmentHandler>(); knockbackListener = GetComponent <KnockbackListener>(); cameraFocusPointDefaultPosition = cameraFocusPoint.transform.position; playerOffset = transform.position; spellList = FindObjectOfType <SpellDatabase>(); fas = GetComponent <FighterAnimationScript>(); input.player = this; input.spellDatabase = spellList; fas.fighter = this; fas.cc = cc; fas.anim = anim; gm = FindObjectOfType <GameManager>(); rm = FindObjectOfType <RespawnManager>(); maxNumberOfJumps++; cc.m_maxJumps = maxNumberOfJumps; cc.m_doubleJumpEnabled = canDoubleJump; comboTimer = defaultComboTime; }
public void CreateMoveSet() // Just for testing { MoveSet.Add(new Attack("Downward Strike", 3, Animation.Downward)); MoveSet.Add(new Attack("Upward Strike", 3, Animation.Upward)); MoveSet.Add(new Attack("Thrust", 5, Animation.Thrust)); MoveSet.Add(new Attack("PRAISE THE SUN", 9999, Animation.Special)); }
public void SetCatMove(MoveSet catMove) { if (canSelectMove) { Cat.moveSet = catMove; } }
/// <summary> /// Creates a new character with the given name, max health, stats and moves. /// </summary> public Character( string name, string team, int maxHealth, StatSet stats, MoveSet moves, Ability ability) { Id = Guid.NewGuid().ToString(); Name = name; Team = team; MaxHealth = maxHealth; CurrentHealth = maxHealth; Stats = stats; Moves = moves; AbilitySlot = new AbilitySlot(); AbilitySlot.Set(ability); ItemSlot = new ItemSlot(); ProtectQueue = new List <Character>(); ProtectLimit = 1; }
/// <summary> /// Generates all legal <see cref="IPawn" /> moves /// </summary> /// <param name="boardState"></param> public override void GenerateMoves(IBoardState boardState) { IChessPieceMover cpm = ModelLocator.ChessPieceMover; MoveSet.Clear(); ChessPosition oneSpaceFromLocation = Color == ChessColor.White ? cpm.North(Location) : cpm.South(Location); bool oneSpaceMoveIsLegal = !boardState.Contains(oneSpaceFromLocation); if (oneSpaceMoveIsLegal) { MoveSet.Add(oneSpaceFromLocation); } else { return; } ChessPosition twoSpaceFromLocation = Color == ChessColor.White ? cpm.North(oneSpaceFromLocation) : cpm.South(oneSpaceFromLocation); bool twoSpaceMoveIsLegal = !boardState.Contains(twoSpaceFromLocation); if (!HasMoved && twoSpaceMoveIsLegal) { MoveSet.Add(Color == ChessColor.White ? cpm.North(cpm.North(Location)) : cpm.South(cpm.South(Location))); } }
public void MoveSet_RemoveMultipleByEnumerableTest() { Move[] validMoves = _validMovesSorted; MoveSet ms = new MoveSet(); Assert.IsNotNull(ms); Assert.AreEqual(0, ms.Count); ms.Add(validMoves); Assert.AreEqual(validMoves.Length, ms.Count); foreach (Move move in validMoves) { Assert.IsTrue(ms.Contains(move)); } ms.Remove(validMoves); Assert.AreEqual(0, ms.Count); foreach (Move move in validMoves) { Assert.IsFalse(ms.Contains(move)); } }
public void MoveSet_NewTest() { MoveSet ms = new MoveSet(); Assert.IsNotNull(ms); Assert.AreEqual(0, ms.Count); }
public void MoveSet_RemoveMultipleTest() { Move[] validMoves = _validMovesSorted; MoveSet ms = new MoveSet(); Assert.IsNotNull(ms); int count = 0; Assert.AreEqual(count, ms.Count); foreach (Move move in validMoves) { Assert.IsTrue(ms.Add(move)); count++; Assert.AreEqual(count, ms.Count); Assert.IsTrue(ms.Contains(move)); } foreach (Move move in validMoves) { Assert.IsTrue(ms.Remove(move)); count--; Assert.AreEqual(count, ms.Count); Assert.IsFalse(ms.Contains(move)); } }
public void MoveSet_AddMultipleDuplicateTest() { Move[] movesToAdd = _validMovesSorted; MoveSet ms = new MoveSet(); Assert.IsNotNull(ms); int count = 0; Assert.AreEqual(count, ms.Count); foreach (Move move in movesToAdd) { Assert.IsTrue(ms.Add(move)); count++; Assert.AreEqual(count, ms.Count); Assert.IsTrue(ms.Contains(move)); } foreach (Move move in movesToAdd) { Assert.IsFalse(ms.Add(move)); Assert.AreEqual(count, ms.Count); Assert.IsTrue(ms.Contains(move)); } }
void Start() { moveset = GetComponent <MoveSet>(); moveset.spellBookSet_A = new List <Item.Spellbook>(); moveset.spellBookSet_B = new List <Item.Spellbook>(); moveset.spellBookSet_C = new List <Item.Spellbook>(); moveset.spellBookSet_A.Add(new Item.Spellbook()); moveset.spellBookSet_B.Add(new Item.Spellbook()); moveset.spellBookSet_C.Add(new Item.Spellbook()); foreach (Attack atk in SpellSetA) { SpellBook_A.attacks.Add(atk); } foreach (Attack atk in SpellSetB) { SpellBook_B.attacks.Add(atk); } foreach (Attack atk in SpellSetC) { SpellBook_C.attacks.Add(atk); } moveset.spellBookSet_A.Add(SpellBook_A); moveset.spellBookSet_A.Add(SpellBook_B); moveset.spellBookSet_A.Add(SpellBook_C); moveset.spellBookSet_C = moveset.spellBookSet_B = moveset.spellBookSet_A; //moveset.spellBook_B_Button; }
public List <BoardPosition> GetAvaibleMoves(BoardPosition bp) { List <BoardPosition> moves = new List <BoardPosition>(); MoveSet moveSets = board[bp.X, bp.Y].GetPiece().pieceType.GetMoveSet(); BoardPosition positionList = new BoardPosition(); positionList = bp; BoardPosition currentPosition; Piece p = board[bp.X, bp.Y].GetPiece(); moves.Add(bp); currentPosition = positionList; foreach (Move m in moveSets.getMoves()) { currentPosition = positionList; if (IsInParameters(currentPosition, m, p)) { currentPosition = new BoardPosition(currentPosition.X + m.DeltaRow, currentPosition.Y + m.DeltaColumn); moves.Add(currentPosition); if (moveSets.IsMultiple()) { while (IsInParameters(currentPosition, m, p)) { currentPosition = new BoardPosition(currentPosition.X + m.DeltaRow, currentPosition.Y + m.DeltaColumn); moves.Add(currentPosition); } } } } return(moves); }
public override void GenerateMoves(IBoardState boardState) { foreach (var move in TestMoves) { MoveSet.Add(move); } }
public override void Update(float elapsed, GraphicsDevice graphicsDevice, Vector2 p_Position) { // Obtain the player position // to be able to move towards him playerPosition = p_Position; ApplyPhysics(elapsed); // If the boss is alive if (GetHealth() > 0) { fsm.Update(elapsed); FSMWaitTime += elapsed; // If the timer is up, // then it's time to switch to // a random state if (FSMWaitTime >= FSMWaitDelay) { currentMove = (MoveSet)currentMoveNum; int previousMoveNum = currentMoveNum; currentMoveNum = rand.Next(0, 3); // To make sure it hasn't randomized // to the same state if (currentMoveNum == previousMoveNum) { currentMoveNum++; currentMoveNum = currentMoveNum % 3; } FSMWaitTime = 0.0f; // To initiate the direction again // when switching to a new state initialPositionSet = false; } } // Else play the die animation else { sprite.PlayAnimation(dieAnimation); } // To make sure the boss // doesn't go out bounds position.X = MathHelper.Clamp(position.X, localBounds.Width / 3, graphicsDevice.Viewport.Width - localBounds.Width / 3); // Update the boss weapons sword.Update(elapsed, new Vector2(GetPosition().X, GetPosition().Y + 50.0f)); left_wave.Update(elapsed, new Vector2(GetPosition().X, GetPosition().Y + 50.0f), -1f, graphicsDevice); right_wave.Update(elapsed, new Vector2(GetPosition().X, GetPosition().Y + 50.0f), 1f, graphicsDevice); }
private void InitializeMoveSet() { //currentMoveSetObject = (GameObject)statesManager.GetCharacterStateValue(ConstantStrings.MOVE_SET); moveSet = currentMoveSetObject.GetComponent <MoveSet>(); SetAllMoveSetObjects(); SetAllAbilitySpawnLocations(); GetAllAbilityTimers(); }
public void MoveSet_EmptyToStringTest() { MoveSet ms = new MoveSet(); Assert.IsNotNull(ms); Assert.AreEqual("", ms.ToString()); }
private void VerifyValidMoves(Board board, MoveSet expectedMoves) { Assert.IsNotNull(board); Assert.IsNotNull(expectedMoves); MoveSet actualMoves = board.GetValidMoves(); TestUtils.AssertHaveEqualChildren(expectedMoves, actualMoves); }
private void GenerateSouthSouthWestMove(IBoardState boardState, IChessPieceMover cpm) { ChessPosition move = cpm.South(cpm.SouthWest(Location)); if (!boardState.Contains(move)) { MoveSet.Add(move); } }
public void MoveSet_ToStringTest() { MoveSet ms = new MoveSet(); Assert.IsNotNull(ms); ms.Add(_validMovesSorted); Assert.AreEqual(_validMovesSortedString, ms.ToString()); }
private void GenerateEastNorthEastMove(IBoardState boardState, IChessPieceMover cpm) { ChessPosition move = cpm.East(cpm.NorthEast(Location)); if (!boardState.Contains(move)) { MoveSet.Add(move); } }
//public string MoveSetType; public Weapon(string name, EquipmentTypes type, int id, WeaponProps _props, string meshName, string hitboxType, string movesetType) : base(name, type, id, meshName) { Hitbox = ((GameObject)Resources.Load($"Equipment/Hitboxes/{hitboxType}")).GetComponent <Hitbox>(); //Mesh = ((GameObject)Resources.Load($"Equipment/Weapons/Meshes/{meshName}")).GetComponent<SkinnedMeshRenderer>(); MoveSet = new MoveSet(); //MoveSet.AnimatorOverride = (AnimatorOverrideController)Resources.Load($"Equipment/MoveSets/Female/{movesetType}"); MoveSet.MovesetType = movesetType; props = _props; }
void MoveSetChanged(object newMoveSet) { currentMoveSetObject = (GameObject)newMoveSet; moveSet = currentMoveSetObject.GetComponent <MoveSet>(); SetAllMoveSetObjects(); SetAllAbilitySpawnLocations(); GetAllAbilityTimers(); CastOneOff(); }
private void GenerateEastMoves(IBoardState boardState, IChessPieceMover cpm) { ChessPosition nextMove = cpm.East(Location); if (!boardState.Contains(nextMove)) { MoveSet.Add(nextMove); } }
// Use this for initialization void Start() { player = FindObjectOfType <MoveSet>(); if (player.transform.localScale.x < 0) { speed = -speed; } }
/// <summary> /// Searchs the reverse hook moves. /// </summary> /// <param name="piece">Piece.</param> /// <param name="moves">Moves.</param> private void SearchReverseHookMoves(PieceData piece, MoveSet moves) { TileNode cur = node.adjacent[hook.direction]; TileNode hooked = node.adjacent[hook.direction]; #region reverse hook condition // can't revese hook your own pieces if (piece.colour == owningColour) { return; } // must have tower of 6 to hook if (pieces.Count != 6) { return; } // check if able to move on the given tile if (!CheckCurrentTileMove(cur)) { return; } // Can't jump or move along the way if (cur.type == TileNode.Type.Way && cur.adjacent[piece.direction] != node) { return; } #endregion // add hook'd //moves.AddMove(node, false, hooked); #region move search // extend out by the range and search for more. for (int r = 0; r < piece.range; r++) { // move to next tile cur = cur.adjacent[piece.direction]; // check if current tile is one you can move to if (CheckCurrentTileMove(cur)) { moves.AddMove(node, true, hooked, cur); } // check if any more moves can be made after (not including range) if (!CheckFurtherMovement(cur)) { break; } } #endregion }
/// <summary> /// Returns a set of moves based on random way roll. /// </summary> /// <param name="roll"></param> /// <returns></returns> public MoveSet GetWayMove(int roll, int wayLineID) { MoveSet moves = new MoveSet(); bool c = false; if (roll == 9) { c = true; roll = 5; moves.AddMove(node, false, node); // on a c, player can stay } else if (roll > 4) { roll -= 4; } for (int d = 0; d < 6; d++) { TileNode cur = node; if (node.adjacent[d] == null) { continue; } // not along the way, look in another direction if (wayLineID != node.adjacent[d].wayLine && node.adjacent[d].type != TileNode.Type.WayCross) { continue; } // keep going along direction d for (int r = 0; r < roll; r++) { if (cur.adjacent[d] == null || cur.adjacent[d].type == TileNode.Type.Block) { break; } cur = cur.adjacent[d]; // Can't capture own pieces if (cur.tower != null && cur.tower.owningColour == owningColour) { continue; } if (c || r == roll - 1) { moves.AddMove(node, false, cur); } } } return(moves); }