예제 #1
0
        public void GetAction(eStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out eActionType yourAction, out int amount)
        {
            amount = 0;
            yourAction = eActionType.ACTION_FOLD;

            // This is the bit where you need to put the AI (mostly likely based on info you receive in other methods)
            if (stage == eStage.STAGE_PREFLOP)
            {
                GetPreFlopAction(callAmount, minRaise, maxRaise, raisesRemaining, potSize, out yourAction, out amount);
            }
            else if (stage == eStage.STAGE_FLOP)
            {
                GetFlopAction(callAmount, minRaise, maxRaise, raisesRemaining, potSize, out yourAction, out amount);
            }
            else if (stage == eStage.STAGE_TURN)
            {
                GetTurnAction(callAmount, minRaise, maxRaise, raisesRemaining, potSize, out yourAction, out amount);
            }
            else if (stage == eStage.STAGE_RIVER)
            {
                GetRiverAction(callAmount, minRaise, maxRaise, raisesRemaining, potSize, out yourAction, out amount);
            }
            else if (stage == eStage.STAGE_SHOWDOWN)
            {
                GetShowdownAction(callAmount, minRaise, maxRaise, raisesRemaining, potSize, out yourAction, out amount);
            }
        }
예제 #2
0
        public void GetAction(eStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out eActionType yourAction, out int amount)
        {
            amount     = 0;
            yourAction = eActionType.ACTION_FOLD;

            // This is the bit where you need to put the AI (mostly likely based on info you receive in other methods)
            if (stage == eStage.STAGE_PREFLOP)
            {
                GetPreFlopAction(callAmount, minRaise, maxRaise, raisesRemaining, potSize, out yourAction, out amount);
            }
            else if (stage == eStage.STAGE_FLOP)
            {
                GetFlopAction(callAmount, minRaise, maxRaise, raisesRemaining, potSize, out yourAction, out amount);
            }
            else if (stage == eStage.STAGE_TURN)
            {
                GetTurnAction(callAmount, minRaise, maxRaise, raisesRemaining, potSize, out yourAction, out amount);
            }
            else if (stage == eStage.STAGE_RIVER)
            {
                GetRiverAction(callAmount, minRaise, maxRaise, raisesRemaining, potSize, out yourAction, out amount);
            }
            else if (stage == eStage.STAGE_SHOWDOWN)
            {
                GetShowdownAction(callAmount, minRaise, maxRaise, raisesRemaining, potSize, out yourAction, out amount);
            }
        }
예제 #3
0
        static bool Battle(Player cPlayer, Player cMonster)
        {
            Console.WriteLine("#############");
            if (!cPlayer.Dead())
            {
                cPlayer.Attack(cMonster);
            }
            else
            {
                m_eStage = eStage.GAMEOVER;
                return(true);
            }

            cMonster.Show();
            if (!cMonster.Dead())
            {
                cMonster.Attack(cPlayer);
            }
            else
            {
                Console.WriteLine(String.Format("몬스터를 쓰러뜨렸습니다!"));
                cPlayer.StillItem(cMonster);
                cPlayer.ShowInventory();
                if (cPlayer.LvUp())
                {
                    Console.WriteLine(String.Format("Level Up!"));
                    cPlayer.Show();
                    m_eStage = eStage.TOWN;
                    return(true);
                }
            }
            cPlayer.Show();
            Console.WriteLine("#######################");
            return(false);
        }
예제 #4
0
 public PluginEvent(eStage stage, string messageName, string entityName, Action <IServiceProvider> pluginAction)
 {
     Stage        = stage;
     MessageName  = messageName;
     EntityName   = entityName;
     PluginAction = pluginAction;
 }
예제 #5
0
    public void Perform(Texture2D _Spectrum0, Texture2D _Omega, out RenderTexture _normal, out RenderTexture _displacement)
    {
        switch (mCurStage)
        {
        case eStage.UpdateSpectrum:
            UpdateSpectrum(_Spectrum0, _Omega);
            mCurStage = eStage.PerformFFT_H;
            break;

        case eStage.PerformFFT_H:
            PerformFFT_H();
            mCurStage = eStage.PerformFFT_V;
            break;

        case eStage.PerformFFT_V:
            PerformFFT_V();
            mCurStage = eStage.EvaluateWave;
            break;

        case eStage.EvaluateWave:
            EvaluateWave();
            mCurStage = eStage.UpdateSpectrum;
            break;
        }

        Graphics.ExecuteCommandBuffer(mCmd);
        mCmd.Clear();

        _normal       = mNormalRT;
        _displacement = mDisplacementRT;
    }
예제 #6
0
    void Awake()
    {
        instance = this;
        //if (instance == null)
        //{
        //}
        //else if (instance != this)
        //{
        //    //Destroy this - singleton pattern, there can only ever be one instance of GameManager
        //    Destroy(gameObject);
        //}

        GameMode = eGameMode.MatchStart;
        Stage    = eStage.Stage1;
        if (Stage == eStage.Stage1)
        {
            maxTime   = TimerStage1;
            countdown = TimerStage1;
        }

        else if (Stage == eStage.Stage2)
        {
            maxTime   = TimerStage1;
            countdown = TimerStage2;
        }
    }
예제 #7
0
    void Start()
    {
        levelData = ExtensionMethod.GetLevelTb(Player.Ins.playerData.nLevel);

        if (levelData == null)
        {
            Debug.LogError("levelDataNull");
            levelData = new LevelData();
        }

        playerInfo.PlayerChangeInfo(Player.Ins.playerData, levelData);
        expendables.ChangeText(levelData);

        ShopInit();
        inven.Init();

        eStage eStage = eStage.Forest1;

        for (int i = 0; i < logoQuestText.Count; ++i)
        {
            var data = ExtensionMethod.GetQuestData((int)eStage);

            if (data == null)
            {
                Debug.LogError("data error"); return;
            }

            logoQuestText[i].text = string.Format("{0}", data.strQuest);

            eStage += (int)eStage.Forest4;
        }

        inven.idx = Player.Ins.heroDataList.Count;
    }
예제 #8
0
        void EventField()
        {
            Console.Write("사냥터를 선택하세요 ");
            for (int i = (int)eMonster.SLIME + 1; i < (int)eMonster.MAX; i++)
            {
                Console.WriteLine(String.Format("{0}. {1}", i, (eMonster)i));
            }
            m_eMonster = (eMonster)int.Parse(Console.ReadLine());
            switch (m_eMonster)
            {
            case eMonster.SLIME:
                m_cMonster = new Player("Slime", 100, 100, 20, 0, 0, 100, 0);
                m_cMonster.SetInventory(m_cItemManager.GetItem(ItemManager.eItem.WoodenSword));
                m_cMonster.SetInventory(m_cItemManager.GetItem(ItemManager.eItem.WoodenArmor));
                m_cMonster.SetInventory(m_cItemManager.GetItem(ItemManager.eItem.WoodenRing));
                break;

            case eMonster.SKELETON:
                m_cMonster = new Player("Skeleton", 200, 200, 30, 0, 0, 200, 0);
                m_cMonster.SetInventory(m_cItemManager.GetItem(ItemManager.eItem.BoneSword));
                m_cMonster.SetInventory(m_cItemManager.GetItem(ItemManager.eItem.BoneArmor));
                m_cMonster.SetInventory(m_cItemManager.GetItem(ItemManager.eItem.BoneRing));
                break;

            case eMonster.BOSS:
                m_cMonster = new Player("Boss", 400, 400, 50, 0, 0, 500, 0);
                m_cMonster.SetInventory(m_cItemManager.GetItem(ItemManager.eItem.WoodenArmor));
                m_cMonster.SetInventory(m_cItemManager.GetItem(ItemManager.eItem.WoodenRing));
                break;

            default:
                break;
            }
            m_eStage = eStage.BATTLE;
        }
예제 #9
0
        public void EventFiled()
        {
            Console.Write("필드을 선택하세요! ");
            for (int i = (int)eMonster.SLIME; i < (int)eMonster.MAX; i++)
            {
                Console.Write(String.Format("{0}:{1},", i, (eMonster)i));
            }
            m_eMonsterIdx = (eMonster)int.Parse(Console.ReadLine());

            switch (m_eMonsterIdx)
            {
            case eMonster.SLIME:
                m_cMonster = new Player("Slime", 100, 100, 10, 0, 0, 100);
                m_cMonster.SetInvetory(m_cItemManager.GetItem(ItemManager.eItem.WoodSword));
                m_cMonster.SetInvetory(m_cItemManager.GetItem(ItemManager.eItem.WoodArmor));
                m_cMonster.SetInvetory(m_cItemManager.GetItem(ItemManager.eItem.WoodRing));
                break;

            case eMonster.SKELTON:
                m_cMonster = new Player("Skelton", 200, 200, 20, 10, 0, 100);
                m_cMonster.SetInvetory(m_cItemManager.GetItem(ItemManager.eItem.BoneSword));
                m_cMonster.SetInvetory(m_cItemManager.GetItem(ItemManager.eItem.BoneArmor));
                m_cMonster.SetInvetory(m_cItemManager.GetItem(ItemManager.eItem.BoneRing));
                break;

            case eMonster.BOSS:
                m_cMonster = new Player("Boss", 300, 300, 30, 15, 0, 100);
                break;

            default:
                m_eStage = eStage.FILED;
                break;
            }
            m_eStage = eStage.BATTLE;
        }
예제 #10
0
 public bool EventBattle()
 {
     Console.WriteLine("####################");
     if (!m_cPlayer.Dead())
     {
         m_cPlayer.Attack(m_cMonster);
     }
     else
     {
         m_eStage = eStage.GAMEOVER;
         return(true);
     }
     m_cMonster.Show();
     if (!m_cMonster.Dead())
     {
         m_cMonster.Attack(m_cPlayer);
     }
     else
     {
         Console.WriteLine(String.Format("몬스터가 쓰러뜨렸습니다!"));
         m_cPlayer.StillItem(m_cMonster);
         m_cPlayer.ShowInevtory();
         if (m_cPlayer.LvUp())
         {
             Console.WriteLine("LvUp!");
             m_cPlayer.Show();
             m_eStage = eStage.TOWN;
             return(true);
         }
     }
     m_cPlayer.Show();
     Console.WriteLine("###################################");
     return(false);
 }
