Phobos icon indicating copy to clipboard operation
Phobos copied to clipboard

Forcing specific weapon by range

Open Coronia opened this issue 1 year ago • 1 comments

  • ForceWeapon.InRange forces specified a list of weapons to be used once the target is within their Range. The first weapon in the listed order satisfied will be selected. This won't affect forced attack on empty cell.
    • ForceWeapon.InRange.Overrides overrides the range when decides which weapon to use. Value from position matching the position from ForceWeapon.InRange is used if found, or the weapon's own Range if not found or set to a value below 0. Specifically, if a position has ForceWeapon.InRange set to -1 and ForceWeapon.InRange.Overrides set to a positive value, it'll use default weapon selection logic once satisfied.
    • If ForceWeapon.InRange.ApplyRangeModifiers is set to true, any applicable weapon range modifiers from the firer are applied to the decision range.

In rulesmd.ini:

[SOMETECHNO]                                    ; TechnoType
ForceWeapon.InRange=                            ; list of integer. 0 for primary weapon, 1 for secondary weapon, -1 to disable
ForceWeapon.InRange.Overrides=                  ; list of floating point value
ForceWeapon.InRange.ApplyRangeModifiers=false   ; boolean

An example:

[SOMETECHNO]
ForceWeapon.InRange=0,1,0,-1,1
ForceWeapon.InRange.Overrides=1,2,3,4,0

when the target distance is less than 1: use primary. when the target distance is between 1 and 2: use secondary. when the target distance is between 2 and 3: use primary. when the target distance is between 3 and 4: use default weapon selection rule. when the target distance is between 4 and secondary's range: use secondary. when the target distance is greater than secondary's range: use default weapon selection rule.

This pattern can natually support WeaponX as well.

Coronia avatar Oct 17 '24 07:10 Coronia

CLA Assistant Lite bot All contributors have signed the COC ✍️ ✅
Posted by the CLA Assistant Lite bot.

github-actions[bot] avatar Oct 21 '24 18:10 github-actions[bot]


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

github-actions[bot] avatar Oct 21 '24 18:10 github-actions[bot]

I have read the Code of Conduct and I hereby accept the Terms

nitronarcosis avatar Oct 21 '24 18:10 nitronarcosis

I have read the CLA Document and I hereby sign the CLA

nitronarcosis avatar Oct 21 '24 18:10 nitronarcosis

thank you for the contribution @nitronarcosis

mstopa-splunk avatar Oct 22 '24 06:10 mstopa-splunk