Navigation

    TripleA Logo

    TripleA Forum

    • Register
    • Login
    • Search
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags

    How do I auto-damage units at the end of a player's turn?

    Map Making
    4
    16
    521
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • VictoryFirst
      VictoryFirst last edited by

      So in this game I am working on, there is a tank unit that has 2 HP on offense, but only 1 HP on defense. I was thinking about auto-damaging all tanks at the end of a player's turn. This would essentially turn all tanks into 1 HP if attacked. However, I am having trouble implementing this.

      This is my code. I tried to place a tank with 1 damage hit in each territory containing a tank, for one player only, just to test some things.

      	<attachment foreach="$LandZones$" name="conditionAttachment_Tanks" attachTo="AustroHungarians" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player">
      		<option name="directPresenceTerritories" value="$LandZones$" count="1"/>
      		<option name="unitPresence" value="tank" count="1"/>
      	</attachment>
      	<attachment foreach="$LandZones$" name="triggerAttachment_Damage_Tanks" attachTo="AustroHungarians" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
      		<option name="conditions" value="conditionAttachment_Tanks"/>
      		<option name="when" value="before:austrohungariansEndTurn"/>
      		<option name="placement" value="@LandZones@:tank" hitsTaken="1" count="1"/>
      	</attachment>
      <!-- Victory Conditions -->
      

      I got this as a result:

      ![0_1721476859686_88cdf30b-2209-4144-a9b7-d8a10f750604-image.png](Uploading 100%)

      1 Reply Last reply Reply Quote 0
      • VictoryFirst
        VictoryFirst last edited by

        2f1e083e-9d2d-4e81-b235-541e93ee31dd-image.png

        The only thing that happened is that one full strength Austrian tank was placed in Ruhr.

        B W 3 Replies Last reply Reply Quote 1
        • B
          beelee @VictoryFirst last edited by beelee

          @victoryfirst

          yea i don't think "hitsTaken" works as an attachment. It only works for placement.

          edit
          placement as in at game start

          Screenshot from 2024-07-20 07-25-10.png

          1 Reply Last reply Reply Quote 1
          • B
            beelee @VictoryFirst last edited by

            @victoryfirst

            make another request. Maybe it's not hard to add and @Myrd will bust it out 🙂

            W 1 Reply Last reply Reply Quote 0
            • W
              wc_sumpton @VictoryFirst last edited by

              @victoryfirst

              There is no attribute "hitTaken" in attachments, only name, value and count. The "hitTaken" attribute can only be used with unitPlacement.

              Then again, this coding would not really work, as only 1 tank would be hit. It is the same problem you would have if you were trying to replace the 2-hit unit with a 1-hit unit, because with the xml coding it is very hard to get the number of units that may occupy a single territory.

              Sorry

              Cheers...

              1 Reply Last reply Reply Quote 3
              • W
                wc_sumpton @beelee last edited by

                @beelee

                Again, I don't think so. As I stated it is very hard to count the number of units that may be located in single territory. TripleA conditions are yes/no, "Is there one or more units located in territory X?", not "How many units are in territory X?". Thus, it would be very difficult to govern how many units the trigger would need to damage.

                So, this would be very difficult to explain, prior to coding.

                Cheers...

                VictoryFirst 1 Reply Last reply Reply Quote 2
                • VictoryFirst
                  VictoryFirst @wc_sumpton last edited by

                  @wc_sumpton

                  Hmm, that's a shame. So there is no way to count the number of units in a territory? My second idea was to change the HP of tanks to "1" and then auto-place a tank_soak unit to each territory containing tanks at the start of a player's turn, so if I have eight tanks sitting somewhere, eight tank_soak units are spawned as well, which can soak up the hits when attacking.

                  B W 2 Replies Last reply Reply Quote 0
                  • B
                    beelee @VictoryFirst last edited by beelee

                    @victoryfirst said in How do I auto-damage units at the end of a player's turn?:

                    So there is no way to count the number of units in a territory?

                    there is with "unitPresence" but you'd have to make a condition for each one. So a separate condition for 1 unit and, 2 , 3 ... and so on.

                    Youd also need separate triggers for each one.

                    Edit
                    and you'd have to do it for each territory

                    Edit 2
                    and for each player 🙂

                    VictoryFirst 1 Reply Last reply Reply Quote 2
                    • W
                      wc_sumpton @VictoryFirst last edited by

                      @victoryfirst

                      If you are thinking of using "createsUnitsList" then you have to remember that this will only work during a player's endTurn phase, and is really not a good workaround.

                      Cheers...

                      1 Reply Last reply Reply Quote 2
                      • VictoryFirst
                        VictoryFirst @beelee last edited by

                        @beelee

                        Heh heh I see, it's a pain in the ass 🙂 I think it's handier to just edit then.

                        B 2 Replies Last reply Reply Quote 1
                        • B
                          beelee @VictoryFirst last edited by

                          @victoryfirst

                          heh heh just do a few at a time. Start with the high use areas. Maybe do 20 tanks. Once you have it done you can copy paste find and replace for the other players.

                          I think your idea of adding the hit soakers might work. Have the soakers place before combat move and then remove them after combat

                          1 Reply Last reply Reply Quote 1
                          • B
                            beelee @VictoryFirst last edited by

                            @victoryfirst

                            could call the soakers "reactiveArmor" lol

                            W 1 Reply Last reply Reply Quote 1
                            • W
                              wc_sumpton @beelee last edited by

                              @beelee, @VictoryFirst

                              Nothing deals with hitPoints, techAttachments, territoryEffectsAttachments, unitSupportAttachments. To add something, it would need to be designed in, and would have to account for the unit's combat situation, offence/defense. Both territoryEffectsAttachments and unitSupportAttachments could be modified. But as I stated this would need to be designed.

                              Cheers...

                              1 Reply Last reply Reply Quote 3
                              • cameron
                                cameron last edited by

                                i think you'd need the game to have separate HP values for ATT/DEF just like it does for firepower... and that would lead ro all sorts of problems especially for units that have more than 2 HP... maybe if it was changed so that units full healed each repair phase instead of just 1 HP at a time.

                                W 1 Reply Last reply Reply Quote 1
                                • W
                                  wc_sumpton @cameron last edited by

                                  @cameron said in How do I auto-damage units at the end of a player's turn?:

                                  maybe if it was changed so that units full healed each repair phase instead of just 1 HP at a time.

                                  There is the "repairUnits" for both the endGame and move delegates. And map properties.

                                  <property name="Units Repair Hits End Turn" value="true" editable="true">
                                    <boolean/>
                                  </property>
                                  <property name="Units Repair Hits Start Turn" value="false" editable="true">
                                    <boolean/>
                                  </property>
                                  

                                  Cheers...

                                  cameron 1 Reply Last reply Reply Quote 2
                                  • cameron
                                    cameron @wc_sumpton last edited by cameron

                                    @wc_sumpton

                                    actually, that makes them heal less...

                                    when i tried:

                                    <property name="Units Repair Hits Start Turn" value="true" editable="false">
                                    	<boolean/>
                                    </property>
                                    <property name="Units Repair Hits End Turn" value="false" editable="false">
                                    	<boolean/>
                                    </property>
                                    

                                    then:

                                    • units healed 0 HP at end of their Turn Complete phase
                                    • units healed 0 HP at end of other players Turn Complete phase
                                    • units healed 1 HP at start of their Combat Move phase

                                    when i tried:

                                    <property name="Units Repair Hits Start Turn" value="true" editable="false">
                                    	<boolean/>
                                    </property>
                                    <property name="Units Repair Hits End Turn" value="true" editable="false">
                                    	<boolean/>
                                    </property>
                                    

                                    then:

                                    • units healed 1 HP at end of their Turn Complete phase
                                    • units healed 0 HP at end of other players Turn Complete phase
                                    • units healed 1 HP at start of their Combat Move phase

                                    when i tried:

                                    <property name="Units Repair Hits Start Turn" value="false" editable="false">
                                    	<boolean/>
                                    </property>
                                    <property name="Units Repair Hits End Turn" value="true" editable="false">
                                    	<boolean/>
                                    </property>
                                    

                                    then:

                                    • units healed 1 HP at end of their Turn Complete phase
                                    • units healed 1 HP at end of other players Turn Complete phase
                                    • units healed ? HP at start of their Combat Move phase [always fully healed before this point but one assumes 0]

                                    EDIT: corrected lazy copy/paste errors

                                    1 Reply Last reply Reply Quote 1
                                    • 1 / 1
                                    • First post
                                      Last post
                                    Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums