Multiple purchase phases



  • First off, is it possible?

    If so, can I have the different phases be different units?

    My goal is to have one be more of a sell phase to get money. Kind of the opposite of what the Dragon
    wars map does. I plan on having the map light on PUs, but comparitively heavy on other resources. Or maybe make another new resource if that works. I would like to have the money made from selling available on that turn.

    Thanks for any tips


  • Moderators

    @ff03k64 I've never tried it but you could add a second purchase step and see what happens.

    <step name="germansPurchase" delegate="purchase" player="Germans"/>

    probably rename the second one as well



  • I tried that, Got this in the console.

    Aug 17, 2020 9:33:30 AM org.triplea.game.client.HeadedGameRunner lambda$initializeClientSettingAndLogging$0
    SEVERE: Unrecognized step name:xcomPurchase2
    java.lang.IllegalArgumentException: Unrecognized step name:xcomPurchase2
    	at games.strategy.triplea.TripleAPlayer.start(TripleAPlayer.java:173)
    	at games.strategy.engine.framework.ServerGame.waitForPlayerToFinishStep(ServerGame.java:537)
    	at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:407)
    	at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:297)
    	at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInternal(LocalLauncher.java:86)
    	at games.strategy.engine.framework.startup.launcher.LocalLauncher.lambda$launch$0(LocalLauncher.java:60)
    	at java.base/java.lang.Thread.run(Thread.java:834)
    
    

    Added this line to the game sequence

                <step name="xcomPurchase2" delegate="purchase2" player="XCOM"/>
    

    and added this to the delegates

    
    		<delegate name="purchase2" javaClass="games.strategy.triplea.delegate.PurchaseDelegate" display="Purchase Units"/>
    

  • Moderators

    @ff03k64 bummer
    I thought you could have. Oh I think "delegate" needs to stay the same. So keep it at "purchase" Just change the first part



  • @ff03k64

    You can have as many purchase phases that you want, and you don't need to use a new delegate, the purchase delegate will do. Just make sure it start with the country's name and ends with purchase.:

    <step name="russiansTech" delegate="tech" player="Russians"/>
    <step name="russiansTechActivation" delegate="tech_activation" player="Russians"/>
    <step name="russiansSellPurchase" delegate="purchase" player="Russians"/>
    <step name="russiansCombatMove" delegate="move" player="Russians"/>
    <step name="russiansPurchase" delegate="purchase" player="Russians"/>
    <step name="russiansBattle" delegate="battle" player="Russians"/>
    <step name="russiansNonCombatMove" delegate="move" player="Russians" display="Non Combat Move"/>
    

    To have different items, create two productionFrontier's <productionFrontier name="production"> with the normal items.<productionFrontier name="sell"> for the resources you want to use t by PUs.

    Then use simple triggers to switch between the two before each purchase phase.

    <!-- Always True to insure proper firing of triggers -->
    <attachment name="conditionAttachmentAlwaysTrue" attachTo="Russians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
       <option name="switch" value="true"/>
    </attachment>
    
    <!-- Triggers to change frontiers -->
    <attachment name="triggerAttachmentRussianSell" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
       <option name="conditions" value="conditionAttachmentAlwaysTrue"/>
       <option name="frontier" value="sell"/>
       <option name="when" value="before:russiansSellPurchase"/>
    </attachment>
    
    <attachment name="triggerAttachmentRussianPurchase" attachTo="Russians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
       <option name="conditions" value="conditionAttachmentAlwaysTrue"/>
       <option name="frontier" value="production"/>
       <option name="when" value="before:russiansPurchase"/>
    </attachment>
    

    Hope this is helpful.

    Cheers...



  • "Simple" triggers? You're funny!

    I haven't done anything with triggers yet, so I will give it a try. Can I actually have a purchase phase where i get PUs for items? Or will i need to make another resource?



  • @ff03k64

    You can purchase resources with resources, you can purchase units with resources. But you can not take a unit off the map to purchase other units or resources. So what type of 'items' are you talking about? Infantry, armour, factories, etc... Or iron, oil, techTokens. It the 'item' is a game piece, then no you can not purchase with the item.

    Hope the clears things up.

    Cheers...

    P.S. All triggers are simple. Its just a matter of prospective. 😵



  • Well, that helped. I got two production phases, but they are both the same. I am pretty sure they are both the second one

    			<!-- Conditions -->
    
    			<attachment name="conditionAttachmentAlwaysTrue" attachTo="XCOM" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
    				<option name="switch" value="true"/>
    			</attachment>
    
    			<!-- Triggers -->
    
    			<attachment name="triggerAttachmentXCOMBlackMarketPurchase" attachTo="XCOM" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
    				<option name="conditions" value="conditionAttachmentAlwaysTrue"/>
    				<option name="frontier" value="production_xcom_bm"/>
    				<option name="when" value="before:xcomBlackMarketPurchase"/>
    			</attachment>
    
    			<attachment name="triggerAttachmentXCOMPurchase" attachTo="XCOM" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
    				<option name="conditions" value="conditionAttachmentAlwaysTrue"/>
    				<option name="frontier" value="production_xcom"/>
    				<option name="when" value="before:xcomPurchase"/>
    

    Here is the game sequence for them

    <step name="xcomTech" delegate="tech" player="XCOM"/>
                <step name="xcomBlackMarketPurchase" delegate="purchase" player="XCOM"/>
                <step name="xcomCombatMove" delegate="move" player="XCOM"/>	
                <step name="xcomPurchase" delegate="purchase" player="XCOM"/>
                <step name="xcomBattle" delegate="battle" player="XCOM"/>
                <step name="xcomNonCombatMove" delegate="move" player="XCOM" display="Non Combat Move"/>
                <step name="xcomPlace" delegate="place" player="XCOM"/>
                <step name="xcomTechActivation" delegate="tech_activation" player="XCOM"/>
                <step name="xcomEndTurn" delegate="endTurn" player="XCOM"/>
    

    ps, who said this was easy? 😛



  • @ff03k64

    Not bad. Looks good here. You are getting the same production for each purchase phase. Its probably the default production that was loaded at the beginning of the xml. This means the engine is not reading the triggers. Please check the properties for the 'Use Triggers' property and its 'true' if its not there then add it:

    <property name="Use Triggers" value="true" editable="false">
       <boolean/>
    </property>
    

    That should do it.

    Cheers...


Log in to reply