Esempio n. 1
0
        /// <summary>
        /// Constructor for the <c>EventData_UnitActionChanged</c> class.
        /// </summary>
        /// <param name="unit">Reference to the unit.</param>
        /// <param name="newAction">New <c>Player.Action</c> for the unit.</param>
        public EventData_UnitActionChanged(ref Player unit, Player.Action newAction)
        {
            _eventType = EventManager.EventType_UnitActionChanged;

            _unit      = unit;
            _newAction = newAction;
        }
Esempio n. 2
0
    private void OnEnable()
    {
        int actionsTotal = System.Enum.GetValues(typeof(Player.Action)).Length;

        if ((this.One == Player.Action.None) && (this.Two == Player.Action.None))
        {
            this.One = (Player.Action) this.RandomizeAction(0, actionsTotal);
            this.Two = (Player.Action) this.RandomizeAction((int)this.One, actionsTotal);

            Debug.LogWarning($"{this.name}: randomized action: One: {this.One}; Two: {this.Two};");
        }
    }
Esempio n. 3
0
        public void sendAction(Player.Action action, string tableId, int amount = 0)
        {
            Console.WriteLine("Sending action: {0} to table: {1}", action, tableId);
            ClientMessage clientMessage = new ClientMessage();

            clientMessage.messageType = "GAME";
            clientMessage.tableId     = tableId;

            switch (action)
            {
            case Player.Action.Check:
                clientMessage.message.action = "CHECK";
                break;

            case Player.Action.Fold:
                clientMessage.message.action = "FOLD";
                break;

            case Player.Action.Call:
                clientMessage.message.action = "CALL";
                break;

            case Player.Action.Raise:
                clientMessage.message.action = "RAISE";
                clientMessage.message.amount = amount;
                break;

            case Player.Action.Bet:
                clientMessage.message.action = "BET";
                clientMessage.message.amount = amount;
                break;

            case Player.Action.AllIn:
                clientMessage.message.action = "BET";
                clientMessage.message.amount = amount;
                break;

            default:
                break;
            }//switch

            Message message = new Message();

            message.From = xmppClient.Username + "@" + domain;
            message.To   = gameDomain;
            message.Body = JsonConvert.SerializeObject(clientMessage);

            xmppClient.Send(message);
        }//sendCommand
Esempio n. 4
0
        public void SetPlayerAction(SetPlayerAction message)
        {
            Player.Action action = Player.Action.Out;

            switch (message.message.actionName)
            {
            case "CALL":
                action = Player.Action.Call;
                break;

            case "FOLD":
                action = Player.Action.Fold;
                break;

            case "BET":
                action = Player.Action.Bet;
                break;

            case "CHECK":
                action = Player.Action.Check;
                break;

            case "ALLIN":
                action = Player.Action.AllIn;
                break;

            case "RAISE":
                action = Player.Action.Raise;
                break;
            }//switch

            var bot = bots.Find(b => { return(b.GetTableId() == message.tableId); });

            bot?.SetPlayerAction(message.message.seatNumber, action);
            bot?.SetBalance(message.message.seatNumber, message.message.balance);
            bot?.SetMinimumBet(message.message.minimumBet);
        }
Esempio n. 5
0
        public void SetPlayerAction(int seat, Player.Action action)
        {
            var player = players.Find(p => { return(p.SeatNumber == seat); });

            player.LastAction = action;
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            //This will be used later
            SpeechSynthesizer synth = new SpeechSynthesizer();

            //Prompt for player information
            Console.WriteLine("Hello, wanderer...\n" +
                              "What be thy name?");
            string inputName = Console.ReadLine();

            Console.Clear();

            Console.WriteLine(string.Format("Nice to meet you, {0}.", inputName));
            Thread.Sleep(1000);
            Console.WriteLine("\nWhat's your specialization, friend?\n" +
                              "0: Horse Mange\n" +
                              "1: Troll Cat\n" +
                              "2: Knight Templator\n" +
                              "3: Demogorg\n" +
                              "4: Vampire\n" +
                              "5: Bovine Frog");
            //Get value user provided
            int inputSpec = Int32.Parse(Console.ReadLine());

            //Perform explicit cast from int to Specialization enum type
            Player.Specialization inputSpecialization = (Player.Specialization)inputSpec;

            //if user enters 0-5, print this line; else print
            //"Please select a specialization from the list provided."
            Console.WriteLine(string.Format("Ahh... a {0}, an interesting choice.", inputSpecialization));
            Thread.Sleep(2000);

            //Create new Player object
            Player hero = new Player(inputName, inputSpecialization);

            Console.Clear();

            Console.WriteLine(string.Format("Your journey begins here {0}, the {1}!", hero.Name, hero.Role));
            Thread.Sleep(2000);
            Console.Clear();

            Console.WriteLine("A shady figure appears...");
            Thread.Sleep(1500);

            Console.WriteLine(string.Format("You're going down, {0}!", hero.Name));
            synth.Speak(string.Format("You're going down {0}, the {1}", hero.Name, hero.Role));
            Thread.Sleep(1000);

            Enemy robot = new Enemy("Dark Wizard", hero.Level);

            Console.WriteLine("BATTLE INITIATED!");
            synth.Speak("BATTLE INITIATED!");

            //Battle Loop
            while (hero.IsAlive && robot.IsAlive)
            {
                Console.Clear();
                Console.WriteLine(string.Format("{0}'s Health: {1}\n", hero.Name, hero.Health) +
                                  string.Format("{0}'s Health: {1}\n\n", robot.Name, robot.Health));
                Console.WriteLine("=======================\n" +
                                  "         ACTIONS   \n" +
                                  "=======================");
                Console.Write("0: Attack\n" +
                              "1: Run\n" +
                              "2: Hide\n");
                int           inputAction = Int32.Parse(Console.ReadLine());
                Player.Action heroAction  = (Player.Action)inputAction;

                //Handle hero action
                switch (heroAction)
                {
                case Player.Action.Attack:
                    //Generate attacks
                    int heroAttack  = hero.Attack();
                    int robotAttack = robot.Attack();
                    //Adjust health values
                    hero.Health  -= robotAttack;
                    robot.Health -= heroAttack;

                    //Display attack stuff in the console
                    Console.Clear();
                    Console.WriteLine("=====================================\n" +
                                      string.Format("{0} Deals {1} to {2}\n", hero.Name, heroAttack, robot.Name) +
                                      "=====================================\n");
                    Thread.Sleep(1000);
                    Console.WriteLine("=====================================\n" +
                                      string.Format("{0} Deals {1} to {2}\n", robot.Name, robotAttack, hero.Name) +
                                      "=====================================\n");
                    Console.WriteLine(robot.Taunt(hero.Health));
                    synth.Speak(robot.Taunt(hero.Health));
                    Thread.Sleep(1000);
                    break;

                case Player.Action.Run:
                    Console.Clear();
                    Console.WriteLine(string.Format("{0} attempts to make a run for it!", hero.Name));
                    Thread.Sleep(1500);
                    synth.Speak("Where do you think you're going?!");
                    Console.Clear();
                    Console.WriteLine(string.Format("{0} pulls {1} back into the fight!", robot.Name, hero.Name));
                    Thread.Sleep(2000);
                    break;

                case Player.Action.Hide:
                    Console.Clear();
                    Console.WriteLine(string.Format("{0} attempts to hide...", hero.Name));
                    Thread.Sleep(1500);
                    synth.Speak(string.Format("You can't hide from me {0}", hero.Role));
                    Console.Clear();
                    Console.WriteLine(string.Format("{0} found {1}!", robot.Name, hero.Name));
                    Thread.Sleep(2000);
                    break;

                default:
                    Console.WriteLine("Enter 0, 1, or 2 to perform an action!");
                    synth.Speak("I know I make computers slow, but this is just ridiculous!");
                    Thread.Sleep(2000);
                    break;
                }

                //Check to see if anoyone is dead
                if (robot.Health <= 0)
                {
                    robot.IsAlive = false;
                    Thread.Sleep(2000);
                    Console.WriteLine(string.Format("{0} has defeated {1}!", hero.Name, robot.Name));
                    Thread.Sleep(1000);
                    synth.Speak("What!?!?! NOOOOOOOOOOOOOOOO!");
                    break;
                }

                if (hero.Health <= 0)
                {
                    hero.IsAlive = false;
                    Thread.Sleep(2000);
                    Console.Clear();
                    Console.WriteLine(string.Format("{0} has defeated {1}!", robot.Name, hero.Name));
                    Thread.Sleep(1000);
                    synth.Speak("Defeating you was exclamation mark difficult. Hahahahahaha.");
                }
            }
            Console.ReadLine();
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            //This will be used for later
            SpeechSynthesizer synth = new SpeechSynthesizer();

            //Prompt for player information
            Console.WriteLine("Hello, wanderer.. \n" +
                              "What be thy name?");
            string inputName = Console.ReadLine();

            Console.Clear();

            Console.WriteLine($"Nice to meet you, {inputName}.");

            Console.WriteLine("\nWhat's your specialization friend?\n" +
                              "0: Horse Mange\n" +
                              "1: Troll Cat\n" +
                              "2: Knight Templator\n" +
                              "3: Demogorg\n" +
                              "4: Vampire\n" +
                              "5: Bovine Frog");
            //Get value user provided
            int specInt = Int32.Parse(Console.ReadLine());

            // perform explicit cast from
            // int to Specialization enum type
            Player.Specialization inputSpecialization = (Player.Specialization)specInt;

            Console.WriteLine($"Ah.. a {inputSpecialization}, an interesting choice...");

            Player newHero = new Player(inputName, inputSpecialization);

            Console.Clear();

            Console.WriteLine($"Your journey begins here {newHero.Name}, the {newHero.Role}...");

            Thread.Sleep(2000);
            Console.Clear();

            Console.WriteLine("A shady figure appears...");
            Thread.Sleep(1500);

            Console.WriteLine($"You're going down {newHero.Role}.");
            synth.Speak($"You're going down {newHero.Role}.");
            Thread.Sleep(1000);

            Enemy robot = new Enemy(newHero.Level);

            Console.WriteLine("BATTLE INSTANTIATED!");
            synth.Speak("BATTLE INSTANTIATED!");

            while (newHero.IsAlive && robot.IsAlive)
            {
                Console.Clear();
                Console.WriteLine($"{newHero.Name}'s Health: {newHero.Health}\n" +
                                  $"{robot.Name} Health: {robot.Health}\n\n");
                Console.WriteLine("=======================\n" +
                                  "         ACTIONS   \n" +
                                  "=======================");
                Console.Write("0: Attack\n" +
                              "1: Run\n" +
                              "2: Hide\n");
                int           inputAction = Int32.Parse(Console.ReadLine());
                Player.Action heroAction  = (Player.Action)inputAction;

                switch (heroAction)
                {
                case Player.Action.Attack:
                    double heroAttack = newHero.Attack();
                    Thread.Sleep(500);
                    double robotAttack = robot.Attack();
                    newHero.Health -= Convert.ToInt32(robotAttack);
                    robot.Health   -= Convert.ToInt32(heroAttack);
                    Console.Clear();
                    Console.WriteLine("=======================\n" +
                                      $"{newHero.Name} Deals {heroAttack} to {robot.Name}\n" +
                                      "=======================\n");
                    Thread.Sleep(1000);
                    Console.WriteLine("=======================\n" +
                                      $"{robot.Name} Deals {robotAttack} to {newHero.Name}\n" +
                                      "=======================\n");
                    Thread.Sleep(1500);
                    break;

                case Player.Action.Run:
                    Console.Clear();
                    Console.WriteLine($"{newHero.Name} attempts to make a run for it!");
                    Thread.Sleep(1500);
                    synth.Speak("Where do you think you're going?!");
                    Console.Clear();
                    Console.WriteLine($"{robot.Name} pulls {newHero.Name} back into the fight!");
                    break;

                case Player.Action.Hide:
                    Console.Clear();
                    Console.WriteLine($"{newHero.Name} attempts to hide...");
                    Thread.Sleep(1500);
                    synth.Speak($"You can't hide from me {newHero.Role}");
                    Console.Clear();
                    Console.WriteLine($"{robot.Name} found {newHero.Name}!");
                    break;

                default:
                    Console.WriteLine("Enter 0, 1, or 2 to perform an action!");
                    synth.Speak("I know I make computers slow, but this is just ridiculous!");
                    break;
                }

                if (newHero.Health < 0)
                {
                    newHero.IsAlive = false;
                    Thread.Sleep(2000);
                    Console.Clear();
                    Console.WriteLine($"{robot.Name} has defeated {newHero.Name}!");
                    Thread.Sleep(1000);
                    synth.Speak("Defeating you was exclamation mark difficult. hahahahahahah.");
                }
                if (robot.Health < 0)
                {
                    robot.IsAlive = false;
                    Thread.Sleep(2000);
                    Console.WriteLine($"{newHero.Name} has defeated {robot.Name}!");
                    Thread.Sleep(1000);
                    synth.Speak("What!?!?! NOOOOOOOOOOOOOOOO!");
                }
            }
        }