Exemple #1
0
 def do_mortage(self, cond):
     mort_list = self.curr_player.mortage_list(cond)
     actionList = []
     if (len(mort_list) == 0):
         if cond:
             self.console.display("no assets to unmortage")
         else:
             self.console.display("no assets to mortage")
     else:
         cmd = ''
         if cond:
             self.console.display("select asset to unmortage:")
             for asset in mort_list:
                 actionList.append(
                     GameAction(asset.name,
                                asset.unmortage,
                                pic=get_asset_image(asset),
                                value=self.curr_player))
         else:
             self.console.display("select asset to mortage")
             for asset in mort_list:
                 actionList.append(
                     GameAction(asset.name,
                                asset.mortage,
                                pic=get_asset_image(asset)))
         self.gameWindow.choose_from_actions(actionList)
Exemple #2
0
 def do_build(self):
     build_list = self.curr_player.get_build_assets()
     if (len(build_list) == 0) or self.curr_player.money:
         self.console.display("nowhere to build houses")
     else:
         actionList = []
         texts = None
         for section in build_list:
             for asset in self.curr_player.assets[section]:
                 if asset.houses < 4:
                     actionList.append(
                         GameAction(asset.name,
                                    self.curr_player.buy_house,
                                    pic=get_asset_image(asset),
                                    value=asset))
                 elif not asset.hotel:
                     actionList.append(
                         GameAction(asset.name,
                                    self.curr_player.buy_hotel,
                                    pic=get_asset_image(asset),
                                    value=asset))
                 else:
                     self.console.display(
                         "Hotel already built in this asset!")
         self.gameWindow.choose_from_actions(actionList, atexts=texts)
Exemple #3
0
 def do_mortage(self,cond):        
     mort_list=self.curr_player.mortage_list(cond)
     actionList=[]
     if(len(mort_list)==0):
         if cond:
             self.console.display("no assets to unmortage")
         else:
             self.console.display("no assets to mortage")
     else:
         cmd=''
         if cond:
             self.console.display("select asset to unmortage:")                
             for asset in mort_list:
                 actionList.append(GameAction(asset.name,asset.unmortage,pic=get_asset_image(asset),value=self.curr_player))
         else:
             self.console.display("select asset to mortage")
             for asset in mort_list:                            
                 actionList.append(GameAction(asset.name,asset.mortage,pic=get_asset_image(asset)))
         self.gameWindow.choose_from_actions(actionList)
Exemple #4
0
 def do_sell(self):
     sell_list = self.curr_player.house_asset_list()
     if (len(sell_list) == 0):
         self.console.display("no houses to sell")
     else:
         actionList = []
         texts = None
         for asset in sell_list:
             if not asset.hotel:
                 actionList.append(
                     GameAction(asset.name,
                                self.curr_player.sell_house,
                                pic=get_asset_image(asset),
                                value=asset))
             else:
                 actionList.append(
                     GameAction(asset.name,
                                self.curr_player.sell_hotel,
                                pic=get_asset_image(asset),
                                value=asset))
         self.gameWindow.choose_from_actions(actionList, atexts=texts)
Exemple #5
0
 def do_move(self,diceSum):
     player=self.players[self.current_player_index]        
     prevBlock=self.board.blocks[player.location]
     prevBlock.player = NOPLAYER
     targetMove=(player.location+diceSum)%len(self.board.blocks)
     if player.location+diceSum>=len(self.board.blocks):
         self.console.display(player.name+" went throught start, got $200")
     currBlock=self.board.blocks[targetMove]
     self.gameWindow.move_pawn(player,targetMove)
     player.landOn(currBlock,targetMove)
     actions=currBlock.getActions()
     if(len(actions)==1):
         for key in actions.keys():
             actions[key]()
     else:            
         self.gameWindow.choose_from_options(actions,get_asset_image(currBlock))
Exemple #6
0
 def applyToPlayer(self,player):
     loc=player.location        
     while board.blocks[loc].name!=self.targetName:            
         loc=(loc+1)%len(board.blocks)
         if self.applyGo:
             if loc==0:
                 player.money+=200
                 console.display("player went through start got 200")        
     player.landOn(board.blocks[loc],loc)
     if self.targetName==JAIL:
         player.inJail=True
         player.jailCounter=0
     actions=board.blocks[loc].getActions()
     if(len(actions)==1):
         for key in actions.keys():
             actions[key]()
     else:
         window.choose_from_options(actions,get_asset_image(board.blocks[loc]))                
Exemple #7
0
 def do_move(self, diceSum):
     player = self.players[self.current_player_index]
     prevBlock = self.board.blocks[player.location]
     prevBlock.player = NOPLAYER
     targetMove = (player.location + diceSum) % len(self.board.blocks)
     if player.location + diceSum >= len(self.board.blocks):
         self.console.display(player.name +
                              " went throught start, got $200")
     currBlock = self.board.blocks[targetMove]
     self.gameWindow.move_pawn(player, targetMove)
     player.landOn(currBlock, targetMove)
     actions = currBlock.getActions()
     if (len(actions) == 1):
         for key in actions.keys():
             actions[key]()
     else:
         self.gameWindow.choose_from_options(actions,
                                             get_asset_image(currBlock))
Exemple #8
0
 def do_build(self):
     build_list=self.curr_player.get_build_assets()
     if(len(build_list)==0) or self.curr_player.money:
         self.console.display("nowhere to build houses")
     else:
         actionList=[]
         texts = None
         for section in build_list:                
             for asset in self.curr_player.assets[section]:
                 if asset.houses<4:
                     actionList.append(GameAction(asset.name,self.curr_player.buy_house,pic=get_asset_image(asset),value=asset))
                 elif not asset.hotel:
                     actionList.append(GameAction(asset.name,self.curr_player.buy_hotel,pic=get_asset_image(asset),value=asset))
                 else:
                     self.console.display("Hotel already built in this asset!")
         self.gameWindow.choose_from_actions(actionList,atexts=texts)
Exemple #9
0
 def do_sell(self):
     sell_list=self.curr_player.house_asset_list()
     if(len(sell_list)==0):
         self.console.display("no houses to sell")
     else:
         actionList=[]
         texts=None
         for asset in sell_list:                                
             if not asset.hotel:
                 actionList.append(GameAction(asset.name,self.curr_player.sell_house,pic=get_asset_image(asset),value=asset))
             else:
                 actionList.append(GameAction(asset.name,self.curr_player.sell_hotel,pic=get_asset_image(asset),value=asset))
         self.gameWindow.choose_from_actions(actionList,atexts=texts)