예제 #11
0
        public void EventInvetory()
        {
            m_cPlayer.ShowInevtory();
            Console.WriteLine("어떻게 하시겠습니까? 1:장착, 2:해재 etc:마을");
            int nSelect = int.Parse(Console.ReadLine());

            if (nSelect == 1)
            {
                nSelect = int.Parse(Console.ReadLine());
                Item cItem = m_cPlayer.GetInvetory(nSelect);
                m_cPlayer.SetEquemnt(cItem);
            }
            else if (nSelect == 2)
            {
                nSelect = int.Parse(Console.ReadLine());
                Item cItem = m_cPlayer.GetInvetory(nSelect);
                for (int i = 0; i < (int)Player.eEqumentKind.MAX; i++)
                {
                    Console.Write(String.Format("{0}:{1},", i, (Player.eEqumentKind)i));
                }
                m_cPlayer.ReleaseEquemnt((Player.eEqumentKind)nSelect);
            }
            else
            {
                m_eStage = eStage.TOWN;
            }
        }
예제 #12
0
        public void EventCreate()
        {
            Console.Write("캐릭터 이름 입력 : ");
            string strName = Console.ReadLine();

            m_cPlayer = new Player(strName, 100, 100, 10, 10, 10, 0, 1000000);
            m_eStage  = eStage.TOWN;
        }
예제 #13
0
        public void EventCreate()
        {
            Console.WriteLine("케릭터이름을 입력하세요:");
            string strName = Console.ReadLine();

            m_cPlayer = new Player(strName, 100, 100, 10, 10, 10, 0, 9999999);
            m_eStage  = eStage.TOWN;
        }
예제 #14
0
        // broadcast action of a player to all players (including themselves)
        private void BroadcastAction(eStage stage, int playerNumDoingAction, eActionType action, int amount)
        {
            System.Console.WriteLine("Player {0} {1} {2}", playerNumDoingAction, action, amount);

            foreach (ServerHoldemPlayer player in players)
            {
                player.SeeAction(stage, playerNumDoingAction, action, amount);
            }
        }
예제 #15
0
 public void EventTown()
 {
     m_cPlayer.Recovery();
     Console.WriteLine("마을입니다.\n\n체력회복 완료!\n어디로 갈 건가요? ");
     for (int i = (int)eStage.FILED; i < (int)eStage.GAMEOVER; i++)
     {
         Console.WriteLine(String.Format("{0}. {1}", i, (eStage)i));
     }
     m_eStage = (eStage)int.Parse(Console.ReadLine());
 }
예제 #16
0
 public void EventTown()
 {
     m_cPlayer.Recovery();
     m_cPlayer.ShowInevtory();
     Console.Write("마을 입니다. 어디로 가시겠습니까? ");
     for (int i = (int)eStage.TOWN + 1; i < (int)eStage.BATTLE; i++)
     {
         Console.Write(String.Format("{0}:{1},", i, (eStage)i));
     }
     m_eStage = (eStage)int.Parse(Console.ReadLine());
 }
예제 #17
0
    public void Init(int _fourierSize)
    {
        InitMaterials();

        InitRenderTextures(_fourierSize);

        CreateCmd();

        mSpectrumDrawer.SetInt("_FourierSize", _fourierSize);

        mFastFourier      = new FastFourier(_fourierSize);
        mFFTOceanOutputer = new FFTOceanOutputer(_fourierSize);

        mCurStage = eStage.UpdateSpectrum;
    }
예제 #18
0
    public void NextStage()
    {
        switch (GameStage)
        {
        case eStage.Normal:
            GameStage = eStage.Flowering;
            break;

        case eStage.Flowering:
            GameStage = eStage.Seeding;
            break;

        case eStage.Seeding:
            GameStage = eStage.Normal;
            break;
        }
    }
예제 #19
0
    void Quest()
    {
        eQuestType eType = (eQuestType)tile[currentTileIdx].eTile;

        //bool flag = dli_CurrenQuest.ContainsKey(eType);

        eStage eStage = (eStage)tile[currentTileIdx].stageData.nID;

        if (eStage == eStage.Fire1 || eStage == eStage.Forest1 || eStage == eStage.Ice1)
        {
            dli_CurrenQuest.Add(eType, eStage);
        }
        else if (Player.Ins.questFlagList[tile[currentTileIdx].stageData.nID - 1] == true)
        {
            dli_CurrenQuest.Add(eType, eStage);
        }
    }
예제 #20
0
    public void Transit(eStage nextStage)
    {
        switch (nextStage)
        {
        case eStage.eStage1:
            StartStage1();
            break;

        case eStage.eStage2:
            StartStage2();
            break;

        case eStage.eStage3:
            StartStage3();
            break;

        case eStage.eStage4:
            StartStage4();
            break;
        }
        m_stage = nextStage;
    }
예제 #21
0
        public void EventStore()
        {
            Console.WriteLine("뭘 할 건가요? 1. 구매 2. 판매 etc. 마을");
            int nSelect = int.Parse(Console.ReadLine());

            if (nSelect == 1)
            {
                m_cStore.ShowInventory();
                nSelect = int.Parse(Console.ReadLine());
                m_cPlayer.Buy(nSelect, m_cStore);
            }
            else if (nSelect == 2)
            {
                m_cPlayer.ShowInventory();
                nSelect = int.Parse(Console.ReadLine());
                m_cPlayer.Sell(nSelect);
            }
            else
            {
                m_eStage = eStage.TOWN;
            }
        }
예제 #22
0
        public void EventStore()
        {
            Console.WriteLine("어떻게 하시겠습니까? 1:구매, 2:판매 etc:마을");
            int nSelect = int.Parse(Console.ReadLine());

            if (nSelect == 1)
            {
                m_cStore.ShowInevtory();
                nSelect = int.Parse(Console.ReadLine());
                m_cPlayer.Buy(nSelect, m_cStore);
            }
            else if (nSelect == 2)
            {
                m_cPlayer.ShowInevtory();
                nSelect = int.Parse(Console.ReadLine());
                m_cPlayer.Sell(nSelect);
            }
            else
            {
                m_eStage = eStage.TOWN;
            }
        }
예제 #23
0
        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)

            if (stage == eStage.STAGE_SHOWDOWN)
            {
                // if stage is the showdown then choose whether to show your hand or fold
                yourAction = eActionType.ACTION_SHOW;
                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.ACTION_CALL;
            amount = callAmount;
        }
        }
예제 #24
0
        public void EventInventory()
        {
            m_cPlayer.ShowInventory();
            Console.Write("어떻게 할 건가요?\n1. 장착 2. 수리 etc. 마을");
            int nSelect = int.Parse(Console.ReadLine());

            if (nSelect == 1)
            {
            }
            else if (nSelect == 2)
            {
                nSelect = int.Parse(Console.ReadLine());
                Item cItem = m_cPlayer.GetInventory(nSelect);
                for (int i = 0; i < (int)Player.eEquipKind.MAX; i++)
                {
                    Console.WriteLine(String.Format("{0}. {1}", i, (Player.eEquipKind)i));
                }
            }
            else
            {
                m_eStage = eStage.TOWN;
            }
        }
예제 #25
0
        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)

            if (stage == eStage.STAGE_SHOWDOWN)
            {
                // if stage is the showdown then choose whether to show your hand or fold
                yourAction = eActionType.ACTION_SHOW;
                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.ACTION_CALL;
                amount     = callAmount;
            }
        }
예제 #26
0
        // broadcast action of a player to all players (including themselves)
        private void BroadcastAction(eStage stage, int playerNumDoingAction, eActionType action, int amount)
        {
            System.Console.WriteLine("Player {0} {1} {2}", playerNumDoingAction, action, amount);

            foreach (ServerHoldemPlayer player in players)
            {
                player.SeeAction(stage, playerNumDoingAction, action, amount);
            }
        }
예제 #27
0
        private void DoBettingRound(eStage stage, out int lastToAct)
        {
            bool bDone = false;
            int callAmount = 0;
            int minRaise = 0; 
            int maxRaise = 0;
            int raisesRemaining = maxNumRaisesPerBettingRound; 
            eActionType playersAction;
            int playersBetAmount;
            int firstBettorPlayerNum;

            maxBetsThisBettingRound = 0;

            foreach (ServerHoldemPlayer player in players)
            {
                player.BetsThisBettingRound = 0;
            }

            if (stage == eStage.STAGE_PREFLOP)
            {
                TakeBlinds();
                firstBettorPlayerNum = GetNextActivePlayer(bigBlindPlayerNum);
            }
            else
            {
                firstBettorPlayerNum = GetNextActivePlayer(dealerPlayerNum);
            }

            int currBettor = firstBettorPlayerNum;
            lastToAct = GetPrevActivePlayer(currBettor);

            while (!bDone)
            {
                callAmount = maxBetsThisBettingRound - players[currBettor].BetsThisBettingRound;
                minRaise = callAmount + bigBlindSize; // !!! this may not be correct - may need to use last raise size depending on rules
                maxRaise = players[currBettor].StackSize; //  if no limit - change this if limit game

                players[currBettor].GetAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize, out playersAction, out playersBetAmount);

                // *** DO ACTION ***
                if(playersAction == eActionType.ACTION_FOLD)
                {
                    // if fold then mark player as inactive
                    players[currBettor].IsActive = false;
                }

                if(playersAction == eActionType.ACTION_RAISE)
                {
                    raisesRemaining--;
                    // if raise then update lastToAct to the preceding active player
                    lastToAct = GetPrevActivePlayer(currBettor);
                }

                if((playersAction == eActionType.ACTION_CALL) || (playersAction == eActionType.ACTION_RAISE))
                {
                    // if call or raise the take $ from players stack and put in pot
                    TransferMoneyToPot(currBettor, playersBetAmount);
                }

                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);
                }

            }
        }
예제 #28
0
 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)
 }
예제 #29
0
        public 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.STAGE_SHOWDOWN)
            {
                if (playersAction != eActionType.ACTION_FOLD)
                {
                    playersAction = eActionType.ACTION_SHOW;
                }
            }
            else
            {
                // -- Validate action - prevent player from doing anything illegal
                if (playersAction != eActionType.ACTION_FOLD &&
                    playersAction != eActionType.ACTION_CHECK &&
                    playersAction != eActionType.ACTION_CALL &&
                    playersAction != eActionType.ACTION_RAISE)
                {
                    // invalid action - default to call
                    playersAction = eActionType.ACTION_CALL;
                }

                if (playersAction == eActionType.ACTION_FOLD && callAmount == 0)
                {
                    // invalid action - don't fold if they can check
                    playersAction = eActionType.ACTION_CHECK;
                }

                if (playersAction == eActionType.ACTION_CHECK && callAmount > 0)
                {
                    // invalid action - can't check so change to call
                    playersAction = eActionType.ACTION_CALL;
                }

                if (playersAction == eActionType.ACTION_RAISE && StackSize < minRaise)
                {
                    // not enough chips to raise - just call
                    playersAction = eActionType.ACTION_CALL;
                }

                if (playersAction == eActionType.ACTION_RAISE && (raisesRemaining <= 0))
                {
                    // no more raises allowed
                    playersAction = eActionType.ACTION_CALL;
                }

                if (playersAction == eActionType.ACTION_CALL && callAmount == 0)
                {
                    // change call to check if callAmount = 0
                    playersAction = eActionType.ACTION_CHECK;
                }
            }

            // *** Fix betAmount
            if (playersAction == eActionType.ACTION_FOLD || playersAction == eActionType.ACTION_CHECK || playersAction == eActionType.ACTION_SHOW)
            {
                playersBetAmount = 0;
            }

            if (playersAction == eActionType.ACTION_CALL)
            {
                playersBetAmount = callAmount;
            }

            if (playersAction == eActionType.ACTION_RAISE)
            {
                // They are trying to raise and have at least minRaise chips

                if (playersBetAmount < minRaise)
                {
                    playersBetAmount = minRaise;
                }

                if (playersBetAmount > maxRaise)
                {
                    playersBetAmount = maxRaise;
                }

                if (playersBetAmount > StackSize)
                {
                    playersBetAmount = StackSize;
                }
            }
        }
예제 #30
0
 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)
 }
예제 #31
0
 public void SeeAction(eStage stage, int playerNum, eActionType action, int amount)
 {
     player.SeeAction(stage, playerNum, action, amount);
 }
예제 #32
0
        public 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.STAGE_SHOWDOWN)
            {
                if(playersAction != eActionType.ACTION_FOLD)
                {
                    playersAction = eActionType.ACTION_SHOW;
                }
            }
            else
            {
                // -- Validate action - prevent player from doing anything illegal
                if (playersAction != eActionType.ACTION_FOLD &&
                    playersAction != eActionType.ACTION_CHECK &&
                    playersAction != eActionType.ACTION_CALL &&
                    playersAction != eActionType.ACTION_RAISE )
                {
                    // invalid action - default to call
                    playersAction = eActionType.ACTION_CALL;
                }

                if (playersAction == eActionType.ACTION_FOLD && callAmount == 0)
                {
                    // invalid action - don't fold if they can check
                    playersAction = eActionType.ACTION_CHECK;
                }

                if (playersAction == eActionType.ACTION_CHECK && callAmount > 0)
                {
                    // invalid action - can't check so change to call
                    playersAction = eActionType.ACTION_CALL;
                }

                if (playersAction == eActionType.ACTION_RAISE && StackSize < minRaise)
                {
                    // not enough chips to raise - just call
                    playersAction = eActionType.ACTION_CALL;
                }

                if (playersAction == eActionType.ACTION_RAISE && (raisesRemaining <= 0))
                {
                    // no more raises allowed
                    playersAction = eActionType.ACTION_CALL;
                }

                if (playersAction == eActionType.ACTION_CALL && callAmount == 0)
                {
                    // change call to check if callAmount = 0
                    playersAction = eActionType.ACTION_CHECK;
                }
            }

            // *** Fix betAmount
            if (playersAction == eActionType.ACTION_FOLD || playersAction == eActionType.ACTION_CHECK || playersAction == eActionType.ACTION_SHOW)
            {
                playersBetAmount = 0;
            }

            if(playersAction == eActionType.ACTION_CALL)
            { 
                playersBetAmount = callAmount;
            }

            if (playersAction == eActionType.ACTION_RAISE)
            {
                // They are trying to raise and have at least minRaise chips

                if (playersBetAmount < minRaise)
                {
                    playersBetAmount = minRaise;
                }

                if (playersBetAmount > maxRaise)
                {
                    playersBetAmount = maxRaise;
                }

                if (playersBetAmount > StackSize)
                {
                    playersBetAmount = StackSize;
                }
            }
        }
예제 #33
0
 public void SeeAction(eStage stage, int playerNum, eActionType action, int amount)
 {
 }
예제 #34
0
 public void GetAction(eStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out eActionType yourAction, out int amount)
 {
     yourAction = eActionType.ACTION_RAISE;
     amount = minRaise;
 }
예제 #35
0
 public void GetAction(eStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out eActionType yourAction, out int amount)
 {
     amount     = 0;
     yourAction = eActionType.ACTION_FOLD;
 }
예제 #36
0
    //퀘스트창에서 완료버튼 누를시
    public void ClickSuccess(int btnIdx)
    {
        //btnIdx = 퀘스트 정보마다 한개씩 버튼을 가지고 있고 그 버튼에 대한 인덱스

        if (successBtn[btnIdx].GetComponent <Image>().color == Color.green)
        {
            //Debug.LogError("이미 완료한 퀘스트 입니다");
            StartCoroutine(PopupText(Define.sQUESTPOPUP_TEXT1));
            return;
        }

        eQuestType eType = (eQuestType)nType;

        //완료 버튼 누른게 어느 스테인지 확인
        int    idx    = 0;
        eStage eStage = eStage.None;

        //d_QuestList에는 내가 현재 클릭한 속성에 대한 퀘스트정보를 가지고있음
        foreach (var val in d_QuestList)
        {
            if (idx > btnIdx)
            {
                break;
            }

            eStage = (eStage)val.Key;
            ++idx;
        }
        //현재 퀘스트가 진행중인건지 확인, Player.Ins.questOpenList 인덱스 0부터 시작 eStage는 1부터 시작
        bool bOpen = Player.Ins.questOpenList[(int)eStage - 1];

        if (!bOpen)
        {
            //Debug.LogError("현재 진행중인 퀘스트가 아닙니다");

            StartCoroutine(PopupText(Define.sQUESTPOPUP_TEXT3));
            return;
        }

        //현재 퀘스트 완료중에 해당 속성이 있는지 확인
        bool bType = GameMng.Ins.dli_CurrenQuest.ContainsKey(eType);

        if (!bType)
        {
            //Debug.LogError("해당 속성 퀘스트를 완료하세요");

            StartCoroutine(PopupText(Define.sQUESTPOPUP_TEXT2));
            return;
        }

        //Debug.LogError("퀘스트 완료");

        //questFlagList 인덱스 0부터 시작 eStage는 1부터 시작 = 현재 진행중인 스테이지
        Player.Ins.questFlagList[(int)eStage - 1] = true;
        //다음 퀘스트 오픈
        Player.Ins.questOpenList[(int)eStage] = true;

        successBtn[btnIdx].GetComponent <Image>().color = Color.green;

        //퀘스트 완료후니까 현재 담고있는 퀘스트 삭제
        GameMng.Ins.dli_CurrenQuest.Remove(eType);

        //퀘스트 보상창
        questRewardBG.color = questRewardBGColor;
        questRewardBG.gameObject.SetActive(true);

        int gemNum = questReward.ReturnGem((int)eStage);

        gem = gemNum;

        if (gemNum == -1)
        {
            Debug.LogError((int)eStage);
        }

        questRewardGemText.text = string.Format("{0}", gemNum);
        questRewardBG.gameObject.SetActive(true);
    }
예제 #37
0
        public void GetAction(eStage stage, int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out eActionType playersAction, out int playersBetAmount)
        {
            player.GetAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize, out playersAction, out playersBetAmount);

            ValidateAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize, ref playersAction, ref playersBetAmount);
        }
예제 #38
0
        static void Main(string[] args)
        {
            GameManager cGameManager = new GameManager();
            ItemManager cItemManager = new ItemManager();
            eMonster    m_eMonster   = eMonster.SLIME;
            Player      cPlayer      = null; // 구조체 포인터와 유사한 역할을 함. C++기준으로 동적할당이 됨.
            Player      cMonster     = null;
            Player      cStore       = new Player("Store");

            // C#에서 구조체는 무조건 정적할당.


            cStore.SetInventory(cItemManager.GetItem(ItemManager.eItem.HPPotion));
            cStore.SetInventory(cItemManager.GetItem(ItemManager.eItem.MPPotion));
            cStore.SetInventory(cItemManager.GetItem(ItemManager.eItem.Sotne));
            cStore.SetInventory(cItemManager.GetItem(ItemManager.eItem.Boom));

            Status sStatus = new Status(100);



            int nSelect;

            while (m_eStage != eStage.GAMEOVER)
            {
                switch (m_eStage)
                {
                case eStage.CREATE:
                    Console.Write("캐릭터 이름 입력 : ");
                    string strName = Console.ReadLine();
                    cPlayer  = new Player(strName, 100, 100, 10, 10, 10, 0, 1000000);
                    m_eStage = eStage.TOWN;
                    break;

                case eStage.STORE:
                    Console.WriteLine("뭘 할 건가요? 1. 구매 2. 판매 etc. 마을");
                    nSelect = int.Parse(Console.ReadLine());
                    if (nSelect == 1)
                    {
                        cStore.ShowInventory();
                        nSelect = int.Parse(Console.ReadLine());
                        cPlayer.Buy(nSelect, cStore);
                    }
                    else if (nSelect == 2)
                    {
                        cPlayer.ShowInventory();
                        nSelect = int.Parse(Console.ReadLine());
                        cPlayer.Sell(nSelect);
                    }
                    else
                    {
                        m_eStage = eStage.TOWN;
                    }
                    break;

                case eStage.TOWN:
                    cPlayer.Recovery();
                    Console.WriteLine("마을입니다.\n\n체력회복 완료!\n어디로 갈 건가요? ");
                    for (int i = (int)eStage.FILED; i < (int)eStage.GAMEOVER; i++)
                    {
                        Console.WriteLine(String.Format("{0}. {1}", i, (eStage)i));
                    }
                    m_eStage = (eStage)int.Parse(Console.ReadLine());
                    break;

                case eStage.INVENTORY:
                    cPlayer.ShowInventory();
                    Console.Write("어떻게 할 건가요?\n1. 장착 2. 수리 etc. 마을");
                    nSelect = int.Parse(Console.ReadLine());

                    if (nSelect == 1)
                    {
                        nSelect = int.Parse(Console.ReadLine());
                        Item cItem = cPlayer.GetInventory(nSelect);
                        cPlayer.SetEquip(cItem);
                    }
                    else if (nSelect == 2)
                    {
                        nSelect = int.Parse(Console.ReadLine());
                        Item cItem = cPlayer.GetInventory(nSelect);
                        for (int i = 0; i < (int)Player.eEquipKind.MAX; i++)
                        {
                            Console.WriteLine(String.Format("{0}. {1}", i, (Player.eEquipKind)i));
                        }
                        cPlayer.ReleaseEquip((Player.eEquipKind)nSelect);
                    }
                    else
                    {
                        m_eStage = eStage.TOWN;
                    }
                    break;

                case eStage.FILED:
                    Console.Write("사냥터를 선택하세요 ");
                    for (int i = (int)eMonster.SLIME; i < (int)eMonster.MAX; i++)
                    {
                        Console.WriteLine(String.Format("{0}. {1}", i, (eMonster)i));
                    }
                    m_eMonster = (eMonster)int.Parse(Console.ReadLine());
                    switch (m_eMonster)
                    {
                    case eMonster.SLIME:
                        cMonster = new Player("Slime", 100, 100, 20, 0, 0, 100, 100);
                        cMonster.SetInventory(cItemManager.GetItem(ItemManager.eItem.WoodenSword));
                        cMonster.SetInventory(cItemManager.GetItem(ItemManager.eItem.WoodenArmor));
                        cMonster.SetInventory(cItemManager.GetItem(ItemManager.eItem.WoodenRing));
                        break;

                    case eMonster.SKELETON:
                        cMonster = new Player("Skeleton", 200, 200, 30, 0, 0, 200, 200);
                        cMonster.SetInventory(cItemManager.GetItem(ItemManager.eItem.BoneSword));
                        cMonster.SetInventory(cItemManager.GetItem(ItemManager.eItem.BoneArmor));
                        cMonster.SetInventory(cItemManager.GetItem(ItemManager.eItem.BoneRing));
                        break;

                    case eMonster.BOSS:
                        cMonster = new Player("Boss", 400, 400, 50, 0, 0, 500, 500);
                        break;

                    default:
                        m_eStage = eStage.FILED;
                        break;
                    }
                    m_eStage = eStage.BATTLE;
                    break;

                case eStage.BATTLE:
                    Battle(cPlayer, cMonster);
                    break;

                case eStage.GAMEOVER:
                    Console.WriteLine("Game Over");
                    break;

                case eStage.THE_END:
                    Console.WriteLine("THE END");
                    break;
                }
            }

            cPlayer.Show();
            Console.WriteLine("#############");
        }
예제 #39
0
        private void DoBettingRound(eStage stage, out int lastToAct)
        {
            bool        bDone           = false;
            int         callAmount      = 0;
            int         minRaise        = 0;
            int         maxRaise        = 0;
            int         raisesRemaining = maxNumRaisesPerBettingRound;
            eActionType playersAction;
            int         playersBetAmount;
            int         firstBettorPlayerNum;

            maxBetsThisBettingRound = 0;

            foreach (ServerHoldemPlayer player in players)
            {
                player.BetsThisBettingRound = 0;
            }

            if (stage == eStage.STAGE_PREFLOP)
            {
                TakeBlinds();
                firstBettorPlayerNum = GetNextActivePlayer(bigBlindPlayerNum);
            }
            else
            {
                firstBettorPlayerNum = GetNextActivePlayer(dealerPlayerNum);
            }

            int currBettor = firstBettorPlayerNum;

            lastToAct = GetPrevActivePlayer(currBettor);

            while (!bDone)
            {
                callAmount = maxBetsThisBettingRound - players[currBettor].BetsThisBettingRound;
                minRaise   = callAmount + bigBlindSize;     // !!! this may not be correct - may need to use last raise size depending on rules
                maxRaise   = players[currBettor].StackSize; //  if no limit - change this if limit game

                players[currBettor].GetAction(stage, callAmount, minRaise, maxRaise, raisesRemaining, potSize, out playersAction, out playersBetAmount);

                // *** DO ACTION ***
                if (playersAction == eActionType.ACTION_FOLD)
                {
                    // if fold then mark player as inactive
                    players[currBettor].IsActive = false;
                }

                if (playersAction == eActionType.ACTION_RAISE)
                {
                    raisesRemaining--;
                    // if raise then update lastToAct to the preceding active player
                    lastToAct = GetPrevActivePlayer(currBettor);
                }

                if ((playersAction == eActionType.ACTION_CALL) || (playersAction == eActionType.ACTION_RAISE))
                {
                    // if call or raise the take $ from players stack and put in pot
                    TransferMoneyToPot(currBettor, playersBetAmount);
                }

                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);
                }
            }
        }
예제 #40
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // a n a l y s e F o n t H d d r                                      //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Provide an interpretation of the contents of a PCL XL soft font    //
        // header.                                                            //
        //                                                                    //
        //--------------------------------------------------------------------//

        public Boolean analyseFontHddr(Int32 hddrLen,
                                       Byte []          buf,
                                       Int32 fileOffset,
                                       ref Int32 bufRem,
                                       ref Int32 bufOffset,
                                       PrnParseLinkData linkData,
                                       PrnParseOptions options,
                                       DataTable table)
        {
            Int32   binDataLen;
            Boolean validSegs = false;

            PrnParseConstants.eContType contType;

            Boolean continuation = false;

            //----------------------------------------------------------------//
            //                                                                //
            // Initialise.                                                    //
            //                                                                //
            //----------------------------------------------------------------//

            _table      = table;
            _buf        = buf;
            _fileOffset = fileOffset;

            _analysisLevel = linkData.AnalysisLevel;

            _options = options;

            contType = linkData.getContType();

            _indxOffsetFormat = _options.IndxGenOffsetFormat;

            _showBinData = _options.FlagPCLXLMiscBinData;

            //----------------------------------------------------------------//

            if (contType == PrnParseConstants.eContType.None)
            {
                _nextStage = eStage.Start;
                _validHddr = true;
                _firstSeg  = true;

                _hddrLen = hddrLen;
                _hddrRem = hddrLen;
                _hddrPos = fileOffset + bufOffset;
            }
            else
            {
                contType = PrnParseConstants.eContType.None;
                linkData.resetContData();
            }

            //----------------------------------------------------------------//

            if (_nextStage == eStage.Start)
            {
                if (bufRem < _cHddrDescLen)
                {
                    //--------------------------------------------------------//
                    //                                                        //
                    // Font header descriptor is not all in buffer.           //
                    // Initiate continuation.                                 //
                    //                                                        //
                    //--------------------------------------------------------//

                    contType = PrnParseConstants.eContType.PCLXLFontHddr;

                    linkData.setBacktrack(contType, -bufRem);
                }
                else
                {
                    _nextStage = eStage.ShowHddr;
                }
            }

            if (_nextStage == eStage.ShowHddr)
            {
                //------------------------------------------------------------//
                //                                                            //
                // Process font header.                                       //
                //                                                            //
                //------------------------------------------------------------//

                processFontHeader(ref bufRem,
                                  ref bufOffset);

                bufRem    = bufRem - _cHddrDescLen;
                _hddrRem  = _hddrRem - _cHddrDescLen;
                bufOffset = bufOffset + _cHddrDescLen;

                if (_validHddr)
                {
                    _nextStage = eStage.ShowData;
                }
                else
                {
                    _nextStage = eStage.BadSeqA;
                }
            }

            if (_nextStage == eStage.ShowData)
            {
                //------------------------------------------------------------//
                //                                                            //
                // Output details of segmented data:                          //
                //                                                            //
                //------------------------------------------------------------//

                Int32 dummy = 0;

                continuation = _parseSegs.processSegData(_buf,
                                                         _fileOffset,
                                                         false,
                                                         _firstSeg,
                                                         true,
                                                         ref bufRem,
                                                         ref bufOffset,
                                                         ref _hddrDataRem,
                                                         ref _hddrRem,
                                                         ref dummy,
                                                         ref validSegs,
                                                         linkData,
                                                         _options,
                                                         _table);

                _firstSeg = false;
            }

            if (_nextStage == eStage.EndOK)
            {
                //------------------------------------------------------------//
                //                                                            //
                // End of processing of valid header.                         //
                //                                                            //
                //------------------------------------------------------------//

                return(_validHddr);
            }

            if (_nextStage == eStage.BadSeqA)
            {
                //------------------------------------------------------------//
                //                                                            //
                // Inconsistency found.                                       //
                //                                                            //
                //------------------------------------------------------------//

                _nextStage = eStage.BadSeqB;

                PrnParseCommon.addTextRow(
                    PrnParseRowTypes.eType.MsgError,
                    _table,
                    PrnParseConstants.eOvlShow.None,
                    "",
                    "",
                    "",
                    "Processing of header abandoned!");
            }

            if ((_nextStage == eStage.BadSeqB) && (_hddrRem != 0))
            {
                //------------------------------------------------------------//
                //                                                            //
                // Header does not appear to be valid.                        //
                // Treat remainder of header as a binary sequence without     //
                // interpretation.                                            //
                // Check if remainder of download sequence is within the      //
                // buffer.                                                    //
                //                                                            //
                //------------------------------------------------------------//

                if (_hddrRem > bufRem)
                {
                    //--------------------------------------------------------//
                    //                                                        //
                    // Remainder of sequence is not in buffer.                //
                    // Initiate continuation.                                 //
                    //                                                        //
                    //--------------------------------------------------------//

                    contType = PrnParseConstants.eContType.PCLXLFontHddr;

                    binDataLen = bufRem;
                    _hddrRem   = _hddrRem - bufRem;

                    linkData.setContinuation(contType);
                }
                else
                {
                    contType = PrnParseConstants.eContType.None;
                    linkData.resetContData();

                    binDataLen = _hddrRem;
                    _hddrRem   = 0;
                }

                if ((binDataLen) != 0)
                {
                    //--------------------------------------------------------//
                    //                                                        //
                    // Some, or all, of the download data is contained within //
                    // the current 'block'.                                   //
                    //                                                        //
                    //--------------------------------------------------------//

                    PrnParseData.processBinary(
                        _table,
                        PrnParseConstants.eOvlShow.None,
                        buf,
                        fileOffset,
                        bufOffset,
                        binDataLen,
                        "PCLXL Binary",
                        _showBinData,
                        false,
                        true,
                        _indxOffsetFormat,
                        _analysisLevel);

                    bufRem    = bufRem - binDataLen;
                    bufOffset = bufOffset + binDataLen;
                }
            }

            return(_validHddr);
        }