Question about bombing damage and repair
-
Hello!
(this is my first post here, so I hope I'm at the right place)
I am trying to mod some ideas about SBR and factories in general. But it seems to me that bombing damages/repair are heavily hardcoded.
Do you confirm that there is currently no way to trigger anything based on a condition that would check the bombing damages of a unit? Or to check if the unit is disabled (via maxOperationalDamage)?
I was trying to circumvent the problem using whenHitPointsDamagedChangesInto, but I understood that it only considers combat damages (hit points). Is there an equivalent feature for bombing damages?
And last question (sorry if this is too much): is there an equivalent of unitAttachment constructionsPerTerrPerTypePerTurn for non-construction units? placementLimit only looks at the total units in a territory, but I was looking for a feature allowing to limit (for example) to purchase/place 2 fighters per factory (no matter how many fighters are already in the territory).
Thanks!
-
@azimuth said in Question about bombing damage and repair:
Do you confirm that there is currently no way to trigger anything based on a condition that would check the bombing damages of a unit? Or to check if the unit is disabled (via maxOperationalDamage)?
Hail and Welcome!
You are correct here.
@azimuth said in Question about bombing damage and repair:
And last question (sorry if this is too much): is there an equivalent of unitAttachment constructionsPerTerrPerTypePerTurn for non-construction units? placementLimit only looks at the total units in a territory, but I was looking for a feature allowing to limit (for example) to purchase/place 2 fighters per factory (no matter how many fighters are already in the territory).
Both uses of "placementLimit" (unitAttachment/playerAttachment) include the number of units already in the territory. By using "requiresUnits" set to a unit that has "canProduceXUnits" can limit the production of certain units.
Just some thoughts.
Cheers...
-
@wc_sumpton Thank you for the prompt answer
Too bad...
I tried with "requiresUnits" coupled with "canProduceXUnits", but the later set a max production for all units (and if there are multiple units producing units, the one producing the more overrides all the others).
Last chance: can the repair phase be separated from the purchase phase? Doesn't seem so, but perhaps I overlooked a possibility...
-
@azimuth said in Question about bombing damage and repair:
I tried with "requiresUnits" coupled with "canProduceXUnits", but the later set a max production for all units (and if there are multiple units producing units, the one producing the more overrides all the others).
Yea this can be tricky. The one producing Infantry has to be set by itself, or infantry could be produced alone with the other productions set to 0. Lot of triggers!
@azimuth said in Question about bombing damage and repair:
Last chance: can the repair phase be separated from the purchase phase? Doesn't seem so, but perhaps I overlooked a possibility...
When you want to repair, remove all other purchase. Don't know if this will work, it may be worth a try. But yea, repair and purchase are mixed together, would be nice if a step option separated them.
Cheers...
-
@wc_sumpton Is there a way to selectlively cancel some productions/purchase?
Anyway, I guess I'll drop the plan: too many constrains to make anything functional.
-
@azimuth said in Question about bombing damage and repair:
Is there a way to selectlively cancel some productions/purchase?
Yes production/purchase can be changed. In PoS2 this is used to change China's production:
<attachment name="triggerAttachmentChinese2a_BurmaRoadOpen" attachTo="Chinese" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="objectiveAttachmentChinese2_BurmaRoad"/> <option name="frontier" value="Chinese_BurmaRoad_production"/> </attachment>
While the following will only add the ability to buy "Air-Transport" to Germany's production:
<attachment name="triggerAttachmentGermansParatroopersCanProduce" attachTo="Germans" javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachmentGermansParatroopers"/> <option name="productionRule" value="Germans_production:buyAir_Transport"/> </attachment>
So yea, there are way to change production/purchase.
Cheers...
-
@wc_sumpton oh... Very interesting. I'll try to play around.
Thanks a lot for your support!
-
@azimuth said in Question about bombing damage and repair:
And last question (sorry if this is too much): is there an equivalent of unitAttachment constructionsPerTerrPerTypePerTurn for non-construction units? placementLimit only looks at the total units in a territory, but I was looking for a feature allowing to limit (for example) to purchase/place 2 fighters per factory (no matter how many fighters are already in the territory).
Are you still trying to place only two infantry without having to count the number of infantry already in a territory. If so I have a workaround that might interest you.
First the purchase of "Infantry" would be replaced with a new unit "Infantry-X":<unitList> ... <unit name="Infantry"/> <unit name="Infantry-X"/> <!-- Used for Infantry purchasing only --> ... </unitList>
<production> ... <!-- Commenting out infantry productionRule --> <!-- <productionRule name="buyInfantry"> <cost resource="PUs" quantity="3"/> <result resourceOrUnit="Infantry" quantity="1"/> </productionRule> --> <!-- New Infantry productionRule, same name but purchases Infantry-X --> <productionRule name="buyInfantry"> <cost resource="PUs" quantity="3"/> <result resourceOrUnit="Infantry-X" quantity="1"/> </productionRule> ... </production>
Now for the unitAttachment, make a copy of the "Infantry" attachment and change "AttachTo" to "Infantry-X"
<attachmentList> ... <!-- You still need the "Infantry" attachment with no changes --> <attachment name="unitAttachment" attachTo="Infantry" javaClass="UnitAttachment" type="unitType"> ... </attachment> <!-- For the "Infantry-X" attachment add the ability to create "Infantry" --> <attachment name="unitAttachment" attachTo="Infantry-X" javaClass="UnitAttachment" type="unitType"> ... <!-- Add the 2 unit restriction here --> <option name="placementLimit" value="owned" count="2"/> <!-- this will add the Infantry unit where Infantry-X is placed --> <option name="createsUnitsList" value="1:Infantry"/> </attachment> ...
Now the Infantry-X will create 1 Infantry during EndTurn phase, what is left is to clear out all Infantry-X so they don't continue to create excess Infantry.
<!-- Still under the attachmentList will need a condition and trigger, so if there is not one create an "Always-True" condition --> ... <!-- Only need one "Always-True" since any player can call this condition --> <attachment name="conditionAttachment_Always_True" attachTo="Germany" javaClass="RulesAttachment" type="player"> <option name="switch" value="true"/> </attachment> <!-- One trigger to clean-up or a trigger for each player --> <attachment name="triggerAttachment_Remove_Infantry-X" attachTo="Germany" javaClass="TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachment_Always_True"/> <option name="removeUnits" value="all:Infantry-X" count="999"/> <!-- use a high count to insure all Infantry-X are removed --> <!-- to allow this trigger to work for all players, the players option would need to be used --> <!-- <option name="players" value="(List all players here)"/> --> <option name="when" value="after:germanyEndTurn"/> <!-- Each player would need an endTurn when --> <!-- <option name="when" value="(Next players endTurn)" --> </attachment> ... </attachmentList>
Seems complicated but it should work.
Cheers...
-
@wc_sumpton Oh, thank you! I got it. Very smart. I'll definitely try it.
My main idea was to have SBR able to target units production rather than just money (like, to block or reduce new aircrafts) and to push players to develop their production capacity not only in quantity, but also in quality (so that you can't build 12 subs one turn, and 12 tanks the next one with the same factory). But as bombing damages are so hardcoded, it seems very difficult to simulate anything like that.
-
@azimuth If you want to prevent the player from switching production easily, you could create different factory types which are restricted to specific units. However, this would increase complexity, require guidance for the AI and could result in unit overcrowding.
-
@wc_sumpton Hello!
So in the end, I used your trick, and I think I am quite happy with the result
But still struggling with the bombing/repair stuff.
Tonight I discovered by chance the "onlyRepairIfDisabled" feature (very well hidden) and thought it would solve all my headaches... But unfortunatelly no, because it cancels the purchase phase fully (changing it into a repair phase).
Well, this could be interesting (that's what I wanted, a separate repair phase) BUT I cannot find a way to cancel the repair to happen before the purchase phase (hence it works the other way around).
The only way is to cancel the repairfrontier completely and repair by other means.
Or... another hidden feature ??
-
I actually found a very, very, very dirty trick. But my map is already so heavily modded that it could do the job. Sharing just in case
I use the repairPlayers step option, which allows a player to repair for another player. The feature seems to be working ONLY if the main player has anything to repair for himself (which isn't very logic or intuitive). To say it another way, if you want Germans to be able to repare italian factories, you need to have at least one german damaged facility as well, otherwise the phase is skipped.
So I created two extra (hidden) players, " Axis" and "Allies". Only those two have the repair frontier. In order to have the repairPlayers feature working (see above), both have a (hidden) fake damaged unit on the map (in Sahara and Himalaya, respectively) that cannot be repaired (no repair frontier).
This way, the repair screen doesn't pop-up before regular players purchase phase (as they don't have the frontier). Instead, just after the Place phase of each players, there is a separate "repair" phase, actually lead by the "Axis" and "Allies" players, and using pooled resources.
This all just to make sure factories cannot be repaired before placing units...