LilasCorner / jlootbox

Other
1 stars 0 forks source link

Modify 'platform check' to separate platform logic from agent logic #19

Open JohnTMurphy-NIU opened 2 years ago

JohnTMurphy-NIU commented 2 years ago

The Player.platformCheck() method currently encodes what is really platform logic. Consider the following modification:

  1. Add an instance variable to the Lootbox object that indicates if it is a limited edition.
  2. Replace the logic in platformCheck so that it asks the platform for any current offers available. This would take the buyer as a parameter ("What do you have for sale for me today?" so that the Platform can customize the offer) and it should return a list of loot boxes for sale. Often this will be just one loot box; if the platform is throwing in a free one, there might be the free one and the one that is for sale. In the future the platform might offer a selection of multiple loot boxes of different prices. Some of the loot boxes might be marked as limited editions. You might need to process the free box at this point.
  3. Modify the 'decide' method to use the information it gets from the platformCheck, especially the price(s) that were returned. (Currently this is 'getAskingPrice()').
  4. You might also need to modify the 'Platform.purchaseLootbox' method so that the platform records the lootbox that was selected- possibly this can just be adding the Lootbox to be purchased as an argument; essentially the player saying, "I want to buy this one." This might not be necessary: Currently the platform doesn't record this information, it stays in the player's memory, so this could be skipped.

The main advantage to this is that it breaks up the process into discrete transactions between the Player and the Platform: The Player says, "What do you have for sale?"; the Platform answers; and the player decides.