Closed mikemclaren closed 8 years ago
I keep forgetting to set my origin to this repo, not my fork, hence the pull request from my fork!
Don't merge this quite yet, I'm seeing an error on retainer purchase I need to work through.
Fixed it, should be good for looking at now. I had made a circular reference when adding upgrades. :disappointed:
Super excited to try this out. Thanks for it! Are there any tests needed for it?
There are! Making some tests for the vendor and upgrades now.
I bought laser pointers earlier in the game, but I sold all of them. Before I bought more, it said I had spent $0 on them. I bought 20, and the card now shows I paid more than they cost per unit.
Yeah, I need to make bookkeeping a little "smarter". Right now it doesn't track until you actually get the bookkeeping upgrade (which I think makes sense, though I need messaging to reflect that), and it's not particularly smart, especially if you don't sell all of something.
What I think I need to do is throw a "boughtAt" array onto an item's inventory object. Every time you "buy" that item, an object that contains the units and amount bought at is appended to it. Once you hit 0 and the item's gone from the inventory, that count would reset, which is perfect! I didn't intend this to be a "historical" price tracker, just more of a short-term turn-to-turn tool.
Added some tests and bookkeeping should in general work a lot better now. :)
Looks great, thank you so much! :shipit: