Beispiel #1
0
        internal Settings(System.Xml.XmlNode pxmlnode)
        {
            //HACK: ON ERROR
            //On Error Resume Next

            ushort.TryParse(pxmlnode.SelectSingleNode("settings/initialcash").InnerText, out _sTART_CAPITAL);
            byte.TryParse(pxmlnode.SelectSingleNode("settings/dicecount").InnerText, out _dICE_COUNT);
            byte.TryParse(pxmlnode.SelectSingleNode("settings/diceeyes").InnerText, out _dICE_EYES);
            byte.TryParse(pxmlnode.SelectSingleNode("settings/maxdoubles")?.InnerText, out _mAX_DOUBLES);
            bool.TryParse(pxmlnode.SelectSingleNode("settings/showendturn")?.InnerText, out _eND_TURN_EVENT);
            Enum.TryParse(pxmlnode.SelectSingleNode("settings/jailaction").InnerText, out _jAIL_ACTION);
            byte.TryParse(pxmlnode.SelectSingleNode("settings/jailaction").Attributes["times"].InnerText, out _jAIL_TIMES);

            byte.TryParse(pxmlnode.SelectSingleNode("settings/FixedDepositePercentage")?.InnerText, out FixedDepositePercentage);

            Enum.TryParse(pxmlnode.SelectSingleNode("settings/upgrade/upgrade").InnerText, out _costUpgradeMethode);
            Enum.TryParse(pxmlnode.SelectSingleNode("settings/upgrade/rent").InnerText, out _rentUpgradeMethode);
            int.TryParse(pxmlnode.SelectSingleNode("settings/upgrade/rent")?.Attributes["factor"]?.InnerText, out _defaultRentUpgradeFactor);
            Enum.TryParse(pxmlnode.SelectSingleNode("settings/upgrade/when").InnerText, out _upgradeGroupMode);

            bool.TryParse(pxmlnode.SelectSingleNode("settings/Credits").InnerText, out _useCredits);
            bool.TryParse(pxmlnode.SelectSingleNode("settings/Wundertuete").InnerText, out _useWundertuete);
            bool.TryParse(pxmlnode.SelectSingleNode("settings/Auctions").InnerText, out _useAuctions);

            Chances = new eActionType[pxmlnode.SelectSingleNode("chances").ChildNodes.Count - 1 + 1];

            var nodeList = pxmlnode.SelectNodes("chances/*");

            for (var i = 0; i < nodeList.Count; i++)
            {
                Enum.TryParse(nodeList?[i].InnerText, out Chances[i]);
            }
        }
Beispiel #2
0
        public static ActionParameter GetActionParameterByActionType(eActionType actionType, out bool isSuccess)
        {
            ActionParameter action = new ActionParameter();

            isSuccess = true;
            switch (actionType)
            {
            case eActionType.ATTACK:
                action = new AttackAction();
                break;

            case eActionType.MOVE:
                action = new MoveAction();
                break;

            case eActionType.KNOCK:
                action = new KnockAction();
                break;

            case eActionType.WAVE_START_IDLE:
                action = new WaveStartIdleAction();
                break;

            case eActionType.BUFF_DEBUFF:
                action = new BuffDebuffAction();
                break;

            default:
                isSuccess = false;
                break;
            }
            return(action);
        }
Beispiel #3
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);
            }
        }
Beispiel #4
0
        public static void Perform(eActionType i_ActionType, string i_OriginPath, string io_DestinationPath)
        {
            if (io_DestinationPath == Path.GetDirectoryName(i_OriginPath) && i_ActionType == eActionType.Move)
            {
                return;
            }

            ProcessDestinationPath(i_OriginPath, ref io_DestinationPath);

            switch (FileManagerUtils.GetCurrentPathType(i_OriginPath))
            {
            case eFileType.File:
                handleFileType(i_ActionType, i_OriginPath, io_DestinationPath);
                break;

            case eFileType.Folder:
                handleFolderType(i_ActionType, i_OriginPath, io_DestinationPath);
                break;

            case eFileType.Invalid:
                break;

            case eFileType.LogicalDrive:
                MessageBox.Show("You cannot move logical drive.", "Windows Explorer",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #5
0
        public void DoAction(eActionType type, int iRow, int iCol, int iIcon)
        {
            switch (type)
            {
            case eActionType.eAT_EliminateIcon:
                //m_SoundManager.PlayGameEliminateIcon();
                break;

            case eActionType.eAT_RestoreIcon:
                //m_SoundManager.PlayGameRestoreIcon();
                break;

            case eActionType.eAT_SetFinalIcon:
                //m_SoundManager.PlayGameSetFinalIcon();
                break;
            }

            Action a = new Action(type, iRow, iCol, iIcon, m_Puzzle);

            a.Perform(m_Puzzle);

            int undoSize = Game.TheGameInfo.VipData.UndoSize <= 0 ? int.MaxValue : Game.TheGameInfo.VipData.UndoSize;

            while (m_History.Count >= undoSize)
            {
                m_History.RemoveAt(0);
            }
            m_History.Add(a);
            m_ButtonPanel.SetUndoCount(m_History.Count, undoSize);
            //HideHint(false);

            SavePuzzle();
        }
Beispiel #6
0
 void Add(eActionType a)
 {
     if (!actions.Contains(a))
     {
         actions.Add(a);
     }
 }
Beispiel #7
0
        public Action(eActionType type, int iRow, int iCol, int iIcon, Puzzle P)
        {
            m_Type  = type;
            m_iRow  = iRow;
            m_iCol  = iCol;
            m_iIcon = iIcon;

            SavePuzzle(P);
        }
Beispiel #8
0
        public Action(eActionType type, int iRow, int iCol, int iIcon, Puzzle P)
        {
            m_Type = type;
            m_iRow = iRow;
            m_iCol = iCol;
            m_iIcon = iIcon;

            SavePuzzle(P);
        }
Beispiel #9
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);
            }
        }
Beispiel #10
0
        internal override void onMoveOn(Player pPlayer)
        {
            foreach (var chance in _chanceTypes)
            {
                base.onMoveOn(pPlayer);

                eActionType chossenChance;
                Field       contextField;
                Entity      contextPlayer;
                ushort      contextCash;

                if (_chanceCash == 0)
                {
                    contextCash = ChanceRandomizer.Next(1, GameBoard.Settings.DICE_COUNT * GameBoard.Settings.DICE_EYES);
                }
                else
                {
                    contextCash = _chanceCash;
                }

                if (chance == eActionType.Random)
                {
                    chossenChance = GameBoard.Settings.Chances(ChanceRandomizer.Next(0, GameBoard.Settings.Chances.Length - 1));
                }
                else
                {
                    chossenChance = chance;
                }

                switch (chossenChance)
                {
                case eActionType.JumpToJail:
                    pPlayer.raiseChance(chossenChance, new object[] { GameBoard.JailField });
                    eActionType[] posActions;

                    if (GameBoard.FreeJailOwner.Equals(pPlayer))
                    {
                        posActions = new eActionType[] { chossenChance, eActionType.CardUseFreeJail }
                    }
                    ;
                    else
                    {
                        posActions = new eActionType[] { chossenChance }
                    };

                    pPlayer.onDelegateControl(new DelegateEventArgs(posActions, new Entity[] { pPlayer }, new Field[] { GameBoard.JailField }, 0));
                    break;

                default:
                    break;
                }
                //'If choosenChance = eActionType.PayRent Then Stop

                //'TODO: define exactly who performs action, sub chance or sub Delegate
            }
        }
Beispiel #11
0
 public AccountActionModel(eActionType type, string destName, string destNum, string sourceName, string sourceNum, string title, int amount)
 {
     ActionType            = type;
     DestinationName       = destName;
     DestinationBankNumber = destNum;
     SourceName            = sourceName;
     SourceBankNumber      = sourceNum;
     Title  = title;
     Amount = amount;
 }
Beispiel #12
0
 private static void Prison(Player pPlayer, eActionType pPrisonEvent)
 {
     if (pPrisonEvent == eActionType.JumpToJail)
     {
         WriteLineInPlayerColor("Spieler {0} geht in {1}", pPlayer, pPlayer, "Jail");
     }
     else if (pPrisonEvent == eActionType.LoseTurn)
     {
         WriteLineInPlayerColor("Spieler {0} setzt eine Runde aus", pPlayer, pPlayer);
     }
 }
Beispiel #13
0
        private void operationEventHandlerHelper(eActionType i_ActionType, string i_Path)
        {
            string destinationFolder = folderBrowserDialog.SelectedPath;

            ActionUtils.Perform(i_ActionType, i_Path, destinationFolder);

            if (i_ActionType != eActionType.Copy)
            {
                removePathFromDataGridView(i_Path);
            }
        }
 public static void RegisterBehaviourAction(eActionType actionType, Type type)
 {
     if (m_behaviourActionMap.Contains(actionType))
     {
         if (log.IsErrorEnabled)
         {
             log.Error(actionType + " is already registered, only one Type can be declared for each ActionType. Duplicate declaration found in :" + m_behaviourActionMap[actionType] + " and " + type);
         }
         return;
     }
     m_behaviourActionMap.Add(actionType, type);
 }
Beispiel #15
0
 private void Jail(Player pPlayer, eActionType pPrisonEvent)
 {
     if (pPrisonEvent == eActionType.JumpToJail)
     {
         MessageBox.Show(this, string.Format("Spieler {0} geht in {1}", pPlayer, "Jail"), $"Event Spieler {pPlayer}", MessageBoxButtons.OK, MessageBoxIcon.Information);
         SetPlayerLocation(pPlayer.Position, pPlayer);
     }
     else if (pPrisonEvent == eActionType.LoseTurn)
     {
         MessageBox.Show(this, string.Format("Spieler {0} setzt eine Runde aus", pPlayer), $"Event Spieler {pPlayer}", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #16
0
        public static void AddAction(eActionType actionType, int questPartID)
        {
            if (questPartID < 0)
            {
                return;
            }

            DataRow row = DB.ActionTable.NewRow();

            row[DB.COL_QUESTPARTACTION_QUESTPARTID] = questPartID;
            row[DB.COL_QUESTPARTACTION_TYPE]        = actionType;
            DB.ActionTable.Rows.Add(row);
        }
Beispiel #17
0
 private static void handleFileType(eActionType i_ActionType, string i_OriginPath, string i_DestinationPath)
 {
     if (i_ActionType == eActionType.Move)
     {
         File.Move(i_OriginPath, i_DestinationPath);
     }
     else if (i_ActionType == eActionType.Copy)
     {
         File.Copy(i_OriginPath, i_DestinationPath);
     }
     else
     {
         File.Delete(i_OriginPath);
     }
 }
Beispiel #18
0
        public static void SetLog(IAction action, eActionType actionType, HttpContextBase context, string Description = "")
        {
            ActionHistoryModel history = new ActionHistoryModel();

            history.action_module     = action.action_module;
            history.action_module_idx = action.action_module_idx;
            history.action_type       = actionType;
            history.action_target_idx = action.target_idx;
            history.action_ip         = CommonUtil.GetRemoteIP(context.Request);
            history.action_us         = Convert.ToInt32(context.Session["USER_IDX"]);
            history.session_id        = context.Session.SessionID;
            history.description       = Description;
            history.action_url        = context.Request.FilePath;
            history.Save();
        }
Beispiel #19
0
        public static void SetLog(IAction action, eActionType actionType, string Description = "")
        {
            ActionHistoryModel history = new ActionHistoryModel();

            history.action_module     = action.action_module;
            history.action_module_idx = action.action_module_idx;
            history.action_type       = actionType;
            history.action_target_idx = action.target_idx;
            history.action_ip         = "192.0.0.1";
            history.action_us         = -1;
            history.session_id        = null;
            history.description       = Description;
            history.action_url        = "ezDeamon";
            history.Save();
        }
Beispiel #20
0
 private static void handleFolderType(eActionType i_ActionType, string i_OriginPath, string i_DestinationPath)
 {
     if (i_ActionType == eActionType.Move)
     {
         Directory.Move(i_OriginPath, i_DestinationPath); // todo handle moving files with the same name?
     }
     else if (i_ActionType == eActionType.Copy)
     {
         copyAll(new DirectoryInfo(i_OriginPath), new DirectoryInfo(i_DestinationPath));
     }
     else // eActionType.Delete
     {
         Directory.Delete(i_OriginPath, true);
     }
 }
        /// <summary>
        /// Initializes a new instance of the AbstractAction class.
        /// </summary>
        /// <param name="npc"></param>
        /// <param name="actionType"></param>
        /// <param name="p"></param>
        /// <param name="q"></param>
        public AbstractAction(GameNPC npc, eActionType actionType, object p, object q) : this(npc, actionType)
        {
            ActionAttribute attr = BehaviourMgr.GetActionAttribute(GetType());

            // handle parameter P
            object defaultValueP = GetDefaultValue(attr.DefaultValueP);

            this.p = (TypeP)BehaviourUtils.ConvertObject(p, defaultValueP, typeof(TypeP));
            CheckParameter(this.p, attr.IsNullableP, typeof(TypeP));

            // handle parameter Q
            object defaultValueQ = GetDefaultValue(attr.DefaultValueQ);

            this.q = (TypeQ)BehaviourUtils.ConvertObject(q, defaultValueQ, typeof(TypeQ));
            CheckParameter(this.q, attr.IsNullableQ, typeof(TypeQ));
        }
Beispiel #22
0
        public void Fire(BattleSkill skill, eActionType fire_action, int fire_value)
        {
            SubActions.ForEach(a => a.Fire(skill, fire_action, fire_value));

            switch (actionType)
            {
            case eActionType.hp_drain:
                if (fire_action == eActionType.damage || fire_action == eActionType.dot_damage)
                {
                    int apply_value = -fire_value *GetValue(skill.Creature.GradePercent, skill.Level) / 10000;

                    skill.Creature.SetHeal(apply_value, fire_action == eActionType.dot_damage);
                    TextManager.Instance.PushHeal(skill.Creature, apply_value, fire_action == eActionType.dot_damage?eTextPushType.Dot : eTextPushType.Normal);
                }
                break;
            }
        }
Beispiel #23
0
        public static void messagePreperations(ref string i_Message, eActionType i_ActionType)
        {
            switch (i_ActionType)
            {
            case eActionType.Copy:
                i_Message = "copy";
                break;

            case eActionType.Move:
                i_Message = "move";
                break;

            case eActionType.Delete:
                i_Message = "delete";
                break;
            }
        }
Beispiel #24
0
        public static string ActionText(eActionType Type, string P, string Q)
        {
            string text = null;

            object[] formatParams = null;
            DataRow  actionRow    = DB.GetActionTypeRowForID((int)Type);

            if (actionRow != null)
            {
                text = Convert.ToString(actionRow[DB.COL_ACTIONTYPE_TEXT]);
                string typeP = Convert.ToString(actionRow[DB.COL_ACTIONTYPE_P]);
                string typeQ = Convert.ToString(actionRow[DB.COL_ACTIONTYPE_Q]);

                int  startIndex = 0;
                int  index;
                int  i = 0;
                char param;
                formatParams = new object[2];
                while ((index = text.IndexOf('$', startIndex)) >= 0)
                {
                    param = Convert.ToChar(text.Substring(index + 1, 1));

                    if (param == Const.CODE_P)
                    {
                        formatParams[i++] = GenerateParameter(param, typeP, P);
                    }
                    else if (param == Const.CODE_Q)
                    {
                        formatParams[i++] = GenerateParameter(param, typeQ, Q);
                    }

                    startIndex = index + 6;                     // skip ending $ of param clause
                }
            }

            if (!String.IsNullOrEmpty(text))
            {
                return(String.Format(text, formatParams));
            }
            else
            {
                Log.Warning("Actiontype unknown:" + Type);
                return("Actiontype unknown:" + Type);
            }
        }
        /// <summary>
        /// Adds an Action to the QuestPart that will be performed once the QuestPart fires
        /// </summary>
        /// <param name="actionType">ActionType</param>
        /// <param name="p">First Action Variable, meaning depends on ActionType</param>
        /// <param name="q">Second Action Variable, meaning depends on ActionType</param>
        public void AddAction(eActionType actionType, Object p, Object q)
        {
            IBehaviourAction action = null;

            Type type = BehaviourMgr.GetTypeForActionType(actionType);

            if (type != null)
            {
                action = (IBehaviourAction)Activator.CreateInstance(type, new object[] { this.NPC, p, q });
                AddAction(action);
            }
            else
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("No registered action found for ActionType " + actionType);
                }
            }
        }
Beispiel #26
0
        public static string ActionText(eActionType Type, string P, string Q)
        {
            string text = null;
            object[] formatParams = null;
            DataRow actionRow = DB.GetActionTypeRowForID((int)Type);
            if (actionRow != null)
            {
                text = Convert.ToString(actionRow[DB.COL_ACTIONTYPE_TEXT]);
                string typeP = Convert.ToString(actionRow[DB.COL_ACTIONTYPE_P]);
                string typeQ = Convert.ToString(actionRow[DB.COL_ACTIONTYPE_Q]);

                int startIndex = 0;
                int index;
                int i = 0;
                char param;
                formatParams = new object[2];
                while ((index = text.IndexOf('$', startIndex)) >= 0)
                {
                    param = Convert.ToChar(text.Substring(index + 1, 1));

                    if (param == Const.CODE_P)
                        formatParams[i++] = GenerateParameter(param, typeP, P);
                    else if (param == Const.CODE_Q)
                        formatParams[i++] = GenerateParameter(param, typeQ, Q);

                    startIndex = index + 6; // skip ending $ of param clause
                }
            }

            if (!String.IsNullOrEmpty(text))
            {
                return String.Format(text, formatParams);
            }
            else
            {
                Log.Warning("Actiontype unknown:" + Type);
                return "Actiontype unknown:" + Type;
            }
        }
Beispiel #27
0
        private void operationEventHandler(eActionType i_ActionType)
        {
            string message = string.Empty;

            FileManagerUtils.messagePreperations(ref message, i_ActionType);

            if (!checkDataGridViewBounds(message))
            {
                return;
            }

            string path = getDataGridViewCellValue();

            if (i_ActionType != eActionType.Delete && showFolderBrowseDialog(path, message))
            {
                operationEventHandlerHelper(i_ActionType, path);
            }
            else if (i_ActionType == eActionType.Delete)
            {
                operationEventHandlerHelper(i_ActionType, path); // todo add delete functionality
            }
        }
Beispiel #28
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;
        }
        }
Beispiel #29
0
    public void DoAction(eActionType type, int iRow, int iCol, int iIcon)
    {
        switch (type)
        {
        case eActionType.eAT_EliminateIcon:
            //m_SoundManager.PlayGameEliminateIcon();
            break;

        case eActionType.eAT_RestoreIcon:
            //m_SoundManager.PlayGameRestoreIcon();
            break;

        case eActionType.eAT_SetFinalIcon:
            //m_SoundManager.PlayGameSetFinalIcon();
            break;
        }

        Action a = new Action(type, iRow, iCol, iIcon, HappinessGameInfo.Puzzle);

        a.Perform(HappinessGameInfo.Puzzle);

        UnityEngine.Debug.Log("TODO: Implmenet undo size");

        /*
         * int undoSize = Game.TheGameInfo.VipData.UndoSize <= 0 ? int.MaxValue : Game.TheGameInfo.VipData.UndoSize;
         * while (m_History.Count >= undoSize)
         * {
         *      m_History.RemoveAt(0);
         * }
         */
        History.Add(a);


        UnityEngine.Debug.Log("TODO: Implement save puzzle");
        //SavePuzzle();
    }
 public void SeeAction(eStage stage, int playerNum, eActionType action, int amount)
 {
     player.SeeAction(stage, playerNum, action, amount);
 }
 /// <summary>
 /// Adds an Action to the QuestPart that will be performed once the QuestPart fires
 /// </summary>
 /// <param name="actionType">ActionType</param>
 /// <param name="p">First Action Variable, meaning depends on ActionType</param>
 public void AddAction(eActionType actionType, Object p)
 {
     AddAction(actionType, p, null);
 }
        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);
        }
Beispiel #33
0
 /// <summary>
 /// Adds an Action to the QuestPart that will be performed once the QuestPart fires
 /// </summary>
 /// <param name="actionType">ActionType</param>
 /// <param name="p">First Action Variable, meaning depends on ActionType</param>
 public void AddAction(eActionType actionType, Object p)
 {
     AddAction(actionType, p, null);
 }
        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;
                }
            }
        }
Beispiel #35
0
        private void GetPreFlopAction(int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out eActionType yourAction, out int amount)
        {
            bool bIsPair = false;
            bool bIsSuited = false;
            eRankType highRank;
            eRankType lowRank;
            int gap;

            amount = 0;
            yourAction = eActionType.ACTION_FOLD;

            if (_hole1.Rank == _hole2.Rank) 
            {
                bIsPair = true;
                lowRank = highRank = _hole1.Rank;
            }
            else if (_hole1.Rank > _hole2.Rank)
            {
                highRank = _hole1.Rank;
                lowRank = _hole2.Rank;
            }
            else
            {
                highRank = _hole2.Rank;
                lowRank = _hole1.Rank;
            }

            gap = highRank - lowRank;
    
            if(_hole1.Suit == _hole2.Suit)
            {
                bIsSuited = true;
            }

            if (bIsPair)
            {
                if (highRank >= eRankType.RANK_EIGHT)
                {
                    yourAction = eActionType.ACTION_RAISE;
                    amount = minRaise;
                }
                else if (highRank >= eRankType.RANK_FIVE)
                {
                    yourAction = eActionType.ACTION_CALL;
                    amount = callAmount;
                }
            }
            else
            {
                if (highRank >= eRankType.RANK_KING && lowRank >= eRankType.RANK_EIGHT)
                {
                    yourAction = eActionType.ACTION_RAISE;
                    amount = minRaise;
                }
                else if (highRank >= eRankType.RANK_JACK)
                {
                    yourAction = eActionType.ACTION_CALL;
                    amount = callAmount;
                }
                else if (bIsSuited && gap == 1)
                {
                    yourAction = eActionType.ACTION_CALL;
                    amount = callAmount;
                }
            }
        }
Beispiel #36
0
        public void DoAction(eActionType type, int iRow, int iCol, int iIcon)
        {
            switch (type)
            {
                case eActionType.eAT_EliminateIcon:
                    //m_SoundManager.PlayGameEliminateIcon();
                    break;
                case eActionType.eAT_RestoreIcon:
                    //m_SoundManager.PlayGameRestoreIcon();
                    break;
                case eActionType.eAT_SetFinalIcon:
                    //m_SoundManager.PlayGameSetFinalIcon();
                    break;
            }

            Action a = new Action(type, iRow, iCol, iIcon, m_Puzzle);
            a.Perform(m_Puzzle);

            int undoSize = NetworkManager.Net.VipData.UndoSize;
            while (m_History.Count >= undoSize)
            {
                m_History.RemoveAt(0);
            }
            m_History.Add(a);
            m_ButtonPanel.SetUndoCount(m_History.Count, undoSize);
            //HideHint(false);

            SavePuzzle();
        }
Beispiel #37
0
 public JailField(string pName, eActionType pActionType) : base(pName)
 {
     _actionType = pActionType;
 }
 public AbstractAction(GameNPC npc, eActionType actionType)
 {
     defaultNPC      = npc;
     this.actionType = actionType;
 }
Beispiel #39
0
 public static Type GetTypeForActionType(eActionType actionType)
 {
     return (Type)m_behaviourActionMap[actionType];
 }
Beispiel #40
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);
            }
        }
Beispiel #41
0
 public static void RegisterBehaviourAction(eActionType actionType, Type type)
 {
     if (m_behaviourActionMap.Contains(actionType))
     {
         if (log.IsErrorEnabled)
             log.Error(actionType + " is already registered, only one Type can be declared for each ActionType. Duplicate declaration found in :" + m_behaviourActionMap[actionType] + " and " + type);
         return;
     }
     m_behaviourActionMap.Add(actionType, type);
 }
Beispiel #42
0
 private void GetRiverAction(int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out eActionType yourAction, out int amount)
 {
     yourAction = eActionType.ACTION_RAISE;
     amount = callAmount;
 }
Beispiel #43
0
 private void GetShowdownAction(int callAmount, int minRaise, int maxRaise, int raisesRemaining, int potSize, out eActionType yourAction, out int amount)
 {
     // if stage is the showdown then choose whether to show your hand or fold
     yourAction = eActionType.ACTION_SHOW;
     amount = 0;
 }
Beispiel #44
0
        internal int SetDamageImpl(DamageData damageData, bool byAttack, ActionParameter.OnDamageHitDelegate onDamageHit, bool hasEffect, Skill skill, bool energyAdd, bool critical, Action onDefeat, bool noMotion, Func <int, float, int> p)
        {
            if (IdleOnly)
            {
                return(0);
            }
            if (IsDivisionSourceForDamage)
            {
                if (!damageData.IsDivisionDamage)
                {
                    return(0);
                }
            }
            //boss
            if (IsAbnormalState(eAbnormalState.NO_DAMAGE_MOTION))
            {
                return(0);
            }
            if (IsAbnormalState(eAbnormalState.CONFUSION))
            {
                if (damageData.DamageType == eDamageType.ATK)
                {
                    SetMissAtk(damageData.Source, eMissLogType.DODGE_BY_NO_DAMAGE_MOTION, eDamageEffectType.NORMAL, damageData.Target, 1);
                    return(0);
                }
            }
            float damage = damageData.Damage;

            if (critical)
            {
                damage *= 2 * damageData.CriticalDamageRate;
            }
            eActionType actionType = damageData.ActionType;
            eDamageType damageType = damageData.DamageType;
            bool        uselog     = false;

            if (actionType == eActionType.ATTACK)
            {
                if ((damageType == eDamageType.ATK && IsAbnormalState(eAbnormalState.LOG_ATK_BARRIR)) ||
                    (damageType == eDamageType.MGC && IsAbnormalState(eAbnormalState.LOG_MGC_BARRIR)) ||
                    IsAbnormalState(eAbnormalState.LOG_ALL_BARRIR))
                {
                    uselog = true;
                    damage = damageData.LogBarrieryexpectedDamage;
                }
            }
            if (damageType == eDamageType.ATK && IsAbnormalState(eAbnormalState.CUT_ATK_DAMAGE))
            {
                damage *= (1 - GetAbnormalStateMainValue(eAbnormalStateCategory.CUT_ATK_DAMAGE) / 100);
            }
            if (damageType == eDamageType.MGC && IsAbnormalState(eAbnormalState.CUT_MGC_DAMAGE))
            {
                damage *= (1 - GetAbnormalStateMainValue(eAbnormalStateCategory.CUT_MGC_DAMAGE) / 100);
            }
            if (IsAbnormalState(eAbnormalState.CUT_ALL_DAMAGE))
            {
                damage *= (1 - GetAbnormalStateMainValue(eAbnormalStateCategory.CUT_ALL_DAMAGE) / 100);
            }
            if (uselog)
            {
                float m, s;
                if (damageType == eDamageType.ATK && IsAbnormalState(eAbnormalState.LOG_ATK_BARRIR))
                {
                    s = GetAbnormalStateSubValue(eAbnormalStateCategory.LOG_ATK_BARRIR);
                    m = GetAbnormalStateMainValue(eAbnormalStateCategory.LOG_ATK_BARRIR);
                    if (damage > s)
                    {
                        damage = s + m * Mathf.Log10(1 + (damage - s) / m);
                    }
                }
                if (damageType == eDamageType.MGC && IsAbnormalState(eAbnormalState.LOG_MGC_BARRIR))
                {
                    s = GetAbnormalStateSubValue(eAbnormalStateCategory.LOG_MGC_BARRIR);
                    m = GetAbnormalStateMainValue(eAbnormalStateCategory.LOG_MGC_BARRIR);
                    if (damage > s)
                    {
                        damage = s + m * Mathf.Log10(1 + (damage - s) / m);
                    }
                }
                if (IsAbnormalState(eAbnormalState.LOG_ALL_BARRIR))
                {
                    s = GetAbnormalStateSubValue(eAbnormalStateCategory.LOG_ALL_BARRIR);
                    m = GetAbnormalStateMainValue(eAbnormalStateCategory.LOG_ALL_BARRIR);
                    if (damage > s)
                    {
                        damage = s + m * Mathf.Log10(1 + (damage - s) / m);
                    }
                }
            }
            if (hasEffect)
            {
                //显示特效
            }
            if (!uselog && !damageData.IgnoreDef)
            {
                if (damageType == eDamageType.ATK)
                {
                    float def = damageData.Target.GetDefZero();
                    damage *= (1.0f - Mathf.Max(0, def - damageData.DefPenetrate) / (100.0f + def));
                }
                else if (damageType == eDamageType.MGC)
                {
                    float def = damageData.Target.GetMagicDefZero();
                    damage *= (1.0f - Mathf.Max(0, def - damageData.DefPenetrate) / (100.0f + def));
                }
            }
            damage = Mathf.Min(1000000, damage);
            if (actionState == eActionState.DIE)
            {
                string mes = UnitName + "受到" + damage + "过量伤害";
                BattleUIManager.Instance.LogMessage(mes, eLogMessageType.GET_DAMAGE, isOther);
                return(0);
            }
            if (p != null)
            {
                damage = p((int)damage, 1);
            }
            if (damageData.Source != null && actionType != eActionType.FORCE_HP_CHANGE)
            {
                //反击相关
            }
            if (skill != null)
            {
                if (actionType == eActionType.ATTACK)
                {
                    damage *= skill.AweValue;
                }
            }
            if (energyAdd)
            {
                ChargeEnergy(eSetEnergyType.BY_SET_DAMAGE, damage * skillStackValDmg, false, this, false, false, true, false);
            }
            if (damage <= 0 && actionType == eActionType.FORCE_HP_CHANGE)
            {
                //特效
                return(0);
            }
            int overRecDamage = 0;

            if (actionType != eActionType.FORCE_HP_CHANGE && actionType != eActionType.INHIBIT_HEAL)
            {
                ExecBarrier(damageData, ref damage, ref overRecDamage);
            }
            Hp -= damage - overRecDamage;
            if (Hp >= 1 && onDamageHit != null)
            {
                onDamageHit(damage);
            }
            //设置HP条
            unitUI.SetHP(Hp / BaseValues.Hp);
            Ondamage?.Invoke(byAttack, damage, critical);
            if (!HasUnDeadTime)
            {
                if (!noMotion)
                {
                    bool k = false;
                    if (skill != null)
                    {
                        k = skill.PauseStopState;
                    }
                    PlayDamageWhenIdle(true, k);
                }
                if (Hp <= 0 && !isDead && actionState <= eActionState.DAMAGE)
                {
                    SetState(eActionState.DIE, 0);
                }
            }
            return((int)damage);
        }
Beispiel #45
0
    public void setAction(eActionType eActionType, bool bRepeat)
    {
        if (null != goModel)
        {
            HeroAnimation ha = goModel.GetComponent<HeroAnimation>();
            if (null == ha)
            {
                return;
            }

            switch (eActionType)
            {
                case eActionType.eAction_Idle:
                    {
                        ha.playIdleAnimation();
                    }
                    break;
                case eActionType.eAction_Walk:
                    {
                        ha.playWalkAnimation();
                    }
                    break;
                case eActionType.eAction_Attack:
                    {
                        ha.playAttackAnimation();
                    }
                    break;
                case eActionType.eAction_CoolDown:
                    break;
                case eActionType.eAction_Skill:
                    break;
                default:
                    break;
            }
        }
    }
Beispiel #46
0
        /// <summary>
        /// Adds an Action to the QuestPart that will be performed once the QuestPart fires
        /// </summary>
        /// <param name="actionType">ActionType</param>
        /// <param name="p">First Action Variable, meaning depends on ActionType</param>
        /// <param name="q">Second Action Variable, meaning depends on ActionType</param>
        public void AddAction(eActionType actionType, Object p, Object q)
        {            
            IBehaviourAction action = null;

            Type type = BehaviourMgr.GetTypeForActionType(actionType);
            if (type != null)
            {                
                action = (IBehaviourAction)Activator.CreateInstance(type, new object[] { this.NPC, p, q });
                AddAction(action);
            }
            else
            {
                if (log.IsErrorEnabled)
                    log.Error("No registered action found for ActionType " + actionType);
            }
            
        }
Beispiel #47
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)
 }
Beispiel #48
0
 public static Type GetTypeForActionType(eActionType actionType)
 {
     return((Type)m_behaviourActionMap[actionType]);
 }
Beispiel #49
0
        public static void AddAction(eActionType actionType, int questPartID)
        {
            if (questPartID < 0)
                return;

            DataRow row = DB.ActionTable.NewRow();
            row[DB.COL_QUESTPARTACTION_QUESTPARTID] = questPartID;
            row[DB.COL_QUESTPARTACTION_TYPE] = actionType;
            DB.ActionTable.Rows.Add(row);
        }
Beispiel #50
0
 public void SeeAction(eStage stage, int playerNum, eActionType action, int amount)
 {
 }
Beispiel #51
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;
 }