Phobos
Phobos copied to clipboard
Forcing specific weapon by range
ForceWeapon.InRangeforces specified a list of weapons to be used once the target is within theirRange. The first weapon in the listed order satisfied will be selected. This won't affect forced attack on empty cell.ForceWeapon.InRange.Overridesoverrides the range when decides which weapon to use. Value from position matching the position fromForceWeapon.InRangeis used if found, or the weapon's ownRangeif not found or set to a value below 0. Specifically, if a position hasForceWeapon.InRangeset to -1 andForceWeapon.InRange.Overridesset to a positive value, it'll use default weapon selection logic once satisfied.- If
ForceWeapon.InRange.ApplyRangeModifiersis 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.
CLA Assistant Lite bot All contributors have signed the COC ✍️ ✅
Posted by the CLA Assistant Lite 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.
I have read the Code of Conduct and I hereby accept the Terms
I have read the CLA Document and I hereby sign the CLA
thank you for the contribution @nitronarcosis