Example #1
0
        public override void Execute(BaseGameEntity pEntity)
        {
            Miner pMiner = (Miner)pEntity;

            if (pMiner.HP == 1)
            {
                DebugMessages.Instance.WriteLine(String.Format("{0}: Dang it, defeated by a drunkard!", MainSM.GetEntityName(pEntity.ID())));

                // Lost fight! Tell Joe we are done.
                MessageDispatcher.Instance.DispatchMessage((int)MessageDispatcher.SEND_MSG_IMMEDIATELY,
                                          pEntity.ID(),
                                          (int)EntityName.ent_BarFly,
                                          (int)message_type.Msg_DeclineFight,
                                          (int)MessageDispatcher.NO_ADDITIONAL_INFO);                

                pMiner.GetFSM().RevertToPreviousState();
            }
            else
            {
                // Throw a punch
                DebugMessages.Instance.WriteLine(String.Format("{0}: Take this, drunken varmint!", MainSM.GetEntityName(pEntity.ID())));

                MessageDispatcher.Instance.DispatchMessage((int)MessageDispatcher.SEND_MSG_IMMEDIATELY,
                                          pEntity.ID(),
                                          (int)EntityName.ent_BarFly,
                                          (int)message_type.Msg_IncomingPunch,
                                          (int)MessageDispatcher.NO_ADDITIONAL_INFO);                

            }
               
        }
Example #2
0
        public override void Enter(BaseGameEntity pEntity)
        {
            DebugMessages.Instance.WriteLine(String.Format("{0}: Time to pick a fight!", MainSM.GetEntityName(pEntity.ID())));

            MessageDispatcher.Instance.DispatchMessage((int)MessageDispatcher.SEND_MSG_IMMEDIATELY, 
                                      pEntity.ID(),
                                      (int)EntityName.ent_Miner_Bob,
                                      (int)message_type.Msg_Antagonize,
                                      (int)MessageDispatcher.NO_ADDITIONAL_INFO);
        }
Example #3
0
        public override bool OnMessage(BaseGameEntity pEntity, Telegram pTelegram)
        {
            Miner pMiner = (Miner)pEntity;

            switch (pTelegram.Msg)
            {
                case (int)message_type.Msg_Antagonize:
                    {
                        double CurrentTime = MessageDispatcher.Instance.GetRunningTime();

                        DebugMessages.Instance.WriteLine(String.Format("Message handled by {0} at time: {1}", MainSM.GetEntityName(pEntity.ID()), CurrentTime));

                        if (pMiner.Location == location_type.saloon)
                        {
                            if (Utils.RandFloat() <= 0.5)
                            {
                                MessageDispatcher.Instance.DispatchMessage((int)MessageDispatcher.SEND_MSG_IMMEDIATELY,
                                                          pEntity.ID(),
                                                          (int)EntityName.ent_BarFly,
                                                          (int)message_type.Msg_AcceptFight,
                                                          (int)MessageDispatcher.NO_ADDITIONAL_INFO);

                                pMiner.GetFSM().ChangeState(new BobFight());
                            }
                            else
                            {
                                DebugMessages.Instance.WriteLine(String.Format("{0}: No, I can't be bothered to fight you drunken fool!", MainSM.GetEntityName(pEntity.ID())));

                                MessageDispatcher.Instance.DispatchMessage((int)MessageDispatcher.SEND_MSG_IMMEDIATELY,
                                                          pEntity.ID(),
                                                          (int)EntityName.ent_BarFly,
                                                          (int)message_type.Msg_DeclineFight,
                                                          (int)MessageDispatcher.NO_ADDITIONAL_INFO);
                            }
                        }                       

                        return true;
                    }
            }

            return false;

        }
Example #4
0
        public override void Enter(BaseGameEntity pEntity)
        {
            BarFlyJoe joe = (BarFlyJoe)pEntity;

            // reset Stats
            joe.Drunkeness = -joe.Drunkeness;
            joe.Angered = false;

            DebugMessages.Instance.WriteLine(String.Format("{0}: Time to do some chillin'!", MainSM.GetEntityName(pEntity.ID())));
        }
Example #5
0
        public override void Execute(BaseGameEntity pEntity)
        {
            BarFlyJoe joe = (BarFlyJoe)pEntity;

            if (!joe.Angered)
            {
                DebugMessages.Instance.WriteLine(String.Format("{0}: Ahh, jus' drinkin'", MainSM.GetEntityName(pEntity.ID())));
                joe.Drunkeness = joe.Drunkeness + 1;

                if (joe.Drunkeness > BarFlyJoe.AlchoAngerSwitch)
                {
                    DebugMessages.Instance.WriteLine(String.Format("{0}: Feelin drunk and angry! I need a fight...", MainSM.GetEntityName(pEntity.ID())));

                    joe.Angered = true;
                }
            }
           
            if (joe.Angered)
            {
                Miner bob = (Miner)MessageDispatcher.Instance.GetRegisteredEntityFromID((int)EntityName.ent_Miner_Bob);

                if (bob.Location != location_type.saloon)
                {
                    if (Utils.RandFloat() <= 0.5)
                    {
                        DebugMessages.Instance.WriteLine(String.Format("{0}: Damnit no one here to fight with!", MainSM.GetEntityName(pEntity.ID())));
                    }
                    else
                    {
                        DebugMessages.Instance.WriteLine(String.Format("{0}: Burp! Grr Im not a happy *hic* cowboy.", MainSM.GetEntityName(pEntity.ID())));
                    }
                }
                else
                {
                    joe.GetFSM().ChangeState(new JoeDoAntagonizin());
                }
            }      

        }
        public override void Execute(BaseGameEntity pEntity)
        {
            switch (Utils.RandInt(0, 2))
            {
                case 0:

                    DebugMessages.Instance.WriteLine(String.Format("{0}: Moppin' the floor", MainSM.GetEntityName(pEntity.ID())));

                    break;

                case 1:

                    DebugMessages.Instance.WriteLine(String.Format("{0}: Washin' the dishes", MainSM.GetEntityName(pEntity.ID())));

                    break;

                case 2:

                    DebugMessages.Instance.WriteLine(String.Format("{0}: Makin' the bed", MainSM.GetEntityName(pEntity.ID())));

                    break;
            }
        }
Example #7
0
        public override void Execute(BaseGameEntity pEntity)
        {
            Miner pMiner = (Miner)pEntity;

            pMiner.BuyAndDrinkAWhiskey();

            DebugMessages.Instance.WriteLine(String.Format("{0}: That's mighty fine sippin' liquer", MainSM.GetEntityName(pEntity.ID()))); 

            pMiner.GetFSM().ChangeState(new EnterMineAndDigForNugget());
        }
Example #8
0
        public override void Enter(BaseGameEntity pEntity)
        {
            Miner pMiner = (Miner)pEntity;

            if (pMiner.Location != location_type.saloon)
            {
                pMiner.Location = location_type.saloon;

                DebugMessages.Instance.WriteLine(String.Format("{0}: Boy, ah sure is thusty! Walking to the saloon", MainSM.GetEntityName(pEntity.ID()))); 
            }
        }
 public override void Exit(BaseGameEntity pEntity)
 {
     DebugMessages.Instance.WriteLine(String.Format("{0}: Puttin' the stew on the table", MainSM.GetEntityName(pEntity.ID())));
 }
Example #10
0
        public override void Execute(BaseGameEntity pEntity)
        {
            BarFlyJoe joe = (BarFlyJoe)pEntity;

            if (joe.HP == 1)
            {
                // Lost fight! Tell Bob we are done.
                DebugMessages.Instance.WriteLine(String.Format("{0}: Ok ok Im beat! Mercy!", MainSM.GetEntityName(pEntity.ID())));

                MessageDispatcher.Instance.DispatchMessage((int)MessageDispatcher.SEND_MSG_IMMEDIATELY,
                                          pEntity.ID(),
                                          (int)EntityName.ent_Miner_Bob,
                                          (int)message_type.Msg_DeclineFight,
                                          (int)MessageDispatcher.NO_ADDITIONAL_INFO);                

                joe.GetFSM().ChangeState(new JoeDoChillin());
            }
            else
            {
                // Throw a punch
                DebugMessages.Instance.WriteLine(String.Format("{0}: Eat mah knuckle!", MainSM.GetEntityName(pEntity.ID())));

                MessageDispatcher.Instance.DispatchMessage((int)MessageDispatcher.SEND_MSG_IMMEDIATELY,
                                          pEntity.ID(),
                                          (int)EntityName.ent_Miner_Bob,
                                          (int)message_type.Msg_IncomingPunch,
                                          (int)MessageDispatcher.NO_ADDITIONAL_INFO);                

            }

        }
Example #11
0
 public override void Exit(BaseGameEntity pEntity)
 {
     DebugMessages.Instance.WriteLine(String.Format("{0}: Thankya li'lle lady. Ah better get back to whatever ah wuz doin'", MainSM.GetEntityName(pEntity.ID()))); 
 }
Example #12
0
        public override void Enter(BaseGameEntity pEntity)
        {
            Miner pMiner = (Miner)pEntity;

            //on entry the miner makes sure he is located at the bank
            if (pMiner.Location != location_type.bank)
            {
                DebugMessages.Instance.WriteLine(String.Format("{0}: Goin' to the bank. Yes siree", MainSM.GetEntityName(pEntity.ID())));

                pMiner.Location = location_type.bank;
            }
        }
Example #13
0
 public override void Exit(BaseGameEntity pEntity)
 {
     DebugMessages.Instance.WriteLine(String.Format("{0}: Ah'm leavin' the goldmine with mah pockets full o' sweet gold", MainSM.GetEntityName(pEntity.ID())));
 }
Example #14
0
        public override void Execute(BaseGameEntity pEntity)
        {
            Miner pMiner = (Miner)pEntity;

            //Now the miner is at the goldmine he digs for gold until he
            //is carrying in excess of MaxNuggets. If he gets thirsty during
            //his digging he packs up work for a while and changes state to
            //gp to the saloon for a whiskey.
            pMiner.AddToGoldCarried(1);

            pMiner.IncreaseFatigue();

            DebugMessages.Instance.WriteLine(String.Format("{0}: Pickin' up a nugget", MainSM.GetEntityName(pEntity.ID())));

            //if enough gold mined, go and put it in the bank
            if (pMiner.PocketsFull())
            {
                pMiner.GetFSM().ChangeState(new VisitBankAndDepositGold());
            }

            if (pMiner.Thirsty())
            {
                pMiner.GetFSM().ChangeState(new QuenchThirst());
            }
        }
Example #15
0
        public override void Enter(BaseGameEntity pEntity)
        {
            Miner pMiner = (Miner)pEntity;

            if (pMiner.Location != location_type.goldmine)
            {
                DebugMessages.Instance.WriteLine(String.Format("{0}: Walkin' to the goldmine", MainSM.GetEntityName(pEntity.ID())));

                pMiner.Location = location_type.goldmine;
            }
        }
Example #16
0
        public override bool OnMessage(BaseGameEntity pEntity, Telegram pTelegram)
        {
            Miner pMiner = (Miner)pEntity;

            switch (pTelegram.Msg)
            {
                case (int)message_type.Msg_IncomingPunch:
                    {
                        if (Utils.RandFloat() <= 0.5)
                        {
                            pMiner.HP = pMiner.HP - 1;

                            DebugMessages.Instance.WriteLine(String.Format("{0}: Ouch, my nose.", MainSM.GetEntityName(pEntity.ID())));
                        }
                        else
                        {
                            DebugMessages.Instance.WriteLine(String.Format("{0}: Dodged!", MainSM.GetEntityName(pEntity.ID())));
                        }

                        return true;
                    }
                case (int)message_type.Msg_DeclineFight:
                    {
                        DebugMessages.Instance.WriteLine(String.Format("{0}: Yes! Victorious!", MainSM.GetEntityName(pEntity.ID())));

                        pMiner.GetFSM().RevertToPreviousState();

                        return true;
                    }
            }

            return false;
        }
Example #17
0
 public override void Enter(BaseGameEntity pEntity)
 {
     DebugMessages.Instance.WriteLine(String.Format("{0}: Time to do some more housework!", MainSM.GetEntityName(pEntity.ID())));
 }
Example #18
0
 public override void Enter(BaseGameEntity pEntity)
 {
     DebugMessages.Instance.WriteLine(String.Format("{0}: Smells Reaaal goood Elsa!", MainSM.GetEntityName(pEntity.ID()))); 
 }
Example #19
0
        public override void Execute(BaseGameEntity pEntity)
        {
            Miner pMiner = (Miner)pEntity;

            DebugMessages.Instance.WriteLine(String.Format("{0}: Tastes real good too!", MainSM.GetEntityName(pEntity.ID()))); 

            pMiner.GetFSM().RevertToPreviousState();
        }
 public void RegisterEntity(BaseGameEntity NewEntity)
 {
     m_dictEntities[NewEntity.ID()] = NewEntity;
 }
Example #21
0
        public override void Execute(BaseGameEntity pEntity)
        {
            Miner pMiner = (Miner)pEntity;

            //deposit the gold
            pMiner.AddToWealth(pMiner.GoldCarried);

            pMiner.GoldCarried = 0;

            DebugMessages.Instance.WriteLine(String.Format("{0}: Depositing gold. Total savings now: {1}", MainSM.GetEntityName(pEntity.ID()), pMiner.Wealth));

            //wealthy enough to have a well earned rest?
            if (pMiner.Wealth >= Miner.ComfortLevel)
            {
                DebugMessages.Instance.WriteLine(String.Format("{0}: WooHoo! Rich enough for now. Back home to mah li'lle lady", MainSM.GetEntityName(pEntity.ID())));

                pMiner.GetFSM().ChangeState(new GoHomeAndSleepTilRested());
            }

            //otherwise get more gold
            else
            {
                pMiner.GetFSM().ChangeState(new EnterMineAndDigForNugget());
            }
        }
Example #22
0
        public override bool OnMessage(BaseGameEntity pEntity, Telegram pTelegram)
        {
            MinersWife wife = (MinersWife)pEntity;

            switch (pTelegram.Msg)
            {

                case (int)message_type.Msg_StewReady:
                    {
                        DebugMessages.Instance.WriteLine(String.Format("Message received by {0} at time {1}", MainSM.GetEntityName(pEntity.ID()), MessageDispatcher.Instance.GetRunningTime()));
                        DebugMessages.Instance.WriteLine(String.Format("{0}: StewReady! Lets eat", MainSM.GetEntityName(pEntity.ID())));

                        //let hubby know the stew is ready
                        MessageDispatcher.Instance.DispatchMessage((int)MessageDispatcher.SEND_MSG_IMMEDIATELY,
                                                  wife.ID(),
                                                  (int)EntityName.ent_Miner_Bob,
                                                  (int)message_type.Msg_StewReady,
                                                  (int)MessageDispatcher.NO_ADDITIONAL_INFO);

                        wife.Cooking = false;
                        wife.GetFSM().ChangeState(new DoHouseWork());

                        return true;
                    }                    

            }//end switch

            return false;
        }
Example #23
0
        public override bool OnMessage(BaseGameEntity pEntity, Telegram pTelegram)
        {
            BarFlyJoe joe = (BarFlyJoe)pEntity;

            switch (pTelegram.Msg)
            {
                case (int)message_type.Msg_DeclineFight:
                    {
                        DebugMessages.Instance.WriteLine(String.Format("{0}: Har har, ya'll a bunch o' yellow bellied chickens!", MainSM.GetEntityName(pEntity.ID())));

                        joe.GetFSM().ChangeState(new JoeDoChillin());

                        return true;
                    }

                case (int)message_type.Msg_AcceptFight:
                    {
                        joe.GetFSM().ChangeState(new JoeFight());

                        return true;
                    }
            }

            return false;
        }
Example #24
0
 public override void Exit(BaseGameEntity pEntity)
 {
     DebugMessages.Instance.WriteLine(String.Format("{0}: Leavin' the bank", MainSM.GetEntityName(pEntity.ID())));
 }
Example #25
0
 public override void Enter(BaseGameEntity pEntity)
 {
     DebugMessages.Instance.WriteLine(String.Format("{0}: Get over here!", MainSM.GetEntityName(pEntity.ID())));
 }
Example #26
0
        public override void Enter(BaseGameEntity pEntity)
        {
            Miner pMiner = (Miner)pEntity;

            if (pMiner.Location != location_type.shack)
            {
                DebugMessages.Instance.WriteLine(String.Format("{0}: Walkin' home", MainSM.GetEntityName(pEntity.ID())));

                pMiner.Location = location_type.shack;

                //let the wife know I'm home
                MessageDispatcher.Instance.DispatchMessage((int)MessageDispatcher.SEND_MSG_IMMEDIATELY, //time delay
                                          pMiner.ID(),        //ID of sender
                                          (int)EntityName.ent_Elsa,            //ID of recipient
                                          (int)message_type.Msg_HiHoneyImHome,   //the message
                                          (int)MessageDispatcher.NO_ADDITIONAL_INFO);
            }
        }
Example #27
0
        public override bool OnMessage(BaseGameEntity pEntity, Telegram pTelegram)
        {
            BarFlyJoe joe = (BarFlyJoe)pEntity;

            switch (pTelegram.Msg)
            {
                case (int)message_type.Msg_IncomingPunch:
                    {
                        if (Utils.RandFloat() <= 0.5)
                        {
                            joe.HP = joe.HP - 1;

                            DebugMessages.Instance.WriteLine(String.Format("{0}: Gaah Im hit!", MainSM.GetEntityName(pEntity.ID())));
                        }
                        else
                        {
                            DebugMessages.Instance.WriteLine(String.Format("{0}: Missed me, sucker!", MainSM.GetEntityName(pEntity.ID())));
                        }

                        return true;
                    }
                case (int)message_type.Msg_DeclineFight:
                    {
                        DebugMessages.Instance.WriteLine(String.Format("{0}: That'll teach ya to mess with an alchoholic!", MainSM.GetEntityName(pEntity.ID())));

                        joe.GetFSM().ChangeState(new JoeDoChillin());

                        return true;
                    }
            }

            return false;
        }
Example #28
0
        public override void Execute(BaseGameEntity pEntity)
        {
            Miner pMiner = (Miner)pEntity;

            //if miner is not fatigued start to dig for nuggets again.
            if (!pMiner.Fatigued())
            {
                DebugMessages.Instance.WriteLine(String.Format("{0}: All mah fatigue has drained away. Time to find more gold!", MainSM.GetEntityName(pEntity.ID())));

                pMiner.GetFSM().ChangeState(new EnterMineAndDigForNugget());
            }

            else
            {
                //sleep
                pMiner.DecreaseFatigue();

                DebugMessages.Instance.WriteLine(String.Format("{0}: ZZZZ... ", MainSM.GetEntityName(pEntity.ID())));
            }
        }
Example #29
0
        public override bool OnMessage(BaseGameEntity pEntity, Telegram pTelegram)
        {
            Miner pMiner = (Miner)pEntity;

            switch (pTelegram.Msg)
            {
                case (int)message_type.Msg_StewReady:
                    {
                        DebugMessages.Instance.WriteLine(String.Format("Message handled by {0} at time {1}", MainSM.GetEntityName(pEntity.ID()), MessageDispatcher.Instance.GetRunningTime()));

                        DebugMessages.Instance.WriteLine(String.Format("{0}: Okay Hun, ahm a comin'", MainSM.GetEntityName(pEntity.ID())));

                        pMiner.GetFSM().ChangeState(new EatStew());

                        return true;
                    }

            }//end switch

            return false; //send message to global message handler
        }
Example #30
0
 public override void Execute(BaseGameEntity pEntity)
 {
     DebugMessages.Instance.WriteLine(String.Format("{0}: Fussin' over food", MainSM.GetEntityName(pEntity.ID())));
 }