@Ramon said:
Is it possible to give the player a choice? either buy 6 dice or dont buy any?
Create it as a purchasable item:
<productionRule name="buyTechTokens">
<cost resource="PUs" quantity="20"/>
<result resourceOrUnit="techTokens" quantity="6"/>
</productionRule>
and add to the production of each player. The triggers are not needed when doing this.
"userActions" can be used:
<attachment name="userActionAttachment_Japanese_Purchase_6TT" attachTo="Japanese" javaClass="UserActionAttachment" type="player">
<option name="conditions" value="conditionAttachment_Is_Japanese_Not_AI"/>
<option name="activateTrigger" value="triggerAttachment_Give_Japanese_6_techTokens"/>
<option name="activateTrigger" value="triggerAttachment_Take_20_PUs_From_Japanese"/>
<option name="text" value="Japanese_6TT"/>
<option name="attemptsPerTurn" value="1"/>
</attachment>
Then the actionstext.properties:
Japanese_6TT.BUTTON=[Purchase]
Japanese_6TT.DESCRIPTION=Purchase 6 techTokens for 20 PUs.
Japanese_6TT.NOTIFICATION_SUCCESS=You have purchased 6 techTokens for 20 PUs.
Japanese_6TT.OTHER_NOTIFICATION_SUCCESS=The Japanese have purchased 6 techTokens for 20 PUs.
There are 2 problems with this approach. The AI does not use "userActions". This can be checked by using "isAI":
<attachment name="conditionAttachment_Is_Japanese_AI" attachTo="Japanese" javaClass="RulesAttachment" type="player">
<option name="isAI" value="true"/>
</attachment>
<attachment name="conditionAttachment_Is_Japanese_Not_AI" attachTo="Japanese" javaClass="RulesAttachment" type="player">
<option name="conditions" value="conditionAttachment_Is_Japanese_AI"/>
<option name="invert" value="true"/>
</attachment>
<attachment name="triggerAttachment_Japanese_Purchase_6TT" attachTo="Japanese" javaClass="TriggerAttachment" type="player">
<option name="conditions" value="conditionAttachment_Is_Japanese_AI"/>
<option name="chance" value="3:6"/>
<option name="chanceIncrementOnFailure" value="1"/>
<option name="chanceDecrementOnSuccess" value="1"/>
<option name="notification" value="Japanese_6TT"/>
<option name="when" value="before:JapaneseTech"/>
<option name="players" value="@All-Players@"/>
<option name="activateTrigger" value="triggerAttachment_Give_Japanese_6_techTokens"/>
<option name="activateTrigger" value="triggerAttachment_Take_20_PUs_From_Japanese"/>
</attachment>
The other problem is there is no way to test if Japanese have the 20PUs, they will always be able to purchase the 6 techTokens.
Cheers...