Crazy's Mod still in development
0 Members and 1 Guest are viewing this topic.
for i in pool: # This will make sure that girl will never buy more than 5 of any item! if i.id in self.inventory: mod = self.inventory[i.id] * 20 else: mod = 0 if dice(100 - i.badness - mod) and self.take_money(i.price, "Items"): self.inventory.append(i) returns.append(i.id) amount -= 1 if not amount: break
Doesn't it mean that if we send a character with low gold, she will keep wanting to buy random stuff but often will be unable to instead of focusing on cheap items she can afford?
Let's say she has 50 gold, and we have like 200 items she cannot afford and 50 she can.So we'll have a list of 250 items, and 200 of them will be useless to us from the beginning. Shouldn't we remove too expensive ones from the list after every purchase, or at least before the first purchase?
total_pool = [i for i in auto_buy_items if i.price <= self.gold]
Should I use a new list every time? Or it's possible to do stuff like pool = [i for i in pool if i.price <= self.gold]?