mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Randomized one extra bullet for side groups in burst attacks
* idea from phobos2077. Added minimum value check to multipliers.
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "..\main.h"
|
||||
#include "..\FalloutEngine\Fallout2.h"
|
||||
|
||||
#include "BurstMods.h"
|
||||
#include "MainLoopHook.h"
|
||||
@@ -47,8 +48,13 @@ static long __fastcall ComputeSpray(DWORD* roundsLeftOut, DWORD* roundsRightOut,
|
||||
*roundsCenterOut = roundsCenter;
|
||||
|
||||
long roundsLeft = (totalRounds - roundsCenter) / 2;
|
||||
long roundsRight = totalRounds - roundsCenter - roundsLeft;
|
||||
if (roundsLeft != roundsRight && fo::func::roll_random(0, 1)) { // randomize the distribution of one extra bullet
|
||||
roundsLeft++;
|
||||
roundsRight--;
|
||||
}
|
||||
*roundsLeftOut = roundsLeft;
|
||||
*roundsRightOut = totalRounds - roundsCenter - roundsLeft;
|
||||
*roundsRightOut = roundsRight;
|
||||
|
||||
// roundsMainTarget = roundsCenter * mult / div
|
||||
result = roundsCenter * compute_spray_target_mult;
|
||||
@@ -99,7 +105,9 @@ void BurstMods::init() {
|
||||
if (compute_spray_center_div < 1) {
|
||||
compute_spray_center_div = 1;
|
||||
}
|
||||
if (compute_spray_center_mult > compute_spray_center_div) {
|
||||
if (compute_spray_center_mult < 1) {
|
||||
compute_spray_center_mult = 1;
|
||||
} else if (compute_spray_center_mult > compute_spray_center_div) {
|
||||
compute_spray_center_mult = compute_spray_center_div;
|
||||
}
|
||||
compute_spray_center_mult_def = compute_spray_center_mult;
|
||||
@@ -110,7 +118,9 @@ void BurstMods::init() {
|
||||
if (compute_spray_target_div < 1) {
|
||||
compute_spray_target_div = 1;
|
||||
}
|
||||
if (compute_spray_target_mult > compute_spray_target_div) {
|
||||
if (compute_spray_target_mult < 1) {
|
||||
compute_spray_target_mult = 1;
|
||||
} else if (compute_spray_target_mult > compute_spray_target_div) {
|
||||
compute_spray_target_mult = compute_spray_target_div;
|
||||
}
|
||||
compute_spray_target_mult_def = compute_spray_target_mult;
|
||||
|
||||
@@ -249,12 +249,16 @@ void mf_set_spray_settings(OpcodeContext& ctx) {
|
||||
targetDiv = ctx.arg(3).rawValue();
|
||||
|
||||
if (centerDiv < 1) centerDiv = 1;
|
||||
if (centerMult > centerDiv) {
|
||||
if (centerMult < 1) {
|
||||
centerMult = 1;
|
||||
} else if (centerMult > centerDiv) {
|
||||
centerMult = centerDiv;
|
||||
ctx.printOpcodeError("%s() - Warning: centerMult value is capped at centerDiv.", ctx.getMetaruleName());
|
||||
}
|
||||
if (targetDiv < 1) targetDiv = 1;
|
||||
if (targetMult > targetDiv) {
|
||||
if (targetMult < 1) {
|
||||
targetMult = 1;
|
||||
} else if (targetMult > targetDiv) {
|
||||
targetMult = targetDiv;
|
||||
ctx.printOpcodeError("%s() - Warning: targetMult value is capped at targetDiv.", ctx.getMetaruleName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user