devolution

Author Topic: <-- Archived --> (Items Concept)  (Read 76268 times)

0 Members and 1 Guest are viewing this topic.

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: Items Concept
« Reply #120 on: December 06, 2015, 09:27:35 AM »
Hm, no, it doesn't seem right to sell stuff without a reason.
If you fire them, they CAN sell any unequipped items if they need money, but don't have to if they already have enough money to live. Yeah, it probably should be part of simulation too.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: Items Concept
« Reply #121 on: December 06, 2015, 09:38:45 AM »
I doubt that we'll manage proper simulation before next release.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: Items Concept
« Reply #122 on: December 06, 2015, 10:14:41 AM »
I'm aware of it  :)

I wonder how should I check general occupations inside autobuying. Cgo uses "for occ in char.traits", but inside autobuying we use self instead of char.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: Items Concept
« Reply #123 on: December 06, 2015, 10:29:03 AM »
Normally:

PytCharacter.occupations is a set of all occupations, main, sub, general, doesn't matter... self.occupations if you check inside of the class. General strings like "Server" should be there as well.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: Items Concept
« Reply #124 on: December 07, 2015, 03:23:12 AM »
Quote
            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?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: Items Concept
« Reply #125 on: December 07, 2015, 03:40:57 AM »
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?

Which part? Code will run itself until amount of items requested is 0 or until all options run themselves out. You'll have to be more specific on what concerns you.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: Items Concept
« Reply #126 on: December 07, 2015, 03:58:38 AM »
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?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: Items Concept
« Reply #127 on: December 07, 2015, 04:32:42 AM »
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?

In the very beginning would be a nice optimization, would prolly speed things up a little bit. New list would have to be created with:

Code: [Select]
total_pool = [i for i in auto_buy_items if i.price <= self.gold]
or something like that. We'll work with total pool after that... maybe removing all bad trait items using extra check while building this list is a decent idea also...

Those methods have been optimized just once because my first version was really, really slow and faaaaar too complicated. Your proposal seems like a good step towards making it better/faster.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: Items Concept
« Reply #128 on: December 07, 2015, 04:41:09 AM »
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]?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: Items Concept
« Reply #129 on: December 07, 2015, 04:50:58 AM »
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]?

It's perfectly possible but not very useful since we're building new lists from total pool two or three times. I think my original suggestion of creating a total pool with all badtrait and too expensive items sorted out is best. Than we can use that instead of the global auto_buy_items or whatever that's called.
Like what we're doing?