From: Erik V. <eri...@xs...> - 2012-03-10 21:13:38
|
Implementing a SpecialBuyRight for a Number of Trains, not yet finished need to find the trigger and a valid way to proceed for the following mechanismn: New special powers are usually a nightmare to implement, and I have always postponed that until everything else works. In such cases we usually need both a new SpecialProperty and a new PossibleAction, and special code in several game-specific subclasses in both the UI and the game engine. I never can predict how any such action can best be implemented, it's usually a trial-and-error exercise. But from experience I may be able to give some advice. If a train has been bought and we have a phase change the second train might be acquired once by the owner of the private Rocket of China (2+2,3,3+3,4 are possible trains/phases) So we need to ask the player if he wants to exercise that special buy action... Afterwards if he does the paper is closed. Different approaches not yet successfull. I suppose this refers to the P7 private. In the (German) rules I see no reference to phase changes as a trigger for this action. I understand it as follows: "If a company operates whose president is the P7 owner, that company may at any time take the currently available new train for free, closing the P7. Once the first 4 train has been bought, the exchange is mandatory" (it's not clear to me if the second sentence also applies if an own company is operating, or if it occurs regardless who is operating). Assuming that this is what you mean, I would create an extra PossibleAction for this purpose (either reuse BuyTrain, or create a new action class) each time there is an opportunity to do this exchange. This PossibleAction will be linked to a menu item in the Special menu in the OR Panel; Special will be yellow-highlighted if such an action is possible. It's then up to the player to notice this and select the action if he wants so. This is how several special actions have been incorporated so far. Alternatively, the UI may raise a popup with a yes/no question. The automatic exchange against the second 4-train can be executed automatically. A message should be displayed. Second special power, after the last train of 2+2 or 3 or 3+3 provenience the owner of the P0 might once declare his company closed and gets 40, 70 or 100 Yuan respectivly, private company is then closed. Note that money goes to the player not any company. This action will often occur out of the normal operating order, which makes it harder to do properly. We just have has such a case, and concluded that (for the time being) it is OK to ask the currently acting player if such an action (possibly by another player) must be executed. It is then left to the players to communicate about this action outside of Rails. So: when the last 2+2, 3 or 3+3 train has been bought, send a (single) action to the UI that triggers this question. Normal operation is interrupted. Several cases already exist where such an "extra" action is injected; I can look for examples if you want. In this case a popup is unavoidable. I hope this helps a little. Erik. |