Replace "roll0(N) + M" by "roll(N) + M-1"
This commit is contained in:
parent
fce1393017
commit
c3be487479
8 changed files with 22 additions and 22 deletions
|
@ -39,8 +39,8 @@
|
||||||
#define DPERCENT_DAMAGE(x) (100.0 * (x) / ((x) + 100.0))
|
#define DPERCENT_DAMAGE(x) (100.0 * (x) / ((x) + 100.0))
|
||||||
#define DMINE_HITCHANCE(x) ((x) / ((x) + 20.0))
|
#define DMINE_HITCHANCE(x) ((x) / ((x) + 20.0))
|
||||||
#define DMINE_LHITCHANCE(x) ((x) / ((x) + 35.0))
|
#define DMINE_LHITCHANCE(x) ((x) / ((x) + 35.0))
|
||||||
#define MINE_DAMAGE() (22 + roll0(21))
|
#define MINE_DAMAGE() (21 + roll(21))
|
||||||
#define MINE_LDAMAGE() (11 + roll0(20))
|
#define MINE_LDAMAGE() (10 + roll(20))
|
||||||
#define DTORP_HITCHANCE(range, vis) \
|
#define DTORP_HITCHANCE(range, vis) \
|
||||||
(0.9 / ((range)+1) + (((vis) < 6) ? (5-(vis)) * 0.03 : 0.0))
|
(0.9 / ((range)+1) + (((vis) < 6) ? (5-(vis)) * 0.03 : 0.0))
|
||||||
#define TORP_DAMAGE() (torpedo_damage + roll0(torpedo_damage) + \
|
#define TORP_DAMAGE() (torpedo_damage + roll0(torpedo_damage) + \
|
||||||
|
|
|
@ -1837,12 +1837,12 @@ att_fight(int combat_mode, struct combat *off, struct emp_qelem *olist,
|
||||||
* since a single dead guy normally wouldn't cause a commander to
|
* since a single dead guy normally wouldn't cause a commander to
|
||||||
* rethink his strategies, but 50 dead guys might.
|
* rethink his strategies, but 50 dead guys might.
|
||||||
*/
|
*/
|
||||||
odds += (roll0(11) - 5) / 100.0;
|
odds += (roll(11) - 6) / 100.0;
|
||||||
if (odds < 0.0)
|
if (odds < 0.0)
|
||||||
odds = 0.1;
|
odds = 0.1;
|
||||||
if (odds > 1.0)
|
if (odds > 1.0)
|
||||||
odds = 1.0;
|
odds = 1.0;
|
||||||
recalctime = 8 + roll0(43);
|
recalctime = 7 + roll(43);
|
||||||
while (!success && ototal) {
|
while (!success && ototal) {
|
||||||
if (chance(odds)) {
|
if (chance(odds)) {
|
||||||
pr("!");
|
pr("!");
|
||||||
|
@ -1858,9 +1858,9 @@ att_fight(int combat_mode, struct combat *off, struct emp_qelem *olist,
|
||||||
if (((a_cas + d_cas) % 70) == 69)
|
if (((a_cas + d_cas) % 70) == 69)
|
||||||
pr("\n");
|
pr("\n");
|
||||||
if (recalctime-- <= 0) {
|
if (recalctime-- <= 0) {
|
||||||
recalctime = 8 + roll0(43);
|
recalctime = 7 + roll(43);
|
||||||
odds = att_calcodds(ototal, dtotal);
|
odds = att_calcodds(ototal, dtotal);
|
||||||
odds += (roll0(11) - 5) / 100.0;
|
odds += (roll(11) - 6) / 100.0;
|
||||||
if (odds < 0.0)
|
if (odds < 0.0)
|
||||||
odds = 0.1;
|
odds = 0.1;
|
||||||
if (odds > 1.0)
|
if (odds > 1.0)
|
||||||
|
|
|
@ -48,7 +48,7 @@ fortgun(int effic, int guns)
|
||||||
double d;
|
double d;
|
||||||
double g = MIN(guns, 7);
|
double g = MIN(guns, 7);
|
||||||
|
|
||||||
d = (roll0(30) + 20.0) * (g / 7.0);
|
d = (roll(30) + 19.0) * (g / 7.0);
|
||||||
d *= effic / 100.0;
|
d *= effic / 100.0;
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ seagun(int effic, int guns)
|
||||||
|
|
||||||
d = 0.0;
|
d = 0.0;
|
||||||
while (guns--)
|
while (guns--)
|
||||||
d += 10.0 + roll0(6);
|
d += 9.0 + roll(6);
|
||||||
d *= effic * 0.01;
|
d *= effic * 0.01;
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ landunitgun(int effic, int guns)
|
||||||
|
|
||||||
d = 0.0;
|
d = 0.0;
|
||||||
while (guns--)
|
while (guns--)
|
||||||
d += 5.0 + roll0(6);
|
d += 4.0 + roll(6);
|
||||||
d *= effic * 0.01;
|
d *= effic * 0.01;
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ takeover(struct sctstr *sp, natid newown)
|
||||||
if (!(chance(LND_SPY_DETECT_CHANCE(lp->lnd_effic))))
|
if (!(chance(LND_SPY_DETECT_CHANCE(lp->lnd_effic))))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
n = lp->lnd_effic - (30 + roll0(100));
|
n = lp->lnd_effic - (29 + roll(100));
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
n = 0;
|
n = 0;
|
||||||
lp->lnd_effic = n;
|
lp->lnd_effic = n;
|
||||||
|
@ -129,7 +129,7 @@ takeover(struct sctstr *sp, natid newown)
|
||||||
* how spunky are these guys?
|
* how spunky are these guys?
|
||||||
* n: random number from -25:75 + (50 - loyalty)
|
* n: random number from -25:75 + (50 - loyalty)
|
||||||
*/
|
*/
|
||||||
n = (50 - sp->sct_loyal) + (roll0(100) - 25);
|
n = (50 - sp->sct_loyal) + (roll(100) - 26);
|
||||||
if (n > 0 && sp->sct_own == sp->sct_oldown) {
|
if (n > 0 && sp->sct_own == sp->sct_oldown) {
|
||||||
che_count = (civ * n / 3000) + 5;
|
che_count = (civ * n / 3000) + 5;
|
||||||
if (che_count * 2 > civ)
|
if (che_count * 2 > civ)
|
||||||
|
@ -186,7 +186,7 @@ takeover_plane(struct plnstr *pp, natid newown)
|
||||||
* XXX If this was done right, planes could escape,
|
* XXX If this was done right, planes could escape,
|
||||||
* flying to a nearby friendly airport.
|
* flying to a nearby friendly airport.
|
||||||
*/
|
*/
|
||||||
n = pp->pln_effic - (30 + roll0(100));
|
n = pp->pln_effic - (29 + roll(100));
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
n = 0;
|
n = 0;
|
||||||
pp->pln_effic = n;
|
pp->pln_effic = n;
|
||||||
|
|
|
@ -95,12 +95,12 @@ do_feed(struct sctstr *sp, struct natstr *np, short *vec,
|
||||||
nreport(sp->sct_own, N_DIE_FAMINE, 0, 1);
|
nreport(sp->sct_own, N_DIE_FAMINE, 0, 1);
|
||||||
}
|
}
|
||||||
sp->sct_work = 0;
|
sp->sct_work = 0;
|
||||||
sp->sct_loyal += roll0(8) + 2;
|
sp->sct_loyal += roll(8) + 1;
|
||||||
}
|
}
|
||||||
sctwork = 0;
|
sctwork = 0;
|
||||||
} else {
|
} else {
|
||||||
if (sp->sct_work < 100)
|
if (sp->sct_work < 100)
|
||||||
sctwork = sp->sct_work + 8 + roll0(15);
|
sctwork = sp->sct_work + 7 + roll(15);
|
||||||
if (sctwork > 100)
|
if (sctwork > 100)
|
||||||
sctwork = 100;
|
sctwork = 100;
|
||||||
if (!player->simulation)
|
if (!player->simulation)
|
||||||
|
|
|
@ -73,7 +73,7 @@ populace(struct natstr *np, struct sctstr *sp, int etu)
|
||||||
n = roundavg(etu * 0.125);
|
n = roundavg(etu * 0.125);
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
n = 1;
|
n = 1;
|
||||||
n = sp->sct_loyal + roll0(n) + 1;
|
n = sp->sct_loyal + roll(n);
|
||||||
if (n > 127)
|
if (n > 127)
|
||||||
n = 127;
|
n = 127;
|
||||||
sp->sct_loyal = n;
|
sp->sct_loyal = n;
|
||||||
|
@ -81,7 +81,7 @@ populace(struct natstr *np, struct sctstr *sp, int etu)
|
||||||
if (sp->sct_loyal > 65 && mil < civ / 20) {
|
if (sp->sct_loyal > 65 && mil < civ / 20) {
|
||||||
int work_red;
|
int work_red;
|
||||||
|
|
||||||
work_red = sp->sct_loyal - (50 + roll0(15));
|
work_red = sp->sct_loyal - (49 + roll(15));
|
||||||
n = sp->sct_work - work_red;
|
n = sp->sct_work - work_red;
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
|
@ -77,7 +77,7 @@ revolt(struct sctstr *sp)
|
||||||
che += che_civ;
|
che += che_civ;
|
||||||
if (che < CHE_MAX) {
|
if (che < CHE_MAX) {
|
||||||
/* che due to uw unrest */
|
/* che due to uw unrest */
|
||||||
n = 10 + roll0(30);
|
n = 9 + roll(30);
|
||||||
che_uw = 5 + (uw * n / 500);
|
che_uw = 5 + (uw * n / 500);
|
||||||
if (che_uw > uw)
|
if (che_uw > uw)
|
||||||
che_uw = uw;
|
che_uw = uw;
|
||||||
|
@ -327,9 +327,9 @@ guerrilla(struct sctstr *sp)
|
||||||
/* loyalty drops during recruitment efforts */
|
/* loyalty drops during recruitment efforts */
|
||||||
n = sp->sct_loyal;
|
n = sp->sct_loyal;
|
||||||
if (n < 30)
|
if (n < 30)
|
||||||
n += roll0(5) + 1;
|
n += roll(5);
|
||||||
else if (n < 70)
|
else if (n < 70)
|
||||||
n += roll0(10) + 4;
|
n += roll(10) + 3;
|
||||||
if (n > 127)
|
if (n > 127)
|
||||||
n = 127;
|
n = 127;
|
||||||
sp->sct_loyal = n;
|
sp->sct_loyal = n;
|
||||||
|
@ -375,7 +375,7 @@ domove:
|
||||||
val = roundintby(val, 10);
|
val = roundintby(val, 10);
|
||||||
/* inject a modicum of indeterminism; also
|
/* inject a modicum of indeterminism; also
|
||||||
* avoids che preferring certain directions */
|
* avoids che preferring certain directions */
|
||||||
val += roll0(10) - 5;
|
val += roll(10) - 6;
|
||||||
if (val >= min_mil)
|
if (val >= min_mil)
|
||||||
continue;
|
continue;
|
||||||
nicest_sp = nsp;
|
nicest_sp = nsp;
|
||||||
|
|
|
@ -810,7 +810,7 @@ grow_islands(void)
|
||||||
secs = 0;
|
secs = 0;
|
||||||
if (!place_island(c, &x, &y))
|
if (!place_island(c, &x, &y))
|
||||||
return;
|
return;
|
||||||
isiz = 1 + roll0(2 * is - 1);
|
isiz = roll(2 * is - 1);
|
||||||
do {
|
do {
|
||||||
++secs;
|
++secs;
|
||||||
find_coast(c);
|
find_coast(c);
|
||||||
|
@ -973,7 +973,7 @@ elevate_sea(void)
|
||||||
for (y = 0; y < WORLD_Y; ++y) {
|
for (y = 0; y < WORLD_Y; ++y) {
|
||||||
for (x = y % 2; x < WORLD_X; x += 2) {
|
for (x = y % 2; x < WORLD_X; x += 2) {
|
||||||
if (elev[x][y] == -INFINITY)
|
if (elev[x][y] == -INFINITY)
|
||||||
elev[x][y] = -roll0((distance_to_land() * 20 + 27)) - 1;
|
elev[x][y] = -roll(distance_to_land() * 20 + 27);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue