End UserActions phase when action fails?
Jason Green-Lowe last edited by
In my ongoing quest to port BBR to TripleA, I am trying to allow a player to decide how many dice to purchase while rolling for tech. The tech is very non-standard, so I cannot use the built-in TripleA tech system. Instead, I am using the userActions system.
The code below allows the player to purchase up to 10 dice and then gives a chance of successfully discovering a tech based on how many dice they rolled. "$MatureTechOdds$ is a lookup table that has values like 33% for 1 die and 70% for 3 dice (because each die hits on a 5 or 6, and you need at least one hit to discover the tech). This part works fine.
<attachment foreach="$Technologies$^$MatureTechDice$:$MatureTechOdds$" name="userActionAttachment_Germans_Choose_Mature_Tech_Effort_@MatureTechDice@_@Technologies@" attachTo="Germans" javaClass="games.strategy.triplea.attachments.UserActionAttachment" type="player"> <option name="conditions" value="conditionAttachmentGermansMayBuyMatureTech:conditionAttachmentGermansIsDeveloping@Technologies@"/> <option name="activateTrigger" value="triggerAttachment_Germans_Buy_Mature_Tech_@MatureTechDice@_@Technologies@_1:1:false:false:false:false"/> <option name="activateTrigger" value="triggerAttachment_Germans_Buy_Mature_Tech_@MatureTechDice@_@Technologies@_2:1:false:false:false:false"/> <option name="text" value="GERMANS_BUY_TECH_@MatureTechDice@"/> <option name="chance" value="@MatureTechOdds@:100"/> <option name="attemptsPerTurn" value="1"/> </attachment>
The problem I'm having is that after rolling some tech dice and failing the roll, the player is invited to purchase some other number of tech dice and try again, which should not be allowed. The whole point of this part of the system is that you choose in advance how many dice to purchase, before seeing the roll, and then if they all miss, you have to wait until the next turn. Setting "attemptsPerTurn" to 1 is not effective here because each of the different numbers of dice you can roll is being treated as a separate userAction. So, if you roll 3 dice and fail, you can't roll 3 dice again the same turn, but the engine is allowing you to just go ahead and buy 2 or 4 or 5 dice if you wish, and I don't want to allow players to do that.
Anyone have advice on how to stop this behavior? Can I, e.g., somehow immediately end the userActions phase after a failure? Can I cause a trigger to fire based on the failure?
Un-sure how to reply to this. You are using userActions to purchase 'techTokens', ok but if you have a tech step, the user can still purchase techTokens then.
Will need more clarifications on what is being done.
Jason Green-Lowe last edited by Jason Green-Lowe
@wc_sumpton So the tech rules that I am using require the player to first choose a tech, then spend exactly 4 PUs per turn for 3 turns to accumulate progress on that tech, then on turn 4, roll 1d6 and discover the tech on a 6, paying the cost of the die rolled in PUs regardless of whether the roll was successful, and then, on turn 5, if the roll was unsuccessful, buy up to 10 dice for 1 PU each and successfully discover the tech if any of those dice came up '5' or '6'.
As you can see, these rules are not even slightly compatible with the built-in tech system in tripleA, which is why I am not using it. I do not have a tech phase in my <gameplay> section.
I have already made the whole tech-accumulation-system work to my satisfaction; the only part that is giving me trouble is finding a way to make a userAction trigger effect A when the userAction succeeds, and trigger effect B when the userAction fails. The particular effect B that I want this userAction to trigger when it fails is to shut off access to the remaining "Buy X dice" userActions for the rest of the turn.
When the selection "chance" is a success, triggers 'triggerAttachment_Germans_Buy_Mature_Tech_@MatureTechDice@@Technologies@_1' and 'triggerAttachment_Germans_Buy_Mature_Tech_@MatureTechDice@@Technologies@_2' are activated, and one condition is changed: 'conditionAttachmentGermansMayBuyMatureTech'. This is what is causing the userAction not to reappear. To get the same effect from an unsuccessful 'chance', the trigger that changes the condition would need to be activated, so the 'chance' would need to be relocated.
Hope this helps!