def Enter(self, gameEntity): out("Sore and tired you arrive back at home") out("Honey i'm home!") gameEntity.location = "Home" game_manager.Broadcast(0, gameEntity.GetID(), globals.id_elsie, Msg.HiHoneyImHome, None)
def Execute(self, entity): entity.hunger += 5 entity.thirst += 5 entity.social += 15 if (randint(0, 9) < 5): out(entity, "*crunch*") elif (randint(0, 9) > 5): out(entity, "*gulp*") else: out(entity, "*burp*") if (entity.gm.HoursTo(9) <= 2): out(entity, "'Oh shit! Hulk must go to work!'") entity.gm.Broadcast(0, entity, G.ID.Rocket, G.MSG.D_HulkRocketPub_6, None) entity.fsm.RevertToPriorState() entity.fsm.ChangeState(HulkTraverse()) entity.gm.Broadcast(2, entity, G.ID.Hulk, G.MSG.ArriveWork, None) elif (entity.social > 85): out(entity, "'Rocket good friend! Hulk must go home now'") entity.gm.Broadcast(0, entity, G.ID.Rocket, G.MSG.D_HulkRocketPub_6, None) entity.fsm.RevertToPriorState() entity.fsm.ChangeState(HulkTraverse()) entity.gm.Broadcast(2, entity, G.ID.Hulk, G.MSG.ArriveHome, None)
def Enter(self, gameEntity): if (not gameEntity.CookingStew()): out("Putting on some stew") game_manager.Broadcast(2, gameEntity.GetID(), globals.id_elsie, Msg.StewReady, None) gameEntity.cookingStew = True
def Execute(self, entity): out(entity, "*Finds chicken* 'There you are chicken! Hulk walk home happy!'") entity.AddItem("DINNER_CHICKEN") entity.money -= 30 entity.fsm.ChangeState(HulkTraverse()) entity.gm.Broadcast(2, entity, G.ID.Hulk, G.MSG.ArriveHome, None)
def OnMessage(self, entity, telegram): if (telegram.msg == G.MSG.GoMovies): super().OnMessage(entity, telegram) if (entity.IsSleeping()): out(entity, "*Wakes up* 'Oh right madam! To the movies!'") else: out(entity, "'To the movies!'") entity.fsm.ChangeState(ThorTraverse()) entity.walkingToMovies = True entity.gm.Broadcast(1, entity, G.ID.Thor, G.MSG.ArriveMovies, None) return True elif (telegram.msg == G.MSG.HulkArriveMovies): super().OnMessage(entity, telegram) entity.aloneAtMovies = False return True elif (telegram.msg == G.MSG.RocketArriveMovies): super().OnMessage(entity, telegram) entity.aloneAtMovies = False return True elif (telegram.msg == G.MSG.GrootArriveMovies): super().OnMessage(entity, telegram) entity.aloneAtMovies = False return True return False
def Execute(self, gameEntity): out("You shower the local peasants in a golden rain") gameEntity.goldCarried -= 5 gameEntity.moneyInBank += 3 if (gameEntity.goldCarried < 5): gameEntity.fsm.ChangeState(MineForGold()) elif (gameEntity.IsTired()): gameEntity.fsm.ChangeState(HomeAndSleep())
def OnMessage(self, entity, telegram): if (telegram.msg == G.MSG.MovieOver): super().OnMessage(entity, telegram) out(entity, "*Movie ended* 'Hulk entertained! Now go home!'") entity.fsm.ChangeState(HulkTraverse()) entity.gm.Broadcast(2, entity, G.ID.Hulk, G.MSG.ArriveHome, None) return True return False
def OnMessage(self, gameEntity, telegram): if (telegram.msg == Msg.HiHoneyImHome): super().OnMessage(gameEntity, telegram) out("Hi honey! Let me make ye some stew!") gameEntity.fsm.ChangeState(MakeStew()) return True return False
def OnMessage(self, gameEntity, telegram): if (telegram.msg == Msg.StewReady): super().OnMessage(gameEntity, telegram) out("Alright honey! I'm coming!") gameEntity.fsm.EnterStateBlip(EatStew()) return True return False
def OnMessage(self, entity, telegram): if(telegram.msg == G.MSG.MovieOver): super().OnMessage(entity, telegram) out(entity, "*Movie ended* 'I, am, Groot.'") entity.fsm.ChangeState(GrootTraverse()) entity.gm.Broadcast(3, entity, G.ID.Groot, G.MSG.ArriveHome, None) return True return False
def Enter(self, entity): out(entity, "*Enters the movie saloon* 'The god of thunder has arrived!'") entity.planGoMovies = False entity.wathingMovie = False entity.gm.Broadcast(2, entity, G.ID.Hulk, G.MSG.MovieOver, None) entity.gm.Broadcast(2, entity, G.ID.Rocket, G.MSG.MovieOver, None) entity.gm.Broadcast(2, entity, G.ID.Thor, G.MSG.MovieOver, None) entity.gm.Broadcast(2, entity, G.ID.Groot, G.MSG.MovieOver, None)
def OnMessage(self, entity, telegram): if (telegram.msg == G.MSG.WakeUp): super().OnMessage(entity, telegram) out(entity, "'Hulk Sleep goooood!'") entity.fsm.RevertToPriorState() entity.gm.Broadcast(1, entity, G.ID.Hulk, G.MSG.GoWork, None) return True return False
def Execute(self, gameEntity): out("*Chunk*") gameEntity.fatigue += 1 gameEntity.thirst += 2 gameEntity.goldCarried += 4 if (gameEntity.IsThirsty()): gameEntity.fsm.ChangeState(SaloonAndDrink()) elif (gameEntity.IsWealthy()): gameEntity.fsm.ChangeState(DepositAtBank())
def OnMessage(self, entity, telegram): if (telegram.msg == G.MSG.GoHome): super().OnMessage(entity, telegram) out(entity, "'Job done! Walking home!'") entity.fsm.ChangeState(HulkTraverse()) entity.gm.Broadcast(2, entity, G.ID.Hulk, G.MSG.ArriveHome, None) return True return False
def Enter(self, entity): if (entity.HasItem("DINNER_CHICKEN")): out(entity, "'Chicken taste GOOOOD..'") entity.hunger = 90 entity.RemoveItem("DINNER_CHICKEN") entity.fsm.RevertToPriorState() else: out(entity, "'NO CHICKEN!?!? Hulk will starve...'") # Revert and msg Hulk to go store entity.fsm.RevertToPriorState() entity.gm.Broadcast(0, entity, G.ID.Hulk, G.MSG.GoStore, None)
def OnMessage(self, entity, telegram): if (telegram.msg == G.MSG.D_HulkRocketPub_3): super().OnMessage(entity, telegram) out(entity, "'Good.. Hulk smash things'") return True if (telegram.msg == G.MSG.D_HulkRocketPub_5): super().OnMessage(entity, telegram) out(entity, "'Yes.. Hulk relaxed'") return True return False
def OnMessage(self, gameEntity, telegram): if (telegram.msg == Msg.StewReady): super().OnMessage(gameEntity, telegram) out("Stew is ready Bob!") game_manager.Broadcast(0, gameEntity.GetID(), globals.id_bob, Msg.StewReady, None) gameEntity.cookingStew = False gameEntity.fsm.ChangeState(WifeClean()) return True return False
def Execute(self, entity): if (entity.IsHungry()): out(entity, "'Hulk HUNGRY!!'") entity.fsm.EnterStateBlip(HulkAtHomeDinner()) elif (entity.IsTired()): out(entity, "'Hulk tired, go SLEEP!'") entity.fsm.EnterStateBlip(HulkAtHomeSleep()) elif (entity.IsLonely() and entity.gm.GetTime() > 12 and not entity.planGoPub): out(entity, "'Hulk lonely! Maybe Rocket work?'") out(entity, "---> Rocket #You at the pub?#") entity.gm.Broadcast(0, entity, G.ID.Rocket, G.MSG.D_HulkAskRocketIfWorking_1, None) else: out(entity, "*Watches TV*")
def Execute(self, entity): if (not entity.IsSleeping()): entity.hunger -= 4 entity.thirst -= 2 entity.fatigue -= 4 entity.social -= 5 if (entity.IsThirsty()): if (entity.IsHome() or entity.IsWorking()): out(entity, "'Hulk thirsty! *clunk*") entity.thirst += 25 if (entity.gm.GetTime() == 13 and entity.IsWorking()): entity.gm.Broadcast(randint(0, 2), entity, G.ID.Hulk, G.MSG.GoHome, None)
def OnMessage(self, entity, telegram): if (telegram.msg == G.MSG.MovieOver): super().OnMessage(entity, telegram) if (entity.aloneAtMovies): out( entity, "*Movie ended* 'Would be more fun to watch The Avengers with actual friends..'" ) else: out( entity, "*Movie ended* 'Aren't The Avengers the best movie? Am'a Right? Love the part about me..'" ) entity.fsm.ChangeState(ThorTraverse()) entity.gm.Broadcast(1, entity, G.ID.Thor, G.MSG.ArriveHome, None) return True return False
def OnMessage(self, entity, telegram): if (telegram.msg == G.MSG.GoHome): super().OnMessage(entity, telegram) out(entity, "'No Rocket, no Hulk!'") entity.fsm.ChangeState(HulkTraverse()) entity.gm.Broadcast(2, entity, G.ID.Hulk, G.MSG.ArriveHome, None) return True elif (telegram.msg == G.MSG.D_HulkRocketPub_1): super().OnMessage(entity, telegram) out(entity, "*grabs beer* 'Hulk always calm!'") entity.AddItem("BEER") entity.fsm.EnterStateBlip(HulkAtPubChillax()) return True return False
def OnMessage(self, entity, telegram): if (telegram.msg == G.MSG.GoWork and not entity.IsSleeping()): super().OnMessage(entity, telegram) if (entity.HasItem("MJOLNIR")): out( entity, "Stupid mortals and their silly working habit! I have better things to do than work. Pwning noobs, for example.." ) else: out( entity, "I do need a new hammer.. A god cannot be without his mighty weapon! Of to work!" ) entity.fsm.ChangeState(ThorTraverse()) # Thor is fast entity.gm.Broadcast(1, entity, G.ID.Thor, G.MSG.ArriveWork, None) return True return False
def Execute(self, entity): if(not entity.IsSleeping()): entity.hunger -= 1 entity.thirst -= 3 entity.fatigue -= 2 entity.social -= 2 if(entity.gm.GetTime() == 5 and entity.IsHome()): if(entity.IsSleeping()): entity.gm.Broadcast(0, entity, G.ID.Groot, G.MSG.WakeUp, None) else: out(entity, "*Of to work* 'I am Groot...'") entity.fsm.ChangeState(GrootTraverse()) # Groot slow entity.gm.Broadcast(3, entity, G.ID.Groot, G.MSG.ArriveWork, None) if(entity.gm.GetTime() == 15 and entity.IsWorking()): out(entity, "*End of workday* 'I am Groot.'") entity.fsm.ChangeState(GrootTraverse()) entity.gm.Broadcast(3, entity, G.ID.Groot, G.MSG.ArriveHome, None)
def OnMessage(self, entity, telegram): if(telegram.msg == G.MSG.D_ThorPlanGoMovies_1): super().OnMessage(entity, telegram) if(not entity.planGoMovies): entity.planGoMovies = True entity.gm.Broadcast(telegram.extraInfo - 3, entity, G.ID.Groot, G.MSG.GoMovies, None) # If asleep, send reminder to check phone next loop if(entity.IsSleeping()): entity.gm.Broadcast(1, entity, G.ID.Groot, G.MSG.D_ThorPlanGoMovies_1, None) # Awake, respond to text else: out(entity, "---> Thor #I am Groooooooot!#") return True elif(telegram.msg == G.MSG.GoMovies): super().OnMessage(entity, telegram) if(entity.IsWorking()): out(entity, "*Leaving work for movies* 'I am Groot, I am Groot!'") else: out(entity, "*Leaving for movies* 'I am Groot!'") entity.fsm.ChangeState(GrootTraverse()) entity.walkingToMovies = True entity.gm.Broadcast(3, entity, G.ID.Groot, G.MSG.ArriveMovies, None) return True return False
def Execute(self, entity): out(entity, "*Works at store*") entity.money += 3 if(randint(0, 9) > 8 and entity.money >= 10): out(entity, "*Buys tampons*") entity.AddItem("TAMPONS") entity.money -= 10 elif(randint(0, 9) > 8 and entity.money >= 15): out(entity, "*Buys Baby Groot*") entity.AddItem("BABY_GROOT") entity.money -= 15 elif(randint(0, 9) > 8 and entity.money >= 5): out(entity, "*Buys a fork*") entity.AddItem("FORK") entity.money -= 5
def Execute(self, entity): if (entity.wathingMovie): out(entity, "*Watches movie*") else: if (entity.aloneAtMovies): out( entity, "'No one could come!? That sucks! I'll watch the movie alone then!'" ) else: out(entity, "'Lets go! Before the movie watches itself without us!'") entity.wathingMovie = True
def OnMessage(self, entity, telegram): # Hulk goes to store if (telegram.msg == G.MSG.GoStore): super().OnMessage(entity, telegram) out(entity, "'Hulk go to store! Need more chicken!'") entity.fsm.ChangeState(HulkTraverse()) # Arrive in 2 loops entity.gm.Broadcast(2, entity, G.ID.Hulk, G.MSG.ArriveStore, None) return True # Rocket works elif (telegram.msg == G.MSG.D_HulkAskRocketIfWorking_2): super().OnMessage(entity, telegram) out(entity, "---> Rocket #Hulk come just to smash you!#") entity.fsm.ChangeState(HulkTraverse()) # Arrive in 2 loops entity.gm.Broadcast(2, entity, G.ID.Hulk, G.MSG.ArrivePub, None) return True # Rocket works soon, plan to go elif (telegram.msg == G.MSG.D_HulkAskRocketIfWorking_3): super().OnMessage(entity, telegram) out( entity, "---> Rocket #Good! Hulk be at the pub around " + entity.gm.ToTimeStr(entity.gm.GetTime() + telegram.extraInfo) + "#") entity.gm.Broadcast(telegram.extraInfo - 2, entity, G.ID.Hulk, G.MSG.GoPub, None) entity.planGoPub = True return True # Follow plan and go pub elif (telegram.msg == G.MSG.GoPub): super().OnMessage(entity, telegram) out(entity, "---> Rocket #Hulk walking to pub now!#") entity.fsm.ChangeState(HulkTraverse()) entity.gm.Broadcast(2, entity, G.ID.Hulk, G.MSG.ArrivePub, None) return True return False
def Execute(self, entity): out(entity, "*Cleaning*") if (entity.gm.GetTime() >= 15): out(entity, "'I'm done cleaning for today!!'") entity.fsm.ChangeState(ThorTraverse()) entity.gm.Broadcast(1, entity, G.ID.Thor, G.MSG.ArriveHome, None) elif (entity.HasItem("MJOLNIR")): entity.money += 5 if (randint(0, 9) > 7): # Random chance Mjolnir breaks out(entity, "*Mjolnir breaks* 'AGAIN!?'") entity.RemoveItem("MJOLNIR") elif (entity.money > 45): # Thor has money for new Mjolnir out(entity, "'Of to buy a new hammer!'") entity.fsm.ChangeState(ThorTraverse()) # Thor is fast entity.gm.Broadcast(1, entity, G.ID.Thor, G.MSG.ArriveStore, None) else: entity.money += 3
def Execute(self, entity): out( entity, "*Searches for new hammer* 'God why do mortals always move stuff around!?'" ) if (randint(0, 9) > 6): # Thor finds new hammes sometimes out(entity, "*Finds hammes* 'There we go, back to work'") entity.AddItem("MJOLNIR") entity.money -= 45 entity.fsm.ChangeState(ThorTraverse()) entity.gm.Broadcast(1, entity, G.ID.Thor, G.MSG.ArriveWork, None) elif (entity.searchTries >= 2): out(entity, "*Swears* '3 hours and still nothing! I'm out!'") entity.fsm.ChangeState(ThorTraverse()) entity.gm.Broadcast(1, entity, G.ID.Thor, G.MSG.ArriveWork, None) else: entity.searchTries += 1
def Execute(self, gameEntity): out("Taste super good as well!") gameEntity.fsm.RevertToPriorState()