def build_house(self, player): """ if we have hotel it means 0 housesh 1 hotel if we dist """ if not self.is_mourtaged and self.owner == player: if player.has_line(self.color_street)[0] and self.house_count < 5: self.house_count = self.house_count + 1 player.pay_money(self.perhouse_price) return True return False
def buy_building(self, player, auctcion_buy=False): """ check if the building have owner and current player have money to buy it auction mean that """ # print(player) if self.owner == ' ' and (player.player_budget() >= self.building_price or auctcion_buy and auctcion_buy <= player.player_budget()): self.owner = player # change ownar if auctcion_buy is False: # if he buyies it he is on it # self.players_on_building.append(player)#ne se polzva veche # player pays for the building player.pay_money(self.building_price) return True else: player.pay_money(auctcion_buy) return True return False
def take_fee(self, player, tax=0): """ 1) check if the building is owned from somebody -> if not can be bought 2) if owned from current player didnt take fee 3) tax if building is from that kind 5) check for station fee and utility fee 6) feee from normal building 7) community or chance return it to game .... """ print(self.owner, self.color_street) # za krasota da pitam zashto ne raboti if self.owner == ' ' and self.color_street not in ['STATION', 'utility', 'CC', 'C', 'TAX']: return 'buy' # ako tova raboti shte rabotqt i ostanalite elif self.owner == player: # totalno ne raboti return 'own' elif self.color_street == 'TAX': player.pay_money(self.with_house_fee[self.house_count]) print(111) return 'TAX' elif self.color_street in ['STATION', 'utility']: if self.color_street == 'STATION': money = [25, 50, 100, 200] player.pay_money(money[self.owner.has_line('STATION')[1]]) self.owner.add_money(money[count_stations]) print(12) return 'STATION' else: a = random.randint(1, 7) b = random.randint(1, 7) money = [4, 10] player.pay_money( (a + b) * money[self.owner.has_line('utility')[1]]) self.owner.add_money((a + b) * money[count_stations]) print(112) return 'utility' # tax: # take fee from player elif not self.is_mourtaged and not self.owner == player and self.color_street not in ['CC', 'C']: player.pay_money(self.with_house_fee[self.house_count]) self.owner.add_money(self.with_house_fee[self.house_count]) # take money and return print(11) return 'fee' print(133) return self.color_street
def unmourtage(self, player): if self.owner == player and not self.is_mourtaged: player.pay_money(self.building_price / 2) return True else: return False