Marketplace is a buildable building for all cities. Once a player has built a marketplace in any city they can access the marketplace tab. The tab is accessible at any time while the player owns a city with the marketplace building. The marketplace tab can be used to request trades with other players, or to trade resources with the “market” at specific ratios. When a player requests a trade with another player, the second player will be prompted to accept or decline this trade at the beginning of their turn. Players may not request trade with players who do not yet own a marketplace. The marketplace price ratio when trading with the market is improved by a percentage for every additional marketplace you own.
Marketplace price ratios should be exposed in a data file located somewhere in the data folder.
When a new game is created, part of the init process is to generate market ratio data for every player based on the data file. The data file should include the base ratios (i.e ratios for players with only 1 marketplace, and should include a percentage value to indicate the improvement in ratios per additional marketplace).
Martekplace object should be created as part of the Player object.
this Object is affected by:
-building a market place
-gaining control of a city
-losing control of a city
The marketplace object in the player object is a data component which should have no functionality.
Additionally there will need to be a logic component with the following functions:
-requestPlayerTrade(trade, source, target)
trade: is an object with the following format
source: name of player who is requesting trade
target: name of player whom the trade is requesting
-processPlayerTrade(trade, source, target)
#if the trade is accepted, this function should process the trade
#this function should also log the event of this trade
#this function will be used when a player establishes a trade against the market.
#market ratios will be enforced by the UI so this function will simply process the trade by subtracting and adding resources to the source.