internal PlayerBoardState Copy(BoardState boardState) { var original = this; var toReturn = new PlayerBoardState(original) { playerSetup = original.playerSetup, manaMax = original.manaMax, manaTotal = original.manaTotal, manaThisTurn = original.manaThisTurn, templateDeck = original.templateDeck, fatigueDamage = original.fatigueDamage, startCards = original.startCards, board = boardState, maxBoardSize = original.maxBoardSize, deckSize = original.deckSize, playerNr = original.playerNr }; toReturn.myDeck = CopyAList(templateDeck, original.myDeck, boardState, toReturn); toReturn.myHand = CopyAList(templateDeck, original.myHand, boardState, toReturn); toReturn.myBoard = CopyAList(templateDeck, original.myBoard, boardState, toReturn); toReturn.myBoardWithTaunt = GetTaunts(myBoard); toReturn.Hero = original.Hero.Copy(board, toReturn); this.board = boardState; return(toReturn); }
public Hero Copy(BoardState board, PlayerBoardState playerState) { var toReturn = new Hero(board, player); toReturn.hp = hp; this.board = board; return(toReturn); }
public override ICard InstantiateModel(Deck deck, BoardState board, PlayerBoardState player) { var toReturn = new Card_User_Defined(deck, this, this); toReturn.player = player; toReturn.board = board; return(toReturn); }
List <ICard> CopyAList(Deck deck, List <ICard> oldList, BoardState board, PlayerBoardState player) { List <ICard> newList = new List <ICard>(oldList.Count); oldList.ForEach((item) => { newList.Add(item.Copy(deck, board, player)); }); return(newList); }
public virtual ICard Copy(Deck deck, BoardState boardState, PlayerBoardState playerBoardState) { var card = InstantiateModel(deck, board, playerBoardState); card.SetDamage(GetDamage()); card.SetHasTaunt(HasTaunt()); card.SetHP(hpLeft); card.SetAttack(CanAttack()); return(card); }
public void Update(BoardState newBoard) { statisticResult = newBoard.GetStatistics(); p1 = newBoard.GetPlayer(playerNr.Player1); p2 = newBoard.GetPlayer(playerNr.Player2); isFinished = newBoard.IsFinished(); if (isFinished) { winner = newBoard.GetWinner(); loser = newBoard.GetLoser(); } }
public BoardState(PlayerSetup givenP1, Deck p1Deck1, PlayerSetup givenP2, Deck p2Deck, int startCards) { Random random = new Random(); int randomNumber = random.Next(0, 1000); playerGoingFirst = randomNumber / 500; p1 = new PlayerBoardState(givenP1, playerGoingFirst == 0, p1Deck1, this, playerNr.Player1, startCards); p2 = new PlayerBoardState(givenP2, playerGoingFirst == 1, p2Deck, this, playerNr.Player2, startCards); p1.SetOpponent(p2); p2.SetOpponent(p1); statisticResult = new MatchResult(); }
public void FinishGame(PlayerBoardState loser) { if (p1 == loser) { this.loser = p1; winner = p2; statisticResult.SetWinner(p2.playerSetup.name, p2.GetDeck()); statisticResult.SetLoser(p1.playerSetup.name, p1.GetDeck()); } else { this.loser = p2; winner = p1; statisticResult.SetWinner(p1.playerSetup.name, p1.GetDeck()); statisticResult.SetLoser(p2.playerSetup.name, p2.GetDeck()); } isFinished = true; }
public Hero(BoardState board, PlayerBoardState player) { this.board = board; this.player = player; }
/// <summary> /// Used as ctor for copying /// </summary> public PlayerBoardState(PlayerBoardState original) { }
public void SetOpponent(PlayerBoardState opponent) { this.opponent = opponent; }
public bool CanBePlayed(BoardState board, PlayerBoardState player) { return(true); }
/// <summary> /// Creates a card from a cardpool into a game, without changing the template. /// </summary> /// <param name="deck"></param> /// <param name="board"></param> /// <param name="player"></param> /// <returns></returns> public virtual ICard InstantiateModel(Deck deck, BoardState board, PlayerBoardState player) { throw new NotSupportedException("Override InstantiateModel if inheriting from CardTemplate, this template is not suppose to be instantiated as Model"); }