public void Next() { switch (_Stage) { case EStage.Config: _Stage = EStage.Names; break; case EStage.Names: _Stage = EStage.Main; GameData.Team = CBase.Game.GetRandom(100) < 50 ? 0 : 1; CBase.Songs.ResetSongSung(); GameData.CurrentRoundNr = 1; _CreateRounds(); _SetNumJokers(); _PreparePlayerList(0); break; case EStage.Main: _Stage = EStage.Singing; _StartRound(GameData.FieldNr); break; case EStage.Singing: _Stage = EStage.Main; GameData.Team = GameData.Team == 1 ? 0 : 1; _UpdatePlayerList(); break; default: throw new ArgumentException("Invalid stage: " + _Stage); } _FadeToScreen(); }
public void SeeAction(EStage stage, int playerNum, EActionType action, int amount) { // this is called to inform you when any player (including yourself) makes an action (eg puts in blinds, checks, folds, calls, raises, or wins hand) if (action == EActionType.ActionFold) { switch (stage) { case EStage.StagePreflop: playerStats[playerNum].NumPreFlopsFolded++; break; case EStage.StageFlop: playerStats[playerNum].NumFlopsFolded++; break; case EStage.StageTurn: playerStats[playerNum].NumTurnsFolded++; break; case EStage.StageRiver: playerStats[playerNum].NumRiversFolded++; break; } } else if (action == EActionType.ActionWin) { // be careful not to double count here. This can be call multiple times for the same player for the same hand if they win more than one side pot if (!playerStats[playerNum].bWonThisHand) { playerStats[playerNum].NumHandsWon++; playerStats[playerNum].bWonThisHand = true; } } }
public void Back() { switch (_Stage) { case EStage.Config: CBase.Graphics.FadeTo(EScreen.Party); return; case EStage.Songs: _Stage = EStage.Config; break; case EStage.Names: _Stage = EStage.Songs; break; case EStage.Main: _Stage = EStage.Names; break; default: // Rest is not allowed throw new ArgumentException("Invalid stage: " + _Stage); } _FadeToScreen(); }
void ProcessCrumbing() { if (SequenceTimer > 2.5f) { m_eCurrentStage = EStage.Crumbled; } }
public void SeeAction(EStage stage, int playerDoingAction, EActionType action, int amount) { if (_botTimeOutMilliSeconds > 0) { if (!IsBotBusy()) { _task = Task.Run(() => { RunSeeAction(stage, playerDoingAction, action, amount); }); // wait X amount of time for task to complete if (!_task.Wait(_botTimeOutMilliSeconds)) { // Note that the task is still running in the background _bIsBotBusy = true; Logger.Log("TIMEOUT: {0} Player {1}", MethodBase.GetCurrentMethod().Name, PlayerNum); } } else { // bot is busy still running the previous task Logger.Log("BOT BUSY: {0} Player {1}", MethodBase.GetCurrentMethod().Name, PlayerNum); } } else { // timeout code disabled - just called method directly RunSeeAction(stage, playerDoingAction, action, amount); } }
void ProcessBreaking() { if (SequenceTimer > 2.5) { m_eCurrentStage = EStage.Broken; } }
public void Next() { switch (_Stage) { case EStage.Config: _Stage = EStage.Names; break; case EStage.Names: _Stage = EStage.Main; CBase.Songs.ResetSongSung(); GameData.ResultTable = new List <CResultTableRow>(); GameData.Rounds = new CChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce); GameData.CurrentRoundNr = 1; GameData.Jokers = null; break; case EStage.Main: _Stage = EStage.Singing; _StartNextRound(); break; case EStage.Singing: _Stage = EStage.Main; _UpdateScores(); break; default: throw new ArgumentException("Invalid stage: " + _Stage); } _FadeToScreen(); }
public override void PlayDeathSequence() { base.SetDeathSequenceStarted(); m_cRipSound.Play(); m_eCurrentStage = EStage.Ripping; }
public void Init() { if (EStage.Free == stage) { this.OnInit(); stage = EStage.Inited; } }
public override void PlayDeathSequence() { base.SetDeathSequenceStarted(); m_cOpenSound.Play(); m_cParticles.particleSystem.Play (); m_eCurrentStage = EStage.Crumbing; }
public void GetAction(EStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out EActionType yourAction, out int amount) { // This is the bit where you need to put the AI (mostly likely based on info you receive in other methods) System.Threading.Thread.Sleep(_sleepMilliSeconds); yourAction = EActionType.ActionCall; amount = callAmount; }
void ProcessRipping() { if (SequenceTimer < 2.128f) { m_cLeftPeice.transform.Translate(0, 0, .0001f); m_cRightPeice.transform.Translate(0, 0, -.0001f); } else { m_eCurrentStage = EStage.Ripped; } }
private void RunSeeAction(EStage stage, int playerDoingAction, EActionType action, int amount) { try { _player.SeeAction(stage, playerDoingAction, action, amount); } catch (Exception e) { Logger.Log(string.Format("EXCEPTION: {0} Player {1} : {2}", MethodBase.GetCurrentMethod().Name, PlayerNum, e.Message)); } }
public override bool Init() { if (!base.Init()) { return(false); } _Stage = EStage.Config; SetDefaults(); return(true); }
private void RunGetAction(EStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize) { try { // call player.GetAction - can't put out params in anonymous method above so doing it this way _player.GetAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize, out _playersAction, out _playersBetAmount); } catch (Exception e) { Logger.Log(string.Format("EXCEPTION: {0} Player {1} : {2}", MethodBase.GetCurrentMethod().Name, PlayerNum, e.Message)); } }
void ProcessBreaking() { if (SequenceTimer > 2.0f) { m_cBreakSound.Play(); m_eCurrentStage = EStage.Broken; foreach (Renderer cTheRenderer in GetComponentsInChildren<Renderer>()) { cTheRenderer.enabled = false; } } }
public void Next() { switch (_Stage) { case EStage.Config: _Stage = EStage.Songs; break; case EStage.Songs: _Stage = EStage.Names; break; case EStage.Names: _Stage = EStage.Main; CBase.Songs.ResetSongSung(); GameData.ResultTable = new List <CResultTableRow>(); GameData.Rounds = new CChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce); GameData.CurrentRoundNr = 1; GameData.Jokers = null; break; case EStage.Main: if (GameData.GameMode == EGameMode.TR_GAMEMODE_MEDLEY) { _Stage = EStage.MedleySinging; _PrepareMedleyRound(); } else { _Stage = EStage.SongSelection; _PrepareSongSelection(); } break; case EStage.SongSelection: _Stage = EStage.Singing; break; case EStage.MedleySinging: case EStage.Singing: _Stage = EStage.Main; _UpdateScores(); break; default: throw new ArgumentException("Invalid stage: " + _Stage); } _FadeToScreen(); }
public void GetAction(EStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out EActionType yourAction, out int amount) { if (stage == EStage.StagePreflop) { if (_currentHand.Any(c => c.Rank == ERankType.RankSeven) && _currentHand.Any(c => c.Rank == ERankType.RankTwo) && _currentHand[0].Suit != _currentHand[1].Suit) { yourAction = EActionType.ActionRaise; amount = maxRaise; } } yourAction = EActionType.ActionFold; amount = 0; }
void StageClear(EStage stage) { switch (stage) { case EStage.Stage1: m_bMonsterturn = false; m_fTime = 0; m_cHeroPrefab1.SetStat(Stat.EStat.EXP, 100); m_cHeroPrefab1.LvUp(); m_cHeroPrefab2.SetStat(Stat.EStat.EXP, 100); m_cHeroPrefab2.LvUp(); m_cHeroPrefab3.SetStat(Stat.EStat.EXP, 100); m_cHeroPrefab3.LvUp(); StageClearUI.SetActive(true); gameManager.m_nStageClearCnt++; Reward(ItemManager.EItem.VITALITY); ReleaseMonsters(); // m_Button.SetActive(true); break; case EStage.Stage2: m_bMonsterturn = false; m_fTime = 0; m_cHeroPrefab1.SetStat(Stat.EStat.EXP, 100); m_cHeroPrefab1.LvUp(); m_cHeroPrefab2.SetStat(Stat.EStat.EXP, 100); m_cHeroPrefab2.LvUp(); m_cHeroPrefab3.SetStat(Stat.EStat.EXP, 100); m_cHeroPrefab3.LvUp(); ReleaseMonsters(); break; case EStage.Stage3: m_bMonsterturn = false; m_fTime = 0; m_cHeroPrefab1.SetStat(Stat.EStat.EXP, 100); m_cHeroPrefab1.LvUp(); m_cHeroPrefab2.SetStat(Stat.EStat.EXP, 100); m_cHeroPrefab2.LvUp(); m_cHeroPrefab3.SetStat(Stat.EStat.EXP, 100); m_cHeroPrefab3.LvUp(); ReleaseMonsters(); break; } m_HeroPrefab.SetActive(false); m_MonsterPrefab.SetActive(false); ReleaseMonsters(); }
public override void SetDefaults() { _Stage = EStage.Config; _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles(); _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting(); _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF; _ScreenSongOptions.Selection.SongIndex = -1; if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE) { _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON; } GameData.ResultTable = new List <CResultTableRow>(); }
// broadcast action of a player to all players (including themselves) private void BroadcastAction(EStage stage, int playerNumDoingAction, EActionType action, int amount) { var sLogMsg = string.Format("Player {0} {1} {2}", playerNumDoingAction, action, amount); if (_players[playerNumDoingAction].StackSize <= 0) { sLogMsg += " *ALL IN*"; } Logger.Log(sLogMsg); foreach (var player in _players) { player.SeeAction(stage, playerNumDoingAction, action, amount); } }
ERet CallUtil(EStage fromStage, EStage toStage, FnToCall fn) { if (toStage == stage) { return(ERet.Success); } if (fromStage != stage) { return(ERet.Fail); } ERet ret = fn(); if (ERet.Success == ret) { stage = toStage; } return(ret); }
public override void SetDefaults() { _Stage = EStage.Config; _ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles(); _ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting(); _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF; _ScreenSongOptions.Selection.SongIndex = -1; if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE) { _ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON; } GameData.Songs.Clear(); GameData.Rounds.Clear(); GameData.PlayerTeam1.Clear(); GameData.PlayerTeam2.Clear(); }
public void GetAction(EStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out EActionType playersAction, out int playersBetAmount) { // Default to fold if exception or timeout playersAction = EActionType.ActionFold; playersBetAmount = 0; if (_botTimeOutMilliSeconds > 0) { if (!IsBotBusy()) { _task = Task.Run(() => { RunGetAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize); }); // wait X amount of time for task to complete // if method has not returned in time then use default action if (_task.Wait(_botTimeOutMilliSeconds)) { playersAction = _playersAction; playersBetAmount = _playersBetAmount; } else { // Note that the task is still running in the background Logger.Log("TIMEOUT: {0} Player {1}", MethodBase.GetCurrentMethod().Name, PlayerNum); } } else { // bot is busy still running the previous task Logger.Log("BOT BUSY: {0} Player {1}", MethodBase.GetCurrentMethod().Name, PlayerNum); } } else { // timeout code disabled - just called method directly RunGetAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize); playersAction = _playersAction; playersBetAmount = _playersBetAmount; } ValidateAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize, ref playersAction, ref playersBetAmount); }
void StageManager() { // Switches stages based on health lost if (enemyHealth >= 10 && currentStage != EStage.EStageOne) { currentStage = EStage.EStageOne; currentState = EState.ENone; } else if (enemyHealth < 10 && enemyHealth > 5 && currentStage != EStage.EStageTwo) { print("Stage Two"); currentStage = EStage.EStageTwo; currentState = EState.ENone; } else if (enemyHealth <= 5 && currentStage != EStage.EStageThree) { print("Stage Three"); currentStage = EStage.EStageThree; currentState = EState.ENone; } }
public void GetAction(EStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out EActionType yourAction, out int amount) { yourAction = EActionType.ActionFold; amount = 0; // This is the bit where you need to put the AI (mostly likely based on info you receive in other methods) if (stage == EStage.StageShowdown) { // if stage is the showdown then choose whether to show your hand or fold yourAction = EActionType.ActionShow; amount = 0; } else { // stage is preflop, flop, turn or river // choose whether to fold, check, call or raise // the controller will validate your action and try to honour your action if possible but may change it (e.g. it won't let you fold if checking is possible) // amount only matters if you are raising (if calling the controller will use the correct amount). // If raising, minRaise and maxRaise are the total amount required to put into the pot (i.e. it includes the call amount) // Side pots are now implemented so you can go all in and call or raise even if you have less than minimum int actionNum = _rnd.Next(100); if (actionNum < 20) { yourAction = EActionType.ActionFold; amount = 0; } else if (actionNum < 60) { yourAction = EActionType.ActionCall; amount = callAmount; } else { yourAction = EActionType.ActionRaise; amount = minRaise; } } }
public void GetAction(EStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out EActionType yourAction, out int amount) { // This is the bit where you need to put the AI (mostly likely based on info you receive in other methods) int i = 1 / zero; if (stage == EStage.StageShowdown) { // if stage is the showdown then choose whether to show your hand or fold yourAction = EActionType.ActionShow; amount = 0; } else { // stage is preflop, flop, turn or river // choose whether to fold, check, call or raise // the controller will validate your action and try to honour your action if possible but may change it (e.g. it won't let you fold if checking is possible) // amount only matters if you are raising (if calling the controller will use the correct amount). // If raising, minRaise and maxRaise are the total amount required to put into the pot (i.e. it includes the call amount) // Side pots aren't implemented so if you run out of money you can still call (but not raise) and your stack size may go negative. // If your stack size is still 0 or negative at the end of the hand then you are out of the game. yourAction = EActionType.ActionCall; amount = callAmount; } }
public void SeeAction(EStage stage, int playerNum, EActionType action, int amount) { // this is called to inform you when any player (including yourself) makes an action (eg puts in blinds, checks, folds, calls, raises, or wins hand) System.Threading.Thread.Sleep(_sleepMilliSeconds); }
private void ValidateAction(EStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, ref EActionType playersAction, ref int playersBetAmount) { // *** Fix up action if (stage == EStage.StageShowdown) { if (playersAction != EActionType.ActionFold) { playersAction = EActionType.ActionShow; } playersBetAmount = 0; } else { var bAllIn = false; if (playersBetAmount < 0) { playersBetAmount = 0; } if (playersAction == EActionType.ActionRaise) { /* * // We shouldn't increase a players bet - but can reduce it if outside limits * if (playersBetAmount < minRaise) * { * playersBetAmount = minRaise; * } */ if (playersBetAmount > maxRaise) { playersBetAmount = maxRaise; } } if (playersBetAmount > StackSize) { playersBetAmount = StackSize; } if (playersBetAmount == StackSize) { bAllIn = true; } // -- Validate action - prevent player from doing anything illegal if (playersAction != EActionType.ActionFold && playersAction != EActionType.ActionCheck && playersAction != EActionType.ActionCall && playersAction != EActionType.ActionRaise) { // invalid action - default to call playersAction = EActionType.ActionCall; } if (playersAction == EActionType.ActionFold && callAmount == 0) { // invalid action - don't fold if they can check playersAction = EActionType.ActionCheck; } if (playersAction == EActionType.ActionCheck && callAmount > 0) { // invalid action - can't check so change to call playersAction = EActionType.ActionCall; } if (playersAction == EActionType.ActionRaise && playersBetAmount <= callAmount) { // not enough chips to raise - just call playersAction = EActionType.ActionCall; } if (playersAction == EActionType.ActionRaise && playersBetAmount > callAmount && playersBetAmount < minRaise && !bAllIn) { // not enough chips to raise - just call unless going allin playersAction = EActionType.ActionCall; } if (playersAction == EActionType.ActionRaise && (raisesRemaining <= 0)) { // no more raises allowed playersAction = EActionType.ActionCall; } if (playersAction == EActionType.ActionCall && callAmount == 0) { // change call to check if callAmount = 0 playersAction = EActionType.ActionCheck; } // *** Fix betAmount if (playersAction == EActionType.ActionFold || playersAction == EActionType.ActionCheck) { playersBetAmount = 0; } if (playersAction == EActionType.ActionCall) { playersBetAmount = callAmount; if (playersBetAmount > StackSize) { playersBetAmount = StackSize; } } } }
public override void SetDefaults() { _Stage = EStage.Config; GameData.CurrentRoundNr = 1; GameData.ResultTable = new List <CResultTableRow>(); }
public void GetAction(EStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out EActionType yourAction, out int amount) { yourAction = EActionType.ActionRaise; amount = minRaise; }
public void GetAction(EStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out EActionType playersAction, out int playersBetAmount) { // Default to fold if exception or timeout playersAction = EActionType.ActionFold; playersBetAmount = 0; if (_botTimeOutMilliSeconds > 0) { if (!IsBotBusy()) { _task = Task.Run(() => { RunGetAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize);}); // wait X amount of time for task to complete // if method has not returned in time then use default action if (_task.Wait(_botTimeOutMilliSeconds)) { playersAction = _playersAction; playersBetAmount = _playersBetAmount; } else { // Note that the task is still running in the background Logger.Log("TIMEOUT: {0} Player {1}", MethodBase.GetCurrentMethod().Name, PlayerNum); } } else { // bot is busy still running the previous task Logger.Log("BOT BUSY: {0} Player {1}", MethodBase.GetCurrentMethod().Name, PlayerNum); } } else { // timeout code disabled - just called method directly RunGetAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize); playersAction = _playersAction; playersBetAmount = _playersBetAmount; } ValidateAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize, ref playersAction, ref playersBetAmount); }
public void SeeAction(EStage stage, int playerNum, EActionType action, int amount) { }
private void DoBettingRound(EStage stage, out int lastToAct) { var bDone = false; var raisesRemaining = _maxNumRaisesPerBettingRound; int firstBettorPlayerNum; // calc call /raise amounts req var lastFullPureRaise = _bigBlindSize; int callLevel; if (stage == EStage.StagePreflop) { TakeBlinds(); firstBettorPlayerNum = GetNextActivePlayer(_bigBlindPlayerNum); callLevel = _bigBlindSize; //set this explicitly in case the big blind is short } else { firstBettorPlayerNum = GetNextActivePlayer(_dealerPlayerNum); callLevel = _potMan.MaxContributions(); } var currBettor = firstBettorPlayerNum; lastToAct = GetPrevActivePlayer(currBettor); while (!bDone) { // dont call GetAction if player is already all in if (_players[currBettor].StackSize > 0) { int callAmount; int minRaise; int maxRaise; CalcRequiredBetAmounts(currBettor, callLevel, lastFullPureRaise, out callAmount, out minRaise, out maxRaise); // get the players action EActionType playersAction; int playersBetAmount; _players[currBettor].GetAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, _potMan.Size(), out playersAction, out playersBetAmount); // *** DO ACTION *** if (playersAction == EActionType.ActionFold) { // if fold then mark player as inactive _players[currBettor].IsActive = false; } else if ((playersAction == EActionType.ActionCall) || (playersAction == EActionType.ActionRaise)) { // if call or raise the take $ from players stack and put in pot TransferMoneyToPot(currBettor, playersBetAmount); if (playersAction == EActionType.ActionRaise) { // if raise then update lastToAct to the preceding active player lastToAct = GetPrevActivePlayer(currBettor); raisesRemaining--; // if this raise is less than the minimum (because all in) then we shouldn't count it as a proper raise and shouldn't allow the original raiser to reraise if (playersBetAmount - callAmount > lastFullPureRaise) { lastFullPureRaise = playersBetAmount - callAmount; } if (_potMan.PlayerContributions(currBettor) > callLevel) { callLevel = _potMan.PlayerContributions(currBettor); } } } BroadcastAction(stage, currBettor, playersAction, playersBetAmount); } // if this player is last to act or only one active player left then bDone = true if ((currBettor == lastToAct) || (GetNumActivePlayers() == 1)) { bDone = true; } else { currBettor = GetNextActivePlayer(currBettor); } } }
public void GetAction(EStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out EActionType playersAction, out int playersBetAmount) { // Default playersAction = EActionType.ActionCall; playersBetAmount = callAmount; try { _player.GetAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize, out playersAction, out playersBetAmount); } catch (Exception e) { Logger.Log(string.Format("EXCEPTION: {0} Player {1} : {2}", MethodBase.GetCurrentMethod().Name, PlayerNum, e.Message)); } ValidateAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize, ref playersAction, ref playersBetAmount); }
public void SeeAction(EStage stage, int playerNum, EActionType action, int amount) { // this is called to inform you when any player (including yourself) makes an action (eg puts in blinds, checks, folds, calls, raises, or wins hand) int i = 1 / zero; }
public void GetAction(EStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out EActionType yourAction, out int amount) { yourAction = EActionType.ActionRaise; amount = maxRaise; }
public override void PlayDeathSequence() { base.SetDeathSequenceStarted(); m_eCurrentStage = EStage.Breaking; }
private void DoBettingRound(EStage stage, out int lastToAct) { var bDone = false; var raisesRemaining = _maxNumRaisesPerBettingRound; int firstBettorPlayerNum; // calc call /raise amounts req var lastFullPureRaise = _bigBlindSize; int callLevel; if (stage == EStage.StagePreflop) { TakeBlinds(); firstBettorPlayerNum = GetNextActivePlayer(_bigBlindPlayerNum); callLevel = _bigBlindSize; //set this explicitly in case the big blind is short } else { firstBettorPlayerNum = GetNextActivePlayer(_dealerPlayerNum); callLevel = _potMan.MaxContributions(); } var currBettor = firstBettorPlayerNum; lastToAct = GetPrevActivePlayer(currBettor); while (!bDone) { // dont call GetAction if player is already all in var player = _players[currBettor]; if (player.StackSize > 0) { int callAmount; int minRaise; int maxRaise; CalcRequiredBetAmounts(currBettor, callLevel, lastFullPureRaise, out callAmount, out minRaise, out maxRaise); // get the players action EActionType playersAction; int playersBetAmount; player.GetAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, _potMan.Size(), out playersAction, out playersBetAmount); _display.UpdatePlayerAction(player.IsAlive, currBettor, playersAction, playersBetAmount); // *** DO ACTION *** if (playersAction == EActionType.ActionFold) { // if fold then mark player as inactive player.IsActive = false; } else if ((playersAction == EActionType.ActionCall) || (playersAction == EActionType.ActionRaise)) { // if call or raise the take $ from players stack and put in pot TransferMoneyToPot(currBettor, playersBetAmount); if (playersAction == EActionType.ActionRaise) { // if raise then update lastToAct to the preceding active player lastToAct = GetPrevActivePlayer(currBettor); raisesRemaining--; // if this raise is less than the minimum (because all in) then we shouldn't count it as a proper raise and shouldn't allow the original raiser to reraise if (playersBetAmount - callAmount > lastFullPureRaise) { lastFullPureRaise = playersBetAmount - callAmount; } if (_potMan.PlayerContributions(currBettor) > callLevel) { callLevel = _potMan.PlayerContributions(currBettor); } } } BroadcastAction(stage, currBettor, playersAction, playersBetAmount); if (player.IsActive) { _display.UpdatePlayer(player); } } // if this player is last to act or only one active player left then bDone = true if ((currBettor == lastToAct) || (GetNumActivePlayers() == 1)) { bDone = true; } else { currBettor = GetNextActivePlayer(currBettor); } } }
private void ValidateAction(EStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, ref EActionType playersAction, ref int playersBetAmount) { // *** Fix up action if(stage == EStage.StageShowdown) { if(playersAction != EActionType.ActionFold) { playersAction = EActionType.ActionShow; } playersBetAmount = 0; } else { var bAllIn = false; if (playersBetAmount < 0) { playersBetAmount = 0; } if (playersAction == EActionType.ActionRaise) { /* // We shouldn't increase a players bet - but can reduce it if outside limits if (playersBetAmount < minRaise) { playersBetAmount = minRaise; } */ if (playersBetAmount > maxRaise) { playersBetAmount = maxRaise; } } if (playersBetAmount > StackSize) { playersBetAmount = StackSize; } if (playersBetAmount == StackSize) { bAllIn = true; } // -- Validate action - prevent player from doing anything illegal if (playersAction != EActionType.ActionFold && playersAction != EActionType.ActionCheck && playersAction != EActionType.ActionCall && playersAction != EActionType.ActionRaise ) { // invalid action - default to call playersAction = EActionType.ActionCall; } if (playersAction == EActionType.ActionFold && callAmount == 0) { // invalid action - don't fold if they can check playersAction = EActionType.ActionCheck; } if (playersAction == EActionType.ActionCheck && callAmount > 0) { // invalid action - can't check so change to call playersAction = EActionType.ActionCall; } if (playersAction == EActionType.ActionRaise && playersBetAmount <= callAmount) { // not enough chips to raise - just call playersAction = EActionType.ActionCall; } if (playersAction == EActionType.ActionRaise && playersBetAmount > callAmount && playersBetAmount < minRaise && !bAllIn) { // not enough chips to raise - just call unless going allin playersAction = EActionType.ActionCall; } if (playersAction == EActionType.ActionRaise && (raisesRemaining <= 0)) { // no more raises allowed playersAction = EActionType.ActionCall; } if (playersAction == EActionType.ActionCall && callAmount == 0) { // change call to check if callAmount = 0 playersAction = EActionType.ActionCheck; } // *** Fix betAmount if (playersAction == EActionType.ActionFold || playersAction == EActionType.ActionCheck) { playersBetAmount = 0; } if (playersAction == EActionType.ActionCall) { playersBetAmount = callAmount; if (playersBetAmount > StackSize) { playersBetAmount = StackSize; } } } }
private static bool ShouldDebugQuit(EStage eCurrentStage) { return(s_fIsQuitAfterStage && (s_eQuitAfterStage == eCurrentStage)); }
public void SeeAction(EStage stage, int playerNum, EActionType action, int amount) { // this is called to inform you when any player (including yourself) makes an action (eg puts in blinds, checks, folds, calls, raises, or wins hand) if (action == EActionType.ActionFold) { switch (stage) { case EStage.StagePreflop: playerStats[playerNum].NumPreFlopsFolded++; break; case EStage.StageFlop: playerStats[playerNum].NumFlopsFolded++; break; case EStage.StageTurn: playerStats[playerNum].NumTurnsFolded++; break; case EStage.StageRiver: playerStats[playerNum].NumRiversFolded++; break; } } else if (action == EActionType.ActionWin) { // be careful not to double count here. This can be call multiple times for the same player for the same hand if they win more than one side pot if(!playerStats[playerNum].bWonThisHand) { playerStats[playerNum].NumHandsWon++; playerStats[playerNum].bWonThisHand = true; } } }
public void Restart() { eStage = EStage.Stage1; StageClearUI.SetActive(false); }