public void CanAssignRandomValueToAttack() { ICharacter character = new Character("Blbdfd", 100, 100, 5); IRoundActions actions = new RoundActions(); var attackDamage = actions.Attack(character); Assert.AreEqual(6, attackDamage); }
public void HeroCanCreateAnIntegerValueRepresentingRoundsAttackDamage() { ICharacter hero = new Hero("Meh", 100, 100, 25); ICharacter monster = new Monster("Bob", 100, 44); IRoundActions actions = new RoundActions(); var heroAttackDamage = actions.Attack(hero); Assert.AreEqual(26, heroAttackDamage); }
public void CanDecrementStatsBasedOnAttackDamage() { ICharacter character = new Character("bsedrfsdf", 100, 100, 5); IRoundActions actions = new RoundActions(); var attackDamage = actions.Attack(character); character = DecrementStats.DecrementHealthPoints(character, attackDamage); Assert.AreEqual(95, character.HitPoints); }
public void CanMitigateDamageBasedOnBlockValue() { ICharacter character = new Character("vdisosdf", 100, 100, 20); ICharacter character2 = new Character("monster", 100, 100, 10); IRoundActions actions = new RoundActions(); var attackDamage = actions.Attack(character); var attackDamageAfterBlock = actions.Block(attackDamage); Assert.AreEqual(6, attackDamageAfterBlock); Assert.AreEqual(9, attackDamageAfterBlock); }
public void DoAction(PokerPlayer player, PlayerAction action, int bet = 0, bool isforced = false, bool verbose = true) { if (!isforced && CurrentTurn != player) { return; } var pm = player.Owner; string message = string.Empty; Exporter.AddAction(pm, action, State, action == PlayerAction.AllIn ? player.Currency : bet); switch (action) { case PlayerAction.Bet: message = String.Format("I {0} {1}.", "bet", bet); MakeBet(player, bet); MinimumBet = bet; //raise after a bet is always 2*bet according to poker rules MinimumRaise = bet * 2; break; case PlayerAction.Raise: message = String.Format("I {0} {1}.", RoundActions.Exists(x => x == PlayerAction.Raise) ? "reraise" : "raise", bet); MakeBet(player, GetCallAmount(player) + bet); MinimumBet += bet; MinimumRaise = bet; break; case PlayerAction.Call: message = "I call."; //match what is on the table from the last player. This takes into account how much you already have on the table in that round bet = GetCallAmount(player); MakeBet(player, bet); break; case PlayerAction.Check: message = "Check."; break; case PlayerAction.Fold: message = "I fold."; player.HasFolded = true; if (ActivePlayers.Count(x => !x.HasFolded) == 1) { DoShowdown(); return; } break; case PlayerAction.AllIn: if (player.Currency > 0) { message = MinimumBet > player.Currency ? "I call: all-in." : "All in."; int difference = player.Currency + player.TotalBetInRound; if (difference > MinimumBet) { MinimumBet = difference; } MakeBet(player, player.Currency); } break; } RefreshGumps(); if (verbose) { PokerMessage(pm, message); } if (!isforced) { player.HasActed = true; } RoundActions.Add(action); if (!isforced && !CanEndBettingRound()) { AssignNextTurn(); } }
public bool HasRaised() { return(RoundActions.Exists(x => x == PlayerAction.Raise)); }
/// <summary> /// Raises can only be made if a bet has already been posted /// <returns>amount needed to meet call</returns> /// </summary> public bool CanRaise() { return(RoundActions.Exists(x => x == PlayerAction.Bet)); }