TripleA Logo TripleA Forum
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags
    • Register
    • Login

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

    Scheduled Pinned Locked Moved Map Making
    16 Posts 4 Posters 2.2k Views 4 Watching
    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.
    • VictoryFirstV Offline
      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
      • VictoryFirstV Offline
        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 wc_sumptonW 3 Replies Last reply Reply Quote 1
        • B Offline
          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 Offline
            beelee @VictoryFirst
            last edited by

            @victoryfirst

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

            wc_sumptonW 1 Reply Last reply Reply Quote 0
            • wc_sumptonW Online
              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
              • wc_sumptonW Online
                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...

                VictoryFirstV 1 Reply Last reply Reply Quote 2
                • VictoryFirstV Offline
                  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 wc_sumptonW 2 Replies Last reply Reply Quote 0
                  • B Offline
                    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 🙂

                    VictoryFirstV 1 Reply Last reply Reply Quote 2
                    • wc_sumptonW Online
                      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
                      • VictoryFirstV Offline
                        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 Offline
                          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 Offline
                            beelee @VictoryFirst
                            last edited by

                            @victoryfirst

                            could call the soakers "reactiveArmor" lol

                            wc_sumptonW 1 Reply Last reply Reply Quote 1
                            • wc_sumptonW Online
                              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
                              • cameronC Offline
                                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.

                                wc_sumptonW 1 Reply Last reply Reply Quote 1
                                • wc_sumptonW Online
                                  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...

                                  cameronC 1 Reply Last reply Reply Quote 2
                                  • cameronC Offline
                                    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

                                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                    With your input, this post could be even better 💗

                                    Register Login
                                    • 1 / 1
                                    • First post
                                      Last post
                                    Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums