예제 #1
0
        protected void remove_battle_action(Battle_Actions action)
        {
            Battle_Action.Remove((int)action);
#if DEBUG
            Last_Removed_Action = action;
#endif
        }
예제 #2
0
        protected void add_battle_action(Battle_Actions action)
        {
            Battle_Action.Add((int)action);
#if DEBUG
            Last_Added_Action = action;
#endif
        }
예제 #3
0
        protected void insert_battle_action(int index, Battle_Actions action)
        {
            Battle_Action.Insert(index, (int)action);
#if DEBUG
            Last_Added_Action = action;
#endif
        }
 public user_battle_info(string Username)
 {
     actions = new Battle_Actions[5];
     for (int i = 0; i < 5; i++)
     {
         actions[i] = Battle_Actions.NULL;
     }
     username     = Username;
     battle_score = 0;
 }
예제 #5
0
        /// <summary>
        /// 1 win, 0 draw, -1 lose
        /// </summary>
        public static int action_eval(Battle_Actions action_1, Battle_Actions action_2)
        {
            if (action_1 == Battle_Actions.Lizard)
            {
                if (action_2 == Battle_Actions.Lizard)
                {
                    return(0);
                }
                if (action_2 == Battle_Actions.Spock || action_2 == Battle_Actions.Paper)
                {
                    return(1);
                }
                return(-1);
            }

            if (action_1 == Battle_Actions.Spock)
            {
                if (action_2 == Battle_Actions.Spock)
                {
                    return(0);
                }
                if (action_2 == Battle_Actions.Rock || action_2 == Battle_Actions.Scissors)
                {
                    return(1);
                }
                return(-1);
            }

            if (action_1 == Battle_Actions.Scissors)
            {
                if (action_2 == Battle_Actions.Scissors)
                {
                    return(0);
                }
                if (action_2 == Battle_Actions.Paper || action_2 == Battle_Actions.Lizard)
                {
                    return(1);
                }
                return(-1);
            }

            if (action_1 == Battle_Actions.Rock)
            {
                if (action_2 == Battle_Actions.Rock)
                {
                    return(0);
                }
                if (action_2 == Battle_Actions.Scissors || action_2 == Battle_Actions.Lizard)
                {
                    return(1);
                }
                return(-1);
            }

            if (action_1 == Battle_Actions.Paper)
            {
                if (action_2 == Battle_Actions.Paper)
                {
                    return(0);
                }
                if (action_2 == Battle_Actions.Rock || action_2 == Battle_Actions.Spock)
                {
                    return(1);
                }
                return(-1);
            }

            return(0);
        }