static void curse_artifact(object_type * o_ptr)
{
- if (o_ptr->pval > 0) o_ptr->pval = 0 - (o_ptr->pval + randint(4));
- if (o_ptr->to_a > 0) o_ptr->to_a = 0 - (o_ptr->to_a + randint(4));
- if (o_ptr->to_h > 0) o_ptr->to_h = 0 - (o_ptr->to_h + randint(4));
- if (o_ptr->to_d > 0) o_ptr->to_d = 0 - (o_ptr->to_d + randint(4));
+ if (o_ptr->pval > 0) o_ptr->pval = 0 - (o_ptr->pval + randint1(4));
+ if (o_ptr->to_a > 0) o_ptr->to_a = 0 - (o_ptr->to_a + randint1(4));
+ if (o_ptr->to_h > 0) o_ptr->to_h = 0 - (o_ptr->to_h + randint1(4));
+ if (o_ptr->to_d > 0) o_ptr->to_d = 0 - (o_ptr->to_d + randint1(4));
o_ptr->art_flags3 |= (TR3_HEAVY_CURSE | TR3_CURSED);
}
}
- switch (randint(this_type))
+ switch (randint1(this_type))
{
case 1: case 2:
o_ptr->art_flags1 |= TR1_STR;
}
}
- switch (specific ? specific : randint(42))
+ switch (specific ? specific : randint1(42))
{
case 1:
if (!one_in_(WEIRD_LUCK))
}
}
- switch (randint(31))
+ switch (randint1(31))
{
case 1:
o_ptr->art_flags2 |= TR2_SUST_STR;
random_misc(o_ptr, is_scroll);
else
{
- o_ptr->to_a = 4 + randint(11);
+ o_ptr->to_a = 4 + randint1(11);
}
break;
case 27:
{
int bonus_h, bonus_d;
o_ptr->art_flags3 |= TR3_SHOW_MODS;
- bonus_h = 4 + (randint(11));
- bonus_d = 4 + (randint(11));
+ bonus_h = 4 + (randint1(11));
+ bonus_d = 4 + (randint1(11));
if ((o_ptr->tval != TV_SWORD) && (o_ptr->tval != TV_POLEARM) && (o_ptr->tval != TV_HAFTED) && (o_ptr->tval != TV_DIGGING) && (o_ptr->tval != TV_GLOVES) && (o_ptr->tval != TV_RING))
{
bonus_h /= 2;
if (o_ptr->tval != TV_BOW)
{
- switch (randint(34))
+ switch (randint1(34))
{
case 1:
case 2:
}
else
{
- switch (randint(6))
+ switch (randint1(6))
{
case 1:
case 2:
}
}
- while (!type || (randint(100) >= chance))
+ while (!type || (randint1(100) >= chance))
{
- type = randint(255);
+ type = randint1(255);
switch (type)
{
case ACT_SUNLIGHT:
static void get_random_name(char *return_name, bool armour, int power)
{
- if (randint(100) <= TABLE_NAME)
+ if (randint1(100) <= TABLE_NAME)
{
get_table_name(return_name);
}
{
char new_name[1024];
int has_pval = 0;
- int powers = randint(5) + 1;
+ int powers = randint1(5) + 1;
int max_type = (o_ptr->tval < TV_BOOTS ? 7 : 5);
int power_level;
s32b total_flags;
break;
case CLASS_MINDCRAFTER:
case CLASS_BARD:
- if (randint(5) > 2) artifact_bias = BIAS_PRIESTLY;
+ if (randint1(5) > 2) artifact_bias = BIAS_PRIESTLY;
break;
case CLASS_TOURIST:
- if (randint(5) > 2) artifact_bias = BIAS_WARRIOR;
+ if (randint1(5) > 2) artifact_bias = BIAS_WARRIOR;
break;
case CLASS_IMITATOR:
- if (randint(2) > 1) artifact_bias = BIAS_RANGER;
+ if (randint1(2) > 1) artifact_bias = BIAS_RANGER;
break;
case CLASS_BEASTMASTER:
artifact_bias = BIAS_CHR;
warrior_artifact_bias = 50;
break;
case CLASS_MIRROR_MASTER:
- if (randint(4) > 1)
+ if (randint1(4) > 1)
{
artifact_bias = BIAS_MAGE;
}
}
}
- if (a_scroll && (randint(100) <= warrior_artifact_bias))
+ if (a_scroll && (randint1(100) <= warrior_artifact_bias))
artifact_bias = BIAS_WARRIOR;
strcpy(new_name, "");
/* Main loop */
while (powers--)
{
- switch (randint(max_type))
+ switch (randint1(max_type))
{
case 1: case 2:
random_plus(o_ptr, a_scroll);
if (o_ptr->art_flags1 & TR1_BLOWS)
{
- o_ptr->pval = randint(2);
+ o_ptr->pval = randint1(2);
if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA))
o_ptr->pval++;
}
{
o_ptr->pval++;
}
- while (o_ptr->pval < randint(5) || one_in_(o_ptr->pval));
+ while (o_ptr->pval < randint1(5) || one_in_(o_ptr->pval));
}
if ((o_ptr->pval > 4) && !one_in_(WEIRD_LUCK))
/* give it some plusses... */
if (o_ptr->tval >= TV_BOOTS && o_ptr->tval <= TV_DRAG_ARMOR)
- o_ptr->to_a += randint(o_ptr->to_a > 19 ? 1 : 20 - o_ptr->to_a);
+ o_ptr->to_a += randint1(o_ptr->to_a > 19 ? 1 : 20 - o_ptr->to_a);
else if (o_ptr->tval <= TV_SWORD)
{
- o_ptr->to_h += randint(o_ptr->to_h > 19 ? 1 : 20 - o_ptr->to_h);
- o_ptr->to_d += randint(o_ptr->to_d > 19 ? 1 : 20 - o_ptr->to_d);
+ o_ptr->to_h += randint1(o_ptr->to_h > 19 ? 1 : 20 - o_ptr->to_h);
+ o_ptr->to_d += randint1(o_ptr->to_d > 19 ? 1 : 20 - o_ptr->to_d);
if ((o_ptr->art_flags1 & TR1_WIS) && (o_ptr->pval > 0)) o_ptr->art_flags3 |= TR3_BLESSED;
}
if (a_cursed) curse_artifact(o_ptr);
if (!a_cursed &&
- (randint((o_ptr->tval >= TV_BOOTS)
+ (randint1((o_ptr->tval >= TV_BOOTS)
? ACTIVATION_CHANCE * 2 : ACTIVATION_CHANCE) == 1))
{
o_ptr->xtra2 = 0;
while ((o_ptr->to_d+o_ptr->to_h) > 20)
{
if (one_in_(o_ptr->to_d) && one_in_(o_ptr->to_h)) break;
- o_ptr->to_d -= (s16b)rand_int(3);
- o_ptr->to_h -= (s16b)rand_int(3);
+ o_ptr->to_d -= (s16b)randint0(3);
+ o_ptr->to_h -= (s16b)randint0(3);
}
while ((o_ptr->to_d+o_ptr->to_h) > 10)
{
if (one_in_(o_ptr->to_d) || one_in_(o_ptr->to_h)) break;
- o_ptr->to_d -= (s16b)rand_int(3);
- o_ptr->to_h -= (s16b)rand_int(3);
+ o_ptr->to_d -= (s16b)randint0(3);
+ o_ptr->to_h -= (s16b)randint0(3);
}
}
if (!get_aim_dir(&dir)) return FALSE;
fire_ball(GF_POIS, dir, 12, 3);
- o_ptr->timeout = rand_int(4) + 4;
+ o_ptr->timeout = randint0(4) + 4;
break;
}
if (!get_aim_dir(&dir)) return FALSE;
fire_bolt(GF_ELEC, dir, damroll(4, 8));
- o_ptr->timeout = rand_int(5) + 5;
+ o_ptr->timeout = randint0(5) + 5;
break;
}
if (!get_aim_dir(&dir)) return FALSE;
fire_bolt(GF_ACID, dir, damroll(5, 8));
- o_ptr->timeout = rand_int(6) + 6;
+ o_ptr->timeout = randint0(6) + 6;
break;
}
if (!get_aim_dir(&dir)) return FALSE;
fire_bolt(GF_COLD, dir, damroll(6, 8));
- o_ptr->timeout = rand_int(7) + 7;
+ o_ptr->timeout = randint0(7) + 7;
break;
}
if (!get_aim_dir(&dir)) return FALSE;
fire_bolt(GF_FIRE, dir, damroll(9, 8));
- o_ptr->timeout = rand_int(8) + 8;
+ o_ptr->timeout = randint0(8) + 8;
break;
}
if (!get_aim_dir(&dir)) return FALSE;
if (drain_life(dir, 100))
- o_ptr->timeout = rand_int(100) + 100;
+ o_ptr->timeout = randint0(100) + 100;
break;
}
if (!get_aim_dir(&dir)) return FALSE;
fire_bolt(GF_ARROW, dir, 150);
- o_ptr->timeout = rand_int(90) + 90;
+ o_ptr->timeout = randint0(90) + 90;
break;
}
if (!get_aim_dir(&dir)) return FALSE;
fire_ball(GF_FIRE, dir, 120, 3);
- o_ptr->timeout = rand_int(225) + 225;
+ o_ptr->timeout = randint0(225) + 225;
break;
}
if (!get_aim_dir(&dir)) return FALSE;
fire_ball(GF_COLD, dir, 200, 3);
- o_ptr->timeout = rand_int(325) + 325;
+ o_ptr->timeout = randint0(325) + 325;
break;
}
if (!get_aim_dir(&dir)) return FALSE;
fire_ball(GF_ELEC, dir, 250, 3);
- o_ptr->timeout = rand_int(425) + 425;
+ o_ptr->timeout = randint0(425) + 425;
break;
}
#endif
dispel_evil(p_ptr->lev * 5);
- o_ptr->timeout = rand_int(300) + 300;
+ o_ptr->timeout = randint0(300) + 300;
break;
}
#endif
dispel_good(p_ptr->lev * 5);
- o_ptr->timeout = rand_int(300) + 300;
+ o_ptr->timeout = randint0(300) + 300;
break;
}
#endif
}
- o_ptr->timeout = 250 + randint(250);
+ o_ptr->timeout = 250 + randint1(250);
break;
}
case ACT_SUMMON_ANIMAL:
{
(void)summon_specific(-1, py, px, plev, SUMMON_ANIMAL_RANGER, TRUE, TRUE, TRUE, FALSE, FALSE);
- o_ptr->timeout = 200 + randint(300);
+ o_ptr->timeout = 200 + randint1(300);
break;
}
#endif
(void)summon_specific(-1, py, px, dun_level, SUMMON_PHANTOM, TRUE, TRUE, TRUE, FALSE, FALSE);
- o_ptr->timeout = 200 + randint(200);
+ o_ptr->timeout = 200 + randint1(200);
break;
}
}
- o_ptr->timeout = 666 + randint(333);
+ o_ptr->timeout = 666 + randint1(333);
break;
}
}
- o_ptr->timeout = 666 + randint(333);
+ o_ptr->timeout = 666 + randint1(333);
break;
}
hp_player(damroll(4, 8));
(void)set_cut((p_ptr->cut / 2) - 50);
- o_ptr->timeout = rand_int(3) + 3;
+ o_ptr->timeout = randint0(3) + 3;
break;
}
case ACT_ESP:
{
- (void)set_tim_esp(randint(30) + 25, FALSE);
+ (void)set_tim_esp(randint1(30) + 25, FALSE);
o_ptr->timeout = 200;
break;
}
case ACT_BERSERK:
{
- (void)set_hero(randint(50) + 50, FALSE);
- (void)set_blessed(randint(50) + 50, FALSE);
- o_ptr->timeout = 100 + randint(100);
+ (void)set_hero(randint1(50) + 50, FALSE);
+ (void)set_blessed(randint1(50) + 50, FALSE);
+ o_ptr->timeout = 100 + randint1(100);
break;
}
#endif
k = 3 * p_ptr->lev;
- (void)set_protevil(randint(25) + k, FALSE);
- o_ptr->timeout = rand_int(225) + 225;
+ (void)set_protevil(randint1(25) + k, FALSE);
+ o_ptr->timeout = randint0(225) + 225;
break;
}
msg_print("It glows many colours...");
#endif
- (void)set_oppose_acid(randint(40) + 40, FALSE);
- (void)set_oppose_elec(randint(40) + 40, FALSE);
- (void)set_oppose_fire(randint(40) + 40, FALSE);
- (void)set_oppose_cold(randint(40) + 40, FALSE);
- (void)set_oppose_pois(randint(40) + 40, FALSE);
+ (void)set_oppose_acid(randint1(40) + 40, FALSE);
+ (void)set_oppose_elec(randint1(40) + 40, FALSE);
+ (void)set_oppose_fire(randint1(40) + 40, FALSE);
+ (void)set_oppose_cold(randint1(40) + 40, FALSE);
+ (void)set_oppose_pois(randint1(40) + 40, FALSE);
o_ptr->timeout = 200;
break;
}
msg_print("It glows bright green...");
#endif
- (void)set_fast(randint(20) + 20, FALSE);
+ (void)set_fast(randint1(20) + 20, FALSE);
o_ptr->timeout = 250;
break;
}
msg_print("It glows brightly...");
#endif
- (void)set_fast(randint(75) + 75, FALSE);
- o_ptr->timeout = rand_int(200) + 200;
+ (void)set_fast(randint1(75) + 75, FALSE);
+ o_ptr->timeout = randint0(200) + 200;
break;
}
case ACT_WRAITH:
{
- set_wraith_form(randint(plev / 2) + (plev / 2), FALSE);
+ set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
o_ptr->timeout = 1000;
break;
}
case ACT_INVULN:
{
- (void)set_invuln(randint(8) + 8, FALSE);
+ (void)set_invuln(randint1(8) + 8, FALSE);
o_ptr->timeout = 1000;
break;
}
#endif
lite_area(damroll(2, 15), 3);
- o_ptr->timeout = rand_int(10) + 10;
+ o_ptr->timeout = randint0(10) + 10;
break;
}
map_area(DETECT_RAD_MAP);
lite_area(damroll(2, 15), 3);
- o_ptr->timeout = rand_int(50) + 50;
+ o_ptr->timeout = randint0(50) + 50;
break;
}
#endif
detect_all(DETECT_RAD_DEFAULT);
- o_ptr->timeout = rand_int(55) + 55;
+ o_ptr->timeout = randint0(55) + 55;
break;
}
if (o_ptr->name1 == ART_BLOOD)
{
int dummy, i;
- dummy = randint(2)+randint(2);
+ dummy = randint1(2)+randint1(2);
for (i = 0; i < dummy; i++)
- o_ptr->art_flags1 |= (TR1_CHAOTIC << rand_int(18));
- dummy = randint(2);
+ o_ptr->art_flags1 |= (TR1_CHAOTIC << randint0(18));
+ dummy = randint1(2);
for (i = 0; i < dummy; i++)
- random_resistance(o_ptr, FALSE, randint(34) + 4);
+ random_resistance(o_ptr, FALSE, randint1(34) + 4);
dummy = 2;
for (i = 0; i < dummy; i++)
{
- int tmp = rand_int(11);
+ int tmp = randint0(11);
if (tmp < 6) o_ptr->art_flags1 |= (TR1_STR << tmp);
else o_ptr->art_flags1 |= (TR1_STEALTH << (tmp - 6));
}
o_ptr->xtra1 = EGO_XTRA_ABILITY;
/* Randomize the "xtra" power */
- if (o_ptr->xtra1) o_ptr->xtra2 = randint(256);
+ if (o_ptr->xtra1) o_ptr->xtra2 = randint1(256);
}
artifact_bias = 0;
if (give_resistance)
{
- random_resistance(o_ptr, FALSE, randint(22) + 16);
+ random_resistance(o_ptr, FALSE, randint1(22) + 16);
}
}
/* Randomly choose a type */
while (!(type) || virtue_number(type))
{
- switch (randint(29))
+ switch (randint1(29))
{
case 1: case 2: case 3:
type = V_SACRIFICE;
{
if(cs == n)
{
- k = rand_int(n);
+ k = randint0(n);
break;
}
else
}
if (c == '*')
{
- k = rand_int(n);
+ k = randint0(n);
break;
}
if (c == '8')
for (j = i = 0; i < 18; i++)
{
/* Roll the dice */
- dice[i] = randint(3 + i % 3);
+ dice[i] = randint1(3 + i % 3);
/* Collect the maximum */
j += dice[i];
for (j = i = 0; i < 6; i++)
{
/* Roll the dice */
- dice[i] = randint(7);
+ dice[i] = randint1(7);
/* Collect the maximum */
j += dice[i];
for (i = 1; i < 4; i++)
{
- j = randint(p_ptr->hitdie);
+ j = randint1(p_ptr->hitdie);
player_hp[0] += j;
}
/* Roll the hitpoint values */
for (i = 1; i < PY_MAX_LEVEL; i++)
{
- j = randint(p_ptr->hitdie);
+ j = randint1(p_ptr->hitdie);
player_hp[i] = player_hp[i - 1] + j;
}
buf[0] = '\0';
/* Initial social class */
- social_class = randint(4);
+ social_class = randint1(4);
/* Starting place */
switch (p_ptr->prace)
i = 0;
/* Roll for nobility */
- roll = randint(100);
+ roll = randint1(100);
/* Access the proper entry in the table */
/* Calculate the age */
- p_ptr->age = rp_ptr->b_age + randint(rp_ptr->m_age);
+ p_ptr->age = rp_ptr->b_age + randint1(rp_ptr->m_age);
/* Calculate the height/weight for males */
if (p_ptr->psex == SEX_MALE)
int i, gold;
/* Social Class determines starting gold */
- gold = (p_ptr->sc * 6) + randint(100) + 300;
+ gold = (p_ptr->sc * 6) + randint1(100) + 300;
if (p_ptr->pclass == CLASS_TOURIST)
gold += 2000;
{
if(cs == MAX_RACES)
{
- k = rand_int(MAX_RACES);
+ k = randint0(MAX_RACES);
cs = k;
continue;
}
}
if (c == '*')
{
- k = rand_int(MAX_RACES);
+ k = randint0(MAX_RACES);
cs = k;
continue;
}
{
if(cs == MAX_CLASS_CHOICE)
{
- k = rand_int(MAX_CLASS_CHOICE);
+ k = randint0(MAX_CLASS_CHOICE);
cs = k;
continue;
}
}
if (c == '*')
{
- k = rand_int(MAX_CLASS_CHOICE);
+ k = randint0(MAX_CLASS_CHOICE);
cs = k;
continue;
}
{
do
{
- k = rand_int(MAX_SEIKAKU);
+ k = randint0(MAX_SEIKAKU);
}
while(seikaku_info[k].sex && (seikaku_info[k].sex != (p_ptr->psex+1)));
cs = k;
{
do
{
- k = rand_int(n);
+ k = randint0(n);
}
while(seikaku_info[k].sex && (seikaku_info[k].sex != (p_ptr->psex+1)));
cs = k;
if (c == ' ' || c == '\r' || c == '\n')
{
if(cs == MAX_SEXES)
- k = rand_int(MAX_SEXES);
+ k = randint0(MAX_SEXES);
else
k = cs;
break;
}
if (c == '*')
{
- k = rand_int(MAX_SEXES);
+ k = randint0(MAX_SEXES);
break;
}
if (c == '4')
if (inp[0] == '*')
{
/* 0 to 49 random quests */
- v = rand_int(11);
+ v = randint0(11);
}
else
{
* Random monster 5 - 10 levels out of depth
* (depending on level)
*/
- r_idx = get_mon_num(q_ptr->level + 5 + randint(q_ptr->level / 10));
+ r_idx = get_mon_num(q_ptr->level + 5 + randint1(q_ptr->level / 10));
r_ptr = &r_info[r_idx];
if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
get_money();
/* Hack -- get a chaos patron even if you are not a chaos warrior */
- p_ptr->chaos_patron = (s16b)rand_int(MAX_PATRON);
+ p_ptr->chaos_patron = (s16b)randint0(MAX_PATRON);
p_ptr->muta1 = 0;
p_ptr->muta2 = 0;
/* shuffle cards */
for (i = 0; i < 53; i++){
- int tmp1 = rand_int(53 - i) + i;
+ int tmp1 = randint0(53 - i) + i;
int tmp2 = deck[i];
deck[i] = deck[tmp1];
deck[tmp1] = tmp2;
odds = 4;
win = FALSE;
- roll1 = randint(10);
- roll2 = randint(10);
- choice = randint(10);
+ roll1 = randint1(10);
+ roll2 = randint1(10);
+ choice = randint1(10);
#ifdef JP
sprintf(tmp_str, "¹õ¥À¥¤¥¹: %d ¹õ¥À¥¤¥¹: %d", roll1, roll2);
#else
win = 3;
odds = 2;
- roll1 = randint(6);
- roll2 = randint(6);
+ roll1 = randint1(6);
+ roll2 = randint1(6);
roll3 = roll1 + roll2;
choice = roll3;
#ifdef JP
#endif
msg_print(NULL);
- roll1 = randint(6);
- roll2 = randint(6);
+ roll1 = randint1(6);
+ roll2 = randint1(6);
roll3 = roll1 + roll2;
#ifdef JP
choice = 9;
}
msg_print(NULL);
- roll1 = rand_int(10);
+ roll1 = randint0(10);
#ifdef JP
sprintf(tmp_str, "¥ë¡¼¥ì¥Ã¥È¤Ï²ó¤ê¡¢»ß¤Þ¤Ã¤¿¡£¾¡¼Ô¤Ï %dÈÖ¤À¡£",
#else
#endif
win = FALSE;
- roll1 = randint(21);
+ roll1 = randint1(21);
for (i=6;i>0;i--)
{
if ((roll1-i) < 1)
}
roll1 -= i;
}
- roll2 = randint(21);
+ roll2 = randint1(21);
for (i=6;i>0;i--)
{
if ((roll2-i) < 1)
}
roll2 -= i;
}
- choice = randint(21);
+ choice = randint1(21);
for (i=6;i>0;i--)
{
if ((choice-i) < 1)
for (i = 0; i < max_d_idx; i++)
if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
- mon_level = randint(MIN(max_dl, 122))+5;
- if (rand_int(100) < 60)
+ mon_level = randint1(MIN(max_dl, 122))+5;
+ if (randint0(100) < 60)
{
- i = randint(MIN(max_dl, 122))+5;
+ i = randint1(MIN(max_dl, 122))+5;
mon_level = MAX(i, mon_level);
}
- if (rand_int(100) < 30)
+ if (randint0(100) < 30)
{
- i = randint(MIN(max_dl, 122))+5;
+ i = randint1(MIN(max_dl, 122))+5;
mon_level = MAX(i, mon_level);
}
{
power[i] = total*60/power[i];
if (tekitou && ((power[i] < 160) || power[i] > 1500)) break;
- if ((power[i] < 160) && rand_int(20)) break;
- if (power[i] < 101) power[i] = 100 + randint(5);
+ if ((power[i] < 160) && randint0(20)) break;
+ if (power[i] < 101) power[i] = 100 + randint1(5);
mon_odds[i] = power[i];
}
if (i == 4) break;
msg_format("You behold the %s visage of %s!",
#endif
- funny_desc[rand_int(MAX_SAN_FUNNY)], m_name);
+ funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
if (one_in_(3))
{
- msg_print(funny_comments[rand_int(MAX_SAN_COMMENT)]);
- p_ptr->image = p_ptr->image + randint(r_ptr->level);
+ msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
+ p_ptr->image = p_ptr->image + randint1(r_ptr->level);
}
/* Never mind; we can't see it clearly enough */
msg_format("You behold the %s visage of %s!",
#endif
- horror_desc[rand_int(MAX_SAN_HORROR)], desc);
+ horror_desc[randint0(MAX_SAN_HORROR)], desc);
r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
{
if (!p_ptr->resist_conf)
{
- (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+ (void)set_confused(p_ptr->confused + randint0(4) + 4);
}
if (!p_ptr->resist_chaos && one_in_(3))
{
- (void)set_image(p_ptr->image + rand_int(250) + 150);
+ (void)set_image(p_ptr->image + randint0(250) + 150);
}
return;
}
{
if (!p_ptr->resist_conf)
{
- (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+ (void)set_confused(p_ptr->confused + randint0(4) + 4);
}
if (!p_ptr->free_act)
{
- (void)set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4);
+ (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
}
while (!saving_throw(p_ptr->skill_sav))
{
}
if (!p_ptr->resist_chaos)
{
- (void)set_image(p_ptr->image + rand_int(250) + 150);
+ (void)set_image(p_ptr->image + randint0(250) + 150);
}
return;
}
while (!happened)
{
- switch (randint(4))
+ switch (randint1(4))
{
case 1:
{
if (q_ptr->r_idx == 0)
{
/* Random monster at least 5 - 10 levels out of deep */
- q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint(6));
+ q_ptr->r_idx = get_mon_num(q_ptr->level + 4 + randint1(6));
}
r_ptr = &r_info[q_ptr->r_idx];
while ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->rarity != 1))
{
- q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint(6);
+ q_ptr->r_idx = get_mon_num(q_ptr->level) + 4 + randint1(6);
r_ptr = &r_info[q_ptr->r_idx];
}
if (q_ptr->max_num == 0)
{
/* Random monster number */
- if (randint(10) > 7)
+ if (randint1(10) > 7)
q_ptr->max_num = 1;
else
- q_ptr->max_num = randint(3) + 1;
+ q_ptr->max_num = randint1(3) + 1;
}
q_ptr->cur_num = 0;
/* Normal graphics */
if (!(streq(ANGBAND_SYS, "ibm")))
{
- (*cp) = r_info[randint(max_r_idx-1)].x_char;
- (*ap) = r_info[randint(max_r_idx-1)].x_attr;
+ (*cp) = r_info[randint1(max_r_idx-1)].x_char;
+ (*ap) = r_info[randint1(max_r_idx-1)].x_attr;
}
else
/* IBM-pseudo graphics */
{
n = strlen(image_monster_hack_ibm);
- (*cp) = (image_monster_hack_ibm[rand_int(n)]);
+ (*cp) = (image_monster_hack_ibm[randint0(n)]);
/* Random color */
- (*ap) = randint(15);
+ (*ap) = randint1(15);
}
}
else
/* Text mode */
{
- (*cp) = (image_monster_hack[rand_int(n)]);
+ (*cp) = (image_monster_hack[randint0(n)]);
/* Random color */
- (*ap) = randint(15);
+ (*ap) = randint1(15);
}
}
{
if (!(streq(ANGBAND_SYS, "ibm")))
{
- (*cp) = k_info[randint(max_k_idx-1)].x_char;
- (*ap) = k_info[randint(max_k_idx-1)].x_attr;
+ (*cp) = k_info[randint1(max_k_idx-1)].x_char;
+ (*ap) = k_info[randint1(max_k_idx-1)].x_attr;
}
else
{
n = strlen(image_object_hack_ibm);
- (*cp) = (image_object_hack_ibm[rand_int(n)]);
+ (*cp) = (image_object_hack_ibm[randint0(n)]);
/* Random color */
- (*ap) = randint(15);
+ (*ap) = randint1(15);
}
}
else
{
- (*cp) = (image_object_hack[rand_int(n)]);
+ (*cp) = (image_object_hack[randint0(n)]);
/* Random color */
- (*ap) = randint(15);
+ (*ap) = randint1(15);
}
}
static void image_random(byte *ap, char *cp)
{
/* Normally, assume monsters */
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
{
image_monster(ap, cp);
}
}
/* Hack -- rare random hallucination, except on outer dungeon walls */
- if (p_ptr->image && (c_ptr->feat < FEAT_PERM_SOLID) && !rand_int(256))
+ if (p_ptr->image && (c_ptr->feat < FEAT_PERM_SOLID) && !randint0(256))
{
/* Hallucinate */
image_random(ap, cp);
{
if (!(streq(ANGBAND_SYS, "ibm")))
{
- (*cp) = r_info[randint(max_r_idx-1)].x_char;
- (*ap) = r_info[randint(max_r_idx-1)].x_attr;
+ (*cp) = r_info[randint1(max_r_idx-1)].x_char;
+ (*ap) = r_info[randint1(max_r_idx-1)].x_attr;
}
else
{
int n = strlen(image_monster_hack_ibm);
- (*cp) = (image_monster_hack_ibm[rand_int(n)]);
+ (*cp) = (image_monster_hack_ibm[randint0(n)]);
/* Random color */
- (*ap) = randint(15);
+ (*ap) = randint1(15);
}
}
else
{
(*cp) = (one_in_(25) ?
- image_object_hack[rand_int(strlen(image_object_hack))] :
- image_monster_hack[rand_int(strlen(image_monster_hack))]);
+ image_object_hack[randint0(strlen(image_object_hack))] :
+ image_monster_hack[randint0(strlen(image_monster_hack))]);
}
}
else
/* Multi-hued attr */
if (r_ptr->flags2 & RF2_ATTR_ANY)
- (*ap) = randint(15);
- else switch (randint(7))
+ (*ap) = randint1(15);
+ else switch (randint1(7))
{
case 1:
(*ap) = TERM_RED;
case CLASS_CHAOS_WARRIOR:
do
{
- a = randint(15);
+ a = randint1(15);
}
while (a == TERM_DARK);
break;
int k;
/* Percentile dice */
- k = rand_int(100);
+ k = randint0(100);
/* Hack -- Instant miss or hit */
if (k < 10) return (k < 5);
if (!vis) chance = (chance + 1) / 2;
/* Power competes against armor */
- if (rand_int(chance) < (ac * 3 / 4)) return (FALSE);
+ if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
/* Assume hit */
return (TRUE);
int k;
/* Percentile dice */
- k = rand_int(100);
+ k = randint0(100);
/* Hack -- Instant miss or hit */
if (k < 10) return (k < 5);
if (!vis) chance = (chance + 1) / 2;
/* Power must defeat armor */
- if (rand_int(chance) < (ac * 3 / 4)) return (FALSE);
+ if (randint0(chance) < (ac * 3 / 4)) return (FALSE);
/* Assume hit */
return (TRUE);
i = (weight + ((p_ptr->to_h_b + plus) * 4) + (p_ptr->lev * 2));
/* Critical hit */
- if (randint(5000) <= i)
+ if (randint1(5000) <= i)
{
- k = weight + randint(500);
+ k = weight + randint1(500);
if (k < 500)
{
i = (weight + (meichuu * 3 + plus * 5) + (p_ptr->lev * 3));
/* Chance */
- if ((randint((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
+ if ((randint1((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
{
- k = weight + randint(650);
- if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k+= randint(650);
+ k = weight + randint1(650);
+ if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k+= randint1(650);
if (k < 400)
{
for (x = (px - 1); x <= (px + 1); x++)
{
/* Sometimes, notice things */
- if (rand_int(100) < chance)
+ if (randint0(100) < chance)
{
/* Access the grid */
c_ptr = &cave[y][x];
int k, ac;
/* Percentile dice */
- k = rand_int(100);
+ k = randint0(100);
/* Hack -- 5% hit, 5% miss */
if (k < 10) return (k < 5);
ac = p_ptr->ac + p_ptr->to_a;
/* Power competes against Armor */
- if (randint(power) > ((ac * 3) / 4)) return (TRUE);
+ if (randint1(power) > ((ac * 3) / 4)) return (TRUE);
/* Assume miss */
return (FALSE);
dam = damroll(2, 6);
/* Extra spike damage */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
#ifdef JP
msg_print("¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
#endif
dam = dam * 2;
- (void)set_cut(p_ptr->cut + randint(dam));
+ (void)set_cut(p_ptr->cut + randint1(dam));
}
/* Take the damage */
/* Extra spike damage */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
#ifdef JP
msg_print("ÆǤòÅɤé¤ì¤¿¥¹¥Ñ¥¤¥¯¤¬»É¤µ¤Ã¤¿¡ª");
dam = dam * 2;
- (void)set_cut(p_ptr->cut + randint(dam));
+ (void)set_cut(p_ptr->cut + randint1(dam));
if (p_ptr->resist_pois || p_ptr->oppose_pois)
{
else
{
dam = dam * 2;
- (void)set_poisoned(p_ptr->poisoned + randint(dam));
+ (void)set_poisoned(p_ptr->poisoned + randint1(dam));
}
}
#endif
c_ptr->info &= ~(CAVE_MARK);
- cave_set_feat(y, x, floor_type[rand_int(100)]);
- num = 2 + randint(3);
+ cave_set_feat(y, x, floor_type[randint0(100)]);
+ num = 2 + randint1(3);
for (i = 0; i < num; i++)
{
(void)summon_specific(0, y, x, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE);
}
- if (dun_level > randint(100)) /* No nasty effect for low levels */
+ if (dun_level > randint1(100)) /* No nasty effect for low levels */
{
bool stop_ty = FALSE;
int count = 0;
dam = damroll(1, 4);
take_hit(DAMAGE_ATTACK, dam, name, -1);
- (void)set_slow(p_ptr->slow + rand_int(20) + 20, FALSE);
+ (void)set_slow(p_ptr->slow + randint0(20) + 20, FALSE);
}
else
{
if (!p_ptr->resist_blind)
{
- (void)set_blind(p_ptr->blind + rand_int(50) + 25);
+ (void)set_blind(p_ptr->blind + randint0(50) + 25);
}
break;
}
if (!p_ptr->resist_conf)
{
- (void)set_confused(p_ptr->confused + rand_int(20) + 10);
+ (void)set_confused(p_ptr->confused + randint0(20) + 10);
}
break;
}
if (!p_ptr->resist_pois && !p_ptr->oppose_pois)
{
- (void)set_poisoned(p_ptr->poisoned + rand_int(20) + 10);
+ (void)set_poisoned(p_ptr->poisoned + randint0(20) + 10);
}
break;
}
/* Remove the monster restriction */
get_mon_num_prep(NULL, NULL);
}
- (void)set_paralyzed(p_ptr->paralyzed + rand_int(10) + 5);
+ (void)set_paralyzed(p_ptr->paralyzed + randint0(10) + 5);
}
break;
}
/* Destroy this trap */
- cave_set_feat(y, x, floor_type[rand_int(100)]);
+ cave_set_feat(y, x, floor_type[randint0(100)]);
/* Make some new traps */
project(0, 1, y, x, 0, GF_MAKE_TRAP, PROJECT_HIDE | PROJECT_JUMP | PROJECT_GRID, -1);
}
if (break_trap && is_trap(c_ptr->feat))
{
- cave_set_feat(y, x, floor_type[rand_int(100)]);
+ cave_set_feat(y, x, floor_type[randint0(100)]);
#ifdef JP
msg_print("¥È¥é¥Ã¥×¤òÊ´ºÕ¤·¤¿¡£");
#else
chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
/* Test for hit */
- if ((!(r_ptr->flags2 & RF2_QUANTUM) || !rand_int(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
+ if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
{
/* Sound */
sound(SOUND_HIT);
/* Can't backstab creatures that we can't see, right? */
backstab = TRUE;
}
- else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (rand_int(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flags3 & RF3_RES_ALL))
+ else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level+20)) && m_ptr->ml && !(r_ptr->flags3 & RF3_RES_ALL))
{
fuiuchi = TRUE;
}
if (one_in_(10))
chg_virtue(V_CHANCE, 1);
- if (randint(5) < 3)
+ if (randint1(5) < 3)
{
/* Vampiric (20%) */
chaos_effect = 1;
can_drain = FALSE;
}
- if ((f1 & TR1_VORPAL) && (randint((o_ptr->name1 == ART_VORPAL_BLADE) ? 3 : 6) == 1) && !zantetsu_mukou)
+ if ((f1 & TR1_VORPAL) && (randint1((o_ptr->name1 == ART_VORPAL_BLADE) ? 3 : 6) == 1) && !zantetsu_mukou)
vorpal_cut = TRUE;
else vorpal_cut = FALSE;
{
do
{
- ma_ptr = &ma_blows[rand_int(MAX_MA)];
+ ma_ptr = &ma_blows[randint0(MAX_MA)];
if ((p_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
else min_level = ma_ptr->min_level;
}
while ((min_level > p_ptr->lev) ||
- (randint(p_ptr->lev) < ma_ptr->chance));
+ (randint1(p_ptr->lev) < ma_ptr->chance));
/* keep the highest level attack available we found */
if ((ma_ptr->min_level > old_ptr->min_level) &&
{
if (ma_ptr->effect)
{
- stun_effect = (ma_ptr->effect / 2) + randint(ma_ptr->effect / 2);
+ stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
}
msg_format(ma_ptr->desc, m_name);
}
- k = critical_norm(p_ptr->lev * randint((p_ptr->special_defense & KAMAE_SUZAKU) ? 5 : 10), min_level, k, p_ptr->to_h[0], 0);
+ k = critical_norm(p_ptr->lev * randint1((p_ptr->special_defense & KAMAE_SUZAKU) ? 5 : 10), min_level, k, p_ptr->to_h[0], 0);
if ((special_effect == MA_KNEE) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
{
msg_format("%^s moans in agony!", m_name);
#endif
- stun_effect = 7 + randint(13);
+ stun_effect = 7 + randint1(13);
resist_stun /= 3;
}
else if ((special_effect == MA_SLOW) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
{
if (!(r_ptr->flags1 & RF1_UNIQUE) &&
- (randint(p_ptr->lev) > r_ptr->level) &&
+ (randint1(p_ptr->lev) > r_ptr->level) &&
m_ptr->mspeed > 60)
{
#ifdef JP
if (stun_effect && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
{
- if (p_ptr->lev > randint(r_ptr->level + resist_stun + 10))
+ if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
{
if (m_ptr->stunned)
#ifdef JP
if (mode == HISSATSU_MINEUCHI)
{
- int tmp = (10 + randint(15) + p_ptr->lev / 5);
+ int tmp = (10 + randint1(15) + p_ptr->lev / 5);
k = 0;
anger_monster(m_ptr);
k = mon_damage_mod(m_ptr, k, (bool)(((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) || ((p_ptr->pclass == CLASS_BERSERKER) && one_in_(2))));
if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
{
- if ((randint(randint(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
+ if ((randint1(randint1(r_ptr->level/7)+5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
{
k = m_ptr->hp + 1;
#ifdef JP
#endif
}
- else if (rand_int(100) < r_ptr->level)
+ else if (randint0(100) < r_ptr->level)
{
#ifdef JP
msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", m_name);
msg_format("%^s appears confused.", m_name);
#endif
- m_ptr->confused += 10 + rand_int(p_ptr->lev) / 5;
+ m_ptr->confused += 10 + randint0(p_ptr->lev) / 5;
}
}
resists_tele = TRUE;
}
- else if (r_ptr->level > randint(100))
+ else if (r_ptr->level > randint1(100))
{
if (m_ptr->ml) r_ptr->r_flags3 |= RF3_RES_TELE;
#ifdef JP
}
else if ((chaos_effect == 5) && cave_floor_bold(y, x) &&
- (randint(90) > r_ptr->level))
+ (randint1(90) > r_ptr->level))
{
if (!(r_ptr->flags1 & RF1_UNIQUE) &&
!(r_ptr->flags4 & RF4_BR_CHAO) &&
if (m_ptr->ml) health_track(c_ptr->m_idx);
/* displace? */
- if ((stormbringer && (randint(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
+ if ((stormbringer && (randint1(1000) > 666)) || (p_ptr->pclass == CLASS_BERSERKER))
{
py_attack(y, x, 0);
oktomove = FALSE;
cave[py][px].info &= ~(CAVE_MARK);
/* Notice */
- cave_set_feat(py, px, floor_type[rand_int(100)]);
+ cave_set_feat(py, px, floor_type[randint0(100)]);
}
}
if (music_singing(MUSIC_WALL))
cave_set_feat(py, px, FEAT_GRASS);
else
{
- cave[py][px].feat = floor_type[rand_int(100)];
+ cave[py][px].feat = floor_type[randint0(100)];
cave[py][px].info &= ~(CAVE_MASK);
cave[py][px].info |= CAVE_FLOOR;
}
/* Spontaneous Searching */
if ((p_ptr->skill_fos >= 50) ||
- (0 == rand_int(50 - p_ptr->skill_fos)))
+ (0 == randint0(50 - p_ptr->skill_fos)))
{
search();
}
object_wipe(q_ptr);
/* Small chests often drop gold */
- if (small && (rand_int(100) < 25))
+ if (small && (randint0(100) < 25))
{
/* Make some gold */
if (!make_gold(q_ptr)) continue;
for (i = 0; i < 200; i++)
{
/* Pick a totally random spot. */
- y = rand_int(MAX_HGT);
- x = rand_int(MAX_WID);
+ y = randint0(MAX_HGT);
+ x = randint0(MAX_WID);
/* Must be an empty floor. */
if (!cave_empty_bold(y, x)) continue;
if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
{
- (void)set_poisoned(p_ptr->poisoned + 10 + randint(20));
+ (void)set_poisoned(p_ptr->poisoned + 10 + randint1(20));
}
}
if (!p_ptr->free_act)
{
- (void)set_paralyzed(p_ptr->paralyzed + 10 + randint(20));
+ (void)set_paralyzed(p_ptr->paralyzed + 10 + randint1(20));
}
}
/* Summon monsters */
if (trap & (CHEST_SUMMON))
{
- int num = 2 + randint(3);
+ int num = 2 + randint1(3);
#ifdef JP
msg_print("ÆÍÇ¡¿á¤½Ð¤·¤¿±ì¤ËÊñ¤ß¹þ¤Þ¤ì¤¿¡ª");
#else
for (i = 0; i < num; i++)
{
- if (randint(100)<dun_level)
+ if (randint1(100)<dun_level)
activate_hi_summon(py, px, FALSE);
else
(void)summon_specific(0, y, x, mon_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE);
#else
msg_print("Elemental beings appear to protect their treasures!");
#endif
- for (i = 0; i < randint(3) + 5; i++)
+ for (i = 0; i < randint1(3) + 5; i++)
{
(void)summon_specific(0, y, x, mon_level, SUMMON_ELEMENTAL, TRUE, FALSE, FALSE, TRUE, TRUE);
}
msg_print("A storm of birds swirls around you!");
#endif
- for (i = 0; i < randint(3) + 3; i++)
+ for (i = 0; i < randint1(3) + 3; i++)
(void)fire_meteor(-1, GF_FORCE, y, x, o_ptr->pval / 5, 7);
- for (i = 0; i < randint(5) + o_ptr->pval / 5; i++)
+ for (i = 0; i < randint1(5) + o_ptr->pval / 5; i++)
{
(void)summon_specific(0, y, x, mon_level, SUMMON_BIRD, TRUE, FALSE, FALSE, TRUE, TRUE);
}
msg_print("Demons materialize in clouds of fire and brimstone!");
#endif
- for (i = 0; i < randint(3) + 2; i++)
+ for (i = 0; i < randint1(3) + 2; i++)
{
(void)fire_meteor(-1, GF_FIRE, y, x, 10, 5);
(void)summon_specific(0, y, x, mon_level, SUMMON_DEMON, TRUE, FALSE, FALSE, TRUE, TRUE);
msg_print("Draconic forms loom out of the darkness!");
#endif
- for (i = 0; i < randint(3) + 2; i++)
+ for (i = 0; i < randint1(3) + 2; i++)
{
(void)summon_specific(0, y, x, mon_level, SUMMON_DRAGON, TRUE, FALSE, FALSE, TRUE, TRUE);
}
msg_print("Creatures strange and twisted assault you!");
#endif
- for (i = 0; i < randint(5) + 3; i++)
+ for (i = 0; i < randint1(5) + 3; i++)
{
(void)summon_specific(0, y, x, mon_level, SUMMON_HYBRID, TRUE, FALSE, FALSE, TRUE, TRUE);
}
msg_print("Vortices coalesce and wreak destruction!");
#endif
- for (i = 0; i < randint(3) + 2; i++)
+ for (i = 0; i < randint1(3) + 2; i++)
{
(void)summon_specific(0, y, x, mon_level, SUMMON_VORTEX, TRUE, FALSE, FALSE, TRUE, TRUE);
}
if ((trap & (CHEST_RUNES_OF_EVIL)) && o_ptr->k_idx)
{
/* Determine how many nasty tricks can be played. */
- int nasty_tricks_count = 4 + rand_int(3);
+ int nasty_tricks_count = 4 + randint0(3);
/* Message. */
#ifdef JP
for (; nasty_tricks_count > 0; nasty_tricks_count--)
{
/* ...but a high saving throw does help a little. */
- if (randint(100+o_ptr->pval*2) > p_ptr->skill_sav)
+ if (randint1(100+o_ptr->pval*2) > p_ptr->skill_sav)
{
#ifdef JP
if (one_in_(6)) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), "ÇËÌǤΥȥé¥Ã¥×¤ÎÊõÈ¢", -1);
{
if (!p_ptr->free_act)
(void)set_paralyzed(p_ptr->paralyzed + 2 +
- rand_int(6));
+ randint0(6));
else
(void)set_stun(p_ptr->stun + 10 +
- rand_int(100));
+ randint0(100));
}
else if (one_in_(3)) apply_disenchant(0);
else if (one_in_(2))
if (j < 2) j = 2;
/* Success -- May still have traps */
- if (rand_int(100) < j)
+ if (randint0(100) < j)
{
#ifdef JP
msg_print("¸°¤ò¤Ï¤º¤·¤¿¡£");
if (j < 2) j = 2;
/* Success */
- if (rand_int(100) < j)
+ if (randint0(100) < j)
{
/* Message */
#ifdef JP
else if (c_ptr->feat == FEAT_TREES) /* -KMW- */
{
/* Chop Down */
- if ((p_ptr->skill_dig > 10 + rand_int(400)) && twall(y, x, FEAT_GRASS))
+ if ((p_ptr->skill_dig > 10 + randint0(400)) && twall(y, x, FEAT_GRASS))
{
#ifdef JP
msg_print("ÌÚ¤òÀÚ¤êʧ¤Ã¤¿¡£");
more = TRUE;
/* Occasional Search XXX XXX */
- if (rand_int(100) < 25) search();
+ if (randint0(100) < 25) search();
}
}
(c_ptr->feat <= FEAT_WALL_SOLID))
{
/* Tunnel */
- if ((p_ptr->skill_dig > 40 + rand_int(1600)) && twall(y, x, floor_type[rand_int(100)]))
+ if ((p_ptr->skill_dig > 40 + randint0(1600)) && twall(y, x, floor_type[randint0(100)]))
{
#ifdef JP
msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
/* Quartz */
if (hard)
{
- okay = (p_ptr->skill_dig > 20 + rand_int(800));
+ okay = (p_ptr->skill_dig > 20 + randint0(800));
}
/* Magma */
else
{
- okay = (p_ptr->skill_dig > 10 + rand_int(400));
+ okay = (p_ptr->skill_dig > 10 + randint0(400));
}
/* Success */
- if (okay && twall(y, x, floor_type[rand_int(100)]))
+ if (okay && twall(y, x, floor_type[randint0(100)]))
{
/* Found treasure */
if (gold)
else if (c_ptr->feat == FEAT_RUBBLE)
{
/* Remove the rubble */
- if ((p_ptr->skill_dig > rand_int(200)) && twall(y, x, floor_type[rand_int(100)]))
+ if ((p_ptr->skill_dig > randint0(200)) && twall(y, x, floor_type[randint0(100)]))
{
/* Message */
#ifdef JP
#endif
/* Hack -- place an object */
- if (rand_int(100) < (15 - dun_level/2))
+ if (randint0(100) < (15 - dun_level/2))
{
/* Create a simple object */
place_object(y, x, FALSE, FALSE);
else if (c_ptr->feat >= FEAT_SECRET)
{
/* Tunnel */
- if ((p_ptr->skill_dig > 30 + rand_int(1200)) && twall(y, x, floor_type[rand_int(100)]))
+ if ((p_ptr->skill_dig > 30 + randint0(1200)) && twall(y, x, floor_type[randint0(100)]))
{
#ifdef JP
msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
more = TRUE;
/* Occasional Search XXX XXX */
- if (rand_int(100) < 25) search();
+ if (randint0(100) < 25) search();
}
}
else
{
/* Tunnel */
- if ((p_ptr->skill_dig > 30 + rand_int(1200)) && twall(y, x, floor_type[randint(100)]))
+ if ((p_ptr->skill_dig > 30 + randint0(1200)) && twall(y, x, floor_type[randint1(100)]))
{
#ifdef JP
msg_print("·ê¤ò·¡¤ê½ª¤¨¤¿¡£");
if (j < 2) j = 2;
/* Success */
- if (rand_int(100) < j)
+ if (randint0(100) < j)
{
/* Message */
#ifdef JP
}
/* Success (get a lot of experience) */
- else if (rand_int(100) < j)
+ else if (randint0(100) < j)
{
#ifdef JP
msg_print("È¢¤Ë»Å³Ý¤±¤é¤ì¤Æ¤¤¤¿¥È¥é¥Ã¥×¤ò²ò½ü¤·¤¿¡£");
}
/* Failure -- Keep trying */
- else if ((i > 5) && (randint(i) > 5))
+ else if ((i > 5) && (randint1(i) > 5))
{
/* We may keep trying */
more = TRUE;
if (j < 2) j = 2;
/* Success */
- if (rand_int(100) < j)
+ if (randint0(100) < j)
{
/* Message */
#ifdef JP
c_ptr->info &= ~(CAVE_MARK);
/* Remove the trap */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
note_spot(y, x);
}
/* Failure -- Keep trying */
- else if ((i > 5) && (randint(i) > 5))
+ else if ((i > 5) && (randint1(i) > 5))
{
/* Failure */
if (flush_failure) flush();
if (temp < 1) temp = 1;
/* Hack -- attempt to bash down the door */
- if (rand_int(100) < temp)
+ if (randint0(100) < temp)
{
/* Message */
#ifdef JP
/* Break down the door */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
cave_set_feat(y, x, FEAT_BROKEN);
}
}
/* Saving throw against stun */
- else if (rand_int(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
+ else if (randint0(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
p_ptr->lev)
{
/* Message */
/* Hack -- Lose balance ala paralysis */
- (void)set_paralyzed(p_ptr->paralyzed + 2 + rand_int(2));
+ (void)set_paralyzed(p_ptr->paralyzed + 2 + randint0(2));
}
/* Result */
int tmp = 120 + p_ptr->lev*10 - wilderness[py][px].level + 5;
if (tmp < 1)
tmp = 1;
- if (((wilderness[py][px].level + 5) > (p_ptr->lev / 2)) && rand_int(tmp) < (21-p_ptr->skill_stl))
+ if (((wilderness[py][px].level + 5) > (p_ptr->lev / 2)) && randint0(tmp) < (21-p_ptr->skill_stl))
{
/* Inform the player of his horrible fate :=) */
#ifdef JP
/* Go into large wilderness view */
p_ptr->wilderness_x = px;
p_ptr->wilderness_y = py;
- p_ptr->oldpy = randint(MAX_HGT-2);
- p_ptr->oldpx = randint(MAX_WID-2);
+ p_ptr->oldpy = randint1(MAX_HGT-2);
+ p_ptr->oldpx = randint1(MAX_WID-2);
energy_use = 100;
change_wild_mode();
/* Spontaneous Searching */
- if ((p_ptr->skill_fos >= 50) || (0 == rand_int(50 - p_ptr->skill_fos)))
+ if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos)))
{
search();
}
if (shuriken)
{
- ty = rand_int(101)-50+py;
- tx = rand_int(101)-50+px;
+ ty = randint0(101)-50+py;
+ tx = randint0(101)-50+px;
}
else
{
/* Potions smash open */
if (object_is_potion(q_ptr))
{
- if (hit_body || hit_wall || (randint(100) < j))
+ if (hit_body || hit_wall || (randint1(100) < j))
{
/* Message */
#ifdef JP
if (return_when_thrown)
{
- int back_chance = randint(30)+20+((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
+ int back_chance = randint1(30)+20+((int)(adj_dex_th[p_ptr->stat_ind[A_DEX]]) - 128);
char o2_name[MAX_NLEN];
bool super_boomerang = (((q_ptr->name1 == ART_MJOLLNIR) || (q_ptr->name1 == ART_AEGISFANG)) && boomerang);
j = -1;
- if (boomerang) back_chance += 4+randint(5);
+ if (boomerang) back_chance += 4+randint1(5);
if (super_boomerang) back_chance += 100;
object_desc(o2_name, q_ptr, FALSE, 0);
path_build(buf, 1024, ANGBAND_DIR_USER, file_name);
if (p_ptr->pclass == CLASS_WARRIOR || p_ptr->pclass == CLASS_MONK || p_ptr->pclass == CLASS_SAMURAI || p_ptr->pclass == CLASS_BERSERKER)
- strcpy(tmp,subtitle[rand_int(MAX_SUBTITLE-1)]);
+ strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)]);
else if (p_ptr->pclass == CLASS_MAGE || p_ptr->pclass == CLASS_HIGH_MAGE || p_ptr->pclass == CLASS_SORCERER)
- strcpy(tmp,subtitle[rand_int(MAX_SUBTITLE-1)+1]);
- else strcpy(tmp,subtitle[rand_int(MAX_SUBTITLE-2)+1]);
+ strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-1)+1]);
+ else strcpy(tmp,subtitle[randint0(MAX_SUBTITLE-2)+1]);
#ifdef JP
sprintf(nikki_title, "¡Ö%s%s%s¤ÎÅÁÀâ -%s-¡×",
min, (hour < 12) ? "AM" : "PM");
/* Find the path */
- if (!rand_int(10) || p_ptr->image)
+ if (!randint0(10) || p_ptr->image)
{
#ifdef JP
path_build(buf, 1024, ANGBAND_DIR_FILE, "timefun_j.txt");
num++;
/* Apply the randomizer */
- if (!rand_int(num)) strcpy(desc, buf + 2);
+ if (!randint0(num)) strcpy(desc, buf + 2);
/* Next... */
continue;
void wild_magic(int spell)
{
int counter = 0;
- int type = SUMMON_BIZARRE1 + rand_int(6);
+ int type = SUMMON_BIZARRE1 + randint0(6);
if (type < SUMMON_BIZARRE1) type = SUMMON_BIZARRE1;
else if (type > SUMMON_BIZARRE6) type = SUMMON_BIZARRE6;
- switch (randint(spell) + randint(8) + 1)
+ switch (randint1(spell) + randint1(8) + 1)
{
case 1:
case 2:
(void)set_cut(p_ptr->cut - 10);
break;
case 2: /* Bless */
- (void)set_blessed(randint(12) + 12, FALSE);
+ (void)set_blessed(randint1(12) + 12, FALSE);
break;
case 3: /* Remove Fear */
(void)set_afraid(0);
(void)set_cut(0);
break;
case 11: /* Sense Unseen */
- (void)set_tim_invis(randint(24) + 24, FALSE);
+ (void)set_tim_invis(randint1(24) + 24, FALSE);
break;
case 12: /* Holy Orb */
if (!get_aim_dir(&dir)) return FALSE;
break;
case 13: /* Protection from Evil */
- (void)set_protevil(randint(25) + 3 * p_ptr->lev, FALSE);
+ (void)set_protevil(randint1(25) + 3 * p_ptr->lev, FALSE);
break;
case 14: /* Healing */
(void)hp_player(300);
warding_glyph();
break;
case 16: /* Exorcism */
- (void)dispel_undead(randint(plev));
- (void)dispel_demons(randint(plev));
+ (void)dispel_undead(randint1(plev));
+ (void)dispel_demons(randint1(plev));
(void)turn_evil(plev);
break;
case 17: /* Dispel Curse */
}
break;
case 18: /* Dispel Undead + Demons */
- (void)dispel_undead(randint(plev * 3));
- (void)dispel_demons(randint(plev * 3));
+ (void)dispel_undead(randint1(plev * 3));
+ (void)dispel_demons(randint1(plev * 3));
break;
case 19: /* 'Day of the Dove' */
charm_monsters(plev * 2);
break;
case 20: /* Dispel Evil */
- (void)dispel_evil(randint(plev * 4));
+ (void)dispel_evil(randint1(plev * 4));
break;
case 21: /* Banishment */
if (banish_evil(100))
}
break;
case 22: /* Holy Word */
- (void)dispel_evil(randint(plev * 4));
+ (void)dispel_evil(randint1(plev * 4));
(void)hp_player(1000);
(void)set_afraid(0);
(void)set_poisoned(0);
glyph_creation();
break;
case 24: /* Heroism */
- (void)set_hero(randint(25) + 25, FALSE);
+ (void)set_hero(randint1(25) + 25, FALSE);
(void)hp_player(10);
(void)set_afraid(0);
break;
case 25: /* Prayer */
- (void)set_blessed(randint(48) + 48, FALSE);
+ (void)set_blessed(randint1(48) + 48, FALSE);
break;
case 26: /* Turn Undead */
(void)mass_genocide_undead(plev+50,TRUE);
turn_monsters(plev * 4);
stasis_monsters(plev * 4);
summon_specific(-1, py, px, plev, SUMMON_ANGEL, TRUE, TRUE, TRUE, FALSE, FALSE);
- (void)set_hero(randint(25) + 25, FALSE);
+ (void)set_hero(randint1(25) + 25, FALSE);
(void)hp_player(300);
- (void)set_fast(randint(20 + plev) + plev, FALSE);
+ (void)set_fast(randint1(20 + plev) + plev, FALSE);
(void)set_afraid(0);
break;
case 31: /* Ultimate resistance */
{
- int v = randint(plev/2)+plev/2;
+ int v = randint1(plev/2)+plev/2;
(void)set_fast(v, FALSE);
set_oppose_acid(v, FALSE);
set_oppose_elec(v, FALSE);
(void)fire_beam(GF_AWAY_ALL, dir, plev);
break;
case 13: /* Haste Self */
- (void)set_fast(randint(20 + plev) + plev, FALSE);
+ (void)set_fast(randint1(20 + plev) + plev, FALSE);
break;
case 14: /* Detection True */
(void)detect_all(DETECT_RAD_DEFAULT);
(void)charm_monster(dir, plev);
break;
case 18: /* Sense Minds */
- (void)set_tim_esp(randint(30) + 25, FALSE);
+ (void)set_tim_esp(randint1(30) + 25, FALSE);
break;
case 19: /* Teleport to town */
return tele_town();
wiz_lite(FALSE, FALSE);
if (!(p_ptr->telepathy))
{
- (void)set_tim_esp(randint(30) + 25, FALSE);
+ (void)set_tim_esp(randint1(30) + 25, FALSE);
}
break;
case 28: /* Charm Monsters */
banish_monsters(plev * 4);
break;
case 31: /* Globe of Invulnerability */
- (void)set_invuln(randint(4) + 4, FALSE);
+ (void)set_invuln(randint1(4) + 4, FALSE);
break;
default:
#ifdef JP
(void)charm_animal(dir, plev);
break;
case 6: /* Resist Environment */
- (void)set_oppose_cold(randint(20) + 20, FALSE);
- (void)set_oppose_fire(randint(20) + 20, FALSE);
- (void)set_oppose_elec(randint(20) + 20, FALSE);
+ (void)set_oppose_cold(randint1(20) + 20, FALSE);
+ (void)set_oppose_fire(randint1(20) + 20, FALSE);
+ (void)set_oppose_elec(randint1(20) + 20, FALSE);
break;
case 7: /* Cure Wounds & Poison */
(void)hp_player(damroll(2, 8));
(void)stair_creation();
break;
case 17: /* Stone Skin */
- (void)set_shield(randint(20) + 30, FALSE);
+ (void)set_shield(randint1(20) + 30, FALSE);
break;
case 18: /* Resistance True */
- (void)set_oppose_acid(randint(20) + 20, FALSE);
- (void)set_oppose_elec(randint(20) + 20, FALSE);
- (void)set_oppose_fire(randint(20) + 20, FALSE);
- (void)set_oppose_cold(randint(20) + 20, FALSE);
- (void)set_oppose_pois(randint(20) + 20, FALSE);
+ (void)set_oppose_acid(randint1(20) + 20, FALSE);
+ (void)set_oppose_elec(randint1(20) + 20, FALSE);
+ (void)set_oppose_fire(randint1(20) + 20, FALSE);
+ (void)set_oppose_cold(randint1(20) + 20, FALSE);
+ (void)set_oppose_pois(randint1(20) + 20, FALSE);
break;
case 19: /* Tree Creation */
(void)tree_creation();
}
break;
case 30: /* Elemental Branding */
- brand_weapon(rand_int(2));
+ brand_weapon(randint0(2));
break;
case 31: /* Nature's Wrath */
(void)dispel_monsters(plev * 4);
keeping the results quite random. It also allows
some potent effects only at high level. */
- int die = randint(100) + plev / 5;
+ int die = randint1(100) + plev / 5;
int vir = virtue_number(V_CHANCE);
if (vir)
{
if (p_ptr->virtues[vir - 1] > 0)
{
- while (randint(400) < p_ptr->virtues[vir - 1]) die++;
+ while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
}
else
{
- while (randint(400) < (0-p_ptr->virtues[vir - 1])) die--;
+ while (randint1(400) < (0-p_ptr->virtues[vir - 1])) die--;
}
}
}
else if (die < 106)
{
- destroy_area(py, px, 13+rand_int(5), TRUE);
+ destroy_area(py, px, 13+randint0(5), TRUE);
}
else if (die < 108)
{
(void)fire_beam(GF_AWAY_ALL, dir, plev);
break;
case 14: /* Word of Destruction */
- destroy_area(py, px, 13+rand_int(5), TRUE);
+ destroy_area(py, px, 13+randint0(5), TRUE);
break;
case 15: /* Invoke Logrus */
if (!get_aim_dir(&dir)) return FALSE;
case 25: /* Meteor Swarm */
{
int x, y, dx, dy;
- int b = 10 + randint(10);
+ int b = 10 + randint1(10);
for (i = 0; i < b; i++)
{
int count = 0, d = 0;
{
count++;
if (count > 20) break;
- x = px - 8 + rand_int(17);
- y = py - 8 + rand_int(17);
+ x = px - 8 + randint0(17);
+ y = py - 8 + randint0(17);
if (!in_bounds(y,x) || (!cave_floor_bold(y,x) && (cave[y][x].feat != FEAT_TREES)) || !player_has_los_bold(y, x)) continue;
if (one_in_(5))
{ /* Special effect first */
- dummy = randint(1000);
+ dummy = randint1(1000);
if (dummy == 666)
fire_ball_hide(GF_DEATH_RAY, dir, plev * 200, 0);
else if (dummy < 500)
(void)sleep_monster(dir);
break;
case 5: /* Resist Poison */
- (void)set_oppose_pois(randint(20) + 20, FALSE);
+ (void)set_oppose_pois(randint1(20) + 20, FALSE);
break;
case 6: /* Horrify */
if (!get_aim_dir(&dir)) return FALSE;
case 13: /* Vampiric Drain */
if (!get_aim_dir(&dir)) return FALSE;
- dummy = plev * 2 + randint(plev * 2); /* Dmg */
+ dummy = plev * 2 + randint1(plev * 2); /* Dmg */
if (drain_life(dir, dummy))
{
chg_virtue(V_SACRIFICE, -1);
(void)symbol_genocide(plev+50, TRUE);
break;
case 16: /* Berserk */
- (void)set_shero(randint(25) + 25, FALSE);
+ (void)set_shero(randint1(25) + 25, FALSE);
(void)hp_player(30);
(void)set_afraid(0);
break;
case 17: /* Invoke Spirits */
{
- int die = randint(100) + plev / 5;
+ int die = randint1(100) + plev / 5;
int vir = virtue_number(V_CHANCE);
if (vir)
{
if (p_ptr->virtues[vir - 1] > 0)
{
- while (randint(400) < p_ptr->virtues[vir - 1]) die++;
+ while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
}
else
{
- while (randint(400) < (0-p_ptr->virtues[vir - 1])) die--;
+ while (randint1(400) < (0-p_ptr->virtues[vir - 1])) die--;
}
}
msg_print("An unnamable evil brushes against your mind...");
#endif
- set_afraid(p_ptr->afraid + randint(4) + 4);
+ set_afraid(p_ptr->afraid + randint1(4) + 4);
}
else if (die < 26)
{
msg_print("Your head is invaded by a horde of gibbering spectral voices...");
#endif
- set_confused(p_ptr->confused + randint(4) + 4);
+ set_confused(p_ptr->confused + randint1(4) + 4);
}
else if (die < 31)
{
}
else if (die < 106)
{
- destroy_area(py, px, 13+rand_int(5), TRUE);
+ destroy_area(py, px, 13+randint0(5), TRUE);
}
else if (die < 108)
{
damroll(4 + ((plev - 5) / 4), 8));
break;
case 19: /* Battle Frenzy */
- (void)set_shero(randint(25) + 25, FALSE);
+ (void)set_shero(randint1(25) + 25, FALSE);
(void)hp_player(30);
(void)set_afraid(0);
- (void)set_fast(randint(20 + (plev / 2)) + (plev / 2), FALSE);
+ (void)set_fast(randint1(20 + (plev / 2)) + (plev / 2), FALSE);
break;
case 20: /* Vampiric Branding */
brand_weapon(4);
}
break;
case 22: /* Word of Death */
- (void)dispel_living(randint(plev * 3));
+ (void)dispel_living(randint1(plev * 3));
break;
case 23: /* Darkness Storm */
if (!get_aim_dir(&dir)) return FALSE;
break;
}
case 26: /* Esoteria */
- if (randint(50) > plev)
+ if (randint1(50) > plev)
return ident_spell(FALSE);
else
return identify_fully(FALSE);
break;
case 27: /* Mimic vampire */
- (void)set_mimic(10+plev/2 + randint(10+plev/2), MIMIC_VAMPIRE, FALSE);
+ (void)set_mimic(10+plev/2 + randint1(10+plev/2), MIMIC_VAMPIRE, FALSE);
break;
case 28: /* Restore Life */
(void)restore_level();
fire_ball(GF_HELL_FIRE, dir, 666, 3);
#ifdef JP
-take_hit(DAMAGE_USELIFE, 20 + randint(30), "ÃϹö¤Î¹å²Ð¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+take_hit(DAMAGE_USELIFE, 20 + randint1(30), "ÃϹö¤Î¹å²Ð¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
#else
- take_hit(DAMAGE_USELIFE, 20 + randint(30), "the strain of casting Hellfire", -1);
+ take_hit(DAMAGE_USELIFE, 20 + randint1(30), "the strain of casting Hellfire", -1);
#endif
break;
case 31: /* Wraithform */
- set_wraith_form(randint(plev / 2) + (plev / 2), FALSE);
+ set_wraith_form(randint1(plev / 2) + (plev / 2), FALSE);
break;
default:
msg_format("You cast an unknown Death spell: %d.", spell);
int dir;
int beam;
int plev = p_ptr->lev;
- int summon_lev = plev * 2 / 3 + randint(plev/2);
+ int summon_lev = plev * 2 / 3 + randint1(plev/2);
int dummy = 0;
bool no_trump = FALSE;
bool unique_okay = FALSE;
else beam = plev / 2;
if (summon_lev < 1) summon_lev = 1;
- if (!success || (randint(50+plev) < plev/10)) unique_okay = TRUE;
+ if (!success || (randint1(50+plev) < plev/10)) unique_okay = TRUE;
switch (spell)
{
case 0: /* Phase Door */
break;
case 1: /* Trump Spiders */
{
- bool pet = success; /* (randint(5) > 2) */
+ bool pet = success; /* (randint1(5) > 2) */
#ifdef JP
msg_print("¤¢¤Ê¤¿¤ÏÃØéá¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
if (success)
{
/* A limited power 'wonder' spell */
- int die = randint(120);
+ int die = randint1(120);
int vir = virtue_number(V_CHANCE);
if ((p_ptr->pclass == CLASS_ROGUE) ||
(p_ptr->pclass == CLASS_HIGH_MAGE) ||
(p_ptr->pclass == CLASS_SORCERER))
- die = (randint(110)) + plev / 5;
+ die = (randint1(110)) + plev / 5;
/* Card sharks and high mages get a level bonus */
if (vir)
{
if (p_ptr->virtues[vir - 1] > 0)
{
- while (randint(400) < p_ptr->virtues[vir - 1]) die++;
+ while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
}
else
{
- while (randint(400) < (0-p_ptr->virtues[vir - 1])) die--;
+ while (randint1(400) < (0-p_ptr->virtues[vir - 1])) die--;
}
}
msg_print("Oh no! It's Death!");
#endif
- for (dummy = 0; dummy < randint(3); dummy++)
+ for (dummy = 0; dummy < randint1(3); dummy++)
(void)activate_hi_summon(py, px, FALSE);
}
else if (die < 14)
msg_print("It's the picture of a strange monster.");
#endif
- if (!(summon_specific(0, py, px, (dun_level * 3) / 2, 32 + randint(6), TRUE, FALSE, FALSE, TRUE, TRUE)))
+ if (!(summon_specific(0, py, px, (dun_level * 3) / 2, 32 + randint1(6), TRUE, FALSE, FALSE, TRUE, TRUE)))
no_trump = TRUE;
}
else if (die < 33)
msg_print("It's the Wheel of Fortune.");
#endif
- wild_magic(rand_int(32));
+ wild_magic(randint0(32));
}
else if (die < 40)
{
case 5: /* Trump Spying */
if (success)
{
- (void)set_tim_esp(randint(30) + 25, FALSE);
+ (void)set_tim_esp(randint1(30) + 25, FALSE);
}
break;
case 6: /* Teleport Away */
break;
case 7: /* Trump Animals */
{
- bool pet = success; /* was (randint(5) > 2) */
+ bool pet = success; /* was (randint1(5) > 2) */
int type = (pet ? SUMMON_ANIMAL_RANGER : SUMMON_ANIMAL);
bool group = (pet ? FALSE : TRUE);
#endif
- for (dummy = 2 + rand_int(plev / 7); dummy > 0; dummy--)
+ for (dummy = 2 + randint0(plev / 7); dummy > 0; dummy--)
{
- bool pet = success; /* was (randint(10) > 3) */
+ bool pet = success; /* was (randint1(10) > 3) */
bool group = (pet ? FALSE : TRUE);
int type;
}
case 17: /* Trump Undead */
{
- bool pet = success; /* (randint(10) > 3) */
+ bool pet = success; /* (randint1(10) > 3) */
bool group = (pet ? FALSE : TRUE);
#ifdef JP
}
case 18: /* Trump Reptiles */
{
- bool pet = success; /* was (randint(5) > 2) */
+ bool pet = success; /* was (randint1(5) > 2) */
bool group = !pet;
#ifdef JP
for (dummy = 0; dummy < 1 + ((plev - 15)/ 10); dummy++)
{
- bool pet = success; /* was (randint(10) > 3) */
+ bool pet = success; /* was (randint1(10) > 3) */
bool group = (pet ? FALSE : TRUE);
int type;
}
case 20: /* Trump Hounds */
{
- bool pet = success; /* was (randint(5) > 2) */
+ bool pet = success; /* was (randint1(5) > 2) */
#ifdef JP
msg_print("¤¢¤Ê¤¿¤Ï¥Ï¥¦¥ó¥É¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
break;
case 23: /* Trump Cyberdemon */
{
- bool pet = success; /* was (randint(10) > 3) */
+ bool pet = success; /* was (randint1(10) > 3) */
#ifdef JP
msg_print("¤¢¤Ê¤¿¤Ï¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤Î¥«¡¼¥É¤Ë½¸Ã椹¤ë...");
break;
case 27: /* Trump Dragon */
{
- bool pet = success; /* was (randint(10) > 3) */
+ bool pet = success; /* was (randint1(10) > 3) */
bool group = (pet ? FALSE : TRUE);
#ifdef JP
if (success)
{
int x, y, dx, dy, i;
- int b = 10 + randint(10);
+ int b = 10 + randint1(10);
for (i = 0; i < b; i++)
{
int count = 0, d = 0;
{
count++;
if (count > 20) break;
- x = px - 8 + rand_int(17);
- y = py - 8 + rand_int(17);
+ x = px - 8 + randint0(17);
+ y = py - 8 + randint0(17);
if (!in_bounds(y,x) || (!cave_floor_bold(y,x) && (cave[y][x].feat != FEAT_TREES)) || !player_has_los_bold(y, x)) continue;
break;
case 29: /* Trump Demon */
{
- bool pet = success; /* was (randint(10) > 3) */
+ bool pet = success; /* was (randint1(10) > 3) */
bool group = (pet ? FALSE : TRUE);
#ifdef JP
}
case 30: /* Trump Greater Undead */
{
- bool pet = success; /* was (randint(10) > 3) */
+ bool pet = success; /* was (randint1(10) > 3) */
bool group = (pet ? FALSE : TRUE);
#ifdef JP
}
case 31: /* Trump Ancient Dragon */
{
- bool pet = success; /* was (randint(10) > 3) */
+ bool pet = success; /* was (randint1(10) > 3) */
bool group = (pet ? FALSE : TRUE);
int type;
if (p_ptr->pclass == CLASS_BEASTMASTER)
(void)set_poisoned(0);
break;
case 14: /* Resist Cold */
- (void)set_oppose_cold(randint(20) + 20, FALSE);
+ (void)set_oppose_cold(randint1(20) + 20, FALSE);
break;
case 15: /* Resist Fire */
- (void)set_oppose_fire(randint(20) + 20, FALSE);
+ (void)set_oppose_fire(randint1(20) + 20, FALSE);
break;
case 16: /* Resist Lightning */
- (void)set_oppose_elec(randint(20) + 20, FALSE);
+ (void)set_oppose_elec(randint1(20) + 20, FALSE);
break;
case 17: /* Resist Acid */
- (void)set_oppose_acid(randint(20) + 20, FALSE);
+ (void)set_oppose_acid(randint1(20) + 20, FALSE);
break;
case 18: /* Cure Medium Wounds */
(void)hp_player(damroll(4, 8));
(void)set_food(PY_FOOD_MAX - 1);
break;
case 24: /* See Invisible */
- (void)set_tim_invis(randint(24) + 24, FALSE);
+ (void)set_tim_invis(randint1(24) + 24, FALSE);
break;
case 25: /* Conjure Elemental */
if (!summon_specific(-1, py, px, plev, SUMMON_ELEMENTAL, TRUE, TRUE, TRUE, FALSE, FALSE))
case 28: /* Elemental Ball */
if (!get_aim_dir(&dir)) return FALSE;
- switch (randint(4))
+ switch (randint1(4))
{
case 1: dummy = GF_FIRE;break;
case 2: dummy = GF_ELEC;break;
wiz_lite(FALSE, FALSE);
if (!p_ptr->telepathy)
{
- (void)set_tim_esp(randint(30) + 25, FALSE);
+ (void)set_tim_esp(randint1(30) + 25, FALSE);
}
break;
default:
switch (spell)
{
case 0: /* Infravision */
- set_tim_infra(100 + randint(100), FALSE);
+ set_tim_infra(100 + randint1(100), FALSE);
break;
case 1: /* Regeneration */
- set_tim_regen(80 + randint(80), FALSE);
+ set_tim_regen(80 + randint1(80), FALSE);
break;
case 2: /* Satisfy Hunger */
(void)set_food(PY_FOOD_MAX - 1);
break;
case 3: /* Resist Cold */
- (void)set_oppose_cold(randint(20) + 20, FALSE);
+ (void)set_oppose_cold(randint1(20) + 20, FALSE);
break;
case 4: /* Resist Fire */
- (void)set_oppose_fire(randint(20) + 20, FALSE);
+ (void)set_oppose_fire(randint1(20) + 20, FALSE);
break;
case 5: /* Heroism */
- (void)set_hero(randint(25) + 25, FALSE);
+ (void)set_hero(randint1(25) + 25, FALSE);
(void)hp_player(10);
(void)set_afraid(0);
break;
case 6: /* Resist Lightning */
- (void)set_oppose_elec(randint(20) + 20, FALSE);
+ (void)set_oppose_elec(randint1(20) + 20, FALSE);
break;
case 7: /* Resist Acid */
- (void)set_oppose_acid(randint(20) + 20, FALSE);
+ (void)set_oppose_acid(randint1(20) + 20, FALSE);
break;
case 8: /* See Invisibility */
- (void)set_tim_invis(randint(24) + 24, FALSE);
+ (void)set_tim_invis(randint1(24) + 24, FALSE);
break;
case 9: /* Remove Curse */
if (remove_curse())
}
break;
case 10: /* Resist Poison */
- (void)set_oppose_pois(randint(20) + 20, FALSE);
+ (void)set_oppose_pois(randint1(20) + 20, FALSE);
break;
case 11: /* Berserk */
- (void)set_shero(randint(25) + 25, FALSE);
+ (void)set_shero(randint1(25) + 25, FALSE);
(void)hp_player(30);
(void)set_afraid(0);
break;
(void)self_knowledge();
break;
case 13: /* Protection from Evil */
- (void)set_protevil(randint(25) + 3 * p_ptr->lev, FALSE);
+ (void)set_protevil(randint1(25) + 3 * p_ptr->lev, FALSE);
break;
case 14: /* Healing */
set_poisoned(0);
return choose_ele_attack();
break;
case 16: /* Telepathy */
- (void)set_tim_esp(randint(30) + 25, FALSE);
+ (void)set_tim_esp(randint1(30) + 25, FALSE);
break;
case 17: /* Stone Skin */
- (void)set_shield(randint(20) + 30, FALSE);
+ (void)set_shield(randint1(20) + 30, FALSE);
break;
case 18: /* Resistance */
- (void)set_oppose_acid(randint(20) + 20, FALSE);
- (void)set_oppose_elec(randint(20) + 20, FALSE);
- (void)set_oppose_fire(randint(20) + 20, FALSE);
- (void)set_oppose_cold(randint(20) + 20, FALSE);
- (void)set_oppose_pois(randint(20) + 20, FALSE);
+ (void)set_oppose_acid(randint1(20) + 20, FALSE);
+ (void)set_oppose_elec(randint1(20) + 20, FALSE);
+ (void)set_oppose_fire(randint1(20) + 20, FALSE);
+ (void)set_oppose_cold(randint1(20) + 20, FALSE);
+ (void)set_oppose_pois(randint1(20) + 20, FALSE);
break;
case 19: /* Haste */
- (void)set_fast(randint(20 + plev) + plev, FALSE);
+ (void)set_fast(randint1(20 + plev) + plev, FALSE);
break;
case 20: /* Walk through Wall */
- (void)set_kabenuke(randint(plev/2) + plev/2, FALSE);
+ (void)set_kabenuke(randint1(plev/2) + plev/2, FALSE);
break;
case 21: /* Pulish Shield */
(void)pulish_shield();
}
break;
case 23: /* Magic armor */
- (void)set_magicdef(randint(20) + 20, FALSE);
+ (void)set_magicdef(randint1(20) + 20, FALSE);
break;
case 24: /* Remove Enchantment */
if (!mundane_spell(TRUE)) return FALSE;
return identify_fully(FALSE);
break;
case 27: /* Enchant Weapon */
- return enchant_spell(rand_int(4) + 1, rand_int(4) + 1, 0);
+ return enchant_spell(randint0(4) + 1, randint0(4) + 1, 0);
break;
case 28: /* Enchant Armor */
- return enchant_spell(0, 0, rand_int(3) + 2);
+ return enchant_spell(0, 0, randint0(3) + 2);
break;
case 29: /* Brand Weapon */
- brand_weapon(rand_int(17));
+ brand_weapon(randint0(17));
break;
case 30: /* Living Trump */
if (one_in_(7))
#endif
break;
case 31: /* Immune */
- return (choose_ele_immune(13 + randint(13)));
+ return (choose_ele_immune(13 + randint1(13)));
break;
default:
msg_format("You cast an unknown Craft spell: %d.", spell);
(void)detect_monsters_nonliving(DETECT_RAD_DEFAULT);
break;
case 2: /* Bless */
- (void)set_blessed(randint(12) + 12, FALSE);
+ (void)set_blessed(randint1(12) + 12, FALSE);
break;
case 3: /* Resist Fire */
- (void)set_oppose_fire(randint(20) + 20, FALSE);
+ (void)set_oppose_fire(randint1(20) + 20, FALSE);
break;
case 4: /* Horrify */
if (!get_aim_dir(&dir)) return FALSE;
map_area(DETECT_RAD_MAP);
break;
case 10: /* Resist Nether */
- (void)set_tim_res_nether(randint(20) + 20, FALSE);
+ (void)set_tim_res_nether(randint1(20) + 20, FALSE);
break;
case 11: /* Plasma Bolt */
if (!get_aim_dir(&dir)) return FALSE;
bool pet = !one_in_(3);
bool group = !(pet && (plev < 50));
- if (summon_specific((pet ? -1 : 0), py, px, plev*2/3+randint(plev/2), SUMMON_DEMON, group, FALSE, pet, FALSE, (bool)(!pet)))
+ if (summon_specific((pet ? -1 : 0), py, px, plev*2/3+randint1(plev/2), SUMMON_DEMON, group, FALSE, pet, FALSE, (bool)(!pet)))
{
#ifdef JP
msg_print("ⲫ¤Î°½¤¬½¼Ëþ¤·¤¿¡£");
break;
}
case 16: /* Telepathy */
- (void)set_tim_esp(randint(30) + 25, FALSE);
+ (void)set_tim_esp(randint1(30) + 25, FALSE);
break;
case 17: /* Demoncloak */
{
- int dur=randint(20) + 20;
+ int dur=randint1(20) + 20;
set_oppose_fire(dur, FALSE);
set_oppose_cold(dur, FALSE);
}
case 18: /* Rain of Lava */
fire_ball(GF_FIRE, 0, (55 + plev)*2, 3);
- fire_ball_hide(GF_LAVA_FLOW, 0, 2+randint(2), 3);
+ fire_ball_hide(GF_LAVA_FLOW, 0, 2+randint1(2), 3);
break;
case 19: /* Plasma ball */
if (!get_aim_dir(&dir)) return FALSE;
fire_ball(GF_PLASMA, dir, plev*3/2 + 80, 2 + plev/40);
break;
case 20: /* Mimic demon */
- (void)set_mimic(10+plev/2 + randint(10+plev/2), MIMIC_DEMON, FALSE);
+ (void)set_mimic(10+plev/2 + randint1(10+plev/2), MIMIC_DEMON, FALSE);
break;
case 21: /* Nether Wave == Dispel Good */
- (void)dispel_monsters(randint(plev * 2));
- (void)dispel_good(randint(plev * 2));
+ (void)dispel_monsters(randint1(plev * 2));
+ (void)dispel_good(randint1(plev * 2));
break;
case 22: /* */
if (!get_aim_dir(&dir)) return FALSE;
fire_ball_hide(GF_HAND_DOOM, dir, plev * 2, 0);
break;
case 24: /* Heroism */
- (void)set_hero(randint(25) + 25, FALSE);
+ (void)set_hero(randint1(25) + 25, FALSE);
(void)hp_player(10);
(void)set_afraid(0);
break;
case 25: /* Tim resist time */
- (void)set_tim_res_time(randint(20)+20, FALSE);
+ (void)set_tim_res_time(randint1(20)+20, FALSE);
break;
case 26: /* Circle of Madness */
fire_ball(GF_CHAOS, 0, 50+plev, 3+plev/20);
fire_ball_hide(GF_BLOOD_CURSE, dir, 600, 0);
#ifdef JP
-take_hit(DAMAGE_USELIFE, 20 + randint(30), "·ì¤Î¼ö¤¤", -1);
+take_hit(DAMAGE_USELIFE, 20 + randint1(30), "·ì¤Î¼ö¤¤", -1);
#else
- take_hit(DAMAGE_USELIFE, 20 + randint(30), "Blood curse", -1);
+ take_hit(DAMAGE_USELIFE, 20 + randint1(30), "Blood curse", -1);
#endif
break;
}
case 31: /* Mimic Demon lord */
- (void)set_mimic(15 + randint(15), MIMIC_DEMON_LORD, FALSE);
+ (void)set_mimic(15 + randint1(15), MIMIC_DEMON_LORD, FALSE);
break;
default:
msg_format("You cast an unknown Daemon spell: %d.", spell);
chance = spell_chance(spell, use_realm - 1);
/* Failed spell */
- if (rand_int(100) < chance)
+ if (randint0(100) < chance)
{
if (flush_failure) flush();
if (realm == REALM_LIFE)
{
- if (randint(100) < chance)
+ if (randint1(100) < chance)
chg_virtue(V_FAITH, -1);
}
else if (realm == REALM_DEATH)
{
- if (randint(100) < chance)
+ if (randint1(100) < chance)
chg_virtue(V_UNLIFE, -1);
}
else if (realm == REALM_NATURE)
{
- if (randint(100) < chance)
+ if (randint1(100) < chance)
chg_virtue(V_NATURE, -1);
}
else if (realm == REALM_DAEMON)
{
- if (randint(100) < chance)
+ if (randint1(100) < chance)
chg_virtue(V_JUSTICE, 1);
}
- else if (randint(100) < chance)
+ else if (randint1(100) < chance)
{
chg_virtue(V_KNOWLEDGE, -1);
}
{
cast_trump_spell(spell, FALSE);
}
- else if ((o_ptr->tval == TV_CHAOS_BOOK) && (randint(100) < spell))
+ else if ((o_ptr->tval == TV_CHAOS_BOOK) && (randint1(100) < spell))
{
#ifdef JP
msg_print("¥«¥ª¥¹Åª¤Ê¸ú²Ì¤òȯÀ¸¤·¤¿¡ª");
wild_magic(spell);
}
- else if ((o_ptr->tval == TV_DEATH_BOOK) && (randint(100) < spell))
+ else if ((o_ptr->tval == TV_DEATH_BOOK) && (randint1(100) < spell))
{
if ((sval == 3) && one_in_(2))
{
lose_exp(spell * 250);
}
}
- else if ((o_ptr->tval == TV_MUSIC_BOOK) && (randint(200) < spell))
+ else if ((o_ptr->tval == TV_MUSIC_BOOK) && (randint1(200) < spell))
{
#ifdef JP
msg_print("¤¤¤ä¤Ê²»¤¬¶Á¤¤¤¿");
aggravate_monsters(0);
}
- if (randint(100) >= chance)
+ if (randint1(100) >= chance)
chg_virtue(V_CHANCE,-1);
}
/* Canceled spells cost neither a turn nor mana */
if (!cast) return;
- if (randint(100) < chance)
+ if (randint1(100) < chance)
chg_virtue(V_CHANCE,1);
/* A spell was cast */
}
if (realm == REALM_LIFE)
{
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, 1);
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_COMPASSION, 1);
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_VITALITY, 1);
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HONOUR, 1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, 1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_COMPASSION, 1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_VITALITY, 1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HONOUR, 1);
}
else if (realm == REALM_DEATH)
{
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_UNLIFE, 1);
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_JUSTICE, -1);
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, -1);
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_VITALITY, -1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_UNLIFE, 1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_JUSTICE, -1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, -1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_VITALITY, -1);
}
else if (realm == REALM_DAEMON)
{
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_JUSTICE, -1);
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, -1);
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HONOUR, -1);
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_TEMPERANCE, -1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_JUSTICE, -1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_FAITH, -1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HONOUR, -1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_TEMPERANCE, -1);
}
else if (realm == REALM_NATURE)
{
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_NATURE, 1);
- if (randint(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HARMONY, 1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_NATURE, 1);
+ if (randint1(100 + p_ptr->lev) < shouhimana) chg_virtue(V_HARMONY, 1);
}
if (mp_ptr->spell_xtra & MAGIC_GAIN_EXP)
{
/* Hack -- Bypass free action */
- (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops + 1));
+ (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
if (realm == REALM_LIFE)
chg_virtue(V_FAITH, -10);
chg_virtue(V_KNOWLEDGE, -10);
/* Damage CON (possibly permanently) */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
- bool perm = (rand_int(100) < 25);
+ bool perm = (randint0(100) < 25);
/* Message */
#ifdef JP
/* Reduce constitution */
- (void)dec_stat(A_CON, 15 + randint(10), perm);
+ (void)dec_stat(A_CON, 15 + randint1(10), perm);
}
}
else skill_exp[GINOU_RIDING]++;
}
}
- if (rand_int(dam/2 + level*2) < (skill_exp[GINOU_RIDING]/30+10))
+ if (randint0(dam/2 + level*2) < (skill_exp[GINOU_RIDING]/30+10))
{
if ((((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY)) && !p_ptr->riding_ryoute) || !one_in_(p_ptr->lev*(p_ptr->riding_ryoute ? 2 : 3)+30))
{
sn++;
/* Randomize choice */
- if (rand_int(sn) > 0) continue;
+ if (randint0(sn) > 0) continue;
/* Save the safe location */
sy = y; sx = x;
return FALSE;
}
- if (r_info[m_ptr->r_idx].level > randint((skill_exp[GINOU_RIDING]/50 + p_ptr->lev/2 +20)))
+ if (r_info[m_ptr->r_idx].level > randint1((skill_exp[GINOU_RIDING]/50 + p_ptr->lev/2 +20)))
{
#ifdef JP
msg_print("¤¦¤Þ¤¯¾è¤ì¤Ê¤«¤Ã¤¿¡£");
{
if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
{
- if (set_poisoned(p_ptr->poisoned + rand_int(10) + 10))
+ if (set_poisoned(p_ptr->poisoned + randint0(10) + 10))
{
ident = TRUE;
}
{
if (!p_ptr->resist_blind)
{
- if (set_blind(p_ptr->blind + rand_int(200) + 200))
+ if (set_blind(p_ptr->blind + randint0(200) + 200))
{
ident = TRUE;
}
{
if (!p_ptr->resist_fear)
{
- if (set_afraid(p_ptr->afraid + rand_int(10) + 10))
+ if (set_afraid(p_ptr->afraid + randint0(10) + 10))
{
ident = TRUE;
}
{
if (!p_ptr->resist_conf)
{
- if (set_confused(p_ptr->confused + rand_int(10) + 10))
+ if (set_confused(p_ptr->confused + randint0(10) + 10))
{
ident = TRUE;
}
{
if (!p_ptr->resist_chaos)
{
- if (set_image(p_ptr->image + rand_int(250) + 250))
+ if (set_image(p_ptr->image + randint0(250) + 250))
{
ident = TRUE;
}
{
if (!p_ptr->free_act)
{
- if (set_paralyzed(p_ptr->paralyzed + rand_int(10) + 10))
+ if (set_paralyzed(p_ptr->paralyzed + randint0(10) + 10))
{
ident = TRUE;
}
case SV_POTION_SLOWNESS:
{
- if (set_slow(randint(25) + 15, FALSE)) ident = TRUE;
+ if (set_slow(randint1(25) + 15, FALSE)) ident = TRUE;
break;
}
{
if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
{
- if (set_poisoned(p_ptr->poisoned + rand_int(15) + 10))
+ if (set_poisoned(p_ptr->poisoned + randint0(15) + 10))
{
ident = TRUE;
}
{
if (!p_ptr->resist_blind)
{
- if (set_blind(p_ptr->blind + rand_int(100) + 100))
+ if (set_blind(p_ptr->blind + randint0(100) + 100))
{
ident = TRUE;
}
else if (!p_ptr->resist_conf) p_ptr->special_attack |= ATTACK_SUIKEN;
if (!p_ptr->resist_conf)
{
- if (set_confused(rand_int(20) + 15))
+ if (set_confused(randint0(20) + 15))
{
ident = TRUE;
}
{
if (one_in_(2))
{
- if (set_image(p_ptr->image + rand_int(150) + 150))
+ if (set_image(p_ptr->image + randint0(150) + 150))
{
ident = TRUE;
}
/* Remove the monster restriction */
get_mon_num_prep(NULL, NULL);
}
- if (set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4))
+ if (set_paralyzed(p_ptr->paralyzed + randint0(4) + 4))
{
ident = TRUE;
}
case SV_POTION_INFRAVISION:
{
- if (set_tim_infra(p_ptr->tim_infra + 100 + randint(100), FALSE))
+ if (set_tim_infra(p_ptr->tim_infra + 100 + randint1(100), FALSE))
{
ident = TRUE;
}
case SV_POTION_DETECT_INVIS:
{
- if (set_tim_invis(p_ptr->tim_invis + 12 + randint(12), FALSE))
+ if (set_tim_invis(p_ptr->tim_invis + 12 + randint1(12), FALSE))
{
ident = TRUE;
}
{
if (!p_ptr->fast)
{
- if (set_fast(randint(25) + 15, FALSE)) ident = TRUE;
+ if (set_fast(randint1(25) + 15, FALSE)) ident = TRUE;
}
else
{
case SV_POTION_RESIST_HEAT:
{
- if (set_oppose_fire(p_ptr->oppose_fire + randint(10) + 10, FALSE))
+ if (set_oppose_fire(p_ptr->oppose_fire + randint1(10) + 10, FALSE))
{
ident = TRUE;
}
case SV_POTION_RESIST_COLD:
{
- if (set_oppose_cold(p_ptr->oppose_cold + randint(10) + 10, FALSE))
+ if (set_oppose_cold(p_ptr->oppose_cold + randint1(10) + 10, FALSE))
{
ident = TRUE;
}
case SV_POTION_HEROISM:
{
if (set_afraid(0)) ident = TRUE;
- if (set_hero(p_ptr->hero + randint(25) + 25, FALSE)) ident = TRUE;
+ if (set_hero(p_ptr->hero + randint1(25) + 25, FALSE)) ident = TRUE;
if (hp_player(10)) ident = TRUE;
break;
}
case SV_POTION_BESERK_STRENGTH:
{
if (set_afraid(0)) ident = TRUE;
- if (set_shero(p_ptr->shero + randint(25) + 25, FALSE)) ident = TRUE;
+ if (set_shero(p_ptr->shero + randint1(25) + 25, FALSE)) ident = TRUE;
if (hp_player(30)) ident = TRUE;
break;
}
case SV_POTION_RESISTANCE:
{
- (void)set_oppose_acid(p_ptr->oppose_acid + randint(20) + 20, FALSE);
- (void)set_oppose_elec(p_ptr->oppose_elec + randint(20) + 20, FALSE);
- (void)set_oppose_fire(p_ptr->oppose_fire + randint(20) + 20, FALSE);
- (void)set_oppose_cold(p_ptr->oppose_cold + randint(20) + 20, FALSE);
- (void)set_oppose_pois(p_ptr->oppose_pois + randint(20) + 20, FALSE);
+ (void)set_oppose_acid(p_ptr->oppose_acid + randint1(20) + 20, FALSE);
+ (void)set_oppose_elec(p_ptr->oppose_elec + randint1(20) + 20, FALSE);
+ (void)set_oppose_fire(p_ptr->oppose_fire + randint1(20) + 20, FALSE);
+ (void)set_oppose_cold(p_ptr->oppose_cold + randint1(20) + 20, FALSE);
+ (void)set_oppose_pois(p_ptr->oppose_pois + randint1(20) + 20, FALSE);
ident = TRUE;
break;
}
case SV_POTION_INVULNERABILITY:
{
- (void)set_invuln(p_ptr->invuln + randint(4) + 4, FALSE);
+ (void)set_invuln(p_ptr->invuln + randint1(4) + 4, FALSE);
ident = TRUE;
break;
}
case SV_POTION_NEO_TSUYOSHI:
{
(void)set_image(0);
- (void)set_tsuyoshi(p_ptr->tsuyoshi + randint(100) + 100, FALSE);
+ (void)set_tsuyoshi(p_ptr->tsuyoshi + randint1(100) + 100, FALSE);
ident = TRUE;
break;
}
(void)set_tsuyoshi(0, TRUE);
if (!p_ptr->resist_chaos)
{
- (void)set_image(50 + randint(50));
+ (void)set_image(50 + randint1(50));
}
ident = TRUE;
break;
{
if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
{
- (void)set_blind(p_ptr->blind + 3 + randint(5));
+ (void)set_blind(p_ptr->blind + 3 + randint1(5));
}
if (unlite_area(10, 3)) ident = TRUE;
break;
case SV_SCROLL_SUMMON_MONSTER:
{
- for (k = 0; k < randint(3); k++)
+ for (k = 0; k < randint1(3); k++)
{
if (summon_specific(0, py, px, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE))
{
case SV_SCROLL_SUMMON_UNDEAD:
{
- for (k = 0; k < randint(3); k++)
+ for (k = 0; k < randint1(3); k++)
{
if (summon_specific(0, py, px, dun_level, SUMMON_UNDEAD, TRUE, FALSE, FALSE, TRUE, TRUE))
{
case SV_SCROLL_STAR_ENCHANT_ARMOR:
{
- if (!enchant_spell(0, 0, randint(3) + 2)) used_up = FALSE;
+ if (!enchant_spell(0, 0, randint1(3) + 2)) used_up = FALSE;
ident = TRUE;
break;
}
case SV_SCROLL_STAR_ENCHANT_WEAPON:
{
- if (!enchant_spell(randint(3), randint(3), 0)) used_up = FALSE;
+ if (!enchant_spell(randint1(3), randint1(3), 0)) used_up = FALSE;
ident = TRUE;
break;
}
case SV_SCROLL_BLESSING:
{
- if (set_blessed(p_ptr->blessed + randint(12) + 6, FALSE)) ident = TRUE;
+ if (set_blessed(p_ptr->blessed + randint1(12) + 6, FALSE)) ident = TRUE;
break;
}
case SV_SCROLL_HOLY_CHANT:
{
- if (set_blessed(p_ptr->blessed + randint(24) + 12, FALSE)) ident = TRUE;
+ if (set_blessed(p_ptr->blessed + randint1(24) + 12, FALSE)) ident = TRUE;
break;
}
case SV_SCROLL_HOLY_PRAYER:
{
- if (set_blessed(p_ptr->blessed + randint(48) + 24, FALSE)) ident = TRUE;
+ if (set_blessed(p_ptr->blessed + randint1(48) + 24, FALSE)) ident = TRUE;
break;
}
case SV_SCROLL_PROTECTION_FROM_EVIL:
{
k = 3 * p_ptr->lev;
- if (set_protevil(p_ptr->protevil + randint(25) + k, FALSE)) ident = TRUE;
+ if (set_protevil(p_ptr->protevil + randint1(25) + k, FALSE)) ident = TRUE;
break;
}
case SV_SCROLL_STAR_DESTRUCTION:
{
- if (destroy_area(py, px, 13+rand_int(5), TRUE))
+ if (destroy_area(py, px, 13+randint0(5), TRUE))
ident = TRUE;
else
#ifdef JP
case SV_SCROLL_STAR_ACQUIREMENT:
{
- acquirement(py, px, randint(2) + 1, TRUE, FALSE);
+ acquirement(py, px, randint1(2) + 1, TRUE, FALSE);
ident = TRUE;
break;
}
/* Note: "Double" damage since it is centered on the player ... */
if (!(p_ptr->oppose_fire || p_ptr->resist_fire || p_ptr->immune_fire))
#ifdef JP
-take_hit(DAMAGE_NOESCAPE, 50+randint(50), "±ê¤Î´¬Êª", -1);
+take_hit(DAMAGE_NOESCAPE, 50+randint1(50), "±ê¤Î´¬Êª", -1);
#else
- take_hit(DAMAGE_NOESCAPE, 50 + randint(50), "a Scroll of Fire", -1);
+ take_hit(DAMAGE_NOESCAPE, 50 + randint1(50), "a Scroll of Fire", -1);
#endif
ident = TRUE;
fire_ball(GF_ICE, 0, 777, 4);
if (!(p_ptr->oppose_cold || p_ptr->resist_cold || p_ptr->immune_cold))
#ifdef JP
-take_hit(DAMAGE_NOESCAPE, 100+randint(100), "ɹ¤Î´¬Êª", -1);
+take_hit(DAMAGE_NOESCAPE, 100+randint1(100), "ɹ¤Î´¬Êª", -1);
#else
- take_hit(DAMAGE_NOESCAPE, 100 + randint(100), "a Scroll of Ice", -1);
+ take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "a Scroll of Ice", -1);
#endif
ident = TRUE;
fire_ball(GF_CHAOS, 0, 1000, 4);
if (!p_ptr->resist_chaos)
#ifdef JP
-take_hit(DAMAGE_NOESCAPE, 111+randint(111), "¥í¥°¥ë¥¹¤Î´¬Êª", -1);
+take_hit(DAMAGE_NOESCAPE, 111+randint1(111), "¥í¥°¥ë¥¹¤Î´¬Êª", -1);
#else
- take_hit(DAMAGE_NOESCAPE, 111 + randint(111), "a Scroll of Logrus", -1);
+ take_hit(DAMAGE_NOESCAPE, 111 + randint1(111), "a Scroll of Logrus", -1);
#endif
ident = TRUE;
{
errr err = 0;
- switch (randint(20))
+ switch (randint1(20))
{
case 1:
#ifdef JP
{
if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
{
- if (set_blind(p_ptr->blind + 3 + randint(5))) ident = TRUE;
+ if (set_blind(p_ptr->blind + 3 + randint1(5))) ident = TRUE;
}
if (unlite_area(10, 3)) ident = TRUE;
break;
case SV_STAFF_SLOWNESS:
{
- if (set_slow(p_ptr->slow + randint(30) + 15, FALSE)) ident = TRUE;
+ if (set_slow(p_ptr->slow + randint1(30) + 15, FALSE)) ident = TRUE;
break;
}
case SV_STAFF_SUMMONING:
{
- for (k = 0; k < randint(4); k++)
+ for (k = 0; k < randint1(4); k++)
{
if (summon_specific(0, py, px, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE))
{
case SV_STAFF_SPEED:
{
- if (set_fast(randint(30) + 15, FALSE)) ident = TRUE;
+ if (set_fast(randint1(30) + 15, FALSE)) ident = TRUE;
break;
}
{
if (dispel_evil(150)) ident = TRUE;
k = 3 * p_ptr->lev;
- if (set_protevil((magic ? 0 : p_ptr->protevil) + randint(25) + k, FALSE)) ident = TRUE;
+ if (set_protevil((magic ? 0 : p_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
if (set_poisoned(0)) ident = TRUE;
if (set_afraid(0)) ident = TRUE;
if (hp_player(50)) ident = TRUE;
case SV_STAFF_DESTRUCTION:
{
- if (destroy_area(py, px, 13+rand_int(5), TRUE))
+ if (destroy_area(py, px, 13+randint0(5), TRUE))
ident = TRUE;
break;
msg_print("Mighty magics rend your enemies!");
#endif
project(0, 5, py, px,
- (randint(200) + 300) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID | PROJECT_NO_REF, -1);
+ (randint1(200) + 300) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID | PROJECT_NO_REF, -1);
if ((p_ptr->pclass != CLASS_MAGE) && (p_ptr->pclass != CLASS_HIGH_MAGE) && (p_ptr->pclass != CLASS_SORCERER) && (p_ptr->pclass != CLASS_MAGIC_EATER) && (p_ptr->pclass != CLASS_BLUE_MAGE))
{
#ifdef JP
}
/* Roll for usage */
- if ((chance < USE_DEVICE) || (randint(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
+ if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
{
if (flush_failure) flush();
#ifdef JP
if (sval == SV_WAND_WONDER)
{
int vir = virtue_number(V_CHANCE);
- sval = rand_int(SV_WAND_WONDER);
+ sval = randint0(SV_WAND_WONDER);
if (vir)
{
if (p_ptr->virtues[vir - 1] > 0)
{
- while (randint(300) < p_ptr->virtues[vir - 1]) sval++;
- if (sval > SV_WAND_COLD_BALL) sval = rand_int(4) + SV_WAND_ACID_BALL;
+ while (randint1(300) < p_ptr->virtues[vir - 1]) sval++;
+ if (sval > SV_WAND_COLD_BALL) sval = randint0(4) + SV_WAND_ACID_BALL;
}
else
{
- while (randint(300) < (0-p_ptr->virtues[vir - 1])) sval--;
- if (sval < SV_WAND_HEAL_MONSTER) sval = rand_int(3) + SV_WAND_HEAL_MONSTER;
+ while (randint1(300) < (0-p_ptr->virtues[vir - 1])) sval--;
+ if (sval < SV_WAND_HEAL_MONSTER) sval = randint0(3) + SV_WAND_HEAL_MONSTER;
}
}
if (sval < SV_WAND_TELEPORT_AWAY)
case SV_WAND_DRAGON_BREATH:
{
- switch (randint(5))
+ switch (randint1(5))
{
case 1:
{
case SV_WAND_DISINTEGRATE:
{
- fire_ball(GF_DISINTEGRATE, dir, 200 + randint(p_ptr->lev * 2), 2);
+ fire_ball(GF_DISINTEGRATE, dir, 200 + randint1(p_ptr->lev * 2), 2);
ident = TRUE;
break;
}
}
/* Roll for usage */
- if ((chance < USE_DEVICE) || (randint(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
+ if ((chance < USE_DEVICE) || (randint1(chance) < USE_DEVICE) || (p_ptr->pclass == CLASS_BERSERKER))
{
if (flush_failure) flush();
#ifdef JP
case SV_ROD_SPEED:
{
- if (set_fast(randint(30) + 15, FALSE)) ident = TRUE;
+ if (set_fast(randint1(30) + 15, FALSE)) ident = TRUE;
break;
}
if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
else if (chance > fail)
{
- if (rand_int(chance*2) < fail) success = FALSE;
+ if (randint0(chance*2) < fail) success = FALSE;
else success = TRUE;
}
else
{
- if (rand_int(fail*2) < chance) success = TRUE;
+ if (randint0(fail*2) < chance) success = TRUE;
else success = FALSE;
}
void ring_of_power(int dir)
{
/* Pick a random effect */
- switch (randint(10))
+ switch (randint1(10))
{
case 1:
case 2:
if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
else if (chance > fail)
{
- if (rand_int(chance*2) < fail) success = FALSE;
+ if (randint0(chance*2) < fail) success = FALSE;
else success = TRUE;
}
else
{
- if (rand_int(fail*2) < chance) success = TRUE;
+ if (randint0(fail*2) < chance) success = TRUE;
else success = FALSE;
}
#endif
lite_area(damroll(2, 15), 3);
- o_ptr->timeout = rand_int(10) + 10;
+ o_ptr->timeout = randint0(10) + 10;
break;
}
map_area(DETECT_RAD_MAP);
lite_area(damroll(2, 15), 3);
- o_ptr->timeout = rand_int(50) + 50;
+ o_ptr->timeout = randint0(50) + 50;
break;
}
(void)word_of_recall();
}
- o_ptr->timeout = rand_int(20) + 20;
+ o_ptr->timeout = randint0(20) + 20;
break;
}
#endif
k = 3 * p_ptr->lev;
- (void)set_protevil(randint(25) + k, FALSE);
- o_ptr->timeout = rand_int(225) + 225;
+ (void)set_protevil(randint1(25) + k, FALSE);
+ o_ptr->timeout = randint0(225) + 225;
break;
}
#endif
dispel_evil(p_ptr->lev * 5);
- o_ptr->timeout = rand_int(200) + 200;
+ o_ptr->timeout = randint0(200) + 200;
break;
}
#endif
dispel_evil(p_ptr->lev * 5);
- o_ptr->timeout = rand_int(200) + 200;
+ o_ptr->timeout = randint0(200) + 200;
break;
}
if (!get_aim_dir(&dir)) return;
if (drain_life(dir, 100))
- o_ptr->timeout = rand_int(100) + 100;
+ o_ptr->timeout = randint0(100) + 100;
break;
}
msg_print("The ring glows brightly...");
#endif
- (void)set_fast(randint(75) + 75, FALSE);
- o_ptr->timeout = rand_int(150) + 150;
+ (void)set_fast(randint1(75) + 75, FALSE);
+ o_ptr->timeout = randint0(150) + 150;
break;
}
if (!get_aim_dir(&dir)) return;
fire_ball(GF_FIRE, dir, 300, 3);
- o_ptr->timeout = rand_int(225) + 225;
+ o_ptr->timeout = randint0(225) + 225;
break;
}
if (!get_aim_dir(&dir)) return;
fire_ball(GF_COLD, dir, 400, 3);
- o_ptr->timeout = rand_int(325) + 325;
+ o_ptr->timeout = randint0(325) + 325;
break;
}
if (!get_aim_dir(&dir)) return;
fire_ball(GF_ELEC, dir, 500, 3);
- o_ptr->timeout = rand_int(425) + 425;
+ o_ptr->timeout = randint0(425) + 425;
break;
}
if (!get_aim_dir(&dir)) return;
ring_of_power(dir);
- o_ptr->timeout = rand_int(450) + 450;
+ o_ptr->timeout = randint0(450) + 450;
break;
}
#endif
(void)set_afraid(0);
- (void)set_hero(randint(50) + 50, FALSE);
+ (void)set_hero(randint1(50) + 50, FALSE);
(void)hp_player(10);
- (void)set_blessed(randint(50) + 50, FALSE);
- (void)set_oppose_acid(randint(50) + 50, FALSE);
- (void)set_oppose_elec(randint(50) + 50, FALSE);
- (void)set_oppose_fire(randint(50) + 50, FALSE);
- (void)set_oppose_cold(randint(50) + 50, FALSE);
- (void)set_oppose_pois(randint(50) + 50, FALSE);
+ (void)set_blessed(randint1(50) + 50, FALSE);
+ (void)set_oppose_acid(randint1(50) + 50, FALSE);
+ (void)set_oppose_elec(randint1(50) + 50, FALSE);
+ (void)set_oppose_fire(randint1(50) + 50, FALSE);
+ (void)set_oppose_cold(randint1(50) + 50, FALSE);
+ (void)set_oppose_pois(randint1(50) + 50, FALSE);
o_ptr->timeout = 400;
break;
}
(void)set_stun(0);
(void)set_confused(0);
(void)set_blind(0);
- (void)set_hero(randint(25) + 25, FALSE);
+ (void)set_hero(randint1(25) + 25, FALSE);
(void)hp_player(777);
o_ptr->timeout = 300;
break;
#endif
detect_all(DETECT_RAD_DEFAULT);
- o_ptr->timeout = rand_int(55) + 55;
+ o_ptr->timeout = randint0(55) + 55;
break;
}
msg_format("Your cloak glows many colours...");
#endif
- (void)set_oppose_acid(randint(20) + 20, FALSE);
- (void)set_oppose_elec(randint(20) + 20, FALSE);
- (void)set_oppose_fire(randint(20) + 20, FALSE);
- (void)set_oppose_cold(randint(20) + 20, FALSE);
- (void)set_oppose_pois(randint(20) + 20, FALSE);
+ (void)set_oppose_acid(randint1(20) + 20, FALSE);
+ (void)set_oppose_elec(randint1(20) + 20, FALSE);
+ (void)set_oppose_fire(randint1(20) + 20, FALSE);
+ (void)set_oppose_cold(randint1(20) + 20, FALSE);
+ (void)set_oppose_pois(randint1(20) + 20, FALSE);
o_ptr->timeout = 111;
break;
}
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_FIRE, dir, damroll(9, 8));
- o_ptr->timeout = rand_int(8) + 8;
+ o_ptr->timeout = randint0(8) + 8;
break;
}
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_COLD, dir, damroll(6, 8));
- o_ptr->timeout = rand_int(7) + 7;
+ o_ptr->timeout = randint0(7) + 7;
break;
}
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_ELEC, dir, damroll(4, 8));
- o_ptr->timeout = rand_int(5) + 5;
+ o_ptr->timeout = randint0(5) + 5;
break;
}
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_ACID, dir, damroll(5, 8));
- o_ptr->timeout = rand_int(6) + 6;
+ o_ptr->timeout = randint0(6) + 6;
break;
}
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_ARROW, dir, 150);
- o_ptr->timeout = rand_int(90) + 90;
+ o_ptr->timeout = randint0(90) + 90;
break;
}
msg_print("Your boots glow bright green...");
#endif
- (void)set_fast(randint(20) + 20, FALSE);
+ (void)set_fast(randint1(20) + 20, FALSE);
o_ptr->timeout = 200;
break;
}
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_FIRE, dir, damroll(9, 8));
- o_ptr->timeout = rand_int(8) + 8;
+ o_ptr->timeout = randint0(8) + 8;
break;
}
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_COLD, dir, damroll(6, 8));
- o_ptr->timeout = rand_int(7) + 7;
+ o_ptr->timeout = randint0(7) + 7;
break;
}
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_ELEC, dir, damroll(4, 8));
- o_ptr->timeout = rand_int(5) + 5;
+ o_ptr->timeout = randint0(5) + 5;
break;
}
if (!get_aim_dir(&dir)) return;
fire_ball(GF_POIS, dir, 12, 3);
- o_ptr->timeout = rand_int(4) + 4;
+ o_ptr->timeout = randint0(4) + 4;
break;
}
if (!get_aim_dir(&dir)) return;
fire_ball(GF_COLD, dir, 48, 2);
- o_ptr->timeout = rand_int(5) + 5;
+ o_ptr->timeout = randint0(5) + 5;
break;
}
case ART_KUSANAGI:
case ART_ANGUIREL:
{
- switch (randint(13))
+ switch (randint1(13))
{
case 1: case 2: case 3: case 4: case 5:
teleport_player(10);
#endif
(void)summon_specific(-1, py, px, dun_level, SUMMON_DAWN, TRUE, TRUE, TRUE, FALSE, FALSE);
- o_ptr->timeout = 500 + randint(500);
+ o_ptr->timeout = 500 + randint1(500);
break;
}
hp_player(damroll(4, 8));
(void)set_cut((p_ptr->cut / 2) - 50);
- o_ptr->timeout = rand_int(3) + 3;
+ o_ptr->timeout = randint0(3) + 3;
break;
}
msg_print("Your mace glows bright green...");
#endif
- (void)set_fast(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(100) + 100;
+ (void)set_fast(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(100) + 100;
break;
}
/* Hack -- Bypass free action */
(void)set_paralyzed(p_ptr->paralyzed +
- randint(5 * oops + 1));
+ randint1(5 * oops + 1));
/* Confusing. */
(void)set_confused(p_ptr->confused +
- randint(5 * oops + 1));
+ randint1(5 * oops + 1));
}
/* Redraw mana */
/* Confusing. */
if (one_in_(5)) (void)set_confused(p_ptr->confused +
- randint(10));
+ randint1(10));
/* Exercise a little care... */
if (one_in_(20))
{
msg_print("You wind a mighty blast; your enemies tremble!");
(void)turn_monsters((3 * p_ptr->lev / 2) + 10);
- o_ptr->timeout = rand_int(40) + 40;
+ o_ptr->timeout = randint0(40) + 40;
break;
}
case ART_FARAMIR:
msg_print("You exterminate small life.");
#endif
(void)dispel_monsters(4);
- o_ptr->timeout = rand_int(55) + 55;
+ o_ptr->timeout = randint0(55) + 55;
break;
}
#else
msg_print("A shrill wailing sound surrounds you.");
#endif
- (void)set_protevil(randint(25) + p_ptr->lev, FALSE);
- o_ptr->timeout = rand_int(200) + 200;
+ (void)set_protevil(randint1(25) + p_ptr->lev, FALSE);
+ o_ptr->timeout = randint0(200) + 200;
break;
}
#endif
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_MANA, dir, 120);
- o_ptr->timeout = rand_int(120) + 120;
+ o_ptr->timeout = randint0(120) + 120;
break;
}
case ART_HURIN:
{
- (void)set_fast(randint(50) + 50, FALSE);
+ (void)set_fast(randint1(50) + 50, FALSE);
hp_player(10);
set_afraid(0);
- set_hero(randint(50) + 50, FALSE);
- o_ptr->timeout = rand_int(200) + 100;
+ set_hero(randint1(50) + 50, FALSE);
+ o_ptr->timeout = randint0(200) + 100;
break;
}
case ART_GIL_GALAD:
if (!get_aim_dir(&dir)) return;
fire_ball(GF_MANA, dir, 400, 4);
- o_ptr->timeout = rand_int(250) + 250;
+ o_ptr->timeout = randint0(250) + 250;
break;
}
case ART_TAIKOBO:
#endif
fetch(dir, 500, TRUE);
- o_ptr->timeout = rand_int(25) + 25;
+ o_ptr->timeout = randint0(25) + 25;
break;
}
case ART_ARRYU:
}
- o_ptr->timeout = 300 + randint(150);
+ o_ptr->timeout = 300 + randint1(150);
break;
}
if (!get_aim_dir(&dir)) return;
fire_ball(GF_LITE, dir, 200, 3);
- o_ptr->timeout = rand_int(200) + 200;
+ o_ptr->timeout = randint0(200) + 200;
break;
}
msg_print("Nothing happen.");
#endif
}
- o_ptr->timeout = rand_int(150) + 150;
+ o_ptr->timeout = randint0(150) + 150;
break;
}
case ART_MATOI:
case ART_AEGISFANG:
{
- set_hero(randint(25)+25, FALSE);
+ set_hero(randint1(25)+25, FALSE);
hp_player(10);
- o_ptr->timeout = rand_int(30) + 30;
+ o_ptr->timeout = randint0(30) + 30;
break;
}
#endif
o_ptr->art_flags1 = a_info[ART_BLOOD].flags1;
o_ptr->art_flags2 = a_info[ART_BLOOD].flags2;
- dummy = randint(2)+randint(2);
+ dummy = randint1(2)+randint1(2);
for (i = 0; i < dummy; i++)
- o_ptr->art_flags1 |= (TR1_CHAOTIC << rand_int(18));
- dummy = randint(2);
+ o_ptr->art_flags1 |= (TR1_CHAOTIC << randint0(18));
+ dummy = randint1(2);
for (i = 0; i < dummy; i++)
- random_resistance(o_ptr, FALSE, randint(34) + 4);
+ random_resistance(o_ptr, FALSE, randint1(34) + 4);
dummy = 2;
for (i = 0; i < dummy; i++)
{
- int tmp = rand_int(11);
+ int tmp = randint0(11);
if (tmp < 6) o_ptr->art_flags1 |= (TR1_STR << tmp);
else o_ptr->art_flags1 |= (TR1_STEALTH << (tmp - 6));
}
#else
msg_print("You stamp. (as if you are in a ring.)");
#endif
- (void)set_hero(randint(20) + 20, FALSE);
+ (void)set_hero(randint1(20) + 20, FALSE);
dispel_evil(p_ptr->lev * 3);
- o_ptr->timeout = 100 + randint(100);
+ o_ptr->timeout = 100 + randint1(100);
break;
}
case ART_MOOK:
#else
msg_print("Your cloak grows white.");
#endif
- (void)set_oppose_cold(randint(20) + 20, FALSE);
- o_ptr->timeout = 40 + randint(40);
+ (void)set_oppose_cold(randint1(20) + 20, FALSE);
+ o_ptr->timeout = 40 + randint1(40);
break;
}
case ART_VIOLET:
#endif
k = 3 * p_ptr->lev;
- (void)set_protevil(randint(25) + k, FALSE);
- o_ptr->timeout = rand_int(225) + 225;
+ (void)set_protevil(randint1(25) + k, FALSE);
+ o_ptr->timeout = randint0(225) + 225;
break;
}
case ART_JIZO:
}
- o_ptr->timeout = 300 + randint(150);
+ o_ptr->timeout = 300 + randint1(150);
break;
}
#endif
dispel_evil(p_ptr->lev * 5);
- o_ptr->timeout = rand_int(100) + 100;
+ o_ptr->timeout = randint0(100) + 100;
break;
}
#endif
if (!get_aim_dir(&dir)) return;
fire_ball(GF_DARK, dir, 250, 4);
- o_ptr->timeout = rand_int(150) + 150;
+ o_ptr->timeout = randint0(150) + 150;
break;
}
}
else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_ACID))
{
- (void)set_oppose_acid(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(50) + 50;
+ (void)set_oppose_acid(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(50) + 50;
return;
}
else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_ELEC))
{
- (void)set_oppose_elec(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(50) + 50;
+ (void)set_oppose_elec(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(50) + 50;
return;
}
else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_FIRE))
{
- (void)set_oppose_fire(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(50) + 50;
+ (void)set_oppose_fire(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(50) + 50;
return;
}
else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_TMP_RES_COLD))
{
- (void)set_oppose_cold(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(50) + 50;
+ (void)set_oppose_cold(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(50) + 50;
return;
}
else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3 == ESSENCE_EARTHQUAKE))
{
earthquake(py, px, 5);
- o_ptr->timeout = 100 + randint(100);
+ o_ptr->timeout = 100 + randint1(100);
/* Window stuff */
p_ptr->window |= (PW_INVEN | PW_EQUIP);
else if (o_ptr->name2 == EGO_TRUMP)
{
teleport_player(100);
- o_ptr->timeout = 50 + randint(50);
+ o_ptr->timeout = 50 + randint1(50);
/* Window stuff */
p_ptr->window |= (PW_INVEN | PW_EQUIP);
return;
}
lite_area(damroll(2, 15), 3);
- o_ptr->timeout = rand_int(10) + 10;
+ o_ptr->timeout = randint0(10) + 10;
/* Window stuff */
p_ptr->window |= (PW_INVEN | PW_EQUIP);
else if (o_ptr->name2 == EGO_EARTHQUAKES)
{
earthquake(py, px, 5);
- o_ptr->timeout = 100 + randint(100);
+ o_ptr->timeout = 100 + randint1(100);
/* Window stuff */
p_ptr->window |= (PW_INVEN | PW_EQUIP);
else if (o_ptr->name2 == EGO_JUMP)
{
teleport_player(10);
- o_ptr->timeout = 10 + randint(10);
+ o_ptr->timeout = 10 + randint1(10);
/* Window stuff */
p_ptr->window |= (PW_INVEN | PW_EQUIP);
#endif
fire_ball(GF_ELEC, dir, 100, -2);
- o_ptr->timeout = rand_int(150) + 150;
+ o_ptr->timeout = randint0(150) + 150;
break;
}
#endif
fire_ball(GF_COLD, dir, 110, -2);
- o_ptr->timeout = rand_int(150) + 150;
+ o_ptr->timeout = randint0(150) + 150;
break;
}
#endif
fire_ball(GF_ACID, dir, 130, -2);
- o_ptr->timeout = rand_int(150) + 150;
+ o_ptr->timeout = randint0(150) + 150;
break;
}
#endif
fire_ball(GF_POIS, dir, 150, -2);
- o_ptr->timeout = rand_int(180) + 180;
+ o_ptr->timeout = randint0(180) + 180;
break;
}
#endif
fire_ball(GF_FIRE, dir, 200, -2);
- o_ptr->timeout = rand_int(200) + 200;
+ o_ptr->timeout = randint0(200) + 200;
break;
}
case SV_DRAGON_MULTIHUED:
{
- chance = rand_int(5);
+ chance = randint0(5);
#ifdef JP
msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£",
((chance == 1) ? "°ðºÊ" :
((chance == 3) ? GF_ACID :
((chance == 4) ? GF_POIS : GF_FIRE)))),
dir, 250, -2);
- o_ptr->timeout = rand_int(200) + 200;
+ o_ptr->timeout = randint0(200) + 200;
break;
}
#endif
fire_ball(GF_CONFUSION, dir, 120, -2);
- o_ptr->timeout = rand_int(180) + 180;
+ o_ptr->timeout = randint0(180) + 180;
break;
}
#endif
fire_ball(GF_SOUND, dir, 130, -2);
- o_ptr->timeout = rand_int(180) + 180;
+ o_ptr->timeout = randint0(180) + 180;
break;
}
case SV_DRAGON_CHAOS:
{
- chance = rand_int(2);
+ chance = randint0(2);
#ifdef JP
msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£",
((chance == 1 ? "¥«¥ª¥¹" : "Îô²½")));
fire_ball((chance == 1 ? GF_CHAOS : GF_DISENCHANT),
dir, 220, -2);
- o_ptr->timeout = rand_int(200) + 200;
+ o_ptr->timeout = randint0(200) + 200;
break;
}
case SV_DRAGON_LAW:
{
- chance = rand_int(2);
+ chance = randint0(2);
#ifdef JP
msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£",
((chance == 1 ? "¹ì²»" : "ÇËÊÒ")));
fire_ball((chance == 1 ? GF_SOUND : GF_SHARDS),
dir, 230, -2);
- o_ptr->timeout = rand_int(200) + 200;
+ o_ptr->timeout = randint0(200) + 200;
break;
}
case SV_DRAGON_BALANCE:
{
- chance = rand_int(4);
+ chance = randint0(4);
#ifdef JP
msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿",
((chance == 1) ? "¥«¥ª¥¹" :
((chance == 2) ? GF_DISENCHANT :
((chance == 3) ? GF_SOUND : GF_SHARDS))),
dir, 250, -2);
- o_ptr->timeout = rand_int(200) + 200;
+ o_ptr->timeout = randint0(200) + 200;
break;
}
case SV_DRAGON_SHINING:
{
- chance = rand_int(2);
+ chance = randint0(2);
#ifdef JP
msg_format("¤¢¤Ê¤¿¤Ï%s¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿¡£",
((chance == 0 ? "Á®¸÷" : "°Å¹õ")));
#endif
fire_ball((chance == 0 ? GF_LITE : GF_DARK), dir, 200, -2);
- o_ptr->timeout = rand_int(200) + 200;
+ o_ptr->timeout = randint0(200) + 200;
break;
}
#endif
fire_ball(GF_MISSILE, dir, 300, -3);
- o_ptr->timeout = rand_int(200) + 200;
+ o_ptr->timeout = randint0(200) + 200;
break;
}
}
{
case EGO_RING_HERO:
(void)set_afraid(0);
- (void)set_hero(randint(25) + 25, FALSE);
+ (void)set_hero(randint1(25) + 25, FALSE);
(void)hp_player(10);
- o_ptr->timeout = randint(100)+100;
+ o_ptr->timeout = randint1(100)+100;
break;
case EGO_RING_MAGIC_MIS:
if (!get_aim_dir(&dir)) return;
case EGO_RING_FIRE_BOLT:
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_FIRE, dir, damroll(9, 8));
- o_ptr->timeout = rand_int(8) + 8;
+ o_ptr->timeout = randint0(8) + 8;
break;
case EGO_RING_COLD_BOLT:
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_COLD, dir, damroll(6, 8));
- o_ptr->timeout = rand_int(7) + 7;
+ o_ptr->timeout = randint0(7) + 7;
break;
case EGO_RING_ELEC_BOLT:
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_ELEC, dir, damroll(4, 8));
- o_ptr->timeout = rand_int(5) + 5;
+ o_ptr->timeout = randint0(5) + 5;
break;
case EGO_RING_ACID_BOLT:
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_FIRE, dir, damroll(5, 8));
- o_ptr->timeout = rand_int(6) + 6;
+ o_ptr->timeout = randint0(6) + 6;
break;
case EGO_RING_MANA_BOLT:
if (!get_aim_dir(&dir)) return;
fire_bolt(GF_MANA, dir, 120);
- o_ptr->timeout = rand_int(120)+120;
+ o_ptr->timeout = randint0(120)+120;
break;
case EGO_RING_FIRE_BALL:
if (!get_aim_dir(&dir)) return;
fire_ball(GF_FIRE, dir, 100, 2);
- o_ptr->timeout = rand_int(80) + 80;
+ o_ptr->timeout = randint0(80) + 80;
break;
case EGO_RING_COLD_BALL:
if (!get_aim_dir(&dir)) return;
fire_ball(GF_COLD, dir, 100, 2);
- o_ptr->timeout = rand_int(80) + 80;
+ o_ptr->timeout = randint0(80) + 80;
break;
case EGO_RING_ELEC_BALL:
if (!get_aim_dir(&dir)) return;
fire_ball(GF_ELEC, dir, 100, 2);
- o_ptr->timeout = rand_int(80) + 80;
+ o_ptr->timeout = randint0(80) + 80;
break;
case EGO_RING_ACID_BALL:
if (!get_aim_dir(&dir)) return;
fire_ball(GF_ACID, dir, 100, 2);
- o_ptr->timeout = rand_int(80) + 80;
+ o_ptr->timeout = randint0(80) + 80;
break;
case EGO_RING_MANA_BALL:
if (!get_aim_dir(&dir)) return;
fire_ball(GF_FIRE, dir, 200, -2);
if (o_ptr->sval == SV_RING_FLAMES)
{
- (void)set_oppose_fire(randint(20) + 20, FALSE);
+ (void)set_oppose_fire(randint1(20) + 20, FALSE);
o_ptr->timeout = 200;
}
else o_ptr->timeout = 250;
fire_ball(GF_COLD, dir, 200, -2);
if (o_ptr->sval == SV_RING_ICE)
{
- (void)set_oppose_cold(randint(20) + 20, FALSE);
+ (void)set_oppose_cold(randint1(20) + 20, FALSE);
o_ptr->timeout = 200;
}
else o_ptr->timeout = 250;
o_ptr->timeout = 150;
break;
case EGO_RING_D_SPEED:
- (void)set_fast(randint(30) + 15, FALSE);
+ (void)set_fast(randint1(30) + 15, FALSE);
o_ptr->timeout = 100;
break;
case EGO_RING_BERSERKER:
- (void)set_shero(randint(25) + 25, FALSE);
- o_ptr->timeout = rand_int(75)+75;
+ (void)set_shero(randint1(25) + 25, FALSE);
+ o_ptr->timeout = randint0(75)+75;
break;
case EGO_RING_TELE_AWAY:
if (!get_aim_dir(&dir)) return;
break;
case EGO_RING_TRUE:
{
- int v = randint(25)+25;
+ int v = randint1(25)+25;
(void)set_afraid(0);
(void)set_hero(v, FALSE);
(void)hp_player(10);
case SV_RING_ACID:
{
fire_ball(GF_ACID, dir, 100, 2);
- (void)set_oppose_acid(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(50) + 50;
+ (void)set_oppose_acid(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(50) + 50;
break;
}
case SV_RING_ICE:
{
fire_ball(GF_COLD, dir, 100, 2);
- (void)set_oppose_cold(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(50) + 50;
+ (void)set_oppose_cold(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(50) + 50;
break;
}
case SV_RING_FLAMES:
{
fire_ball(GF_FIRE, dir, 100, 2);
- (void)set_oppose_fire(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(50) + 50;
+ (void)set_oppose_fire(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(50) + 50;
break;
}
case SV_RING_ELEC:
{
fire_ball(GF_ELEC, dir, 100, 2);
- (void)set_oppose_elec(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(50) + 50;
+ (void)set_oppose_elec(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(50) + 50;
break;
}
}
break;
case EGO_AMU_JUMP:
teleport_player(10);
- o_ptr->timeout = rand_int(10) + 10;
+ o_ptr->timeout = randint0(10) + 10;
break;
case EGO_AMU_TELEPORT:
teleport_player(100);
- o_ptr->timeout = rand_int(50) + 50;
+ o_ptr->timeout = randint0(50) + 50;
break;
case EGO_AMU_D_DOOR:
(void)dimension_door();
o_ptr->timeout = 200;
break;
case EGO_AMU_RES_FIRE_:
- (void)set_oppose_fire(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(50) + 50;
+ (void)set_oppose_fire(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(50) + 50;
break;
case EGO_AMU_RES_COLD_:
- (void)set_oppose_cold(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(50) + 50;
+ (void)set_oppose_cold(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(50) + 50;
break;
case EGO_AMU_RES_ELEC_:
- (void)set_oppose_elec(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(50) + 50;
+ (void)set_oppose_elec(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(50) + 50;
break;
case EGO_AMU_RES_ACID_:
- (void)set_oppose_acid(randint(20) + 20, FALSE);
- o_ptr->timeout = rand_int(50) + 50;
+ (void)set_oppose_acid(randint1(20) + 20, FALSE);
+ o_ptr->timeout = randint0(50) + 50;
break;
case EGO_AMU_DETECTION:
detect_all(DETECT_RAD_DEFAULT);
- o_ptr->timeout = rand_int(55)+55;
+ o_ptr->timeout = randint0(55)+55;
break;
}
}
/* Free the "who" array */
C_KILL(who, max_m_idx, u16b);
}
- o_ptr->timeout = 100+randint(100);
+ o_ptr->timeout = 100+randint1(100);
return;
}
else if (o_ptr->tval == TV_CAPTURE)
if(p_ptr->dec_mana) chance--;
if (p_ptr->heavy_spell) chance += 5;
- if (rand_int(100) < chance)
+ if (randint0(100) < chance)
{
if (flush_failure) flush();
#endif
sound(SOUND_FAIL);
- if (randint(100) >= chance)
+ if (randint1(100) >= chance)
chg_virtue(V_CHANCE,-1);
energy_use = 100;
staff_effect(sval, &use_charge, TRUE);
if (!use_charge) return;
}
- if (randint(100) < chance)
+ if (randint1(100) < chance)
chg_virtue(V_CHANCE,1);
}
energy_use = 100;
if (!feel) return;
/* Bad luck */
- if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !rand_int(13))
+ if ((p_ptr->muta3 & MUT3_BAD_LUCK) && !randint0(13))
{
switch (feel)
{
}
case FEEL_CURSED:
{
- feel = rand_int(3) ? FEEL_GOOD : FEEL_AVERAGE;
+ feel = randint0(3) ? FEEL_GOOD : FEEL_AVERAGE;
break;
}
case FEEL_AVERAGE:
{
- feel = rand_int(2) ? FEEL_CURSED : FEEL_GOOD;
+ feel = randint0(2) ? FEEL_CURSED : FEEL_GOOD;
break;
}
case FEEL_GOOD:
{
- feel = rand_int(3) ? FEEL_CURSED : FEEL_AVERAGE;
+ feel = randint0(3) ? FEEL_CURSED : FEEL_AVERAGE;
break;
}
case FEEL_EXCELLENT:
case CLASS_CAVALRY:
{
/* Good sensing */
- if (0 != rand_int(9000L / (plev * plev + 40))) return;
+ if (0 != randint0(9000L / (plev * plev + 40))) return;
/* Heavy sensing */
heavy = TRUE;
case CLASS_SMITH:
{
/* Good sensing */
- if (0 != rand_int(6000L / (plev * plev + 50))) return;
+ if (0 != randint0(6000L / (plev * plev + 50))) return;
/* Heavy sensing */
heavy = TRUE;
case CLASS_MAGIC_EATER:
{
/* Very bad (light) sensing */
- if (0 != rand_int(240000L / (plev + 5))) return;
+ if (0 != randint0(240000L / (plev + 5))) return;
/* Done */
break;
case CLASS_BARD:
{
/* Good (light) sensing */
- if (0 != rand_int(10000L / (plev * plev + 40))) return;
+ if (0 != randint0(10000L / (plev * plev + 40))) return;
/* Done */
break;
case CLASS_NINJA:
{
/* Okay sensing */
- if (0 != rand_int(20000L / (plev * plev + 40))) return;
+ if (0 != randint0(20000L / (plev * plev + 40))) return;
/* Heavy sensing */
heavy = TRUE;
case CLASS_RANGER:
{
/* Bad sensing */
- if (0 != rand_int(95000L / (plev * plev + 40))) return;
+ if (0 != randint0(95000L / (plev * plev + 40))) return;
/* Changed! */
heavy = TRUE;
case CLASS_PALADIN:
{
/* Bad sensing */
- if (0 != rand_int(77777L / (plev * plev + 40))) return;
+ if (0 != randint0(77777L / (plev * plev + 40))) return;
/* Heavy sensing */
heavy = TRUE;
case CLASS_RED_MAGE:
{
/* Bad sensing */
- if (0 != rand_int(75000L / (plev * plev + 40))) return;
+ if (0 != randint0(75000L / (plev * plev + 40))) return;
/* Done */
break;
case CLASS_MIRROR_MASTER:
{
/* Bad sensing */
- if (0 != rand_int(55000L / (plev * plev + 40))) return;
+ if (0 != randint0(55000L / (plev * plev + 40))) return;
/* Done */
break;
case CLASS_CHAOS_WARRIOR:
{
/* Bad sensing */
- if (0 != rand_int(80000L / (plev * plev + 40))) return;
+ if (0 != randint0(80000L / (plev * plev + 40))) return;
/* Changed! */
heavy = TRUE;
case CLASS_FORCETRAINER:
{
/* Okay sensing */
- if (0 != rand_int(20000L / (plev * plev + 40))) return;
+ if (0 != randint0(20000L / (plev * plev + 40))) return;
/* Done */
break;
case CLASS_TOURIST:
{
/* Good sensing */
- if (0 != rand_int(20000L / ((plev+50)*(plev+50)))) return;
+ if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
/* Heavy sensing */
heavy = TRUE;
case CLASS_BLUE_MAGE:
{
/* Bad sensing */
- if (0 != rand_int(55000L / (plev * plev + 40))) return;
+ if (0 != randint0(55000L / (plev * plev + 40))) return;
/* Done */
break;
case CLASS_BEASTMASTER:
{
/* Bad sensing */
- if (0 != rand_int(65000L / (plev * plev + 40))) return;
+ if (0 != randint0(65000L / (plev * plev + 40))) return;
/* Done */
break;
if (!okay) continue;
/* Occasional failure on inventory items */
- if ((i < INVEN_RARM) && (0 != rand_int(5))) continue;
+ if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
/* Good luck */
- if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !rand_int(13))
+ if ((p_ptr->muta3 & MUT3_GOOD_LUCK) && !randint0(13))
{
heavy = TRUE;
}
case CLASS_NINJA:
{
/* Very bad (light) sensing */
- if (0 != rand_int(240000L / (plev + 5))) return;
+ if (0 != randint0(240000L / (plev + 5))) return;
/* Done */
break;
case CLASS_MONK:
{
/* Bad sensing */
- if (0 != rand_int(95000L / (plev * plev + 40))) return;
+ if (0 != randint0(95000L / (plev * plev + 40))) return;
/* Done */
break;
case CLASS_MINDCRAFTER:
{
/* Good sensing */
- if (0 != rand_int(20000L / (plev * plev + 40))) return;
+ if (0 != randint0(20000L / (plev * plev + 40))) return;
/* Done */
break;
case CLASS_BLUE_MAGE:
{
/* Good sensing */
- if (0 != rand_int(9000L / (plev * plev + 40))) return;
+ if (0 != randint0(9000L / (plev * plev + 40))) return;
/* Done */
break;
case CLASS_TOURIST:
{
/* Good sensing */
- if (0 != rand_int(20000L / ((plev+50)*(plev+50)))) return;
+ if (0 != randint0(20000L / ((plev+50)*(plev+50)))) return;
/* Done */
break;
if (!okay) continue;
/* Occasional failure on inventory items */
- if ((i < INVEN_RARM) && (0 != rand_int(5))) continue;
+ if ((i < INVEN_RARM) && (0 != randint0(5))) continue;
sense_inventory_aux(i, TRUE);
}
#endif
- to_ruin = randint(45) + 35;
+ to_ruin = randint1(45) + 35;
while (to_ruin--)
{
project_hack(GF_TURN_ALL, p_ptr->lev);
break;
case MUSIC_PSI:
- project_hack(GF_PSI, randint(p_ptr->lev * 3 / 2));
+ project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
break;
case MUSIC_ID:
project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
break;
case MUSIC_DISPEL:
- dispel_monsters(randint(p_ptr->lev * 3));
- dispel_evil(randint(p_ptr->lev * 3));
+ dispel_monsters(randint1(p_ptr->lev * 3));
+ dispel_evil(randint1(p_ptr->lev * 3));
break;
case MUSIC_SARUMAN:
slow_monsters();
stasis_monsters(p_ptr->lev * 4);
break;
case MUSIC_SHERO:
- dispel_monsters(randint(p_ptr->lev * 3));
+ dispel_monsters(randint1(p_ptr->lev * 3));
break;
case MUSIC_H_LIFE:
hp_player(damroll(15,10));
if ((cave[py][px].feat == FEAT_SHAL_LAVA) &&
!p_ptr->invuln && !p_ptr->immune_fire && !p_ptr->ffall)
{
- int damage = 3000 + rand_int(2000);
+ int damage = 3000 + randint0(2000);
if (prace_is_(RACE_ENT)) damage += damage/3;
if (p_ptr->resist_fire) damage = damage / 3;
if (p_ptr->oppose_fire) damage = damage / 3;
- damage = damage / 100 + (rand_int(100) < (damage % 100));
+ damage = damage / 100 + (randint0(100) < (damage % 100));
if (damage)
{
else if ((cave[py][px].feat == FEAT_DEEP_LAVA) &&
!p_ptr->invuln && !p_ptr->immune_fire)
{
- int damage = 6000 + rand_int(4000);
+ int damage = 6000 + randint0(4000);
cptr message;
cptr hit_from;
}
- damage = damage / 100 + (rand_int(100) < (damage % 100));
+ damage = damage / 100 + (randint0(100) < (damage % 100));
if (damage)
{
/* Take damage */
/* Take damage */
#ifdef JP
msg_print("Å®¤ì¤Æ¤¤¤ë¡ª");
-take_hit(DAMAGE_NOESCAPE, randint(p_ptr->lev), "Å®¤ì", -1);
+take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "Å®¤ì", -1);
#else
msg_print("You are drowning!");
- take_hit(DAMAGE_NOESCAPE, randint(p_ptr->lev), "drowning", -1);
+ take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->lev), "drowning", -1);
#endif
cave_no_regen = TRUE;
if ((p_ptr->food < PY_FOOD_FAINT) && !p_ptr->inside_battle)
{
/* Faint occasionally */
- if (!p_ptr->paralyzed && (rand_int(100) < 10))
+ if (!p_ptr->paralyzed && (randint0(100) < 10))
{
/* Message */
#ifdef JP
disturb(1, 0);
/* Hack -- faint (bypass free action) */
- (void)set_paralyzed(p_ptr->paralyzed + 1 + rand_int(5));
+ (void)set_paralyzed(p_ptr->paralyzed + 1 + randint0(5));
}
}
}
msg_print("You feel a fit of rage coming over you!");
#endif
- (void)set_shero(10 + randint(p_ptr->lev), FALSE);
+ (void)set_shero(10 + randint1(p_ptr->lev), FALSE);
}
- if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint(3000) == 13))
+ if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
{
if (!(p_ptr->resist_fear || p_ptr->hero || p_ptr->shero))
{
msg_print("It's so dark... so scary!");
#endif
- set_afraid(p_ptr->afraid + 13 + randint(26));
+ set_afraid(p_ptr->afraid + 13 + randint1(26));
}
}
- if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint(5000) == 88))
+ if ((p_ptr->muta2 & MUT2_RTELEPORT) && (randint1(5000) == 88))
{
if (!p_ptr->resist_nexus && !(p_ptr->muta1 & MUT1_VTELEPORT) &&
!p_ptr->anti_tele)
}
}
- if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint(6400) == 321))
+ if ((p_ptr->muta2 & MUT2_ALCOHOL) && (randint1(6400) == 321))
{
if (!p_ptr->resist_conf && !p_ptr->resist_chaos)
{
if (!p_ptr->resist_conf)
{
- (void)set_confused(p_ptr->confused + rand_int(20) + 15);
+ (void)set_confused(p_ptr->confused + randint0(20) + 15);
}
if (!p_ptr->resist_chaos)
msg_print("Thishcischs GooDSChtuff!");
#endif
- (void)set_image(p_ptr->image + rand_int(150) + 150);
+ (void)set_image(p_ptr->image + randint0(150) + 150);
}
}
}
}
- if ((p_ptr->muta2 & MUT2_HALLU) && (randint(6400) == 42))
+ if ((p_ptr->muta2 & MUT2_HALLU) && (randint1(6400) == 42))
{
if (!p_ptr->resist_chaos)
{
disturb(0, 0);
p_ptr->redraw |= PR_EXTRA;
- (void)set_image(p_ptr->image + rand_int(50) + 20);
+ (void)set_image(p_ptr->image + randint0(50) + 20);
}
}
- if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint(3000) == 13))
+ if ((p_ptr->muta2 & MUT2_FLATULENT) && (randint1(3000) == 13))
{
disturb(0, 0);
}
if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
- !p_ptr->anti_magic && (randint(6666) == 666))
+ !p_ptr->anti_magic && (randint1(6666) == 666))
{
bool pet = one_in_(6);
bool not_pet = (bool)(!pet);
}
else
{
- set_slow(randint(30) + 10, FALSE);
+ set_slow(randint1(30) + 10, FALSE);
}
}
else
}
else
{
- set_fast(randint(30) + 10, FALSE);
+ set_fast(randint1(30) + 10, FALSE);
}
}
msg_print(NULL);
msg_print("You see one of the shopkeepers running for the hills!");
#endif
- store_shuffle(rand_int(MAX_STORES));
+ store_shuffle(randint0(MAX_STORES));
}
msg_print(NULL);
}
#endif
msg_print(NULL);
- set_wraith_form(randint(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
+ set_wraith_form(randint1(p_ptr->lev / 2) + (p_ptr->lev / 2), FALSE);
}
if ((p_ptr->muta2 & MUT2_POLY_WOUND) && one_in_(3000))
{
}
if ((p_ptr->muta2 & MUT2_WASTING) && one_in_(3000))
{
- int which_stat = rand_int(6);
+ int which_stat = randint0(6);
int sustained = FALSE;
switch (which_stat)
#endif
msg_print(NULL);
- (void)dec_stat(which_stat, randint(6) + 6, one_in_(3));
+ (void)dec_stat(which_stat, randint1(6) + 6, one_in_(3));
}
}
if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
#endif
msg_print(NULL);
- (void)set_invuln(randint(8) + 8, FALSE);
+ (void)set_invuln(randint1(8) + 8, FALSE);
}
if ((p_ptr->muta2 & MUT2_SP_TO_HP) && one_in_(2000))
{
disturb(0, 0);
#ifdef JP
msg_print("¤¬¤â¤Ä¤ì¤Æž¤ó¤À¡ª");
-take_hit(DAMAGE_NOESCAPE, randint(p_ptr->wt / 6), "žÅÝ", -1);
+take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "žÅÝ", -1);
#else
msg_print("You trip over your own feet!");
- take_hit(DAMAGE_NOESCAPE, randint(p_ptr->wt / 6), "tripping", -1);
+ take_hit(DAMAGE_NOESCAPE, randint1(p_ptr->wt / 6), "tripping", -1);
#endif
/* Handle experience draining */
if (p_ptr->exp_drain)
{
- if (rand_int(100) < 25)
+ if (randint0(100) < 25)
{
p_ptr->exp -= (p_ptr->lev+1)/2;
if (p_ptr->exp < 0) p_ptr->exp = 0;
* Hack: Uncursed teleporting items (e.g. Trump Weapons)
* can actually be useful!
*/
- if ((f3 & TR3_TELEPORT) && (rand_int(100) < 1))
+ if ((f3 & TR3_TELEPORT) && (randint0(100) < 1))
{
if ((o_ptr->ident & IDENT_CURSED) && !p_ptr->anti_tele)
{
if (dun_level < 1) dun_level = 1;
/* Nightmare mode makes recall more dangerous */
- if (ironman_nightmare && !rand_int(666) && (dungeon_type == DUNGEON_ANGBAND))
+ if (ironman_nightmare && !randint0(666) && (dungeon_type == DUNGEON_ANGBAND))
{
if (dun_level < 50)
{
}
/* Give the player some energy */
- else if((rand_int(60) < ((p_ptr->pspeed > 199) ? 49 : ((p_ptr->pspeed < 0) ? 1 : extract_energy[p_ptr->pspeed]))) && !(load && p_ptr->energy >= 100))
+ else if((randint0(60) < ((p_ptr->pspeed > 199) ? 49 : ((p_ptr->pspeed < 0) ? 1 : extract_energy[p_ptr->pspeed]))) && !(load && p_ptr->energy >= 100))
p_ptr->energy += gain_energy();
/* No turn yet */
int d = 1;
/* Make a "saving throw" against stun */
- if (rand_int(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
+ if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
{
/* Recover fully */
d = m_ptr->stunned;
int d = 1;
/* Make a "saving throw" against stun */
- if (rand_int(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
+ if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
{
/* Recover fully */
d = m_ptr->confused;
int d = 1;
/* Make a "saving throw" against stun */
- if (rand_int(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
+ if (randint0(r_info[m_ptr->r_idx].level) < skill_exp[GINOU_RIDING])
{
/* Recover fully */
d = m_ptr->monfear;
write_level = TRUE;
/* Hack -- seed for flavors */
- seed_flavor = rand_int(0x10000000);
+ seed_flavor = randint0(0x10000000);
/* Hack -- seed for town layout */
- seed_town = rand_int(0x10000000);
+ seed_town = randint0(0x10000000);
/* Roll up a new character */
player_birth();
break;
}
- if (randint(1000) < v || one_in_(16))
+ if (randint1(1000) < v || one_in_(16))
{
#ifdef JP
msg_print("³ä¤ì¤ë¤è¤¦¤ÊƬÄˤ¬¤¹¤ë¡£");
/* Notice */
notice = TRUE;
- if (randint(1000) < v || one_in_(16))
+ if (randint1(1000) < v || one_in_(16))
{
if (!p_ptr->sustain_chr)
{
/* Gain one (sometimes two) points */
if (value < 18)
{
- gain = ((rand_int(100) < 75) ? 1 : 2);
+ gain = ((randint0(100) < 75) ? 1 : 2);
value += gain;
}
if (gain < 1) gain = 1;
/* Apply the bonus */
- value += randint(gain) + gain / 2;
+ value += randint1(gain) + gain / 2;
/* Maximal value */
if (value > (p_ptr->stat_max_max[stat]-1)) value = p_ptr->stat_max_max[stat]-1;
if (loss < 1) loss = 1;
/* Randomize the loss */
- loss = ((randint(loss) + loss) * amount) / 100;
+ loss = ((randint1(loss) + loss) * amount) / 100;
/* Maximal loss */
if (loss < amount/2) loss = amount/2;
/* and one-half of the stat bonus times the percentage, with a */
/* minimum damage of half the percentage. -CWS */
loss = (((max-18) / 2 + 1) / 2 + 1);
- loss = ((randint(loss) + loss) * amount) / 100;
+ loss = ((randint1(loss) + loss) * amount) / 100;
if (loss < amount/2) loss = amount/2;
/* Lose some points */
}
/* Sustain */
- if (sust && (!ironman_nightmare || rand_int(13)))
+ if (sust && (!ironman_nightmare || randint0(13)))
{
/* Message */
#ifdef JP
}
/* Attempt to reduce the stat */
- if (dec_stat(stat, 10, (ironman_nightmare && !rand_int(13))))
+ if (dec_stat(stat, 10, (ironman_nightmare && !randint0(13))))
{
/* Message */
#ifdef JP
chg_virtue(V_CHANCE, 1);
- if ((power > rand_int(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
+ if ((power > randint0(20)) && one_in_(3) && (p_ptr->prace != RACE_ANDROID))
{
char effect_msg[80] = "";
int new_race, expfact, goalexpfact, h_percent;
/* Some form of racial polymorph... */
power -= 10;
- if ((power > rand_int(5)) && one_in_(4))
+ if ((power > randint0(5)) && one_in_(4))
{
/* sex change */
power -= 2;
}
}
- if ((power > rand_int(30)) && one_in_(5))
+ if ((power > randint0(30)) && one_in_(5))
{
int tmp = 0;
{
if (one_in_(2))
{
- (void)dec_stat(tmp, randint(6) + 6, one_in_(3));
+ (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
power -= 1;
}
tmp++;
}
/* Deformities are discriminated against! */
- (void)dec_stat(A_CHR, randint(6), TRUE);
+ (void)dec_stat(A_CHR, randint1(6), TRUE);
if (effect_msg[0])
{
}
}
- while ((power > rand_int(20)) && one_in_(10))
+ while ((power > randint0(20)) && one_in_(10))
{
/* Polymorph into a less mutated form */
power -= 10;
if (power < 0)
goalexpfact = 100;
else
- goalexpfact = 100 + 3 * rand_int(power);
+ goalexpfact = 100 + 3 * randint0(power);
do
{
- new_race = rand_int(MAX_RACES);
+ new_race = randint0(MAX_RACES);
expfact = race_info[new_race].r_exp;
}
while (((new_race == p_ptr->prace) && (expfact > goalexpfact)) || (new_race == RACE_ANDROID));
lite_spot(py, px);
}
- if ((power > rand_int(30)) && one_in_(6))
+ if ((power > randint0(30)) && one_in_(6))
{
int tmp = 0;
while (tmp < 6)
{
- (void)dec_stat(tmp, randint(6) + 6, one_in_(3));
+ (void)dec_stat(tmp, randint1(6) + 6, one_in_(3));
tmp++;
}
if (one_in_(6))
{
#ifdef JP
msg_print("¸½ºß»Ñ¤ÇÀ¸¤¤Æ¤¤¤¯¤Î¤Ïº¤Æñ¤Ê¤è¤¦¤À¡ª");
-take_hit(DAMAGE_LOSELIFE, damroll(randint(10), p_ptr->lev), "Ã×̿Ū¤ÊÆÍÁ³ÊÑ°Û", -1);
+take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), "Ã×̿Ū¤ÊÆÍÁ³ÊÑ°Û", -1);
#else
msg_print("You find living difficult in your present form!");
- take_hit(DAMAGE_LOSELIFE, damroll(randint(10), p_ptr->lev), "a lethal mutation", -1);
+ take_hit(DAMAGE_LOSELIFE, damroll(randint1(10), p_ptr->lev), "a lethal mutation", -1);
#endif
power -= 10;
}
}
- if ((power > rand_int(20)) && one_in_(4))
+ if ((power > randint0(20)) && one_in_(4))
{
power -= 10;
do_cmd_rerate(FALSE);
}
- while ((power > rand_int(15)) && one_in_(3))
+ while ((power > randint0(15)) && one_in_(3))
{
power -= 7;
(void)gain_random_mutation(0);
}
- if (power > rand_int(5))
+ if (power > randint0(5))
{
power -= 5;
do_poly_wounds();
/* ºù»¶¤ë */
for (i = 0; i < 40; i++)
- Term_putstr(rand_int(w / 2) * 2, rand_int(h), 2, TERM_VIOLET, "¦Ô");
+ Term_putstr(randint0(w / 2) * 2, randint0(h), 2, TERM_VIOLET, "¦Ô");
str = death_message;
if (strncmp(str, "¡Ö", 2) == 0) str += 2;
choice = inkey();
if ((choice == 'a') || (choice == 'A'))
- set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint(p_ptr->lev/2));
+ set_ele_attack(ATTACK_FIRE, p_ptr->lev/2 + randint1(p_ptr->lev/2));
else if (((choice == 'b') || (choice == 'B')) && (num >= 2))
- set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint(p_ptr->lev/2));
+ set_ele_attack(ATTACK_COLD, p_ptr->lev/2 + randint1(p_ptr->lev/2));
else if (((choice == 'c') || (choice == 'C')) && (num >= 3))
- set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint(p_ptr->lev/2));
+ set_ele_attack(ATTACK_POIS, p_ptr->lev/2 + randint1(p_ptr->lev/2));
else if (((choice == 'd') || (choice == 'D')) && (num >= 4))
- set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint(p_ptr->lev/2));
+ set_ele_attack(ATTACK_ACID, p_ptr->lev/2 + randint1(p_ptr->lev/2));
else if (((choice == 'e') || (choice == 'E')) && (num >= 5))
- set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint(p_ptr->lev/2));
+ set_ele_attack(ATTACK_ELEC, p_ptr->lev/2 + randint1(p_ptr->lev/2));
else
{
#ifdef JP
if (numentries > 0)
{
/* Grab an appropriate line number */
- line = rand_int(numentries);
+ line = randint0(numentries);
/* Get the random line */
for (counter = 0; counter <= line; counter++)
strcat(out_string, Syllable);
strcat(out_string, "¡Ù");
#else
- int testcounter = randint(3) + 1;
+ int testcounter = randint1(3) + 1;
strcpy(out_string, "'");
- if (randint(3) == 2)
+ if (randint1(3) == 2)
{
while (testcounter--)
- strcat(out_string, syllables[rand_int(MAX_SYLLABLES)]);
+ strcat(out_string, syllables[randint0(MAX_SYLLABLES)]);
}
else
{
char Syllable[80];
- testcounter = randint(2) + 1;
+ testcounter = randint1(2) + 1;
while (testcounter--)
{
(void)get_rnd_line("elvish.txt", 0, Syllable);
/* Rings have "ring colors" */
for (i = 0; i < MAX_ROCKS; i++)
{
- j = rand_int(MAX_ROCKS);
+ j = randint0(MAX_ROCKS);
temp_adj = ring_adj[i];
ring_adj[i] = ring_adj[j];
ring_adj[j] = temp_adj;
/* Amulets have "amulet colors" */
for (i = 0; i < MAX_AMULETS; i++)
{
- j = rand_int(MAX_AMULETS);
+ j = randint0(MAX_AMULETS);
temp_adj = amulet_adj[i];
amulet_adj[i] = amulet_adj[j];
amulet_adj[j] = temp_adj;
/* Staffs */
for (i = 0; i < MAX_WOODS; i++)
{
- j = rand_int(MAX_WOODS);
+ j = randint0(MAX_WOODS);
temp_adj = staff_adj[i];
staff_adj[i] = staff_adj[j];
staff_adj[j] = temp_adj;
/* Wands */
for (i = 0; i < MAX_METALS; i++)
{
- j = rand_int(MAX_METALS);
+ j = randint0(MAX_METALS);
temp_adj = wand_adj[i];
wand_adj[i] = wand_adj[j];
wand_adj[j] = temp_adj;
/* Rods */
for (i = 0; i < MAX_METALS; i++)
{
- j = rand_int(MAX_METALS);
+ j = randint0(MAX_METALS);
temp_adj = rod_adj[i];
rod_adj[i] = rod_adj[j];
rod_adj[j] = temp_adj;
/* Foods (Mushrooms) */
for (i = 0; i < MAX_SHROOM; i++)
{
- j = rand_int(MAX_SHROOM);
+ j = randint0(MAX_SHROOM);
temp_adj = food_adj[i];
food_adj[i] = food_adj[j];
food_adj[j] = temp_adj;
/* Potions */
for (i = 4; i < MAX_COLORS; i++)
{
- j = rand_int(MAX_COLORS - 4) + 4;
+ j = randint0(MAX_COLORS - 4) + 4;
temp_adj = potion_adj[i];
potion_adj[i] = potion_adj[j];
potion_adj[j] = temp_adj;
tmp[0] = '\0';
/* Choose one or two syllables */
- s = ((rand_int(100) < 30) ? 1 : 2);
+ s = ((randint0(100) < 30) ? 1 : 2);
/* Add a one or two syllable word */
for (q = 0; q < s; q++)
{
/* Add the syllable */
- strcat(tmp, syllables[rand_int(MAX_SYLLABLES)]);
+ strcat(tmp, syllables[randint0(MAX_SYLLABLES)]);
}
/* Stop before getting too long */
if (ironman_downward || !dun_level) return TRUE;
if (dun_level > d_info[dungeon_type].mindepth)
- more_num = (randint(num+1))/2;
+ more_num = (randint1(num+1))/2;
}
else if (feat == FEAT_MORE)
{
if (dun_level >= d_info[dungeon_type].maxdepth) return TRUE;
if ((dun_level < d_info[dungeon_type].maxdepth-1) && !quest_number(dun_level+1))
- more_num = (randint(num)+1)/2;
+ more_num = (randint1(num)+1)/2;
}
/* Place "num" stairs */
for (j = 0; !flag && j <= 3000; j++)
{
/* Pick a random grid */
- y = randint(cur_hgt-2);
- x = randint(cur_wid-2);
+ y = randint1(cur_hgt-2);
+ x = randint1(cur_wid-2);
/* Access the grid */
c_ptr = &cave[y][x];
dummy++;
/* Location */
- y = rand_int(cur_hgt);
- x = rand_int(cur_wid);
+ y = randint0(cur_hgt);
+ x = randint0(cur_wid);
c_ptr = &cave[y][x];
if (cave[y][x].info & (CAVE_ROOM)) return;
/* Occasional door (if allowed) */
- if ((rand_int(100) < dun_tun_jct) && possible_doorway(y, x) && !(d_info[dungeon_type].flags1 & DF1_NO_DOORS))
+ if ((randint0(100) < dun_tun_jct) && possible_doorway(y, x) && !(d_info[dungeon_type].flags1 & DF1_NO_DOORS))
{
/* Place a door */
place_random_door(y, x);
destroyed = TRUE;
/* extra rubble around the place looks cool */
- build_lake(3+rand_int(2));
+ build_lake(3+randint0(2));
}
/* Make a lake some of the time */
if (d_info[dungeon_type].flags1 & DF1_LAKE_LAVA)
{
/* Lake of Lava */
- if ((dun_level > 80) && (rand_int(count) < 2)) laketype = 1;
+ if ((dun_level > 80) && (randint0(count) < 2)) laketype = 1;
count -= 2;
/* Lake of Lava2 */
if ((d_info[dungeon_type].flags1 & DF1_LAKE_WATER) && !laketype)
{
/* Lake of Water */
- if ((dun_level > 50) && rand_int(count) < 2) laketype = 2;
+ if ((dun_level > 50) && randint0(count) < 2) laketype = 2;
count -= 2;
/* Lake of Water2 */
if ((d_info[dungeon_type].flags1 & DF1_LAKE_RUBBLE) && !laketype)
{
/* Lake of rubble */
- if ((dun_level > 35) && (rand_int(count) < 2)) laketype = 3;
+ if ((dun_level > 35) && (randint0(count) < 2)) laketype = 3;
count -= 2;
/* Lake of rubble2 */
if ((dun_level > DUN_CAVERN) && !empty_level &&
(d_info[dungeon_type].flags1 & DF1_CAVERN) &&
- (laketype == 0) && !destroyed && (randint(1000) < dun_level))
+ (laketype == 0) && !destroyed && (randint1(1000) < dun_level))
{
cavern = TRUE;
bool force_rooms = (ironman_rooms && !((d_info[dungeon_type].flags1 & DF1_BEGINNER) || (d_info[dungeon_type].flags1 & DF1_CHAMELEON)));
/* Pick a block for the room */
- y = rand_int(dun->row_rooms);
- x = rand_int(dun->col_rooms);
+ y = randint0(dun->row_rooms);
+ x = randint0(dun->col_rooms);
/* Align dungeon rooms */
if (d_info[dungeon_type].flags1 & DF1_NO_CAVE)
}
/* Attempt an "unusual" room */
- if (force_rooms || (rand_int(DUN_UNUSUAL) < dun_level))
+ if (force_rooms || (randint0(DUN_UNUSUAL) < dun_level))
{
/* Roll for room type */
while(1)
{
- k = (force_rooms ? 0 : rand_int(100));
+ k = (force_rooms ? 0 : randint0(100));
if (force_rooms) break;
if ((d_info[dungeon_type].flags1 & DF1_NO_VAULT) && (k < 14)) continue;
break;
}
/* Attempt a very unusual room */
- if (force_rooms || (rand_int(DUN_UNUSUAL) < dun_level))
+ if (force_rooms || (randint0(DUN_UNUSUAL) < dun_level))
{
#ifdef FORCE_V_IDX
if (room_build(y, x, 8)) continue;
}
/* The deeper you are, the more cavelike the rooms are */
- k = randint(100);
+ k = randint1(100);
/* No caves when a cavern exists: they look bad */
if (((k < dun_level) || (d_info[dungeon_type].flags1 & DF1_CAVE)) && (!cavern) && (!empty_level) && (laketype == 0) && !(d_info[dungeon_type].flags1 & DF1_NO_CAVE))
{
while (one_in_(DUN_MOS_DEN))
{
- place_trees(randint(cur_wid - 2), randint(cur_hgt - 2));
+ place_trees(randint1(cur_wid - 2), randint1(cur_hgt - 2));
}
}
if (destroyed) destroy_level();
/* Hack -- Add some rivers */
- if (one_in_(3) && (randint(dun_level) > 5) && terrain_streams)
+ if (one_in_(3) && (randint1(dun_level) > 5) && terrain_streams)
{
/* Choose water or lava */
- if ((randint(MAX_DEPTH * 2) - 1 > dun_level) && (d_info[dungeon_type].flags1 & DF1_WATER_RIVER))
+ if ((randint1(MAX_DEPTH * 2) - 1 > dun_level) && (d_info[dungeon_type].flags1 & DF1_WATER_RIVER))
{
feat1 = FEAT_DEEP_WATER;
feat2 = FEAT_SHAL_WATER;
/* Hack -- Scramble the room order */
for (i = 0; i < dun->cent_n; i++)
{
- int pick1 = rand_int(dun->cent_n);
- int pick2 = rand_int(dun->cent_n);
+ int pick1 = randint0(dun->cent_n);
+ int pick2 = randint0(dun->cent_n);
y1 = dun->cent[pick1].y;
x1 = dun->cent[pick1].x;
dun->cent[pick1].y = dun->cent[pick2].y;
dun->wall_n = 0;
/* Connect the room to the previous room */
- if (randint(dun_level) > d_info[dungeon_type].tunnel_percent)
+ if (randint1(dun_level) > d_info[dungeon_type].tunnel_percent)
{
/* make cave-like tunnel */
build_tunnel2(dun->cent[i].x, dun->cent[i].y, x, y, 2, 2);
place_floor_grid(c_ptr);
/* Occasional doorway */
- if ((rand_int(100) < dun_tun_pen) && !(d_info[dungeon_type].flags1 & DF1_NO_DOORS))
+ if ((randint0(100) < dun_tun_pen) && !(d_info[dungeon_type].flags1 & DF1_NO_DOORS))
{
/* Place a random door */
place_random_door(y, x);
/* Find an empty grid */
while (TRUE)
{
- y = rand_int(cur_hgt);
- x = rand_int(cur_wid);
+ y = randint0(cur_hgt);
+ x = randint0(cur_wid);
/* Access the grid */
c_ptr = &cave[y][x];
}
}
- i += randint(8);
+ i += randint1(8);
/* Put some monsters in the dungeon */
for (i = i + k; i > 0; i--)
}
/* Place some traps in the dungeon */
- alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_TRAP, randint(k));
+ alloc_object(ALLOC_SET_BOTH, ALLOC_TYP_TRAP, randint1(k));
/* Put some rubble in corridors */
- alloc_object(ALLOC_SET_CORR, ALLOC_TYP_RUBBLE, randint(k));
+ alloc_object(ALLOC_SET_CORR, ALLOC_TYP_RUBBLE, randint1(k));
/* Put some objects in rooms */
alloc_object(ALLOC_SET_ROOM, ALLOC_TYP_OBJECT, randnor(DUN_AMT_ROOM, 3));
while(try)
{
/* Get a random spot */
- oy = randint(cur_hgt - 4) + 2;
- ox = randint(cur_wid - 4) + 2;
+ oy = randint1(cur_hgt - 4) + 2;
+ ox = randint1(cur_wid - 4) + 2;
/* Is it a good spot ? */
if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[d_info[dungeon_type].final_guardian]))
}
}
- if ((empty_level && (!one_in_(DARK_EMPTY) || (randint(100) > dun_level))) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
+ if ((empty_level && (!one_in_(DARK_EMPTY) || (randint1(100) > dun_level))) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
{
/* Lite the cave */
for (y = 0; y < cur_hgt; y++)
{
do
{
- level_height = randint(MAX_HGT/SCREEN_HGT);
- level_width = randint(MAX_WID/SCREEN_WID);
+ level_height = randint1(MAX_HGT/SCREEN_HGT);
+ level_width = randint1(MAX_WID/SCREEN_WID);
}
while ((level_height == MAX_HGT/SCREEN_HGT) &&
(level_width == MAX_WID/SCREEN_WID));
if (down_stairs && up_stairs)
{
/* Choose a staircase randomly */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
up_stairs = FALSE;
else
down_stairs = FALSE;
}
/* Choose an object */
- tmp = rand_int(1000);
+ tmp = randint0(1000);
/* Open doors (300/1000) */
if (tmp < 300)
}
/* Choose an object */
- tmp = rand_int(400);
+ tmp = randint0(400);
/* Closed doors (300/400) */
if (tmp < 300)
else if (tmp < 399)
{
/* Create locked door */
- cave_set_feat(y, x, FEAT_DOOR_HEAD + randint(7));
+ cave_set_feat(y, x, FEAT_DOOR_HEAD + randint1(7));
}
/* Stuck doors (1/400) */
else
{
/* Create jammed door */
- cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x08 + rand_int(8));
+ cave_set_feat(y, x, FEAT_DOOR_HEAD + 0x08 + randint0(8));
}
}
if (!is_floor_grid(c_ptr) || c_ptr->o_idx) continue;
/* Place an item */
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
{
place_object(j, k, FALSE, FALSE);
}
/* Never move diagonally */
if (*rdir && *cdir)
{
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
*rdir = 0;
else
*cdir = 0;
void rand_dir(int *rdir, int *cdir)
{
/* Pick a random direction */
- int i = rand_int(4);
+ int i = randint0(4);
/* Extract the dy/dx components */
*rdir = ddy_ddd[i];
if (main_loop_count++ > 2000) break;
/* Allow bends in the tunnel */
- if (rand_int(100) < dun_tun_chg)
+ if (randint0(100) < dun_tun_chg)
{
/* Acquire the correct direction */
correct_dir(&row_dir, &col_dir, row1, col1, row2, col2);
/* Random direction */
- if (rand_int(100) < dun_tun_rnd)
+ if (randint0(100) < dun_tun_rnd)
{
rand_dir(&row_dir, &col_dir);
}
correct_dir(&row_dir, &col_dir, row1, col1, row2, col2);
/* Random direction */
- if (rand_int(100) < dun_tun_rnd)
+ if (randint0(100) < dun_tun_rnd)
{
rand_dir(&row_dir, &col_dir);
}
}
/* Hack -- allow pre-emptive tunnel termination */
- if (rand_int(100) >= dun_tun_con)
+ if (randint0(100) >= dun_tun_con)
{
/* Distance between row1 and start_row */
tmp_row = row1 - start_row;
dx = 0;
while ((i > 0) && is_solid_bold(*y + dy, *x + dx))
{
- dy = rand_int(3) - 1;
- dx = rand_int(3) - 1;
+ dy = randint0(3) - 1;
+ dx = randint0(3) - 1;
if (!in_bounds(*y + dy, *x + dx))
{
dy = (y2 - y1) / 2;
/* perturbation perpendicular to path */
- changex = (rand_int(abs(dy) + 2) * 2 - abs(dy) - 1) / 2;
+ changex = (randint0(abs(dy) + 2) * 2 - abs(dy) - 1) / 2;
/* perturbation perpendicular to path */
- changey = (rand_int(abs(dx) + 2) * 2 - abs(dx) - 1) / 2;
+ changey = (randint0(abs(dx) + 2) * 2 - abs(dx) - 1) / 2;
/* Work out "mid" ponit */
x3 = x1 + dx + changex;
dx = 0;
while ((i > 0) && is_solid_bold(y3 + dy, x3 + dx))
{
- dy = rand_int(3) - 1;
- dx = rand_int(3) - 1;
+ dy = randint0(3) - 1;
+ dx = randint0(3) - 1;
if (!in_bounds(y3 + dy, x3 + dx))
{
dx = 0;
{
if (build_tunnel2(x1, y1, x3, y3, type, cutoff))
{
- if ((cave[y3][x3].info & CAVE_ROOM) || (randint(100) > 95))
+ if ((cave[y3][x3].info & CAVE_ROOM) || (randint1(100) > 95))
{
/* do second half only if works + if have hit a room */
retval = build_tunnel2(x3, y3, x2, y2, type, cutoff);
#define place_floor_bold(Y, X) \
{ \
- set_cave_feat(Y,X,floor_type[rand_int(100)]); \
+ set_cave_feat(Y,X,floor_type[randint0(100)]); \
cave[Y][X].info &= ~(CAVE_MASK); \
add_cave_info(Y,X,CAVE_FLOOR); \
}
#define place_floor_grid(C) \
{ \
- (C)->feat = floor_type[rand_int(100)]; \
+ (C)->feat = floor_type[randint0(100)]; \
(C)->info &= ~(CAVE_MASK); \
(C)->info |= CAVE_FLOOR; \
}
#define place_extra_bold(Y, X) \
{ \
- set_cave_feat(Y,X,fill_type[rand_int(100)]); \
+ set_cave_feat(Y,X,fill_type[randint0(100)]); \
cave[Y][X].info &= ~(CAVE_MASK); \
add_cave_info(Y,X,CAVE_EXTRA); \
}
#define place_extra_grid(C) \
{ \
- (C)->feat = fill_type[rand_int(100)]; \
+ (C)->feat = fill_type[randint0(100)]; \
(C)->info &= ~(CAVE_MASK); \
(C)->info |= CAVE_EXTRA; \
}
#define place_extra_noperm_bold(Y, X) \
{ \
- set_cave_feat(Y,X,fill_type[rand_int(100)]); \
+ set_cave_feat(Y,X,fill_type[randint0(100)]); \
if ((cave[Y][X].feat >= FEAT_PERM_EXTRA) && (cave[Y][X].feat <= FEAT_PERM_SOLID)) cave[Y][X].feat -= 0x04; \
else if (cave[Y][X].feat == FEAT_MOUNTAIN) cave[Y][X].feat = feat_wall_inner; \
cave[Y][X].info &= ~(CAVE_MASK); \
cave[y][x].info &= ~(CAVE_MARK);
/* Destroy the feature */
- cave[y][x].feat = floor_type[rand_int(100)];
+ cave[y][x].feat = floor_type[randint0(100)];
cave[y][x].info &= ~(CAVE_MASK);
cave[y][x].info |= CAVE_FLOOR;
#else
msg_print("You roar out!");
#endif
- project_hack(GF_SOUND, randint(p_ptr->lev * 3));
+ project_hack(GF_SOUND, randint1(p_ptr->lev * 3));
aggravate_monsters(0);
break;
}
return FALSE;
}
#ifdef JP
- take_hit(DAMAGE_NOESCAPE, 100 + randint(100), "·Ä±Àµ´Ç¦·õ¤ò»È¤Ã¤¿¾×·â", -1);
+ take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "·Ä±Àµ´Ç¦·õ¤ò»È¤Ã¤¿¾×·â", -1);
#else
- take_hit(DAMAGE_NOESCAPE, 100 + randint(100), "reaction of your attack", -1); /*nanka*/
+ take_hit(DAMAGE_NOESCAPE, 100 + randint1(100), "reaction of your attack", -1); /*nanka*/
#endif
break;
}
* Random trap and random treasure defined
* 25% chance for trap and 75% chance for object
*/
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
{
place_object(*y, *x, FALSE, FALSE);
}
object_level = base_level + object_index;
/* Create an out of deep object */
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
place_object(*y, *x, FALSE, FALSE);
- else if (rand_int(100) < 80)
+ else if (randint0(100) < 80)
place_object(*y, *x, TRUE, FALSE);
else
place_object(*y, *x, TRUE, TRUE);
{
for (j = 0; j < max_wild_y; j++)
{
- wilderness[j][i].seed = rand_int(0x10000000);
+ wilderness[j][i].seed = randint0(0x10000000);
}
}
* Random monster 5 - 10 levels out of depth
* (depending on level)
*/
- r_idx = get_mon_num(quest[i].level + 5 + randint(quest[i].level / 10));
+ r_idx = get_mon_num(quest[i].level + 5 + randint1(quest[i].level / 10));
r_ptr = &r_info[r_idx];
if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
/* Get a *new* song at random */
while (1)
{
- n = randint(song_number);
+ n = randint1(song_number);
if (n != current_song) break;
}
current_song = n;
if ((v < 0) || (v >= SOUND_MAX)) return (1);
/* Get a random sample from the available ones */
- n = rand_int(sample_count[v]);
+ n = randint0(sample_count[v]);
/* Play the sound, catch errors */
if (samples[v][n])
int dir;
int plev = p_ptr->lev;
bool unique_okay = FALSE;
- if (randint(50+plev) < plev/10) unique_okay = TRUE;
+ if (randint1(50+plev) < plev/10) unique_okay = TRUE;
/* spell code */
break;
case MS_DRAIN_MANA:
if (!get_aim_dir(&dir)) return FALSE;
- fire_ball_hide(GF_DRAIN_MANA, dir, randint(plev*3)+plev, 0);
+ fire_ball_hide(GF_DRAIN_MANA, dir, randint1(plev*3)+plev, 0);
break;
case MS_MIND_BLAST:
if (!get_aim_dir(&dir)) return FALSE;
sleep_monster(dir);
break;
case MS_SPEED:
- (void)set_fast(randint(20 + plev) + plev, FALSE);
+ (void)set_fast(randint1(20 + plev) + plev, FALSE);
break;
case MS_HAND_DOOM:
{
#else
msg_print("You casts a Globe of Invulnerability.");
#endif
- (void)set_invuln(randint(7) + 7, FALSE);
+ (void)set_invuln(randint1(7) + 7, FALSE);
break;
case MS_BLINK:
teleport_player(10);
msg_print("hek!");
msg_print(NULL);
- p_ptr->energy += (randint(200)+1200);
+ p_ptr->energy += (randint1(200)+1200);
/* Redraw map */
p_ptr->redraw |= (PR_MAP);
msg_format("You gestures at %s's feet.", m_name);
#endif
- if ((r_ptr->flags3 & RF3_RES_TELE) || (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint(50) > plev + randint(60)))
+ if ((r_ptr->flags3 & RF3_RES_TELE) || (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60)))
{
#ifdef JP
msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
case MS_S_CYBER:
{
int k;
- int max_cyber = (dun_level / 50) + randint(3);
+ int max_cyber = (dun_level / 50) + randint1(3);
if (!target_set(TARGET_KILL)) return FALSE;
#ifdef JP
msg_print("¥µ¥¤¥Ð¡¼¥Ç¡¼¥â¥ó¤ò¾¤´¤·¤¿¡ª");
if (chance > 95) chance = 95;
/* Failed spell */
- if (rand_int(100) < chance)
+ if (randint0(100) < chance)
{
if (flush_failure) flush();
#ifdef JP
if (dam < total * 19 / 20) return (0);
/* Weak blows rarely work */
- if ((dam < 20) && (rand_int(100) >= dam)) return (0);
+ if ((dam < 20) && (randint0(100) >= dam)) return (0);
/* Perfect damage */
if (dam == total && dam >= 40) max++;
/* Super-charge */
if (dam >= 20)
{
- while (rand_int(100) < 2) max++;
+ while (randint0(100) < 2) max++;
}
/* Critical damage */
int i, k, ac;
/* Percentile dice */
- k = rand_int(100);
+ k = randint0(100);
if (stun && one_in_(2)) return FALSE;
if (p_ptr->special_attack & ATTACK_SUIKEN) ac += (p_ptr->lev * 2);
/* Power and Level compete against Armor */
- if ((i > 0) && (randint(i) > ((ac * 3) / 4))) return (TRUE);
+ if ((i > 0) && (randint1(i) > ((ac * 3) / 4))) return (TRUE);
/* Assume miss */
return (FALSE);
if (py_attack(m_ptr->fy, m_ptr->fx, HISSATSU_IAI)) return TRUE;
}
- if ((p_ptr->special_defense & NINJA_KAWARIMI) && (rand_int(55) < (p_ptr->lev*3/5+20)))
+ if ((p_ptr->special_defense & NINJA_KAWARIMI) && (randint0(55) < (p_ptr->lev*3/5+20)))
{
kawarimi(TRUE);
return TRUE;
if ((p_ptr->protevil > 0) &&
(r_ptr->flags3 & RF3_EVIL) &&
(p_ptr->lev >= rlev) &&
- ((rand_int(100) + p_ptr->lev) > 50))
+ ((randint0(100) + p_ptr->lev) > 50))
{
/* Remember the Evil-ness */
if (m_ptr->ml)
case RBM_INSULT:
{
syouryaku = -1;
- act = desc_insult[rand_int(m_ptr->r_idx == MON_DEBBY ? 10 : 8)];
+ act = desc_insult[randint0(m_ptr->r_idx == MON_DEBBY ? 10 : 8)];
sound(SOUND_MOAN);
break;
}
case RBM_MOAN:
{
syouryaku = -1;
- act = desc_moan[rand_int(4)];
+ act = desc_moan[randint0(4)];
sound(SOUND_MOAN);
break;
}
if (m_ptr->r_idx == MON_JAIAN)
{
#ifdef JP
- switch(randint(15))
+ switch(randint1(15))
{
case 1:
case 6:
if (do_silly_attack)
{
syouryaku = -1;
- act = silly_attacks[rand_int(MAX_SILLY_ATTACK)];
+ act = silly_attacks[randint0(MAX_SILLY_ATTACK)];
}
#ifdef JP
if(syouryaku==0)
case RBE_SUPERHURT:
{
int ac = p_ptr->ac+p_ptr->to_a;
- if ((randint(rlev*2+300) > (ac+200)) || one_in_(13)) {
+ if ((randint1(rlev*2+300) > (ac+200)) || one_in_(13)) {
int tmp_damage = damage-(damage*((ac < 150) ? ac : 150)/250);
#ifdef JP
msg_print("Ä˺¨¤Î°ì·â¡ª");
/* Take "poison" effect */
if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
{
- if (set_poisoned(p_ptr->poisoned + randint(rlev) + 5))
+ if (set_poisoned(p_ptr->poisoned + randint1(rlev) + 5))
{
obvious = TRUE;
}
for (k = 0; k < 10; k++)
{
/* Pick an item */
- i = rand_int(INVEN_PACK);
+ i = randint0(INVEN_PACK);
/* Obtain the item */
o_ptr = &inventory[i];
/* Saving throw (unless paralyzed) based on dex and level */
if (!p_ptr->paralyzed &&
- (rand_int(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
+ (randint0(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
p_ptr->lev)))
{
/* Saving throw message */
/* Occasional blink anyway */
- if (rand_int(3)) blinked = TRUE;
+ if (randint0(3)) blinked = TRUE;
}
/* Eat gold */
else
{
- gold = (p_ptr->au / 10) + randint(25);
+ gold = (p_ptr->au / 10) + randint1(25);
if (gold < 2) gold = 2;
- if (gold > 5000) gold = (p_ptr->au / 20) + randint(3000);
+ if (gold > 5000) gold = (p_ptr->au / 20) + randint1(3000);
if (gold > p_ptr->au) gold = p_ptr->au;
p_ptr->au -= gold;
if (gold <= 0)
/* Saving throw (unless paralyzed) based on dex and level */
if (!p_ptr->paralyzed &&
- (rand_int(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
+ (randint0(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
p_ptr->lev)))
{
/* Saving throw message */
s16b o_idx;
/* Pick an item */
- i = rand_int(INVEN_PACK);
+ i = randint0(INVEN_PACK);
/* Obtain the item */
o_ptr = &inventory[i];
for (k = 0; k < 10; k++)
{
/* Pick an item from the pack */
- i = rand_int(INVEN_PACK);
+ i = randint0(INVEN_PACK);
/* Get the item */
o_ptr = &inventory[i];
if ((o_ptr->xtra4 > 0) && (!artifact_p(o_ptr)))
{
/* Reduce fuel */
- o_ptr->pval -= (250 + randint(250));
+ o_ptr->pval -= (250 + randint1(250));
if (o_ptr->pval < 1) o_ptr->pval = 1;
/* Notice */
/* Increase "blind" */
if (!p_ptr->resist_blind)
{
- if (set_blind(p_ptr->blind + 10 + randint(rlev)))
+ if (set_blind(p_ptr->blind + 10 + randint1(rlev)))
{
#ifdef JP
if(m_ptr->r_idx == MON_DIO) msg_print("¤É¤¦¤À¥Ã¡ª¤³¤Î·ì¤ÎÌÜÄÙ¤·¤Ï¥Ã¡ª");
/* Increase "confused" */
if (!p_ptr->resist_conf)
{
- if (set_confused(p_ptr->confused + 3 + randint(rlev)))
+ if (set_confused(p_ptr->confused + 3 + randint1(rlev)))
{
obvious = TRUE;
}
obvious = TRUE;
}
- else if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
+ else if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¶²Éݤ˿¯¤µ¤ì¤Ê¤«¤Ã¤¿¡ª");
}
else
{
- if (set_afraid(p_ptr->afraid + 3 + randint(rlev)))
+ if (set_afraid(p_ptr->afraid + 3 + randint1(rlev)))
{
obvious = TRUE;
}
obvious = TRUE;
}
- else if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
+ else if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
{
if (!p_ptr->paralyzed)
{
- if (set_paralyzed(3 + randint(rlev)))
+ if (set_paralyzed(3 + randint1(rlev)))
{
obvious = TRUE;
}
if (p_ptr->prace == RACE_ANDROID)
{
}
- else if (p_ptr->hold_life && (rand_int(100) < 95))
+ else if (p_ptr->hold_life && (randint0(100) < 95))
{
#ifdef JP
msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
if (p_ptr->prace == RACE_ANDROID)
{
}
- else if (p_ptr->hold_life && (rand_int(100) < 90))
+ else if (p_ptr->hold_life && (randint0(100) < 90))
{
#ifdef JP
msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
if (p_ptr->prace == RACE_ANDROID)
{
}
- else if (p_ptr->hold_life && (rand_int(100) < 75))
+ else if (p_ptr->hold_life && (randint0(100) < 75))
{
#ifdef JP
msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
if (p_ptr->prace == RACE_ANDROID)
{
}
- else if (p_ptr->hold_life && (rand_int(100) < 50))
+ else if (p_ptr->hold_life && (randint0(100) < 50))
{
#ifdef JP
msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
/* Take "poison" effect */
if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
{
- if (set_poisoned(p_ptr->poisoned + randint(rlev) + 5))
+ if (set_poisoned(p_ptr->poisoned + randint1(rlev) + 5))
{
obvious = TRUE;
}
}
/* Damage CON (10% chance)*/
- if ((randint(100) < 11) && (p_ptr->prace != RACE_ANDROID))
+ if ((randint1(100) < 11) && (p_ptr->prace != RACE_ANDROID))
{
/* 1% chance for perm. damage */
bool perm = one_in_(10);
- if (dec_stat(A_CON, randint(10), perm)) obvious = TRUE;
+ if (dec_stat(A_CON, randint1(10), perm)) obvious = TRUE;
}
break;
if (explode) break;
if (!p_ptr->resist_time)
{
- switch (randint(10))
+ switch (randint1(10))
{
case 1: case 2: case 3: case 4: case 5:
{
case 6: case 7: case 8: case 9:
{
- int stat = rand_int(6);
+ int stat = randint0(6);
switch (stat)
{
if (p_ptr->prace == RACE_ANDROID)
{
}
- else if (p_ptr->hold_life && (rand_int(100) < 50))
+ else if (p_ptr->hold_life && (randint0(100) < 50))
{
#ifdef JP
msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
if (do_cut && do_stun)
{
/* Cancel cut */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
do_cut = 0;
}
switch (tmp)
{
case 0: k = 0; break;
- case 1: k = randint(5); break;
- case 2: k = randint(5) + 5; break;
- case 3: k = randint(20) + 20; break;
- case 4: k = randint(50) + 50; break;
- case 5: k = randint(100) + 100; break;
+ case 1: k = randint1(5); break;
+ case 2: k = randint1(5) + 5; break;
+ case 3: k = randint1(20) + 20; break;
+ case 4: k = randint1(50) + 50; break;
+ case 5: k = randint1(100) + 100; break;
case 6: k = 300; break;
default: k = 500; break;
}
switch (tmp)
{
case 0: k = 0; break;
- case 1: k = randint(5); break;
- case 2: k = randint(5) + 10; break;
- case 3: k = randint(10) + 20; break;
- case 4: k = randint(15) + 30; break;
- case 5: k = randint(20) + 40; break;
+ case 1: k = randint1(5); break;
+ case 2: k = randint1(5) + 10; break;
+ case 3: k = randint1(10) + 20; break;
+ case 4: k = randint1(15) + 30; break;
+ case 5: k = randint1(20) + 40; break;
case 6: k = 80; break;
default: k = 150; break;
}
{
if (p_ptr->inside_battle)
{
- start = randint(m_max-1)+m_max;
- if(rand_int(2)) plus = -1;
+ start = randint1(m_max-1)+m_max;
+ if(randint0(2)) plus = -1;
}
else start = m_max + 1;
if (p_ptr->riding && (m_idx == p_ptr->riding)) disturb(1, 0);
- if (m_ptr->invulner && rand_int(PENETRATE_INVULNERABILITY))
+ if (m_ptr->invulner && randint0(PENETRATE_INVULNERABILITY))
{
if (seen)
{
/* Mega-Hack -- Pain cancels fear */
if (m_ptr->monfear && (dam > 0))
{
- int tmp = randint(dam / 4);
+ int tmp = randint1(dam / 4);
/* Cure a little fear */
if (tmp < m_ptr->monfear)
* Run (sometimes) if at 10% or less of max hit points,
* or (usually) when hit for half its current hit points
*/
- if (((percentage <= 10) && (rand_int(10) < percentage)) ||
- ((dam >= m_ptr->hp) && (rand_int(100) < 80)))
+ if (((percentage <= 10) && (randint0(10) < percentage)) ||
+ ((dam >= m_ptr->hp) && (randint0(100) < 80)))
{
/* Hack -- note fear */
(*fear) = TRUE;
/* XXX XXX XXX Hack -- Add some timed fear */
- m_ptr->monfear += (randint(10) +
+ m_ptr->monfear += (randint1(10) +
(((dam >= m_ptr->hp) && (percentage > 7)) ?
20 : ((11 - percentage) * 5)));
}
int i, k;
/* Percentile dice */
- k = rand_int(100);
+ k = randint0(100);
if (stun && one_in_(2)) return FALSE;
i = (power + (level * 3));
/* Power and Level compete against Armor */
- if ((i > 0) && (randint(i) > ((ac * 3) / 4))) return (TRUE);
+ if ((i > 0) && (randint1(i) > ((ac * 3) / 4))) return (TRUE);
/* Assume miss */
return (FALSE);
{
if (do_silly_attack)
{
- act = silly_attacks[rand_int(MAX_SILLY_ATTACK)];
+ act = silly_attacks[randint0(MAX_SILLY_ATTACK)];
}
strfmt(temp, act, t_name);
#ifdef JP
case RBE_SUPERHURT:
{
- if ((randint(rlev*2+250) > (ac+200)) || one_in_(13)) {
+ if ((randint1(rlev*2+250) > (ac+200)) || one_in_(13)) {
int tmp_damage = damage-(damage*((ac < 150) ? ac : 150)/250);
damage = MAX(damage, tmp_damage*2);
break;
if (p_ptr->aggravate) tmp /= 2;
if (r_ptr->level > (p_ptr->lev*p_ptr->lev/20+10)) tmp /= 3;
/* Low-level monsters will find it difficult to locate the player. */
- if (rand_int(tmp) > (r_ptr->level+20)) aware = FALSE;
+ if (randint0(tmp) > (r_ptr->level+20)) aware = FALSE;
}
/* Quantum monsters are odd */
if (r_ptr->flags2 & (RF2_QUANTUM))
{
/* Sometimes skip move */
- if (!rand_int(2)) return;
+ if (!randint0(2)) return;
/* Sometimes die */
- if (!rand_int((m_idx % 100) + 10) && !(r_ptr->flags1 & RF1_QUESTOR))
+ if (!randint0((m_idx % 100) + 10) && !(r_ptr->flags1 & RF1_QUESTOR))
{
bool sad = FALSE;
u32b notice = 0;
/* Hack -- handle non-aggravation */
- if (!p_ptr->aggravate) notice = rand_int(1024);
+ if (!p_ptr->aggravate) notice = randint0(1024);
/* Nightmare monsters are more alert */
if (ironman_nightmare) notice /= 2;
int d = 1;
/* Make a "saving throw" against stun */
- if (rand_int(10000) <= r_ptr->level * r_ptr->level)
+ if (randint0(10000) <= r_ptr->level * r_ptr->level)
{
/* Recover fully */
d = m_ptr->stunned;
if (m_ptr->confused)
{
/* Amount of "boldness" */
- int d = randint(r_ptr->level / 20 + 1);
+ int d = randint1(r_ptr->level / 20 + 1);
/* Still confused */
if (m_ptr->confused > d)
if (m_ptr->monfear)
{
/* Amount of "boldness" */
- int d = randint(r_ptr->level / 20 + 1);
+ int d = randint1(r_ptr->level / 20 + 1);
/* Still afraid */
if (m_ptr->monfear > d)
}
/* Hack -- multiply slower in crowded areas */
- if ((k < 4) && (!k || !rand_int(k * MON_MULT_ADJ)))
+ if ((k < 4) && (!k || !randint0(k * MON_MULT_ADJ)))
{
/* Try to multiply */
if (multiply_monster(m_idx, FALSE, is_friendly(m_ptr), is_pet(m_ptr)))
/* 75% random movement */
else if ((r_ptr->flags1 & RF1_RAND_50) &&
(r_ptr->flags1 & RF1_RAND_25) &&
- (rand_int(100) < 75))
+ (randint0(100) < 75))
{
/* Memorize flags */
if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_RAND_50);
/* 50% random movement */
else if ((r_ptr->flags1 & RF1_RAND_50) &&
- (rand_int(100) < 50))
+ (randint0(100) < 50))
{
/* Memorize flags */
if (m_ptr->ml) r_ptr->r_flags1 |= (RF1_RAND_50);
/* 25% random movement */
else if ((r_ptr->flags1 & RF1_RAND_25) &&
- (rand_int(100) < 25))
+ (randint0(100) < 25))
{
/* Memorize flags */
if (m_ptr->ml) r_ptr->r_flags1 |= RF1_RAND_25;
d = mm[i];
/* Hack -- allow "randomized" motion */
- if (d == 5) d = ddd[rand_int(8)];
+ if (d == 5) d = ddd[randint0(8)];
/* Get the destination */
ny = oy + ddy[d];
c_ptr->info &= ~(CAVE_MARK);
/* Notice */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
k = ((c_ptr->feat - FEAT_DOOR_HEAD) & 0x07);
/* Try to unlock it XXX XXX XXX */
- if (rand_int(m_ptr->hp / 10) > k)
+ if (randint0(m_ptr->hp / 10) > k)
{
/* Unlock the door */
cave_set_feat(ny, nx, FEAT_DOOR_HEAD + 0x00);
k = ((c_ptr->feat - FEAT_DOOR_HEAD) & 0x07);
/* Attempt to Bash XXX XXX XXX */
- if (rand_int(m_ptr->hp / 10) > k)
+ if (randint0(m_ptr->hp / 10) > k)
{
/* Message */
#ifdef JP
if (did_open_door || did_bash_door)
{
/* Break down the door */
- if (did_bash_door && (rand_int(100) < 50))
+ if (did_bash_door && (randint0(100) < 50))
{
cave_set_feat(ny, nx, FEAT_BROKEN);
}
do_move = FALSE;
/* Break the ward */
- if (!is_pet(m_ptr) && (randint(BREAK_GLYPH) < r_ptr->level))
+ if (!is_pet(m_ptr) && (randint1(BREAK_GLYPH) < r_ptr->level))
{
/* Describe observable breakage */
if (c_ptr->info & CAVE_MARK)
c_ptr->info &= ~(CAVE_MARK);
/* Break the rune */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
if (!is_pet(m_ptr))
{
/* Break the ward */
- if (randint(BREAK_MINOR_GLYPH) > r_ptr->level)
+ if (randint1(BREAK_MINOR_GLYPH) > r_ptr->level)
{
/* Describe observable breakage */
if (c_ptr->info & CAVE_MARK)
c_ptr->info &= ~(CAVE_MARK);
/* Break the rune */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
note_spot(ny, nx);
e = extract_energy[speed];
/* Give this monster some energy */
- if(rand_int(60) < e)
+ if(randint0(60) < e)
m_ptr->energy += gain_energy();
/* Mindblast */
if (!get_aim_dir(&dir)) return FALSE;
- if (randint(100) < plev * 2)
+ if (randint1(100) < plev * 2)
fire_beam(GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)));
else
fire_ball(GF_PSI, dir, damroll(3 + ((plev - 1) / 4), (3 + plev / 15)), 0);
project(0, 2 + plev / 10, py, px,
(plev * 3), GF_PSI, PROJECT_KILL, -1);
else
- (void)mindblast_monsters(randint(plev * ((plev - 5) / 10 + 1)));
+ (void)mindblast_monsters(randint1(plev * ((plev - 5) / 10 + 1)));
break;
case 9:
/* Adrenaline */
hp_player(plev);
}
- b = 10 + randint((plev * 3) / 2);
+ b = 10 + randint1((plev * 3) / 2);
set_hero(b, FALSE);
/* Haste */
(void)set_fast(b, FALSE);
/* This is always a radius-0 ball now */
if (fire_ball(GF_PSI_DRAIN, dir, b, 0))
- p_ptr->energy -= randint(150);
+ p_ptr->energy -= randint1(150);
break;
case 12:
/* psycho-spear */
if (!get_aim_dir(&dir)) return FALSE;
- fire_beam(GF_PSY_SPEAR, dir, randint(plev*3)+plev*3);
+ fire_beam(GF_PSY_SPEAR, dir, randint1(plev*3)+plev*3);
break;
case 13:
{
(void)lite_area(damroll(2, (plev / 2)), (plev / 10) + 1);
break;
case 2:
- set_tim_ffall(randint(30) + 30 + boost / 5, FALSE);
+ set_tim_ffall(randint1(30) + 30 + boost / 5, FALSE);
break;
case 3:
project_length = plev / 8 + 3;
fire_beam(GF_MISSILE, dir, damroll(5 + ((plev - 1) / 5) + boost / 10, 5));
break;
case 4:
- set_resist_magic(randint(20) + 20 + boost / 5, FALSE);
+ set_resist_magic(randint1(20) + 20 + boost / 5, FALSE);
break;
case 5:
#ifdef JP
msg_print("You improved the Force.");
#endif
p_ptr->magic_num1[0] += (70 + plev);
- if (randint(p_ptr->magic_num1[0]) > (plev * 4 + 120))
+ if (randint1(p_ptr->magic_num1[0]) > (plev * 4 + 120))
{
#ifdef JP
msg_print("µ¤¤¬Ë½Áö¤·¤¿¡ª");
else return TRUE;
break;
case 6:
- set_tim_sh_touki(randint(plev / 2) + 15 + boost / 7, FALSE);
+ set_tim_sh_touki(randint1(plev / 2) + 15 + boost / 7, FALSE);
break;
case 7:
{
monster_desc(m_name, m_ptr, 0);
- if (randint(r_info[m_ptr->r_idx].level * 3 / 2) > rand_int(dam / 2) + dam/2)
+ if (randint1(r_info[m_ptr->r_idx].level * 3 / 2) > randint0(dam / 2) + dam/2)
{
#ifdef JP
msg_format("%s¤ÏÈô¤Ð¤µ¤ì¤Ê¤«¤Ã¤¿¡£", m_name);
fire_beam(GF_MANA, dir, damroll(10 + (plev / 2) + boost * 3 / 10, 15));
break;
case 13:
- set_lightspeed(randint(16) + 16 + boost / 20, FALSE);
+ set_lightspeed(randint1(16) + 16 + boost / 20, FALSE);
break;
default:
#ifdef JP
break;
/* robe of dust */
case 6:
- set_dustrobe(20+randint(20),FALSE);
+ set_dustrobe(20+randint1(20),FALSE);
break;
/* banishing mirror */
case 7:
break;
/* shield of water */
case 12:
- tmp = 20+randint(20);
+ tmp = 20+randint1(20);
set_shield(tmp, FALSE);
if( plev > 31 )set_tim_reflect(tmp, FALSE);
if( plev > 39 )set_resist_magic(tmp,FALSE);
/* super ray */
case 13:
if (!get_aim_dir(&dir)) return FALSE;
- fire_beam(GF_SUPER_RAY,dir, 150+randint(2*plev));
+ fire_beam(GF_SUPER_RAY,dir, 150+randint1(2*plev));
break;
/* illusion light */
case 14:
break;
/* multi-shadow */
case 18:
- set_multishadow(6+randint(6),FALSE);
+ set_multishadow(6+randint1(6),FALSE);
break;
/* binding field */
case 19:
break;
/* mirror of Ruffnor */
case 20:
- (void)set_invuln(randint(4)+4,FALSE);
+ (void)set_invuln(randint1(4)+4,FALSE);
break;
default:
#ifdef JP
break;
}
case 3:
- earthquake(py, px, 8+rand_int(5));
+ earthquake(py, px, 8+randint0(5));
break;
case 4:
{
if (cave[y][x].m_idx)
{
py_attack(y, x, 0);
- if (rand_int(p_ptr->skill_dis) < 7)
+ if (randint0(p_ptr->skill_dis) < 7)
#ifdef JP
msg_print("¤¦¤Þ¤¯Æ¨¤²¤é¤ì¤Ê¤«¤Ã¤¿¡£");
#else
return ident_spell(FALSE);
break;
case 8:
- set_tim_ffall(randint(20) + 20, FALSE);
+ set_tim_ffall(randint1(20) + 20, FALSE);
break;
case 9:
fire_ball(GF_FIRE, 0, 50+plev, plev/10+2);
explosive_rune();
break;
case 16:
- (void)set_kabenuke(randint(plev/2) + plev/2, FALSE);
+ (void)set_kabenuke(randint1(plev/2) + plev/2, FALSE);
set_oppose_acid(plev, FALSE);
break;
case 17:
break;
}
case 19:
- set_multishadow(6+randint(6), FALSE);
+ set_multishadow(6+randint1(6), FALSE);
break;
default:
#ifdef JP
if (chance > 95) chance = 95;
/* Failed spell */
- if (rand_int(100) < chance)
+ if (randint0(100) < chance)
{
if (flush_failure) flush();
#ifdef JP
p_ptr->magic_num1[0] = 0;
}
- if (randint(100) < (chance / 2))
+ if (randint1(100) < (chance / 2))
{
/* Backfire */
- b = randint(100);
+ b = randint1(100);
if( use_mind == MIND_MINDCRAFTER ){
if (b < 5)
msg_print("Weird visions seem to dance before your eyes...");
#endif
- set_image(p_ptr->image + 5 + randint(10));
+ set_image(p_ptr->image + 5 + randint1(10));
}
else if (b < 45)
{
msg_print("Your brain is addled!");
#endif
- set_confused(p_ptr->confused + randint(8));
+ set_confused(p_ptr->confused + randint1(8));
}
else if (b < 90)
{
- set_stun(p_ptr->stun + randint(8));
+ set_stun(p_ptr->stun + randint1(8));
}
else
{
msg_print("Your brain is addled!");
#endif
- set_image(p_ptr->image + 5 + randint(10));
+ set_image(p_ptr->image + 5 + randint1(10));
}
else
{
/* Hack -- Bypass free action */
- (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops + 1));
+ (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
/* Damage WIS (possibly permanently) */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
- bool perm = (rand_int(100) < 25);
+ bool perm = (randint0(100) < 25);
/* Message */
#ifdef JP
/* Reduce constitution */
- (void)dec_stat(A_WIS, 15 + randint(10), perm);
+ (void)dec_stat(A_WIS, 15 + randint1(10), perm);
}
}
{
/* Create the monster name */
case NAME_DWARF:
- strcpy(name, dwarf_syllable1[rand_int(sizeof(dwarf_syllable1) / sizeof(char*))]);
- strcat(name, dwarf_syllable2[rand_int(sizeof(dwarf_syllable2) / sizeof(char*))]);
- strcat(name, dwarf_syllable3[rand_int(sizeof(dwarf_syllable3) / sizeof(char*))]);
+ strcpy(name, dwarf_syllable1[randint0(sizeof(dwarf_syllable1) / sizeof(char*))]);
+ strcat(name, dwarf_syllable2[randint0(sizeof(dwarf_syllable2) / sizeof(char*))]);
+ strcat(name, dwarf_syllable3[randint0(sizeof(dwarf_syllable3) / sizeof(char*))]);
break;
case NAME_ELF:
- strcpy(name, elf_syllable1[rand_int(sizeof(elf_syllable1) / sizeof(char*))]);
- strcat(name, elf_syllable2[rand_int(sizeof(elf_syllable2) / sizeof(char*))]);
- strcat(name, elf_syllable3[rand_int(sizeof(elf_syllable3) / sizeof(char*))]);
+ strcpy(name, elf_syllable1[randint0(sizeof(elf_syllable1) / sizeof(char*))]);
+ strcat(name, elf_syllable2[randint0(sizeof(elf_syllable2) / sizeof(char*))]);
+ strcat(name, elf_syllable3[randint0(sizeof(elf_syllable3) / sizeof(char*))]);
break;
case NAME_GNOME:
- strcpy(name, gnome_syllable1[rand_int(sizeof(gnome_syllable1) / sizeof(char*))]);
- strcat(name, gnome_syllable2[rand_int(sizeof(gnome_syllable2) / sizeof(char*))]);
- strcat(name, gnome_syllable3[rand_int(sizeof(gnome_syllable3) / sizeof(char*))]);
+ strcpy(name, gnome_syllable1[randint0(sizeof(gnome_syllable1) / sizeof(char*))]);
+ strcat(name, gnome_syllable2[randint0(sizeof(gnome_syllable2) / sizeof(char*))]);
+ strcat(name, gnome_syllable3[randint0(sizeof(gnome_syllable3) / sizeof(char*))]);
break;
case NAME_HOBBIT:
- strcpy(name, hobbit_syllable1[rand_int(sizeof(hobbit_syllable1) / sizeof(char*))]);
- strcat(name, hobbit_syllable2[rand_int(sizeof(hobbit_syllable2) / sizeof(char*))]);
- strcat(name, hobbit_syllable3[rand_int(sizeof(hobbit_syllable3) / sizeof(char*))]);
+ strcpy(name, hobbit_syllable1[randint0(sizeof(hobbit_syllable1) / sizeof(char*))]);
+ strcat(name, hobbit_syllable2[randint0(sizeof(hobbit_syllable2) / sizeof(char*))]);
+ strcat(name, hobbit_syllable3[randint0(sizeof(hobbit_syllable3) / sizeof(char*))]);
break;
case NAME_HUMAN:
- strcpy(name, human_syllable1[rand_int(sizeof(human_syllable1) / sizeof(char*))]);
- strcat(name, human_syllable2[rand_int(sizeof(human_syllable2) / sizeof(char*))]);
- strcat(name, human_syllable3[rand_int(sizeof(human_syllable3) / sizeof(char*))]);
+ strcpy(name, human_syllable1[randint0(sizeof(human_syllable1) / sizeof(char*))]);
+ strcat(name, human_syllable2[randint0(sizeof(human_syllable2) / sizeof(char*))]);
+ strcat(name, human_syllable3[randint0(sizeof(human_syllable3) / sizeof(char*))]);
break;
case NAME_ORC:
- strcpy(name, orc_syllable1[rand_int(sizeof(orc_syllable1) / sizeof(char*))]);
- strcat(name, orc_syllable2[rand_int(sizeof(orc_syllable2) / sizeof(char*))]);
- strcat(name, orc_syllable3[rand_int(sizeof(orc_syllable3) / sizeof(char*))]);
+ strcpy(name, orc_syllable1[randint0(sizeof(orc_syllable1) / sizeof(char*))]);
+ strcat(name, orc_syllable2[randint0(sizeof(orc_syllable2) / sizeof(char*))]);
+ strcat(name, orc_syllable3[randint0(sizeof(orc_syllable3) / sizeof(char*))]);
break;
/* Create an empty name */
default:
if (r_ptr->flags1 & (RF1_UNIQUE)) chance = 100;
/* All monsters get a saving throw */
- if (rand_int(100) < chance) continue;
+ if (randint0(100) < chance) continue;
/* Delete the monster */
delete_monster_idx(i);
{
int hoge = entry->prob2 * d_info[dungeon_type].special_div;
entry->prob2 = hoge / 64;
- if (rand_int(64) < (hoge & 0x3f)) entry->prob2++;
+ if (randint0(64) < (hoge & 0x3f)) entry->prob2++;
}
}
if ((level > 0) && !p_ptr->inside_battle && !(d_info[dungeon_type].flags1 & DF1_BEGINNER))
{
/* Nightmare mode allows more out-of depth monsters */
- if (ironman_nightmare && !rand_int(pls_kakuritu))
+ if (ironman_nightmare && !randint0(pls_kakuritu))
{
/* What a bizarre calculation */
- level = 1 + (level * MAX_DEPTH / randint(MAX_DEPTH));
+ level = 1 + (level * MAX_DEPTH / randint1(MAX_DEPTH));
}
else
{
/* Occasional "nasty" monster */
- if (!rand_int(pls_kakuritu))
+ if (!randint0(pls_kakuritu))
{
/* Pick a level bonus */
int d = MIN(5, level/10) + pls_level;
}
/* Occasional "nasty" monster */
- if (!rand_int(pls_kakuritu))
+ if (!randint0(pls_kakuritu))
{
/* Pick a level bonus */
int d = MIN(5, level/10) + pls_level;
/* Pick a monster */
- value = rand_int(total);
+ value = randint0(total);
/* Find the monster */
for (i = 0; i < alloc_race_size; i++)
/* Power boost */
- p = rand_int(100);
+ p = randint0(100);
/* Try for a "harder" monster once (50%) or twice (10%) */
if (p < 60)
j = i;
/* Pick a monster */
- value = rand_int(total);
+ value = randint0(total);
/* Find the monster */
for (i = 0; i < alloc_race_size; i++)
j = i;
/* Pick a monster */
- value = rand_int(total);
+ value = randint0(total);
/* Find the monster */
for (i = 0; i < alloc_race_size; i++)
do
{
- hallu_race = &r_info[randint(max_r_idx - 1)];
+ hallu_race = &r_info[randint1(max_r_idx - 1)];
}
while (hallu_race->flags1 & RF1_UNIQUE);
if (is_pet(m_ptr))
return; /* Pet eldritch horrors are safe most of the time */
- if (randint(100) > power) return;
+ if (randint1(100) > power) return;
if (saving_throw(p_ptr->skill_sav - power))
{
msg_format("You behold the %s visage of %s!",
#endif
- funny_desc[rand_int(MAX_SAN_FUNNY)], m_name);
+ funny_desc[randint0(MAX_SAN_FUNNY)], m_name);
if (one_in_(3))
{
- msg_print(funny_comments[rand_int(MAX_SAN_COMMENT)]);
- p_ptr->image = p_ptr->image + randint(r_ptr->level);
+ msg_print(funny_comments[randint0(MAX_SAN_COMMENT)]);
+ p_ptr->image = p_ptr->image + randint1(r_ptr->level);
}
return; /* Never mind; we can't see it clearly enough */
msg_format("You behold the %s visage of %s!",
#endif
- horror_desc[rand_int(MAX_SAN_HORROR)], m_name);
+ horror_desc[randint0(MAX_SAN_HORROR)], m_name);
r_ptr->r_flags2 |= RF2_ELDRITCH_HORROR;
{
if (!p_ptr->resist_conf)
{
- (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+ (void)set_confused(p_ptr->confused + randint0(4) + 4);
}
if (!p_ptr->resist_chaos && one_in_(3))
{
- (void)set_image(p_ptr->image + rand_int(250) + 150);
+ (void)set_image(p_ptr->image + randint0(250) + 150);
}
return;
}
{
if (!p_ptr->resist_conf)
{
- (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+ (void)set_confused(p_ptr->confused + randint0(4) + 4);
}
if (!p_ptr->free_act)
{
- (void)set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4);
+ (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
}
- while (rand_int(100) > p_ptr->skill_sav)
+ while (randint0(100) > p_ptr->skill_sav)
(void)do_dec_stat(A_INT);
- while (rand_int(100) > p_ptr->skill_sav)
+ while (randint0(100) > p_ptr->skill_sav)
(void)do_dec_stat(A_WIS);
if (!p_ptr->resist_chaos)
{
- (void)set_image(p_ptr->image + rand_int(250) + 150);
+ (void)set_image(p_ptr->image + randint0(250) + 150);
}
return;
}
while (!happened)
{
- switch (randint(21))
+ switch (randint1(21))
{
case 1:
if (!(p_ptr->muta3 & MUT3_MORONIC) && one_in_(5))
else
level = dun_level;
- if (d_info[dungeon_type].flags1 & DF1_CHAMELEON) level+= 2+randint(3);
+ if (d_info[dungeon_type].flags1 & DF1_CHAMELEON) level+= 2+randint1(3);
r_idx = get_mon_num(level);
r_ptr = &r_info[r_idx];
if (c_ptr->feat == FEAT_GLYPH)
{
- if (randint(BREAK_GLYPH) < (r_ptr->level+20))
+ if (randint1(BREAK_GLYPH) < (r_ptr->level+20))
{
/* Describe observable breakage */
if (c_ptr->info & CAVE_MARK)
c_ptr->info &= ~(CAVE_MARK);
/* Break the rune */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
if (slp && r_ptr->sleep && !ironman_nightmare)
{
int val = r_ptr->sleep;
- m_ptr->csleep = ((val * 2) + randint(val * 10));
+ m_ptr->csleep = ((val * 2) + randint1(val * 10));
}
/* Assign maximal hitpoints */
if (m_ptr->mspeed > 199) m_ptr->mspeed = 199;
/* Give a random starting energy */
- m_ptr->energy = (byte)rand_int(100);
+ m_ptr->energy = (byte)randint0(100);
/* Nightmare monsters are more prepared */
if (ironman_nightmare)
if (c_ptr->feat == FEAT_MINOR_GLYPH)
{
/* Break the ward */
- if (randint(BREAK_MINOR_GLYPH) > r_ptr->level)
+ if (randint1(BREAK_MINOR_GLYPH) > r_ptr->level)
{
/* Describe observable breakage */
if (c_ptr->info & CAVE_MARK)
c_ptr->info &= ~(CAVE_MARK);
/* Break the rune */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
note_spot(y, x);
/* Pick a group size */
- total = randint(10);
+ total = randint1(10);
/* Hard monsters, small groups */
if (r_ptr->level > dun_level)
{
extra = r_ptr->level - dun_level;
- extra = 0 - randint(extra);
+ extra = 0 - randint1(extra);
}
/* Easy monsters, large groups */
else if (r_ptr->level < dun_level)
{
extra = dun_level - r_ptr->level;
- extra = randint(extra);
+ extra = randint1(extra);
}
/* Hack -- limit group reduction */
if (m_list[m_idx].mflag2 & MFLAG_CHAMELEON) r_ptr = &r_info[m_list[m_idx].r_idx];
summon_kin_type = r_ptr->d_char;
- for (attempts = randint(10) + 5; attempts; attempts--)
+ for (attempts = randint1(10) + 5; attempts; attempts--)
{
scatter(&cy, &cx, y, x, 5, 0);
while(try)
{
/* Get a random spot */
- oy = randint(cur_hgt - 4) + 2;
- ox = randint(cur_wid - 4) + 2;
+ oy = randint1(cur_hgt - 4) + 2;
+ ox = randint1(cur_wid - 4) + 2;
/* Is it a good spot ? */
if (cave_empty_bold2(oy, ox) && monster_can_cross_terrain(cave[oy][ox].feat, &r_info[guardian]))
while (attempts_left--)
{
/* Pick a location */
- y = rand_int(cur_hgt);
- x = rand_int(cur_wid);
+ y = randint0(cur_hgt);
+ x = randint0(cur_wid);
/* Require empty floor grid (was "naked") */
if (dun_level || (wilderness[p_ptr->wilderness_y][p_ptr->wilderness_x].terrain != TERRAIN_MOUNTAIN))
#ifdef MONSTER_HORDES
- if (randint(5000) <= dun_level)
+ if (randint1(5000) <= dun_level)
{
if (alloc_horde(y, x))
{
if (r_ptr->flags2 & (RF2_STUPID)) return;
/* Not intelligent, only learn sometimes */
- if (!(r_ptr->flags2 & (RF2_SMART)) && (rand_int(100) < 50)) return;
+ if (!(r_ptr->flags2 & (RF2_SMART)) && (randint0(100) < 50)) return;
/* XXX XXX XXX */
if (!(r_ptr->flags2 & RF2_SMART)) prob = prob / 2;
/* Roll the dice */
- return (rand_int(100) < prob);
+ return (randint0(100) < prob);
}
if (smart_learn)
{
/* Hack -- Occasionally forget player status */
- if (m_ptr->smart && (rand_int(100) < 1)) m_ptr->smart = 0L;
+ if (m_ptr->smart && (randint0(100) < 1)) m_ptr->smart = 0L;
/* Use the memorized flags */
smart = m_ptr->smart;
{
bool changed = FALSE;
u32b o1, o2, o3;
- object_type *o_ptr = &inventory[INVEN_RARM + rand_int(12)];
+ object_type *o_ptr = &inventory[INVEN_RARM + randint0(12)];
- if (randint(100) > chance) return;
+ if (randint1(100) > chance) return;
if (!o_ptr->k_idx) return;
/* Extra, biased saving throw for blessed items */
- if ((o3 & TR3_BLESSED) && (randint(888) > chance))
+ if ((o3 & TR3_BLESSED) && (randint1(888) > chance))
{
char o_name[MAX_NLEN];
object_desc(o_name, o_ptr, FALSE, 0);
return;
}
- if ((randint(100) <= heavy_chance) &&
+ if ((randint1(100) <= heavy_chance) &&
(o_ptr->name1 || o_ptr->name2 || o_ptr->art_name))
{
if (!(o3 & TR3_HEAVY_CURSE))
if (r_ptr->flags2 & (RF2_STUPID))
{
/* Pick at random */
- return (spells[rand_int(num)]);
+ return (spells[randint0(num)]);
}
/* Categorize spells */
/*** Try to pick an appropriate spell type ***/
/* world */
- if (world_num && (rand_int(100) < 15) && !world_monster)
+ if (world_num && (randint0(100) < 15) && !world_monster)
{
/* Choose haste spell */
- return (world[rand_int(world_num)]);
+ return (world[randint0(world_num)]);
}
/* special */
break;
default: break;
}
- if (success) return (special[rand_int(special_num)]);
+ if (success) return (special[randint0(special_num)]);
}
/* Still hurt badly, couldn't flee, attempt to heal */
if (m_ptr->hp < m_ptr->maxhp / 3 && one_in_(2))
{
/* Choose heal spell if possible */
- if (heal_num) return (heal[rand_int(heal_num)]);
+ if (heal_num) return (heal[randint0(heal_num)]);
}
/* Hurt badly or afraid, attempt to flee */
if (((m_ptr->hp < m_ptr->maxhp / 3) || m_ptr->monfear) && one_in_(2))
{
/* Choose escape spell if possible */
- if (escape_num) return (escape[rand_int(escape_num)]);
+ if (escape_num) return (escape[randint0(escape_num)]);
}
/* special */
switch(m_ptr->r_idx)
{
case MON_OHMU:
- if (rand_int(100) < 50) success = TRUE;
+ if (randint0(100) < 50) success = TRUE;
break;
case MON_BANORLUPART:
- if (rand_int(100) < 70) success = TRUE;
+ if (randint0(100) < 70) success = TRUE;
break;
default: break;
}
- if (success) return (special[rand_int(special_num)]);
+ if (success) return (special[randint0(special_num)]);
}
/* Player is close and we have attack spells, blink away */
- if ((distance(py, px, m_ptr->fy, m_ptr->fx) < 4) && (attack_num || (r_ptr->flags6 & RF6_TRAPS)) && (rand_int(100) < 75) && !world_monster)
+ if ((distance(py, px, m_ptr->fy, m_ptr->fx) < 4) && (attack_num || (r_ptr->flags6 & RF6_TRAPS)) && (randint0(100) < 75) && !world_monster)
{
/* Choose tactical spell */
- if (tactic_num) return (tactic[rand_int(tactic_num)]);
+ if (tactic_num) return (tactic[randint0(tactic_num)]);
}
/* Summon if possible (sometimes) */
- if (summon_num && (rand_int(100) < 40))
+ if (summon_num && (randint0(100) < 40))
{
/* Choose summon spell */
- return (summon[rand_int(summon_num)]);
+ return (summon[randint0(summon_num)]);
}
/* dispel */
/* Choose dispel spell if possible */
if (dispel_check(m_idx))
{
- return (dispel[rand_int(dispel_num)]);
+ return (dispel[randint0(dispel_num)]);
}
}
/* Raise-dead if possible (sometimes) */
- if (raise_num && (rand_int(100) < 40) && raise_possible(m_ptr->fy, m_ptr->fx))
+ if (raise_num && (randint0(100) < 40) && raise_possible(m_ptr->fy, m_ptr->fx))
{
/* Choose raise-dead spell */
- return (raise[rand_int(raise_num)]);
+ return (raise[randint0(raise_num)]);
}
/* Attack spell (most of the time) */
if (p_ptr->invuln)
{
- if (psy_spe_num && (rand_int(100) < 50))
+ if (psy_spe_num && (randint0(100) < 50))
{
/* Choose attack spell */
- return (psy_spe[rand_int(psy_spe_num)]);
+ return (psy_spe[randint0(psy_spe_num)]);
}
- else if (attack_num && (rand_int(100) < 40))
+ else if (attack_num && (randint0(100) < 40))
{
/* Choose attack spell */
- return (attack[rand_int(attack_num)]);
+ return (attack[randint0(attack_num)]);
}
}
- else if (attack_num && (rand_int(100) < 85))
+ else if (attack_num && (randint0(100) < 85))
{
/* Choose attack spell */
- return (attack[rand_int(attack_num)]);
+ return (attack[randint0(attack_num)]);
}
/* Try another tactical spell (sometimes) */
- if (tactic_num && (rand_int(100) < 50) && !world_monster)
+ if (tactic_num && (randint0(100) < 50) && !world_monster)
{
/* Choose tactic spell */
- return (tactic[rand_int(tactic_num)]);
+ return (tactic[randint0(tactic_num)]);
}
/* Cast globe of invulnerability if not already in effect */
- if (invul_num && !(m_ptr->invulner) && (rand_int(100) < 50))
+ if (invul_num && !(m_ptr->invulner) && (randint0(100) < 50))
{
/* Choose Globe of Invulnerability */
- return (invul[rand_int(invul_num)]);
+ return (invul[randint0(invul_num)]);
}
/* We're hurt (not badly), try to heal */
- if ((m_ptr->hp < m_ptr->maxhp * 3 / 4) && (rand_int(100) < 25))
+ if ((m_ptr->hp < m_ptr->maxhp * 3 / 4) && (randint0(100) < 25))
{
/* Choose heal spell if possible */
- if (heal_num) return (heal[rand_int(heal_num)]);
+ if (heal_num) return (heal[randint0(heal_num)]);
}
/* Haste self if we aren't already somewhat hasted (rarely) */
- if (haste_num && (rand_int(100) < 20) && !(m_ptr->fast))
+ if (haste_num && (randint0(100) < 20) && !(m_ptr->fast))
{
/* Choose haste spell */
- return (haste[rand_int(haste_num)]);
+ return (haste[randint0(haste_num)]);
}
/* Annoy player (most of the time) */
- if (annoy_num && (rand_int(100) < 80))
+ if (annoy_num && (randint0(100) < 80))
{
/* Choose annoyance spell */
- return (annoy[rand_int(annoy_num)]);
+ return (annoy[randint0(annoy_num)]);
}
/* Choose no spell */
if (stupid_monsters)
{
/* Only do spells occasionally */
- if (rand_int(100) >= chance) return (FALSE);
+ if (randint0(100) >= chance) return (FALSE);
}
else
{
- if (rand_int(100) >= chance) return (FALSE);
+ if (randint0(100) >= chance) return (FALSE);
/* Sometimes forbid inate attacks (breaths) */
- if (rand_int(100) >= (chance * 2)) no_inate = TRUE;
+ if (randint0(100) >= (chance * 2)) no_inate = TRUE;
}
/* XXX XXX XXX Handle "track_target" option (?) */
/* Hack -- allow "desperate" spells */
if ((r_ptr->flags2 & (RF2_SMART)) &&
(m_ptr->hp < m_ptr->maxhp / 10) &&
- (rand_int(100) < 50))
+ (randint0(100) < 50))
{
/* Require intelligent spells */
f4 &= (RF4_INT_MASK);
if (stupid_monsters)
{
/* Choose a spell to cast */
- thrown_spell = spell[rand_int(num)];
+ thrown_spell = spell[randint0(num)];
}
else
{
if (r_ptr->flags2 & RF2_STUPID) failrate = 0;
/* Check for spell failure (inate attacks never fail) */
- if ((thrown_spell >= 128) && ((m_ptr->stunned && one_in_(2)) || (rand_int(100) < failrate)))
+ if ((thrown_spell >= 128) && ((m_ptr->stunned && one_in_(2)) || (randint0(100) < failrate)))
{
disturb(1, 0);
/* Message */
else msg_format("%^s casts an acid ball.", m_name);
#endif
- dam = (randint(rlev * 3) + 15) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+ dam = (randint1(rlev * 3) + 15) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
breath(y, x, m_idx, GF_ACID, dam, 2, FALSE, MS_BALL_ACID, learnable);
update_smart_learn(m_idx, DRS_ACID);
break;
else msg_format("%^s casts a lightning ball.", m_name);
#endif
- dam = (randint(rlev * 3 / 2) + 8) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+ dam = (randint1(rlev * 3 / 2) + 8) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
breath(y, x, m_idx, GF_ELEC, dam, 2, FALSE, MS_BALL_ELEC, learnable);
update_smart_learn(m_idx, DRS_ELEC);
break;
#endif
}
- dam = (randint(rlev * 7 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+ dam = (randint1(rlev * 7 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
breath(y, x, m_idx, GF_FIRE, dam, 2, FALSE, MS_BALL_FIRE, learnable);
update_smart_learn(m_idx, DRS_FIRE);
break;
else msg_format("%^s casts a frost ball.", m_name);
#endif
- dam = (randint(rlev * 3 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+ dam = (randint1(rlev * 3 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
breath(y, x, m_idx, GF_COLD, dam, 2, FALSE, MS_BALL_COLD, learnable);
update_smart_learn(m_idx, DRS_COLD);
break;
msg_print("You are engulfed in a whirlpool.");
#endif
- dam = ((r_ptr->flags2 & RF2_POWERFUL) ? randint(rlev * 3) : randint(rlev * 2)) + 50;
+ dam = ((r_ptr->flags2 & RF2_POWERFUL) ? randint1(rlev * 3) : randint1(rlev * 2)) + 50;
breath(y, x, m_idx, GF_WATER, dam, 4, FALSE, MS_BALL_WATER, learnable);
break;
}
/* Attack power */
- r1 = (randint(rlev) / 2) + 1;
+ r1 = (randint1(rlev) / 2) + 1;
/* Full drain */
if (r1 >= p_ptr->csp)
}
dam = damroll(7, 7);
- if (rand_int(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
+ if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
if (!p_ptr->resist_conf)
{
- (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+ (void)set_confused(p_ptr->confused + randint0(4) + 4);
}
if (!p_ptr->resist_chaos && one_in_(3))
{
- (void)set_image(p_ptr->image + rand_int(250) + 150);
+ (void)set_image(p_ptr->image + randint0(250) + 150);
}
p_ptr->csp -= 50;
}
dam = damroll(12, 12);
- if (rand_int(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
+ if (randint0(100 + rlev/2) < (MAX(5, p_ptr->skill_sav)))
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
take_hit(DAMAGE_ATTACK, dam, ddesc, MS_BRAIN_SMASH);
if (!p_ptr->resist_blind)
{
- (void)set_blind(p_ptr->blind + 8 + rand_int(8));
+ (void)set_blind(p_ptr->blind + 8 + randint0(8));
}
if (!p_ptr->resist_conf)
{
- (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+ (void)set_confused(p_ptr->confused + randint0(4) + 4);
}
if (!p_ptr->free_act)
{
- (void)set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4);
+ (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
}
- (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
+ (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
- while (rand_int(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
+ while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
(void)do_dec_stat(A_INT);
- while (rand_int(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
+ while (randint0(100 + rlev/2) > (MAX(5, p_ptr->skill_sav)))
(void)do_dec_stat(A_WIS);
if (!p_ptr->resist_chaos)
{
- (void)set_image(p_ptr->image + rand_int(250) + 150);
+ (void)set_image(p_ptr->image + randint0(250) + 150);
}
}
break;
#endif
dam = damroll(3, 8);
- if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+ if (randint0(100 + rlev/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
#endif
dam = damroll(8, 8);
- if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+ if (randint0(100 + rlev/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
#endif
dam = damroll(10, 15);
- if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+ if (randint0(100 + rlev/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
#endif
dam = damroll(15, 15);
- if ((rand_int(100 + rlev/2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU))
+ if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU))
{
#ifdef JP
msg_print("¤·¤«¤·È빦¤òÄ·¤ÍÊÖ¤·¤¿¡ª");
else msg_format("%^s casts a mana bolt.", m_name);
#endif
- dam = randint(rlev * 7 / 2) + 50;
+ dam = randint1(rlev * 7 / 2) + 50;
bolt(m_idx, GF_MANA, dam, MS_BOLT_MANA, learnable);
update_smart_learn(m_idx, DRS_REFLECT);
break;
#endif
}
- else if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+ else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¶²Éݤ˿¯¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
}
else
{
- (void)set_afraid(p_ptr->afraid + rand_int(4) + 4);
+ (void)set_afraid(p_ptr->afraid + randint0(4) + 4);
}
learn_spell(MS_SCARE);
update_smart_learn(m_idx, DRS_FEAR);
#endif
}
- else if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+ else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
}
else
{
- (void)set_blind(12 + rand_int(4));
+ (void)set_blind(12 + randint0(4));
}
learn_spell(MS_BLIND);
update_smart_learn(m_idx, DRS_BLIND);
#endif
}
- else if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+ else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸¸³Ð¤Ë¤Ï¤À¤Þ¤µ¤ì¤Ê¤«¤Ã¤¿¡£");
}
else
{
- (void)set_confused(p_ptr->confused + rand_int(4) + 4);
+ (void)set_confused(p_ptr->confused + randint0(4) + 4);
}
learn_spell(MS_CONF);
update_smart_learn(m_idx, DRS_CONF);
#endif
}
- else if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+ else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
}
else
{
- (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
+ (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
}
learn_spell(MS_SLOW);
update_smart_learn(m_idx, DRS_FREE);
#endif
}
- else if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+ else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
}
else
{
- (void)set_paralyzed(p_ptr->paralyzed + rand_int(4) + 4);
+ (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
}
learn_spell(MS_SLEEP);
update_smart_learn(m_idx, DRS_FREE);
msg_format("%^s invokes the Hand of Doom!", m_name);
#endif
- if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+ if (randint0(100 + rlev/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_format("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
}
else
{
- int dummy = (((s32b) ((40 + randint(20)) * (p_ptr->chp))) / 100);
+ int dummy = (((s32b) ((40 + randint1(20)) * (p_ptr->chp))) / 100);
#ifdef JP
msg_print("¤¢¤Ê¤¿¤ÏÌ¿¤¬Çö¤Þ¤Ã¤Æ¤¤¤¯¤è¤¦¤Ë´¶¤¸¤¿¡ª");
#else
}
if (!(m_ptr->invulner))
- m_ptr->invulner = randint(4) + 4;
+ m_ptr->invulner = randint1(4) + 4;
if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
if(m_ptr->r_idx == MON_DIO) who = 1;
else if(m_ptr->r_idx == MON_WONG) who = 3;
dam = who;
- if (!process_the_world(randint(2)+2, who, TRUE)) return (FALSE);
+ if (!process_the_world(randint1(2)+2, who, TRUE)) return (FALSE);
break;
}
#endif
}
- else if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+ else if (randint0(100 + rlev/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
else msg_format("%^s throw a Psycho-Spear.", m_name);
#endif
- dam = (r_ptr->flags2 & RF2_POWERFUL) ? (randint(rlev * 2) + 150) : (randint(rlev * 3 / 2) + 100);
+ dam = (r_ptr->flags2 & RF2_POWERFUL) ? (randint1(rlev * 2) + 150) : (randint1(rlev * 3 / 2) + 100);
beam(m_idx, GF_PSY_SPEAR, dam, MS_PSY_SPEAR, learnable);
break;
}
#endif
- if (rand_int(100 + rlev/2) < p_ptr->skill_sav)
+ if (randint0(100 + rlev/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
if(m_ptr->r_idx == MON_ROLENTO)
{
- int num = 1 + randint(3);
+ int num = 1 + randint1(3);
for (k = 0; k < num; k++)
{
count += summon_named_creature(y, x, MON_SHURYUUDAN, FALSE, FALSE, is_friendly(m_ptr), is_pet(m_ptr));
}
else if(m_ptr->r_idx == MON_LOUSY)
{
- int num = 2 + randint(3);
+ int num = 2 + randint1(3);
for (k = 0; k < num; k++)
{
count += summon_specific(m_idx, y, x, rlev, SUMMON_LOUSE, TRUE, FALSE, FALSE, FALSE, FALSE);
}
else if(m_ptr->r_idx == MON_BULLGATES)
{
- int num = 2 + randint(3);
+ int num = 2 + randint1(3);
for (k = 0; k < num; k++)
{
count += summon_named_creature(y, x, 921, FALSE, FALSE, is_friendly(m_ptr), is_pet(m_ptr));
}
else if (m_ptr->r_idx == MON_CALDARM)
{
- int num = randint(3);
+ int num = randint1(3);
for (k = 0; k < num; k++)
{
count += summon_named_creature(y, x, 930, FALSE, FALSE, is_friendly(m_ptr), is_pet(m_ptr));
}
else if (m_ptr->r_idx == MON_SERPENT)
{
- int num = 2 + randint(3);
+ int num = 2 + randint1(3);
if (r_info[MON_JORMUNGAND].cur_num < r_info[MON_JORMUNGAND].max_num && one_in_(6))
{
/* Not allowed to cast spells */
if (!chance) return (FALSE);
- if (rand_int(100) >= chance) return (FALSE);
+ if (randint0(100) >= chance) return (FALSE);
if (p_ptr->inside_battle)
{
- start = randint(m_max-1)+m_max;
- if(rand_int(2)) plus = -1;
+ start = randint1(m_max-1)+m_max;
+ if(randint0(2)) plus = -1;
}
else start = m_max + 1;
/* Hack -- allow "desperate" spells */
if ((r_ptr->flags2 & RF2_SMART) &&
(m_ptr->hp < m_ptr->maxhp / 10) &&
- (rand_int(100) < 50))
+ (randint0(100) < 50))
{
/* Require intelligent spells */
f4 &= (RF4_INT_MASK);
monster_desc(ddesc, m_ptr, 0x88);
/* Choose a spell to cast */
- thrown_spell = spell[rand_int(num)];
+ thrown_spell = spell[randint0(num)];
see_t = t_ptr->ml;
see_either = (see_m || see_t);
}
}
- dam = (randint(rlev * 3) + 15) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+ dam = (randint1(rlev * 3) + 15) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
monst_breath_monst(m_idx, y, x, GF_ACID, dam, 2, FALSE, MS_BALL_ACID, learnable);
break;
}
}
- dam = (randint(rlev * 3 / 2) + 8) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+ dam = (randint1(rlev * 3 / 2) + 8) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
monst_breath_monst(m_idx, y, x, GF_ELEC, dam, 2, FALSE, MS_BALL_ELEC, learnable);
break;
}
}
- dam = (randint(rlev * 7 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+ dam = (randint1(rlev * 7 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
monst_breath_monst(m_idx, y, x, GF_FIRE, dam, 2, FALSE, MS_BALL_FIRE, learnable);
break;
}
}
- dam = (randint(rlev * 3 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
+ dam = (randint1(rlev * 3 / 2) + 10) * ((r_ptr->flags2 & RF2_POWERFUL) ? 2 : 1);
monst_breath_monst(m_idx, y, x, GF_COLD, dam, 2, FALSE, MS_BALL_COLD, learnable);
break;
}
}
- dam = ((r_ptr->flags2 & RF2_POWERFUL) ? randint(rlev * 3) : randint(rlev * 2)) + 50;
+ dam = ((r_ptr->flags2 & RF2_POWERFUL) ? randint1(rlev * 3) : randint1(rlev * 2)) + 50;
monst_breath_monst(m_idx, y, x, GF_WATER, dam, 4, FALSE, MS_BALL_WATER, learnable);
break;
case 128+9:
{
/* Attack power */
- int power = (randint(rlev) / 2) + 1;
+ int power = (randint1(rlev) / 2) + 1;
if (see_m)
{
if ((tr_ptr->flags1 & RF1_UNIQUE) ||
(tr_ptr->flags3 & RF3_NO_CONF) ||
(tr_ptr->flags3 & RF3_RES_ALL) ||
- (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10))
+ (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10))
{
/* No obvious effect */
if (see_both)
}
- t_ptr->confused += rand_int(4) + 4;
+ t_ptr->confused += randint0(4) + 4;
#ifdef JP
mon_take_hit_mon(FALSE, t_idx, dam, &fear, "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£", m_idx);
if ((tr_ptr->flags1 & RF1_UNIQUE) ||
(tr_ptr->flags3 & RF3_NO_CONF) ||
(tr_ptr->flags3 & RF3_RES_ALL) ||
- (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10))
+ (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10))
{
/* No obvious effect */
if (see_both)
}
- t_ptr->confused += rand_int(4) + 4;
+ t_ptr->confused += randint0(4) + 4;
t_ptr->slow = MIN(200, t_ptr->slow + 10);
- t_ptr->stunned += rand_int(4) + 4;
+ t_ptr->stunned += randint0(4) + 4;
#ifdef JP
mon_take_hit_mon(FALSE, t_idx, dam, &fear, "¤ÎÀº¿À¤ÏÊø²õ¤·¡¢ÆùÂΤÏÈ´¤±¶õ¤È¤Ê¤Ã¤¿¡£", m_idx);
}
dam = damroll(3, 8);
- if ((rand_int(100 + rlev/2) < (tr_ptr->level + 35)) ||
+ if ((randint0(100 + rlev/2) < (tr_ptr->level + 35)) ||
(tr_ptr->flags3 & RF3_RES_ALL))
{
/* Memorize a flag */
}
dam = damroll(8, 8);
- if ((rand_int(100 + rlev/2) < (tr_ptr->level + 35)) ||
+ if ((randint0(100 + rlev/2) < (tr_ptr->level + 35)) ||
(tr_ptr->flags3 & RF3_RES_ALL))
{
/* Memorize a flag */
}
dam = damroll(10, 15);
- if ((rand_int(100 + rlev/2) < (tr_ptr->level + 35)) ||
+ if ((randint0(100 + rlev/2) < (tr_ptr->level + 35)) ||
(tr_ptr->flags3 & RF3_RES_ALL))
{
/* Memorize a flag */
}
dam = damroll(15, 15);
- if (((rand_int(100 + rlev/2) < (tr_ptr->level + 35)) && (m_ptr->r_idx != MON_KENSHIROU)) ||
+ if (((randint0(100 + rlev/2) < (tr_ptr->level + 35)) && (m_ptr->r_idx != MON_KENSHIROU)) ||
(tr_ptr->flags3 & RF3_RES_ALL))
{
/* Memorize a flag */
}
}
- dam = randint(rlev * 7 / 2) + 50;
+ dam = randint1(rlev * 7 / 2) + 50;
monst_bolt_monst(m_idx, y, x, GF_MANA,
dam, MS_BOLT_MANA, learnable);
#endif
}
- else if (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
+ else if (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
{
#ifdef JP
if (see_t) msg_format("%^s¤Ï¶²Éݤò´¶¤¸¤Ê¤¤¡£", t_name);
{
if (!t_ptr->monfear) fear = TRUE;
- t_ptr->monfear += rand_int(4) + 4;
+ t_ptr->monfear += randint0(4) + 4;
}
wake_up = TRUE;
#endif
}
- else if (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
+ else if (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
{
#ifdef JP
if (see_t) msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", t_name);
#endif
- t_ptr->confused += 12 + (byte)rand_int(4);
+ t_ptr->confused += 12 + (byte)randint0(4);
}
wake_up = TRUE;
#endif
}
- else if (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
+ else if (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
{
#ifdef JP
if (see_t) msg_format("%^s¤ÏÏǤ蘆¤ì¤Ê¤«¤Ã¤¿¡£", t_name);
#endif
- t_ptr->confused += 12 + (byte)rand_int(4);
+ t_ptr->confused += 12 + (byte)randint0(4);
}
wake_up = TRUE;
#endif
}
- else if (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
+ else if (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
{
#ifdef JP
if (see_t) msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", t_name);
#endif
}
- else if (tr_ptr->level > randint((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
+ else if (tr_ptr->level > randint1((rlev - 10) < 1 ? 1 : (rlev - 10)) + 10)
{
#ifdef JP
if (see_t) msg_format("%^s¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£", t_name);
#endif
- t_ptr->stunned += randint(4) + 4;
+ t_ptr->stunned += randint1(4) + 4;
}
wake_up = TRUE;
}
else
{
- if ((r_ptr->level + randint(20)) >
- (tr_ptr->level + 10 + randint(20)))
+ if ((r_ptr->level + randint1(20)) >
+ (tr_ptr->level + 10 + randint1(20)))
{
t_ptr->hp = t_ptr->hp -
- (((s32b)((40 + randint(20)) * t_ptr->hp)) / 100);
+ (((s32b)((40 + randint1(20)) * t_ptr->hp)) / 100);
if (t_ptr->hp < 1) t_ptr->hp = 1;
}
}
}
- if (!m_ptr->invulner) m_ptr->invulner = randint(4) + 4;
+ if (!m_ptr->invulner) m_ptr->invulner = randint1(4) + 4;
if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
if(m_ptr->r_idx = MON_DIO) who = 1;
else if(m_ptr->r_idx = MON_WONG) who = 3;
dam = who;
- if(!process_the_world(randint(2)+2, who, los(py, px, m_ptr->fy, m_ptr->fx))) return (FALSE);
+ if(!process_the_world(randint1(2)+2, who, los(py, px, m_ptr->fy, m_ptr->fx))) return (FALSE);
#endif
break;
}
resists_tele = TRUE;
}
- else if (tr_ptr->level > randint(100))
+ else if (tr_ptr->level > randint1(100))
{
if (see_t)
{
}
}
- dam = (r_ptr->flags2 & RF2_POWERFUL) ? (randint(rlev * 2) + 180) : (randint(rlev * 3 / 2) + 120);
+ dam = (r_ptr->flags2 & RF2_POWERFUL) ? (randint1(rlev * 2) + 180) : (randint1(rlev * 3 / 2) + 120);
monst_beam_monst(m_idx, y, x, GF_PSY_SPEAR,
dam, MS_PSY_SPEAR, learnable);
break;
if(m_ptr->r_idx == MON_ROLENTO)
{
- int num = 1 + randint(3);
+ int num = 1 + randint1(3);
for (k = 0; k < num; k++)
{
count += summon_named_creature(y, x, MON_SHURYUUDAN, FALSE, FALSE, is_friendly(m_ptr), pet);
}
else if(m_ptr->r_idx == MON_LOUSY)
{
- int num = 2 + randint(3);
+ int num = 2 + randint1(3);
for (k = 0; k < num; k++)
{
count += summon_specific(m_idx, y, x, rlev, SUMMON_LOUSE, TRUE, friendly, pet, FALSE, FALSE);
}
else if(m_ptr->r_idx == MON_BULLGATES)
{
- int num = 2 + randint(3);
+ int num = 2 + randint1(3);
for (k = 0; k < num; k++)
{
count += summon_named_creature(y, x, 921, FALSE, FALSE, is_friendly(m_ptr), FALSE);
}
else if (m_ptr->r_idx == MON_CALDARM)
{
- int num = randint(3);
+ int num = randint1(3);
for (k = 0; k < num; k++)
{
count += summon_named_creature(y, x, 930, FALSE, FALSE, is_friendly(m_ptr), FALSE);
}
else if (m_ptr->r_idx == MON_SERPENT || m_ptr->r_idx == MON_ZOMBI_SERPENT)
{
- int num = 2 + randint(3);
+ int num = 2 + randint1(3);
for (k = 0; k < num; k++)
{
count += summon_specific(m_idx, y, x, rlev, SUMMON_GUARDIANS, TRUE, friendly, pet, TRUE, FALSE);
{
int dir;
int plev = pseudo_plev();
- int summon_lev = p_ptr->lev * 2 / 3 + randint(p_ptr->lev/2);
+ int summon_lev = p_ptr->lev * 2 / 3 + randint1(p_ptr->lev/2);
int hp = p_ptr->chp;
int damage = 0;
bool unique_okay = FALSE;
bool not_pet = (bool)(!pet);
bool no_trump = FALSE;
- if (!success || (randint(50+plev) < plev/10)) unique_okay = TRUE;
+ if (!success || (randint1(50+plev) < plev/10)) unique_okay = TRUE;
/* spell code */
switch (spell)
#else
else msg_print("You cast an acid ball.");
#endif
- damage = randint(plev * 6) + 15;
+ damage = randint1(plev * 6) + 15;
fire_ball(GF_ACID, dir, damage, 2);
break;
case MS_BALL_ELEC:
#else
else msg_print("You cast a lightning ball.");
#endif
- damage = randint(plev * 3) + 8;
+ damage = randint1(plev * 3) + 8;
fire_ball(GF_ELEC, dir, damage, 2);
break;
case MS_BALL_FIRE:
#else
else msg_print("You cast a fire ball.");
#endif
- damage = randint(plev * 7) + 10;
+ damage = randint1(plev * 7) + 10;
fire_ball(GF_FIRE, dir, damage, 2);
break;
case MS_BALL_COLD:
#else
else msg_print("You cast a frost ball.");
#endif
- damage = randint(plev * 3) + 10;
+ damage = randint1(plev * 3) + 10;
fire_ball(GF_COLD, dir, damage, 2);
break;
case MS_BALL_POIS:
#else
else msg_print("You gesture fluidly.");
#endif
- damage = randint(plev * 4) + 50;
+ damage = randint1(plev * 4) + 50;
fire_ball(GF_WATER, dir, damage, 4);
break;
case MS_BALL_MANA:
break;
case MS_DRAIN_MANA:
if (!get_aim_dir(&dir)) return FALSE;
- fire_ball_hide(GF_DRAIN_MANA, dir, randint(plev)+plev, 0);
+ fire_ball_hide(GF_DRAIN_MANA, dir, randint1(plev)+plev, 0);
break;
case MS_MIND_BLAST:
if (!get_aim_dir(&dir)) return FALSE;
#else
else msg_print("You cast a mana bolt.");
#endif
- damage = randint(plev * 7) + 50;
+ damage = randint1(plev * 7) + 50;
fire_bolt(GF_MANA, dir, damage);
break;
case MS_BOLT_PLASMA:
sleep_monster(dir);
break;
case MS_SPEED:
- (void)set_fast(randint(20 + plev) + plev, FALSE);
+ (void)set_fast(randint1(20 + plev) + plev, FALSE);
break;
case MS_HAND_DOOM:
{
#else
msg_print("You cast a Globe of Invulnerability.");
#endif
- (void)set_invuln(randint(4) + 4, FALSE);
+ (void)set_invuln(randint1(4) + 4, FALSE);
break;
case MS_BLINK:
teleport_player(10);
#endif
msg_print(NULL);
- p_ptr->energy += (randint(200)+1200);
+ p_ptr->energy += (randint1(200)+1200);
/* Redraw map */
p_ptr->redraw |= (PR_MAP);
break;
}
- else if (r_ptr->level > randint(100))
+ else if (r_ptr->level > randint1(100))
{
r_ptr->r_flags3 |= RF3_RES_TELE;
#ifdef JP
msg_format("You gesture at %s's feet.", m_name);
#endif
- if ((r_ptr->flags3 & RF3_RES_TELE) || (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint(50) > plev + randint(60)))
+ if ((r_ptr->flags3 & RF3_RES_TELE) || (r_ptr->flags1 & RF1_QUESTOR) || (r_ptr->level + randint1(50) > plev + randint1(60)))
{
#ifdef JP
msg_print("¤·¤«¤·¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª");
#else
else msg_print("You throw a psycho-spear.");
#endif
- damage = randint(plev * 3) + 100;
+ damage = randint1(plev * 3) + 100;
(void)fire_beam(GF_PSY_SPEAR, dir, damage);
break;
case MS_DARKNESS:
chance = MAX(chance,0);
/* Failed spell */
- if (rand_int(100) < chance)
+ if (randint0(100) < chance)
{
if (flush_failure) flush();
#ifdef JP
/* Hack -- Bypass free action */
- (void)set_paralyzed(p_ptr->paralyzed + randint(5 * oops + 1));
+ (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
chg_virtue(V_KNOWLEDGE, -10);
/* Damage CON (possibly permanently) */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
- bool perm = (rand_int(100) < 25);
+ bool perm = (randint0(100) < 25);
/* Message */
#ifdef JP
/* Reduce constitution */
- (void)dec_stat(A_CON, 15 + randint(10), perm);
+ (void)dec_stat(A_CON, 15 + randint1(10), perm);
}
}
if (p_ptr->action != ACTION_LEARN) return;
if (p_ptr->magic_num2[monspell]) return;
if (p_ptr->confused || p_ptr->blind || p_ptr->image || p_ptr->stun || p_ptr->paralyzed) return;
- if (randint(p_ptr->lev + 70) > monster_powers[monspell].level + 40)
+ if (randint1(p_ptr->lev + 70) > monster_powers[monspell].level + 40)
{
p_ptr->magic_num2[monspell] = 1;
#ifdef JP
while (attempts_left--)
{
- switch (choose_mut ? choose_mut : (p_ptr->pclass == CLASS_BERSERKER ? 74+randint(119) : randint(193)))
+ switch (choose_mut ? choose_mut : (p_ptr->pclass == CLASS_BERSERKER ? 74+randint1(119) : randint1(193)))
{
case 1: case 2: case 3: case 4:
muta_class = &(p_ptr->muta1);
if (p_ptr->prace == RACE_VAMPIRE &&
!(p_ptr->muta1 & MUT1_HYPN_GAZE) &&
- (randint(10) < 7))
+ (randint1(10) < 7))
{
muta_class = &(p_ptr->muta1);
muta_which = MUT1_HYPN_GAZE;
else if (p_ptr->prace == RACE_IMP &&
!(p_ptr->muta2 & MUT2_HORNS) &&
- (randint(10) < 7))
+ (randint1(10) < 7))
{
muta_class = &(p_ptr->muta2);
muta_which = MUT2_HORNS;
else if (p_ptr->prace == RACE_YEEK &&
!(p_ptr->muta1 & MUT1_SHRIEK) &&
- (randint(10) < 7))
+ (randint1(10) < 7))
{
muta_class = &(p_ptr->muta1);
muta_which = MUT1_SHRIEK;
else if (p_ptr->prace == RACE_BEASTMAN &&
!(p_ptr->muta1 & MUT1_POLYMORPH) &&
- (randint(10) < 2))
+ (randint1(10) < 2))
{
muta_class = &(p_ptr->muta1);
muta_which = MUT1_POLYMORPH;
else if (p_ptr->prace == RACE_MIND_FLAYER &&
!(p_ptr->muta2 & MUT2_TENTACLES) &&
- (randint(10) < 7))
+ (randint1(10) < 7))
{
muta_class = &(p_ptr->muta2);
muta_which = MUT2_TENTACLES;
while (attempts_left--)
{
- switch (choose_mut ? choose_mut : randint(193))
+ switch (choose_mut ? choose_mut : randint1(193))
{
case 1: case 2: case 3: case 4:
muta_class = &(p_ptr->muta1);
case MUT1_BERSERK:
if (racial_aux(8, 8, A_STR, 14))
{
- (void)set_shero(randint(25) + 25, FALSE);
+ (void)set_shero(randint1(25) + 25, FALSE);
(void)hp_player(30);
(void)set_afraid(0);
}
if (racial_aux(10, 12, A_CON, 12))
{
int num = lvl / 10;
- int dur = randint(20) + 20;
+ int dur = randint1(20) + 20;
- if (rand_int(5) < num)
+ if (randint0(5) < num)
{
(void)set_oppose_acid(dur, FALSE);
num--;
}
- if (rand_int(4) < num)
+ if (randint0(4) < num)
{
(void)set_oppose_elec(dur, FALSE);
num--;
}
- if (rand_int(3) < num)
+ if (randint0(3) < num)
{
(void)set_oppose_fire(dur, FALSE);
num--;
}
- if (rand_int(2) < num)
+ if (randint0(2) < num)
{
(void)set_oppose_cold(dur, FALSE);
num--;
/* Fake a population explosion. */
#ifdef JP
msg_print("ÆÍÁ³Æ¬¤¬Äˤ¯¤Ê¤Ã¤¿¡ª");
-take_hit(DAMAGE_LOSELIFE, randint(17) + 17, "¶ØÍߤò¶¯¤¤¤¿ÈèÏ«", -1);
+take_hit(DAMAGE_LOSELIFE, randint1(17) + 17, "¶ØÍߤò¶¯¤¤¤¿ÈèÏ«", -1);
#else
msg_print("You suddenly have a headache!");
- take_hit(DAMAGE_LOSELIFE, randint(17) + 17, "the strain of forcing abstinence", -1);
+ take_hit(DAMAGE_LOSELIFE, randint1(17) + 17, "the strain of forcing abstinence", -1);
#endif
num_repro += MAX_REPRO;
if (cave[y][x].m_idx)
{
py_attack(y, x, 0);
- if (rand_int(p_ptr->skill_dis) < 7)
+ if (randint0(p_ptr->skill_dis) < 7)
#ifdef JP
msg_print("¤¦¤Þ¤¯Æ¨¤²¤é¤ì¤Ê¤«¤Ã¤¿¡£");
#else
!(r_ptr->flags1 & RF1_QUESTOR) &&
!(r_ptr->flags1 & RF1_UNIQUE) &&
!p_ptr->inside_arena && !p_ptr->inside_quest &&
- (r_ptr->level < randint(p_ptr->lev+50)) &&
+ (r_ptr->level < randint1(p_ptr->lev+50)) &&
!(m_ptr->mflag2 & MFLAG_NOGENO))
{
/* Delete the monster, rather than killing it. */
x = m_ptr->fx;
/* Monsters protect their objects */
- if (rand_int(100) < 90) continue;
+ if (randint0(100) < 90) continue;
}
/* Dungeon */
(cnt < 1000)) chance = 100;
/* Apply the saving throw */
- if (rand_int(100) < chance) continue;
+ if (randint0(100) < chance) continue;
/* Delete the object */
delete_object_idx(i);
if (one_in_(GREAT_OBJ))
{
/* What a bizarre calculation */
- level = 1 + (level * MAX_DEPTH / randint(MAX_DEPTH));
+ level = 1 + (level * MAX_DEPTH / randint1(MAX_DEPTH));
}
}
/* Pick an object */
- value = rand_int(total);
+ value = randint0(total);
/* Find the object */
for (i = 0; i < alloc_kind_size; i++)
/* Power boost */
- p = rand_int(100);
+ p = randint0(100);
/* Try for a "better" object once (50%) or twice (10%) */
if (p < 60)
j = i;
/* Pick a object */
- value = rand_int(total);
+ value = randint0(total);
/* Find the object */
for (i = 0; i < alloc_kind_size; i++)
j = i;
/* Pick a object */
- value = rand_int(total);
+ value = randint0(total);
/* Find the object */
for (i = 0; i < alloc_kind_size; i++)
extra = ((max * level) % MAX_DEPTH);
/* Hack -- simulate floating point computations */
- if (rand_int(MAX_DEPTH) < extra) bonus++;
+ if (randint0(MAX_DEPTH) < extra) bonus++;
/* The "stand" is equal to one quarter of the max */
extra = (max % 4);
/* Hack -- simulate floating point computations */
- if (rand_int(4) < extra) stand++;
+ if (randint0(4) < extra) stand++;
/* Choose an "interesting" value */
}
}
- value = randint(total);
+ value = randint1(total);
for (i = 1; i < max_e_idx; i++)
{
*/
static void a_m_aux_1(object_type *o_ptr, int level, int power)
{
- int tohit1 = randint(5) + m_bonus(5, level);
- int todam1 = randint(5) + m_bonus(5, level);
+ int tohit1 = randint1(5) + m_bonus(5, level);
+ int todam1 = randint1(5) + m_bonus(5, level);
int tohit2 = m_bonus(10, level);
int todam2 = m_bonus(10, level);
else if (power < -1)
{
/* Hack -- Horrible digging bonus */
- o_ptr->pval = 0 - (5 + randint(5));
+ o_ptr->pval = 0 - (5 + randint1(5));
}
/* Bad */
case EGO_DF:
if (one_in_(3))
o_ptr->art_flags2 |= TR2_RES_POIS;
- random_resistance(o_ptr, FALSE, randint(22)+16);
+ random_resistance(o_ptr, FALSE, randint1(22)+16);
break;
case EGO_SLAY_DRAGON:
- random_resistance(o_ptr, FALSE, randint(12) + 4);
+ random_resistance(o_ptr, FALSE, randint1(12) + 4);
break;
case EGO_KILL_DRAGON:
- random_resistance(o_ptr, FALSE, randint(12) + 4);
+ random_resistance(o_ptr, FALSE, randint1(12) + 4);
if (one_in_(3))
o_ptr->art_flags2 |= TR2_RES_POIS;
- random_resistance(o_ptr, FALSE, randint(14) + 4);
+ random_resistance(o_ptr, FALSE, randint1(14) + 4);
case EGO_WEST:
if (one_in_(3))
o_ptr->art_flags2 |= TR2_RES_FEAR;
break;
case EGO_CHAOTIC:
- random_resistance(o_ptr, FALSE, (randint(34) + 4));
+ random_resistance(o_ptr, FALSE, (randint1(34) + 4));
break;
case EGO_SLAYING_WEAPON:
if (one_in_(3)) /* double damage */
}
break;
case EGO_TRUMP:
- random_resistance(o_ptr, FALSE, (randint(22) + 16));
+ random_resistance(o_ptr, FALSE, (randint1(22) + 16));
if (one_in_(5))
o_ptr->art_flags1 |= TR1_SLAY_DEMON;
break;
o_ptr->art_flags1 |= TR1_DEX;
if (one_in_(5))
o_ptr->art_flags2 |= TR2_RES_FEAR;
- random_resistance(o_ptr, FALSE, (randint(22) + 16));
+ random_resistance(o_ptr, FALSE, (randint1(22) + 16));
break;
case EGO_SHARPNESS:
o_ptr->pval = m_bonus(5, level) + 1;
else if (power < -1)
{
/* Roll for ego-item */
- if (rand_int(MAX_DEPTH) < level)
+ if (randint0(MAX_DEPTH) < level)
{
o_ptr->name2 = get_random_ego(INVEN_RARM, FALSE, level);
switch (o_ptr->name2)
else if (power < -1)
{
/* Roll for ego-item */
- if (rand_int(MAX_DEPTH) < level)
+ if (randint0(MAX_DEPTH) < level)
{
o_ptr->name2 = get_random_ego(INVEN_AMMO, FALSE, level);
}
artifact_bias = 0;
if (one_in_(4))
- random_resistance(o_ptr, FALSE, (randint(14) + 4));
+ random_resistance(o_ptr, FALSE, (randint1(14) + 4));
else
- random_resistance(o_ptr, FALSE, (randint(22) + 16));
+ random_resistance(o_ptr, FALSE, (randint1(22) + 16));
}
while (one_in_(2));
}
*/
static void a_m_aux_2(object_type *o_ptr, int level, int power)
{
- int toac1 = randint(5) + m_bonus(5, level);
+ int toac1 = randint1(5) + m_bonus(5, level);
int toac2 = m_bonus(10, level);
/* Hack -- Try for "Robes of the Magi" */
if ((o_ptr->tval == TV_SOFT_ARMOR) &&
(o_ptr->sval == SV_ROBE) &&
- (rand_int(100) < 15))
+ (randint0(100) < 15))
{
if (one_in_(5))
{
case EGO_RESISTANCE:
if (one_in_(4))
o_ptr->art_flags2 |= TR2_RES_POIS;
- random_resistance(o_ptr, FALSE, (randint(22) + 16));
+ random_resistance(o_ptr, FALSE, (randint1(22) + 16));
break;
case EGO_DWARVEN:
if (o_ptr->tval != TV_HARD_ARMOR)
switch (o_ptr->name2)
{
case EGO_ENDURANCE:
- random_resistance(o_ptr, FALSE, (randint(34) + 4));
+ random_resistance(o_ptr, FALSE, (randint1(34) + 4));
if (one_in_(4)) o_ptr->art_flags2 |= TR2_RES_POIS;
break;
case EGO_REFLECTION:
switch (o_ptr->name2)
{
case EGO_POWER:
- random_resistance(o_ptr, FALSE, (randint(22) + 16));
+ random_resistance(o_ptr, FALSE, (randint1(22) + 16));
break;
}
}
case EGO_SLOW_DESCENT:
if (one_in_(2))
{
- random_resistance(o_ptr, FALSE, (randint(22) + 16));
+ random_resistance(o_ptr, FALSE, (randint1(22) + 16));
}
break;
}
switch (o_ptr->name2)
{
case EGO_MAGI:
- random_resistance(o_ptr, FALSE, (randint(22) + 16));
+ random_resistance(o_ptr, FALSE, (randint1(22) + 16));
break;
case EGO_MIGHT:
- random_resistance(o_ptr, FALSE, (randint(22) + 16));
+ random_resistance(o_ptr, FALSE, (randint1(22) + 16));
break;
case EGO_TELEPATHY:
case EGO_REGENERATION:
break;
case EGO_LORDLINESS:
- random_resistance(o_ptr, FALSE, (randint(22) + 16));
+ random_resistance(o_ptr, FALSE, (randint1(22) + 16));
break;
case EGO_SEEING:
if (one_in_(3)) o_ptr->art_flags3 |= TR3_TELEPATHY;
case TV_CLOAK:
{
if (o_ptr->sval == SV_ELVEN_CLOAK)
- o_ptr->pval = randint(4); /* No cursed elven cloaks...? */
+ o_ptr->pval = randint1(4); /* No cursed elven cloaks...? */
/* Very good */
if (power > 1)
case SV_RING_SPEED:
{
/* Base speed (1 to 10) */
- o_ptr->pval = randint(5) + m_bonus(5, level);
+ o_ptr->pval = randint1(5) + m_bonus(5, level);
/* Super-charge the ring */
- while (rand_int(100) < 50) o_ptr->pval++;
+ while (randint0(100) < 50) o_ptr->pval++;
/* Cursed Ring */
if (power < 0)
{
do
{
- random_resistance(o_ptr, FALSE, randint(20) + 18);
+ random_resistance(o_ptr, FALSE, randint1(20) + 18);
}
while (one_in_(4));
/* Bonus to armor class */
- o_ptr->to_a = 10 + randint(5) + m_bonus(10, level);
+ o_ptr->to_a = 10 + randint1(5) + m_bonus(10, level);
rating += 15;
}
break;
case SV_RING_ELEC:
{
/* Bonus to armor class */
- o_ptr->to_a = 5 + randint(5) + m_bonus(10, level);
+ o_ptr->to_a = 5 + randint1(5) + m_bonus(10, level);
break;
}
case SV_RING_DAMAGE:
{
/* Bonus to damage */
- o_ptr->to_d = 1 + randint(5) + m_bonus(16, level);
+ o_ptr->to_d = 1 + randint1(5) + m_bonus(16, level);
/* Cursed */
if (power < 0)
case SV_RING_ACCURACY:
{
/* Bonus to hit */
- o_ptr->to_h = 1 + randint(5) + m_bonus(16, level);
+ o_ptr->to_h = 1 + randint1(5) + m_bonus(16, level);
/* Cursed */
if (power < 0)
case SV_RING_PROTECTION:
{
/* Bonus to armor class */
- o_ptr->to_a = 5 + randint(8) + m_bonus(10, level);
+ o_ptr->to_a = 5 + randint1(8) + m_bonus(10, level);
/* Cursed */
if (power < 0)
case SV_RING_SLAYING:
{
/* Bonus to damage and to hit */
- o_ptr->to_d = randint(5) + m_bonus(12, level);
- o_ptr->to_h = randint(5) + m_bonus(12, level);
+ o_ptr->to_d = randint1(5) + m_bonus(12, level);
+ o_ptr->to_h = randint1(5) + m_bonus(12, level);
/* Cursed */
if (power < 0)
{
int tmp = m_bonus(10, level);
object_kind *k_ptr = &k_info[o_ptr->k_idx];
- switch(randint(28))
+ switch(randint1(28))
{
case 1: case 2:
o_ptr->name2 = EGO_RING_THROW;
else
{
o_ptr->name2 = EGO_RING_BERSERKER;
- o_ptr->to_h -= 2+randint(4);
+ o_ptr->to_h -= 2+randint1(4);
}
break;
case SV_RING_PROTECTION:
break;
case SV_RING_LORDLY:
if (!one_in_(20)) break;
- random_resistance(o_ptr, FALSE, randint(20) + 18);
- random_resistance(o_ptr, FALSE, randint(20) + 18);
+ random_resistance(o_ptr, FALSE, randint1(20) + 18);
+ random_resistance(o_ptr, FALSE, randint1(20) + 18);
o_ptr->name2 = EGO_RING_TRUE;
break;
case SV_RING_SUSTAIN:
while(!o_ptr->name2)
{
object_kind *k_ptr = &k_info[o_ptr->k_idx];
- switch(randint(5))
+ switch(randint1(5))
{
case 1:
if (k_ptr->flags3 & TR3_DRAIN_EXP) break;
case SV_AMULET_RESISTANCE:
{
- if (one_in_(3)) random_resistance(o_ptr, FALSE, (randint(34) + 4));
+ if (one_in_(3)) random_resistance(o_ptr, FALSE, (randint1(34) + 4));
if (one_in_(5)) o_ptr->art_flags2 |= TR2_RES_POIS;
}
break;
/* Amulet of searching */
case SV_AMULET_SEARCHING:
{
- o_ptr->pval = randint(2) + m_bonus(4, level);
+ o_ptr->pval = randint1(2) + m_bonus(4, level);
/* Cursed */
if (power < 0)
/* Amulet of the Magi -- never cursed */
case SV_AMULET_THE_MAGI:
{
- o_ptr->pval = randint(5) + m_bonus(5, level);
- o_ptr->to_a = randint(5) + m_bonus(5, level);
+ o_ptr->pval = randint1(5) + m_bonus(5, level);
+ o_ptr->to_a = randint1(5) + m_bonus(5, level);
/* Boost the rating */
rating += 15;
o_ptr->ident |= (IDENT_CURSED);
/* Penalize */
- o_ptr->pval = 0 - (randint(5) + m_bonus(5, level));
- o_ptr->to_a = 0 - (randint(5) + m_bonus(5, level));
+ o_ptr->pval = 0 - (randint1(5) + m_bonus(5, level));
+ o_ptr->to_a = 0 - (randint1(5) + m_bonus(5, level));
if (power > 0) power = 0 - power;
break;
while(!o_ptr->name2)
{
object_kind *k_ptr = &k_info[o_ptr->k_idx];
- switch(randint(21))
+ switch(randint1(21))
{
case 1: case 2:
if (k_ptr->flags3 & TR3_SLOW_DIGEST) break;
while(!o_ptr->name2)
{
object_kind *k_ptr = &k_info[o_ptr->k_idx];
- switch(randint(5))
+ switch(randint1(5))
{
case 1:
if (k_ptr->flags3 & TR3_DRAIN_EXP) break;
/* Hack -- Torches -- random fuel */
if (o_ptr->sval == SV_LITE_TORCH)
{
- if (o_ptr->pval > 0) o_ptr->xtra4 = randint(o_ptr->pval);
+ if (o_ptr->pval > 0) o_ptr->xtra4 = randint1(o_ptr->pval);
o_ptr->pval = 0;
}
/* Hack -- Lanterns -- random fuel */
if (o_ptr->sval == SV_LITE_LANTERN)
{
- if (o_ptr->pval > 0) o_ptr->xtra4 = randint(o_ptr->pval);
+ if (o_ptr->pval > 0) o_ptr->xtra4 = randint1(o_ptr->pval);
o_ptr->pval = 0;
}
/* The wand or staff gets a number of initial charges equal
* to between 1/2 (+1) and the full object kind's pval. -LM-
*/
- o_ptr->pval = k_ptr->pval / 2 + randint((k_ptr->pval + 1) / 2);
+ o_ptr->pval = k_ptr->pval / 2 + randint1((k_ptr->pval + 1) / 2);
break;
}
/* Pick a random non-unique monster race */
while (1)
{
- i = randint(max_r_idx - 1);
+ i = randint1(max_r_idx - 1);
if (!item_monster_okay(i)) continue;
if (i == MON_TSUCHINOKO) continue;
if (!r_ptr->rarity) continue;
/* Prefer less out-of-depth monsters */
- if (rand_int(check)) continue;
+ if (randint0(check)) continue;
break;
}
if (!(r_ptr->flags9 & match)) continue;
/* Prefer less out-of-depth monsters */
- if (rand_int(check)) continue;
+ if (randint0(check)) continue;
break;
}
/* Pick a random monster race */
while (1)
{
- i = randint(max_r_idx - 1);
+ i = randint1(max_r_idx - 1);
r_ptr = &r_info[i];
if (obj_level <= 0) break;
/* Hack -- pick a "difficulty" */
- o_ptr->pval = randint(obj_level);
+ o_ptr->pval = randint1(obj_level);
if (o_ptr->sval == SV_CHEST_KANDUME) o_ptr->pval = 6;
o_ptr->xtra3 = dun_level + 5;
/* Never exceed "difficulty" of 55 to 59 */
- if (o_ptr->pval > 55) o_ptr->pval = 55 + (byte)rand_int(5);
+ if (o_ptr->pval > 55) o_ptr->pval = 55 + (byte)randint0(5);
break;
}
int i, rolls, f1, f2, power;
- if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) lev += rand_int(p_ptr->lev/2+10);
+ if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) lev += randint0(p_ptr->lev/2+10);
/* Maximum "level" for various things */
if (lev > MAX_DEPTH - 1) lev = MAX_DEPTH - 1;
case TV_RING:
case TV_AMULET:
{
- if (!power && (rand_int(100) < 50)) power = -1;
+ if (!power && (randint0(100) < 50)) power = -1;
a_m_aux_3(o_ptr, lev, power);
break;
}
/* Randomize the "xtra" power */
if (o_ptr->xtra1 && !o_ptr->art_name)
- o_ptr->xtra2 = randint(256);
+ o_ptr->xtra2 = randint1(256);
/* Hack -- acquire "broken" flag */
if (!e_ptr->cost) o_ptr->ident |= (IDENT_BROKEN);
if (cursed_p(o_ptr) || broken_p(o_ptr))
{
/* Hack -- obtain bonuses */
- if (e_ptr->max_to_h) o_ptr->to_h -= randint(e_ptr->max_to_h);
- if (e_ptr->max_to_d) o_ptr->to_d -= randint(e_ptr->max_to_d);
- if (e_ptr->max_to_a) o_ptr->to_a -= randint(e_ptr->max_to_a);
+ if (e_ptr->max_to_h) o_ptr->to_h -= randint1(e_ptr->max_to_h);
+ if (e_ptr->max_to_d) o_ptr->to_d -= randint1(e_ptr->max_to_d);
+ if (e_ptr->max_to_a) o_ptr->to_a -= randint1(e_ptr->max_to_a);
/* Hack -- obtain pval */
- if (e_ptr->max_pval) o_ptr->pval -= randint(e_ptr->max_pval);
+ if (e_ptr->max_pval) o_ptr->pval -= randint1(e_ptr->max_pval);
}
/* Hack -- apply extra bonuses if needed */
if (e_ptr->max_to_h)
{
if (e_ptr->max_to_h > 127)
- o_ptr->to_h -= randint(256-e_ptr->max_to_h);
- else o_ptr->to_h += randint(e_ptr->max_to_h);
+ o_ptr->to_h -= randint1(256-e_ptr->max_to_h);
+ else o_ptr->to_h += randint1(e_ptr->max_to_h);
}
if (e_ptr->max_to_d)
{
if (e_ptr->max_to_d > 127)
- o_ptr->to_d -= randint(256-e_ptr->max_to_d);
- else o_ptr->to_d += randint(e_ptr->max_to_d);
+ o_ptr->to_d -= randint1(256-e_ptr->max_to_d);
+ else o_ptr->to_d += randint1(e_ptr->max_to_d);
}
if (e_ptr->max_to_a)
{
if (e_ptr->max_to_a > 127)
- o_ptr->to_a -= randint(256-e_ptr->max_to_a);
- else o_ptr->to_a += randint(e_ptr->max_to_a);
+ o_ptr->to_a -= randint1(256-e_ptr->max_to_a);
+ else o_ptr->to_a += randint1(e_ptr->max_to_a);
}
/* Hack -- obtain pval */
}
else if (o_ptr->name2 == EGO_ATTACKS)
{
- o_ptr->pval = randint(e_ptr->max_pval*lev/100+1);
+ o_ptr->pval = randint1(e_ptr->max_pval*lev/100+1);
if (o_ptr->pval > 3) o_ptr->pval = 3;
if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA))
- o_ptr->pval += randint(2);
+ o_ptr->pval += randint1(2);
}
else if (o_ptr->name2 == EGO_BAT)
{
- o_ptr->pval = randint(e_ptr->max_pval);
- if (o_ptr->sval == SV_ELVEN_CLOAK) o_ptr->pval += randint(2);
+ o_ptr->pval = randint1(e_ptr->max_pval);
+ if (o_ptr->sval == SV_ELVEN_CLOAK) o_ptr->pval += randint1(2);
}
else
{
- o_ptr->pval += randint(e_ptr->max_pval);
+ o_ptr->pval += randint1(e_ptr->max_pval);
}
}
if ((o_ptr->name2 == EGO_SPEED) && (lev < 50))
{
- o_ptr->pval = randint(o_ptr->pval);
+ o_ptr->pval = randint1(o_ptr->pval);
}
if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2) && (o_ptr->name2 != EGO_ATTACKS))
o_ptr->pval = 2;
/* Hack -- Pick a Treasure variety */
- i = ((randint(object_level + 2) + 2) / 2) - 1;
+ i = ((randint1(object_level + 2) + 2) / 2) - 1;
/* Apply "extra" magic */
if (one_in_(GREAT_OBJ))
{
- i += randint(object_level + 1);
+ i += randint1(object_level + 1);
}
/* Hack -- Creeping Coins only generate "themselves" */
base = k_info[OBJ_GOLD_LIST+i].cost;
/* Determine how much the treasure is "worth" */
- j_ptr->pval = (base + (8L * randint(base)) + randint(8));
+ j_ptr->pval = (base + (8L * randint1(base)) + randint1(8));
/* Success */
return (TRUE);
/* Handle normal "breakage" */
- if (!(j_ptr->art_name || artifact_p(j_ptr)) && (rand_int(100) < chance))
+ if (!(j_ptr->art_name || artifact_p(j_ptr)) && (randint0(100) < chance))
{
/* Message */
#ifdef JP
/* Random locations */
else
{
- ty = rand_int(cur_hgt);
- tx = rand_int(cur_wid);
+ ty = randint0(cur_hgt);
+ tx = randint0(cur_wid);
}
/* Grid */
while (1)
{
/* Hack -- pick a trap */
- feat = trap_num[rand_int(MAX_TRAPS)];
+ feat = trap_num[randint0(MAX_TRAPS)];
/* Accept non-trapdoors */
if (feat != FEAT_TRAP_TRAPDOOR) break;
}
/* Choice one of them */
- return (&inventory[choices[rand_int(number)]]);
+ return (&inventory[choices[randint0(number)]]);
}
/* Examine the grid (xx,yy) and warn the player if there are any danger */
#endif
return;
}
- get_to_h = ((val+1)/2+rand_int(val/2+1));
- get_to_d = ((val+1)/2+rand_int(val/2+1));
+ get_to_h = ((val+1)/2+randint0(val/2+1));
+ get_to_d = ((val+1)/2+randint0(val/2+1));
o_ptr->xtra4 = (get_to_h<<8)+get_to_d;
o_ptr->to_h += get_to_h;
o_ptr->to_d += get_to_d;
if (p_ptr->magic_num2[o_ptr->sval + ext])
{
gain_num *= 256;
- gain_num = (gain_num/3 + rand_int(gain_num/3)) / 256;
+ gain_num = (gain_num/3 + randint0(gain_num/3)) / 256;
if (gain_num < 1) gain_num = 1;
}
p_ptr->magic_num2[o_ptr->sval + ext] += gain_num;
if (use_hp)
{
#ifdef JP
- take_hit(DAMAGE_USELIFE, (cost / 2) + randint(cost / 2),
+ take_hit(DAMAGE_USELIFE, (cost / 2) + randint1(cost / 2),
"²áÅ٤ν¸Ãæ", -1);
#else
- take_hit(DAMAGE_USELIFE, (cost / 2) + randint(cost / 2),
+ take_hit(DAMAGE_USELIFE, (cost / 2) + randint1(cost / 2),
"concentrating too hard", -1);
#endif
}
else
{
- p_ptr->csp -= (cost / 2) + randint(cost / 2);
+ p_ptr->csp -= (cost / 2) + randint1(cost / 2);
}
}
p_ptr->window |= (PW_PLAYER | PW_SPELL);
/* Success? */
- if (randint(p_ptr->stat_cur[use_stat]) >=
- ((difficulty / 2) + randint(difficulty / 2)))
+ if (randint1(p_ptr->stat_cur[use_stat]) >=
+ ((difficulty / 2) + randint1(difficulty / 2)))
{
return TRUE;
}
for (i = 0; i < 6; i++)
{
- dir = rand_int(8);
+ dir = randint0(8);
y = py + ddy_ddd[dir];
x = px + ddx_ddd[dir];
c_ptr = &cave[y][x];
if (cave[y][x].m_idx)
{
py_attack(y, x, 0);
- if (rand_int(p_ptr->skill_dis) < 7)
+ if (randint0(p_ptr->skill_dis) < 7)
#ifdef JP
msg_print("¤¦¤Þ¤¯Æ¨¤²¤é¤ì¤Ê¤«¤Ã¤¿¡£");
#else
rlev = r_ptr->level;
if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
if (rlev > 60) rlev = 60+(rlev-60)/2;
- if ((randint(skill_exp[GINOU_RIDING]/120+p_ptr->lev*2/3) > rlev) && one_in_(2) && !p_ptr->inside_arena && !p_ptr->inside_battle && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR)) && (rlev < p_ptr->lev*3/2+rand_int(p_ptr->lev/5)))
+ if ((randint1(skill_exp[GINOU_RIDING]/120+p_ptr->lev*2/3) > rlev) && one_in_(2) && !p_ptr->inside_arena && !p_ptr->inside_battle && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR)) && (rlev < p_ptr->lev*3/2+randint0(p_ptr->lev/5)))
{
#ifdef JP
msg_format("%s¤ò¼ê¤Ê¤º¤±¤¿¡£",m_name);
msg_print("You grin and bare your fangs...");
#endif
- dummy = plev + randint(plev) * MAX(1, plev / 10); /* Dmg */
+ dummy = plev + randint1(plev) * MAX(1, plev / 10); /* Dmg */
if (drain_life(dir, dummy))
{
if (p_ptr->food < PY_FOOD_FULL)
(void)set_afraid(0);
- (void)set_shero(10 + randint(plev), FALSE);
+ (void)set_shero(10 + randint1(plev), FALSE);
(void)hp_player(30);
}
break;
(void)set_afraid(0);
- (void)set_shero(10 + randint(plev), FALSE);
+ (void)set_shero(10 + randint1(plev), FALSE);
(void)hp_player(30);
}
break;
#endif
- if (randint(100) < plev)
+ if (randint1(100) < plev)
{
switch (p_ptr->pclass)
{
case RACE_GOLEM:
if (racial_aux(20, 15, A_CON, 8))
{
- (void)set_shield(randint(20) + 30, FALSE);
+ (void)set_shield(randint1(20) + 30, FALSE);
}
break;
msg_print("You grin and bare your fangs...");
#endif
- dummy = plev + randint(plev) * MAX(1, plev / 10); /* Dmg */
+ dummy = plev + randint1(plev) * MAX(1, plev / 10); /* Dmg */
if (drain_life(dir, dummy))
{
if (p_ptr->food < PY_FOOD_FULL)
case RACE_KUTA:
if (racial_aux(20, 15, A_CHR, 8))
{
- (void)set_tsubureru(randint(20) + 30, FALSE);
+ (void)set_tsubureru(randint1(20) + 30, FALSE);
}
break;
}
else
{
- set_cave_feat(y, x, FEAT_DOOR_HEAD+randint(7));
+ set_cave_feat(y, x, FEAT_DOOR_HEAD+randint1(7));
cave[y][x].info &= ~(CAVE_FLOOR);
}
}
}
/* Place a secret door on one side */
- switch (rand_int(4))
+ switch (randint0(4))
{
case 0: place_secret_door(y0, x0 - 1); break;
case 1: place_secret_door(y0, x0 + 1); break;
cave_type *c_ptr;
/* Pick a room size */
- y1 = randint(4);
- x1 = randint(11);
- y2 = randint(3);
- x2 = randint(11);
+ y1 = randint1(4);
+ x1 = randint1(11);
+ y2 = randint1(3);
+ x2 = randint1(11);
xsize = x1 + x2 + 1;
ysize = y1 + y2 + 1;
if (!room_alloc(xsize + 2, ysize + 2, FALSE, by0, bx0, &xval, &yval)) return;
/* Choose lite or dark */
- light = ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+ light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
/* Get corner values */
/* Hack -- Occasional divided room */
else if (one_in_(50))
{
- if (randint(100) < 50)
+ if (randint1(100) < 50)
{
/* Horizontal wall */
for (x = x1; x <= x2; x++)
if (!room_alloc(25, 11, FALSE, by0, bx0, &xval, &yval)) return;
/* Choose lite or dark */
- light = ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+ light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
/* Determine extents of the first room */
- y1a = yval - randint(4);
- y2a = yval + randint(3);
- x1a = xval - randint(11);
- x2a = xval + randint(10);
+ y1a = yval - randint1(4);
+ y2a = yval + randint1(3);
+ x1a = xval - randint1(11);
+ x2a = xval + randint1(10);
/* Determine extents of the second room */
- y1b = yval - randint(3);
- y2b = yval + randint(4);
- x1b = xval - randint(10);
- x2b = xval + randint(11);
+ y1b = yval - randint1(3);
+ y2b = yval + randint1(4);
+ x1b = xval - randint1(10);
+ x2b = xval + randint1(11);
/* Place a full floor for room "a" */
if (!room_alloc(25, 11, FALSE, by0, bx0, &xval, &yval)) return;
/* Choose lite or dark */
- light = ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+ light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
/* For now, always 3x3 */
wx = wy = 1;
/* Special features (3/4) */
- switch (rand_int(4))
+ switch (randint0(4))
{
/* Large solid middle pillar */
case 1:
}
/* Place a secret door on the inner room */
- switch (rand_int(4))
+ switch (randint0(4))
{
case 0: place_secret_door(y1b, xval); break;
case 1: place_secret_door(y2b, xval); break;
place_object(yval, xval, FALSE, FALSE);
/* Let's guard the treasure well */
- vault_monsters(yval, xval, rand_int(2) + 3);
+ vault_monsters(yval, xval, randint0(2) + 3);
/* Traps naturally */
- vault_traps(yval, xval, 4, 4, rand_int(3) + 2);
+ vault_traps(yval, xval, 4, 4, randint0(3) + 2);
break;
}
if (!room_alloc(25, 11, FALSE, by0, bx0, &xval, &yval)) return;
/* Choose lite or dark */
- light = ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+ light = ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
/* Large room */
y1 = yval - 4;
/* Inner room variations */
- switch (randint(5))
+ switch (randint1(5))
{
/* Just an inner room with a monster */
case 1:
{
/* Place a secret door */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_secret_door(y1 - 1, xval); break;
case 2: place_secret_door(y2 + 1, xval); break;
case 2:
{
/* Place a secret door */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_secret_door(y1 - 1, xval); break;
case 2: place_secret_door(y2 + 1, xval); break;
}
/* Place a locked door on the inner room */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_locked_door(yval - 1, xval); break;
case 2: place_locked_door(yval + 1, xval); break;
}
/* Monsters to guard the "treasure" */
- vault_monsters(yval, xval, randint(3) + 2);
+ vault_monsters(yval, xval, randint1(3) + 2);
/* Object (80%) */
- if (rand_int(100) < 80)
+ if (randint0(100) < 80)
{
place_object(yval, xval, FALSE, FALSE);
}
}
/* Traps to protect the treasure */
- vault_traps(yval, xval, 4, 10, 2 + randint(3));
+ vault_traps(yval, xval, 4, 10, 2 + randint1(3));
break;
}
case 3:
{
/* Place a secret door */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_secret_door(y1 - 1, xval); break;
case 2: place_secret_door(y2 + 1, xval); break;
/* Occasionally, two more Large Inner Pillars */
if (one_in_(2))
{
- tmp = randint(2);
+ tmp = randint1(2);
for (y = yval - 1; y <= yval + 1; y++)
{
for (x = xval - 5 - tmp; x <= xval - 3 - tmp; x++)
place_inner_grid(c_ptr);
/* Secret doors (random top/bottom) */
- place_secret_door(yval - 3 + (randint(2) * 2), xval - 3);
- place_secret_door(yval - 3 + (randint(2) * 2), xval + 3);
+ place_secret_door(yval - 3 + (randint1(2) * 2), xval - 3);
+ place_secret_door(yval - 3 + (randint1(2) * 2), xval + 3);
/* Monsters */
- vault_monsters(yval, xval - 2, randint(2));
- vault_monsters(yval, xval + 2, randint(2));
+ vault_monsters(yval, xval - 2, randint1(2));
+ vault_monsters(yval, xval + 2, randint1(2));
/* Objects */
if (one_in_(3)) place_object(yval, xval - 2, FALSE, FALSE);
case 4:
{
/* Place a secret door */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_secret_door(y1 - 1, xval); break;
case 2: place_secret_door(y2 + 1, xval); break;
}
/* Monsters just love mazes. */
- vault_monsters(yval, xval - 5, randint(3));
- vault_monsters(yval, xval + 5, randint(3));
+ vault_monsters(yval, xval - 5, randint1(3));
+ vault_monsters(yval, xval + 5, randint1(3));
/* Traps make them entertaining. */
- vault_traps(yval, xval - 3, 2, 8, randint(3));
- vault_traps(yval, xval + 3, 2, 8, randint(3));
+ vault_traps(yval, xval - 3, 2, 8, randint1(3));
+ vault_traps(yval, xval + 3, 2, 8, randint1(3));
/* Mazes should have some treasure too. */
vault_objects(yval, xval, 3);
}
/* Doors into the rooms */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
- int i = randint(10);
+ int i = randint1(10);
place_secret_door(y1 - 1, xval - i);
place_secret_door(y1 - 1, xval + i);
place_secret_door(y2 + 1, xval - i);
}
else
{
- int i = randint(3);
+ int i = randint1(3);
place_secret_door(yval + i, x1 - 1);
place_secret_door(yval - i, x1 - 1);
place_secret_door(yval + i, x2 + 1);
}
/* Treasure, centered at the center of the cross */
- vault_objects(yval, xval, 2 + randint(2));
+ vault_objects(yval, xval, 2 + randint1(2));
/* Gotta have some monsters. */
- vault_monsters(yval + 1, xval - 4, randint(4));
- vault_monsters(yval + 1, xval + 4, randint(4));
- vault_monsters(yval - 1, xval - 4, randint(4));
- vault_monsters(yval - 1, xval + 4, randint(4));
+ vault_monsters(yval + 1, xval - 4, randint1(4));
+ vault_monsters(yval + 1, xval + 4, randint1(4));
+ vault_monsters(yval - 1, xval - 4, randint1(4));
+ vault_monsters(yval - 1, xval + 4, randint1(4));
break;
}
static void vault_prep_dragon(void)
{
/* Pick dragon type */
- switch (rand_int(6))
+ switch (randint0(6))
{
/* Black */
case 0:
}
/* Pick a random type */
- tmp = rand_int(total);
+ tmp = randint0(total);
/* Find this type */
for (n_ptr = l_ptr, total = 0, count = 0; TRUE; n_ptr++, count++)
/* Place a secret door */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_secret_door(y1 - 1, xval); break;
case 2: place_secret_door(y2 + 1, xval); break;
rating += 10;
/* (Sometimes) Cause a "special feeling" (for "Monster Nests") */
- if ((dun_level <= 40) && (randint(dun_level * dun_level + 50) < 300))
+ if ((dun_level <= 40) && (randint1(dun_level * dun_level + 50) < 300))
{
good_item_flag = TRUE;
}
{
for (x = xval - 9; x <= xval + 9; x++)
{
- int r_idx = what[rand_int(64)];
+ int r_idx = what[randint0(64)];
/* Place that "random" monster (no groups) */
(void)place_monster_aux(y, x, r_idx, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
}
/* Place a secret door */
- switch (randint(4))
+ switch (randint1(4))
{
case 1: place_secret_door(y1 - 1, xval); break;
case 2: place_secret_door(y2 + 1, xval); break;
rating += 10;
/* (Sometimes) Cause a "special feeling" (for "Monster Pits") */
- if ((dun_level <= 40) && (randint(dun_level * dun_level + 50) < 300))
+ if ((dun_level <= 40) && (randint1(dun_level * dun_level + 50) < 300))
{
good_item_flag = TRUE;
}
/* Treasure/trap */
case '*':
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
{
place_object(y, x, FALSE, FALSE);
}
/* Monster and/or object */
case ',':
{
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
monster_level = base_level + 3;
place_monster(y, x, TRUE, TRUE);
monster_level = base_level;
}
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
object_level = base_level + 7;
place_object(y, x, FALSE, FALSE);
dummy++;
/* Access a random vault record */
- v_ptr = &v_info[rand_int(max_v_idx)];
+ v_ptr = &v_info[randint0(max_v_idx)];
/* Accept the first lesser vault */
if (v_ptr->typ == 7) break;
if (!v_ptr) return;
/* pick type of transformation (0-7) */
- transno = rand_int(8);
+ transno = randint0(8);
/* calculate offsets */
x = v_ptr->wid;
/* (Sometimes) Cause a special feeling */
if ((dun_level <= 50) ||
- (randint((dun_level - 40) * (dun_level - 40) + 50) < 400))
+ (randint1((dun_level - 40) * (dun_level - 40) + 50) < 400))
{
good_item_flag = TRUE;
}
dummy++;
/* Access a random vault record */
- v_ptr = &v_info[rand_int(max_v_idx)];
+ v_ptr = &v_info[randint0(max_v_idx)];
/* Accept the first greater vault */
if (v_ptr->typ == 8) break;
if (!v_ptr) return;
/* pick type of transformation (0-7) */
- transno = rand_int(8);
+ transno = randint0(8);
/* calculate offsets */
x = v_ptr->wid;
#ifdef FORCE_V_IDX
- v_ptr = &v_info[76 + randint(3)];
+ v_ptr = &v_info[76 + randint1(3)];
#endif
/* Message */
/* (Sometimes) Cause a special feeling */
if ((dun_level <= 50) ||
- (randint((dun_level - 40) * (dun_level - 40) + 50) < 400))
+ (randint1((dun_level - 40) * (dun_level - 40) + 50) < 400))
{
good_item_flag = TRUE;
}
if (xhstep2 > grd)
{
/* If greater than 'grid' level then is random */
- store_height(ii, jj, randint(maxsize));
+ store_height(ii, jj, randint1(maxsize));
}
else
{
store_height(ii, jj,
(cave[jj][fill_data.xmin + (i - xhstep) / 256].feat
+ cave[jj][fill_data.xmin + (i + xhstep) / 256].feat) / 2
- + (randint(xstep2) - xhstep2) * roug / 16);
+ + (randint1(xstep2) - xhstep2) * roug / 16);
}
}
}
if (xhstep2 > grd)
{
/* If greater than 'grid' level then is random */
- store_height(ii, jj, randint(maxsize));
+ store_height(ii, jj, randint1(maxsize));
}
else
{
store_height(ii, jj,
(cave[fill_data.ymin + (j - yhstep) / 256][ii].feat
+ cave[fill_data.ymin + (j + yhstep) / 256][ii].feat) / 2
- + (randint(ystep2) - yhstep2) * roug / 16);
+ + (randint1(ystep2) - yhstep2) * roug / 16);
}
}
}
if (xhstep2 > grd)
{
/* If greater than 'grid' level then is random */
- store_height(ii, jj, randint(maxsize));
+ store_height(ii, jj, randint1(maxsize));
}
else
{
store_height(ii, jj,
(cave[ym][xm].feat + cave[yp][xm].feat
+ cave[ym][xp].feat + cave[yp][xp].feat) / 4
- + (randint(xstep2) - xhstep2) * (diagsize / 16) / 256 * roug);
+ + (randint1(xstep2) - xhstep2) * (diagsize / 16) / 256 * roug);
}
}
}
if (cave[y][x].feat <= c1)
{
/* 25% of the time use the other tile : it looks better this way */
- if (randint(100) < 75)
+ if (randint1(100) < 75)
{
cave[y][x].feat = feat1;
cave[y][x].info &= ~(CAVE_MASK);
else if (cave[y][x].feat <= c2)
{
/* 25% of the time use the other tile : it looks better this way */
- if (randint(100) < 75)
+ if (randint1(100) < 75)
{
cave[y][x].feat = feat2;
cave[y][x].info &= ~(CAVE_MASK);
fill_data.c3 = 0;
/* features to fill with */
- fill_data.feat1 = floor_type[rand_int(100)];
- fill_data.feat2 = floor_type[rand_int(100)];
- fill_data.feat3 = floor_type[rand_int(100)];
+ fill_data.feat1 = floor_type[randint0(100)];
+ fill_data.feat2 = floor_type[randint0(100)];
+ fill_data.feat3 = floor_type[randint0(100)];
fill_data.info1 = CAVE_FLOOR;
fill_data.info2 = CAVE_FLOOR;
bool done, light, room;
/* get size: note 'Evenness'*/
- xsize = randint(22) * 2 + 6;
- ysize = randint(15) * 2 + 6;
+ xsize = randint1(22) * 2 + 6;
+ ysize = randint1(15) * 2 + 6;
/* Try to allocate space for room. If fails, exit */
if (!room_alloc(xsize + 1, ysize + 1, FALSE, by0, bx0, &x0, &y0)) return;
light = done = FALSE;
room = TRUE;
- if ((dun_level <= randint(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
+ if ((dun_level <= randint1(25)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
while (!done)
{
* This causes the tunnels not to connect properly to the room */
/* testing values for these parameters feel free to adjust */
- grd = 1 << (rand_int(4));
+ grd = 1 << (randint0(4));
/* want average of about 16 */
- roug = randint(8) * randint(4);
+ roug = randint1(8) * randint1(4);
/* about size/2 */
- cutoff = randint(xsize / 4) + randint(ysize / 4) +
- randint(xsize / 4) + randint(ysize / 4);
+ cutoff = randint1(xsize / 4) + randint1(ysize / 4) +
+ randint1(xsize / 4) + randint1(ysize / 4);
/* make it */
generate_hmap(y0, x0, xsize, ysize, grd, roug, cutoff);
bool done, light;
light = done = FALSE;
- if ((dun_level <= randint(50)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
+ if ((dun_level <= randint1(50)) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
/* Make a cave the size of the dungeon */
xsize = cur_wid - 1;
while (!done)
{
/* testing values for these parameters: feel free to adjust */
- grd = randint(4) + 4;
+ grd = randint1(4) + 4;
/* want average of about 16 */
- roug = randint(8) * randint(4);
+ roug = randint1(8) * randint1(4);
/* about size/2 */
cutoff = xsize / 2;
/* Lava */
feat1 = FEAT_DEEP_LAVA;
feat2 = FEAT_SHAL_LAVA;
- feat3 = floor_type[rand_int(100)];
+ feat3 = floor_type[randint0(100)];
}; break;
case 2:{
/* Water */
feat1 = FEAT_DEEP_WATER;
feat2 = FEAT_SHAL_WATER;
- feat3 = floor_type[rand_int(100)];
+ feat3 = floor_type[randint0(100)];
}; break;
case 3: {
/* Collapsed cave */
- feat1 = floor_type[rand_int(100)];
- feat2 = floor_type[rand_int(100)];
+ feat1 = floor_type[randint0(100)];
+ feat2 = floor_type[randint0(100)];
feat3 = FEAT_RUBBLE;
}; break;
case 4: {
/* Earth vault */
feat1 = FEAT_RUBBLE;
- feat2 = floor_type[rand_int(100)];
+ feat2 = floor_type[randint0(100)];
feat3 = FEAT_RUBBLE;
}; break;
case 5: {
while (!done)
{
/* testing values for these parameters: feel free to adjust */
- grd = randint(3) + 4;
+ grd = randint1(3) + 4;
/* want average of about 16 */
- roug = randint(8) * randint(4);
+ roug = randint1(8) * randint1(4);
/* Make up size of various componants */
/* Floor */
c3 = 3 * xsize / 4;
/* Deep water/lava */
- c1 = rand_int(c3 / 2) + rand_int(c3 / 2) - 5;
+ c1 = randint0(c3 / 2) + randint0(c3 / 2) - 5;
/* Shallow boundary */
c2 = (c1 + c3) / 2;
{
/* Thing added based on distance to center of vault
* Difficulty is 1-easy to 10-hard */
- value = ((((s32b)(distance(cx, cy, x, y))) * 100) / size) + randint(10) - difficulty;
+ value = ((((s32b)(distance(cx, cy, x, y))) * 100) / size) + randint1(10) - difficulty;
/* hack- empty square part of the time */
- if ((randint(100) - difficulty * 3) > 50) value = 20;
+ if ((randint1(100) - difficulty * 3) > 50) value = 20;
/* if floor, shallow water and lava */
if (is_floor_bold(y, x) ||
else if (value < 23)
{
/* Object or trap */
- if (rand_int(100) < 25)
+ if (randint0(100) < 25)
{
place_object(y, x, FALSE, FALSE);
}
else if (value < 40)
{
/* Monster or object */
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
monster_level = base_level + 3;
place_monster(y, x, TRUE, TRUE);
monster_level = base_level;
}
- if (rand_int(100) < 50)
+ if (randint0(100) < 50)
{
object_level = base_level + 7;
place_object(y, x, FALSE, FALSE);
/* Various Stuff */
/* 20% monster, 40% trap, 20% object, 20% blank space */
- if (rand_int(100) < 20)
+ if (randint0(100) < 20)
{
place_monster(y, x, TRUE, TRUE);
}
- else if (rand_int(100) < 50)
+ else if (randint0(100) < 50)
{
place_trap(y, x);
}
- else if (rand_int(100) < 50)
+ else if (randint0(100) < 50)
{
place_object(y, x, FALSE, FALSE);
}
if (cheat_room) msg_print("Bubble Vault");
/* Allocate center of bubbles */
- center[0].x = randint(xsize - 3) + 1;
- center[0].y = randint(ysize - 3) + 1;
+ center[0].x = randint1(xsize - 3) + 1;
+ center[0].y = randint1(ysize - 3) + 1;
for (i = 1; i < BUBBLENUM; i++)
{
{
done = TRUE;
- x = randint(xsize - 3) + 1;
- y = randint(ysize - 3) + 1;
+ x = randint1(xsize - 3) + 1;
+ y = randint1(ysize - 3) + 1;
for (j = 0; j < i; j++)
{
/* Try to add some random doors */
for (i = 0; i < 500; i++)
{
- x = randint(xsize - 3) - xhsize + x0 + 1;
- y = randint(ysize - 3) - yhsize + y0 + 1;
+ x = randint1(xsize - 3) - xhsize + x0 + 1;
+ y = randint1(ysize - 3) - yhsize + y0 + 1;
add_door(x, y);
}
/* Fill with monsters and treasure, low difficulty */
- fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint(5));
+ fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5));
}
/* add ten random rooms */
for (i = 0; i < 10; i++)
{
- x1 = randint(xhsize) * 2 + x0 - xhsize;
- x2 = randint(xhsize) * 2 + x0 - xhsize;
- y1 = randint(yhsize) * 2 + y0 - yhsize;
- y2 = randint(yhsize) * 2 + y0 - yhsize;
+ x1 = randint1(xhsize) * 2 + x0 - xhsize;
+ x2 = randint1(xhsize) * 2 + x0 - xhsize;
+ y1 = randint1(yhsize) * 2 + y0 - yhsize;
+ y2 = randint1(yhsize) * 2 + y0 - yhsize;
build_room(x1, x2, y1, y2);
}
/* Add some random doors */
for (i = 0; i < 500; i++)
{
- x1 = randint(xsize - 3) - xhsize + x0 + 1;
- y1 = randint(ysize - 3) - yhsize + y0 + 1;
+ x1 = randint1(xsize - 3) - xhsize + x0 + 1;
+ y1 = randint1(ysize - 3) - yhsize + y0 + 1;
add_door(x1, y1);
}
/* Fill with monsters and treasure, high difficulty */
- fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint(5) + 5);
+ fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 2, y0 - yhsize + 1, y0 - yhsize + ysize - 2, randint1(5) + 5);
}
while (!done)
{
/* testing values for these parameters feel free to adjust */
- grd = 1 << rand_int(4);
+ grd = 1 << randint0(4);
/* want average of about 16 */
- roug = randint(8) * randint(4);
+ roug = randint1(8) * randint1(4);
/* about size/2 */
- cutoff = randint(xsize / 4) + randint(ysize / 4) +
- randint(xsize / 4) + randint(ysize / 4);
+ cutoff = randint1(xsize / 4) + randint1(ysize / 4) +
+ randint1(xsize / 4) + randint1(ysize / 4);
/* make it */
generate_hmap(y0, x0, xsize, ysize, grd, roug, cutoff);
}
/* Fill with monsters and treasure, low difficulty */
- fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint(5));
+ fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 1, y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
}
/*
*
* The spanning tree is created by performing a suitably randomized
* depth-first traversal of the graph. The only adjustable parameter
- * is the rand_int(3) below; it governs the relative density of
+ * is the randint0(3) below; it governs the relative density of
* twists and turns in the labyrinth: smaller number, more twists.
*/
static void r_visit(int y1, int x1, int y2, int x2,
adj[i] = i;
for (i = 0; i < 4; i++)
{
- j = rand_int(4);
+ j = randint0(4);
temp = adj[i];
adj[i] = adj[j];
adj[j] = temp;
adj[i] = i;
for (i = 1; i < 4; i++)
{
- j = 1 + rand_int(3);
+ j = 1 + randint0(3);
temp = adj[i];
adj[i] = adj[j];
adj[j] = temp;
if (cheat_room && is_vault) msg_print("Maze Vault");
/* Choose lite or dark */
- light = ((dun_level <= randint(25)) && is_vault && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
+ light = ((dun_level <= randint1(25)) && is_vault && !(d_info[dungeon_type].flags1 & DF1_DARKNESS));
/* Pick a random room size - randomized by calling routine */
dy = ysize / 2 - 1;
visited[i] = 0;
/* traverse the graph to create a spaning tree, pick a random root */
- r_visit(y1, x1, y2, x2, rand_int(num_vertices), 0, visited);
+ r_visit(y1, x1, y2, x2, randint0(num_vertices), 0, visited);
/* Fill with monsters and treasure, low difficulty */
- if (is_vault) fill_treasure(x1, x2, y1, y2, randint(5));
+ if (is_vault) fill_treasure(x1, x2, y1, y2, randint1(5));
free(visited);
}
visited[i] = 0;
/* traverse the graph to create a spannng tree, pick a random root */
- r_visit(y1, x1, y2, x2, rand_int(num_vertices), 0, visited);
+ r_visit(y1, x1, y2, x2, randint0(num_vertices), 0, visited);
/* Make it look like a checker board vault */
for (x = x1; x <= x2; x++)
if (one_in_(2))
{
/* left and right */
- y = randint(dy) + dy / 2;
+ y = randint1(dy) + dy / 2;
place_outer_noperm_bold(y1 + y, x1 - 1);
place_outer_noperm_bold(y1 + y, x2 + 1);
}
else
{
/* top and bottom */
- x = randint(dx) + dx / 2;
+ x = randint1(dx) + dx / 2;
place_outer_noperm_bold(y1 - 1, x1 + x);
place_outer_noperm_bold(y2 + 1, x1 + x);
}
if (power < 10)
{
/* Make rooms + subdivide */
- if ((randint(10) > 2) && (xsize < 8) && (ysize < 8))
+ if ((randint1(10) > 2) && (xsize < 8) && (ysize < 8))
{
choice = 4;
}
else
{
- choice = randint(2) + 1;
+ choice = randint1(2) + 1;
}
}
else
{
/* Mostly subdivide */
- choice = randint(3) + 1;
+ choice = randint1(3) + 1;
}
}
if (one_in_(2))
{
/* left and right */
- y = randint(ysize) + y1;
+ y = randint1(ysize) + y1;
place_floor_bold(y, x1);
place_floor_bold(y, x2);
}
else
{
/* top and bottom */
- x = randint(xsize) + x1;
+ x = randint1(xsize) + x1;
place_floor_bold(y1, x);
place_floor_bold(y2, x);
}
/* Select size of keep */
- t1 = randint(ysize / 3) + y1;
- t2 = y2 - randint(ysize / 3);
- t3 = randint(xsize / 3) + x1;
- t4 = x2 - randint(xsize / 3);
+ t1 = randint1(ysize / 3) + y1;
+ t2 = y2 - randint1(ysize / 3);
+ t3 = randint1(xsize / 3) + x1;
+ t4 = x2 - randint1(xsize / 3);
/* Do outside areas */
}
/* Make a door */
- y = randint(ysize - 3) + y1 + 1;
+ y = randint1(ysize - 3) + y1 + 1;
if (one_in_(2))
{
return;
}
- t1 = randint(xsize - 2) + x1 + 1;
+ t1 = randint1(xsize - 2) + x1 + 1;
build_recursive_room(x1, y1, t1, y2, power - 2);
build_recursive_room(t1 + 1, y1, x2, y2, power - 2);
break;
return;
}
- t1 = randint(ysize - 2) + y1 + 1;
+ t1 = randint1(ysize - 2) + y1 + 1;
build_recursive_room(x1, y1, x2, t1, power - 2);
build_recursive_room(x1, t1 + 1, x2, y2, power - 2);
break;
}
/* Make the castle */
- build_recursive_room(x1, y1, x2, y2, randint(5));
+ build_recursive_room(x1, y1, x2, y2, randint1(5));
/* Fill with monsters and treasure, low difficulty */
- fill_treasure(x1, x2, y1, y2, randint(3));
+ fill_treasure(x1, x2, y1, y2, randint1(3));
}
/* Make a random metric */
int h1, h2, h3, h4;
- h1 = randint(32) - 16;
- h2 = randint(16);
- h3 = randint(32);
- h4 = randint(32) - 16;
+ h1 = randint1(32) - 16;
+ h2 = randint1(16);
+ h3 = randint1(32);
+ h4 = randint1(32) - 16;
if (cheat_room) msg_print("Target Vault");
add_door(x0, y0 - y);
/* Fill with stuff - medium difficulty */
- fill_treasure(x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint(3) + 3);
+ fill_treasure(x0 - rad, x0 + rad, y0 - rad, y0 + rad, randint1(3) + 3);
}
while (!done)
{
/* testing values for these parameters: feel free to adjust */
- grd = 1 << (rand_int(3));
+ grd = 1 << (randint0(3));
/* want average of about 16 */
- roug = randint(8) * randint(4);
+ roug = randint1(8) * randint1(4);
/* Make up size of various componants */
/* Floor */
c3 = 2 * xsize / 3;
/* Deep water/lava */
- c1 = rand_int(c3 / 2) + rand_int(c3 / 2) - 5;
+ c1 = randint0(c3 / 2) + randint0(c3 / 2) - 5;
/* Shallow boundary */
c2 = (c1 + c3) / 2;
/* make a few rooms in the vault */
for (i = 1; i <= (xsize * ysize) / 50; i++)
{
- build_small_room(x0 + rand_int(xsize - 4) - xsize / 2 + 2,
- y0 + rand_int(ysize - 4) - ysize / 2 + 2);
+ build_small_room(x0 + randint0(xsize - 4) - xsize / 2 + 2,
+ y0 + randint0(ysize - 4) - ysize / 2 + 2);
}
/* Fill with monsters and treasure, low difficulty */
fill_treasure(x0 - xhsize + 1, x0 - xhsize + xsize - 1,
- y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint(5));
+ y0 - yhsize + 1, y0 - yhsize + ysize - 1, randint1(5));
}
#endif /* ALLOW_CAVERNS_AND_LAKES */
/* Get size */
/* big enough to look good, small enough to be fairly common. */
- xsize = randint(22) + 22;
- ysize = randint(11) + 11;
+ xsize = randint1(22) + 22;
+ ysize = randint1(11) + 11;
/* Allocate in room_map. If will not fit, exit */
if (!room_alloc(xsize + 1, ysize + 1, FALSE, by0, bx0, &x0, &y0)) return;
/* (Sometimes) Cause a special feeling */
if ((dun_level <= 50) ||
- (randint((dun_level - 40) * (dun_level - 40) + 1) < 400))
+ (randint1((dun_level - 40) * (dun_level - 40) + 1) < 400))
{
good_item_flag = TRUE;
}
/* Select type of vault */
#ifdef ALLOW_CAVERNS_AND_LAKES
- vtype = randint(15);
+ vtype = randint1(15);
#else /* ALLOW_CAVERNS_AND_LAKES */
- vtype = randint(7);
+ vtype = randint1(7);
#endif /* ALLOW_CAVERNS_AND_LAKES */
switch (vtype)
int light = FALSE;
/* Occasional light */
- if ((randint(dun_level) <= 15) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
+ if ((randint1(dun_level) <= 15) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
- rad = rand_int(9);
+ rad = randint0(9);
/* Allocate in room_map. If will not fit, exit */
if (!room_alloc(rad * 2 + 1, rad * 2 + 1, FALSE, by0, bx0, &x0, &y0)) return;
/* Make a random metric */
int h1, h2, h3, h4;
- h1 = randint(32) - 16;
- h2 = randint(16);
- h3 = randint(32);
- h4 = randint(32) - 16;
+ h1 = randint1(32) - 16;
+ h2 = randint1(16);
+ h3 = randint1(32);
+ h4 = randint1(32) - 16;
/* Occasional light */
- if ((randint(dun_level) <= 5) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
+ if ((randint1(dun_level) <= 5) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS)) light = TRUE;
- rad = randint(9);
+ rad = randint1(9);
/* Allocate in room_map. If will not fit, exit */
if (!room_alloc(rad * 2 + 3, rad * 2 + 3, FALSE, by0, bx0, &x0, &y0)) return;
place_object(y0, x0, FALSE, FALSE);
/* Let's guard the treasure well */
- vault_monsters(y0, x0, rand_int(2) + 3);
+ vault_monsters(y0, x0, randint0(2) + 3);
/* Traps naturally */
- vault_traps(y0, x0, 4, 4, rand_int(3) + 2);
+ vault_traps(y0, x0, 4, 4, randint0(3) + 2);
}
}
wr_byte(FAKE_VER_PATCH);
xor_byte = 0;
- tmp8u = (byte)rand_int(256);
+ tmp8u = (byte)randint0(256);
wr_byte(tmp8u);
}
if( mirror_num )
{
- num=rand_int(mirror_num);
+ num=randint0(mirror_num);
*next_y=mirror_y[num];
*next_x=mirror_x[num];
return;
}
- *next_y=rand_int(cur_hgt);
- *next_x=rand_int(cur_wid);
+ *next_y=randint0(cur_hgt);
+ *next_x=randint0(cur_wid);
return;
}
*/
static byte mh_attr(int max)
{
- switch (randint(max))
+ switch (randint1(max))
{
case 1: return (TERM_RED);
case 2: return (TERM_GREEN);
if (!s) return (TERM_WHITE);
/* Pick a random color */
- c = s[rand_int(strlen(s))];
+ c = s[randint0(strlen(s))];
/* Lookup this color */
a = strchr(color_char, c) - color_char;
if (c_ptr->info & CAVE_TRAP) c_ptr->info &= ~(CAVE_TRAP);
else
{
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
}
if (c_ptr->info & CAVE_TRAP) c_ptr->info &= ~(CAVE_TRAP);
else
{
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
}
c_ptr->info &= ~(CAVE_MARK);
/* Destroy the wall */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
}
c_ptr->info &= ~(CAVE_MARK);
/* Destroy the wall */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
c_ptr->info &= ~(CAVE_MARK);
/* Destroy the wall */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
}
c_ptr->info &= ~(CAVE_MARK);
/* Destroy the rubble */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
/* Hack -- place an object */
- if (rand_int(100) < 10)
+ if (randint0(100) < 10)
{
/* Found something */
if (player_can_see_bold(y, x))
c_ptr->info &= ~(CAVE_MARK);
/* Destroy the feature */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
}
bool pet = (!who || is_pet(&m_list[who]));
for (i = 0; i < o_ptr->number ; i++)
{
- if (((o_ptr->sval == SV_CORPSE) && (randint(100) > 80)) ||
- ((o_ptr->sval == SV_SKELETON) && (randint(100) > 60)))
+ if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
+ ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
{
if (!note_kill)
{
* and hurts evil less. If can breath nether, then it resists it as well.
*
* Damage reductions use the following formulas:
- * Note that "dam = dam * 6 / (randint(6) + 6);"
+ * Note that "dam = dam * 6 / (randint1(6) + 6);"
* gives avg damage of .655, ranging from .858 to .500
- * Note that "dam = dam * 5 / (randint(6) + 6);"
+ * Note that "dam = dam * 5 / (randint1(6) + 6);"
* gives avg damage of .544, ranging from .714 to .417
- * Note that "dam = dam * 4 / (randint(6) + 6);"
+ * Note that "dam = dam * 4 / (randint1(6) + 6);"
* gives avg damage of .444, ranging from .556 to .333
- * Note that "dam = dam * 3 / (randint(6) + 6);"
+ * Note that "dam = dam * 3 / (randint1(6) + 6);"
* gives avg damage of .327, ranging from .427 to .250
- * Note that "dam = dam * 2 / (randint(6) + 6);"
+ * Note that "dam = dam * 2 / (randint1(6) + 6);"
* gives something simple.
*
* In this function, "result" messages are postponed until the end, where
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
if (seen) r_ptr->r_flags3 |= (RF3_IM_POIS);
}
else if (one_in_(3)) do_poly = TRUE;
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
}
break;
}
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
if (seen)
r_ptr->r_flags3 |= (RF3_RES_PLAS);
}
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
if (seen) r_ptr->r_flags3 |= (RF3_RES_NETH);
}
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
if (seen) r_ptr->r_flags3 |= (RF3_RES_WATE);
}
break;
break;
}
do_poly = TRUE;
- do_conf = (5 + randint(11) + r) / (r + 1);
+ do_conf = (5 + randint1(11) + r) / (r + 1);
if ((r_ptr->flags4 & RF4_BR_CHAO) ||
(m_ptr->r_idx == MON_STORMBRINGER) ||
((r_ptr->flags3 & RF3_DEMON) && one_in_(3)))
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
do_poly = FALSE;
}
break;
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
}
break;
}
if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
break;
}
- do_stun = (10 + randint(15) + r) / (r + 1);
+ do_stun = (10 + randint1(15) + r) / (r + 1);
if (r_ptr->flags4 & RF4_BR_SOUN)
{
#ifdef JP
note = " resists.";
#endif
- dam *= 2; dam /= randint(6) + 6;
+ dam *= 2; dam /= randint1(6) + 6;
}
break;
}
if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
break;
}
- do_conf = (10 + randint(15) + r) / (r + 1);
+ do_conf = (10 + randint1(15) + r) / (r + 1);
if (r_ptr->flags4 & RF4_BR_CONF)
{
#ifdef JP
note = " resists.";
#endif
- dam *= 2; dam /= randint(6) + 6;
+ dam *= 2; dam /= randint1(6) + 6;
}
else if (r_ptr->flags3 & RF3_NO_CONF)
{
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
if (seen) r_ptr->r_flags3 |= (RF3_RES_DISE);
}
break;
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
if (seen) r_ptr->r_flags3 |= (RF3_RES_NEXU);
}
break;
if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
break;
}
- do_stun = (randint(15) + r) / (r + 1);
+ do_stun = (randint1(15) + r) / (r + 1);
if (r_ptr->flags4 & RF4_BR_WALL)
{
#ifdef JP
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
}
break;
}
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
}
else
{
/* Powerful monsters can resist */
if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
obvious = FALSE;
}
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
}
else do_time = (dam+1)/2;
break;
resist_tele = TRUE;
}
- else if (r_ptr->level > randint(100))
+ else if (r_ptr->level > randint1(100))
{
if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
#ifdef JP
note = " resists.";
#endif
- dam *= 3; dam /= randint(6) + 6;
+ dam *= 3; dam /= randint1(6) + 6;
do_dist = 0;
}
else
/* 1. slowness */
/* Powerful monsters can resist */
if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
obvious = FALSE;
}
/* Attempt a saving throw */
if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
/* Resist */
do_stun = 0;
else if ((r_ptr->flags2 & RF2_STUPID) ||
(r_ptr->flags2 & RF2_WEIRD_MIND) ||
(r_ptr->flags3 & RF3_ANIMAL) ||
- (r_ptr->level > randint(3 * dam)))
+ (r_ptr->level > randint1(3 * dam)))
{
dam /= 3;
#ifdef JP
#endif
/* Saving throw */
- if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
+ if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
if (one_in_(4))
{
- switch (randint(4))
+ switch (randint1(4))
{
case 1:
- set_confused(p_ptr->confused + 3 + randint(dam));
+ set_confused(p_ptr->confused + 3 + randint1(dam));
break;
case 2:
- set_stun(p_ptr->stun + randint(dam));
+ set_stun(p_ptr->stun + randint1(dam));
break;
case 3:
{
#endif
else
- set_afraid(p_ptr->afraid + 3 + randint(dam));
+ set_afraid(p_ptr->afraid + 3 + randint1(dam));
break;
}
default:
if (!p_ptr->free_act)
- (void)set_paralyzed(p_ptr->paralyzed + randint(dam));
+ (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
break;
}
}
if ((dam > 0) && one_in_(4))
{
- switch (randint(4))
+ switch (randint1(4))
{
case 1:
- do_conf = 3 + randint(dam);
+ do_conf = 3 + randint1(dam);
break;
case 2:
- do_stun = 3 + randint(dam);
+ do_stun = 3 + randint1(dam);
break;
case 3:
- do_fear = 3 + randint(dam);
+ do_fear = 3 + randint1(dam);
break;
default:
#ifdef JP
note = " falls asleep!";
#endif
- do_sleep = 3 + randint(dam);
+ do_sleep = 3 + randint1(dam);
break;
}
}
else if ((r_ptr->flags2 & RF2_STUPID) ||
(r_ptr->flags2 & RF2_WEIRD_MIND) ||
(r_ptr->flags3 & RF3_ANIMAL) ||
- (r_ptr->level > randint(3 * dam)))
+ (r_ptr->level > randint1(3 * dam)))
{
dam /= 3;
#ifdef JP
#endif
/* Saving throw */
- if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
+ if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤¢¤Ê¤¿¤Ï¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
/* Attempt a saving throw */
if ((r_ptr->flags1 & RF1_UNIQUE) ||
- (r_ptr->level > 5 + randint(dam)))
+ (r_ptr->level > 5 + randint1(dam)))
{
/* Resist */
do_stun = 0;
if ((r_ptr->flags1 & RF1_UNIQUE) ||
(r_ptr->flags1 & RF1_QUESTOR) ||
(r_ptr->flags3 & RF3_NO_CONF) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
/* Memorize a flag */
if (r_ptr->flags3 & RF3_NO_CONF)
#endif
/* Saving throw */
- if (rand_int(100 + r_ptr->level/2) < p_ptr->skill_sav)
+ if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
else
{
/* Confuse, stun, terrify */
- switch (randint(4))
+ switch (randint1(4))
{
case 1:
set_stun(p_ptr->stun + dam / 2);
}
else
{
- if ((dam > 29) && (randint(100) < dam))
+ if ((dam > 29) && (randint1(100) < dam))
{
#ifdef JP
note = "¤¬¤¢¤Ê¤¿¤ËÎì°¤·¤¿¡£";
}
else
{
- switch (randint(4))
+ switch (randint1(4))
{
case 1:
do_stun = dam / 2;
if (seen) r_ptr->r_flags3 |= (RF3_RES_ALL);
break;
}
- do_stun = (randint(15) + 1) / (r + 1);
+ do_stun = (randint1(15) + 1) / (r + 1);
if (r_ptr->flags3 & RF3_IM_COLD)
{
#ifdef JP
dam = 0;
}
else if (((r_ptr->flags1 & RF1_UNIQUE) &&
- (randint(888) != 666)) ||
- (((r_ptr->level + randint(20)) > randint(p_ptr->lev + randint(10))) &&
- randint(100) != 66))
+ (randint1(888) != 666)) ||
+ (((r_ptr->level + randint1(20)) > randint1(p_ptr->lev + randint1(10))) &&
+ randint1(100) != 66))
{
#ifdef JP
note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡ª";
/* Powerful monsters can resist */
if ((r_ptr->flags1 & RF1_UNIQUE) ||
(r_ptr->flags1 & RF1_QUESTOR) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
#ifdef JP
note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡£";
}
/* Powerful monsters can resist */
if ((r_ptr->flags1 & RF1_UNIQUE) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
#ifdef JP
note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
/* Attempt a saving throw */
if ((r_ptr->flags1 & RF1_UNIQUE) ||
(r_ptr->flags3 & RF3_NO_SLEEP) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
/* Memorize a flag */
if (r_ptr->flags3 & RF3_NO_SLEEP)
}
/* Attempt a saving throw */
if ((r_ptr->flags1 & RF1_UNIQUE) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
#ifdef JP
note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
if ((r_ptr->flags1 & RF1_QUESTOR) ||
(r_ptr->flags3 & RF3_NO_CONF) ||
(m_ptr->mflag2 & MFLAG_NOPET) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 5))
{
/* Memorize a flag */
if (r_ptr->flags3 & RF3_NO_CONF)
if ((r_ptr->flags1 & RF1_QUESTOR) ||
(!(r_ptr->flags3 & RF3_UNDEAD)) ||
(m_ptr->mflag2 & MFLAG_NOPET) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
/* No obvious effect */
#ifdef JP
if ((r_ptr->flags1 & RF1_QUESTOR) ||
(!(r_ptr->flags3 & RF3_DEMON)) ||
(m_ptr->mflag2 & MFLAG_NOPET) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
/* No obvious effect */
#ifdef JP
(!(r_ptr->flags3 & (RF3_ANIMAL))) ||
(m_ptr->mflag2 & MFLAG_NOPET) ||
(r_ptr->flags3 & (RF3_NO_CONF)) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
/* Memorize a flag */
if (r_ptr->flags3 & (RF3_NO_CONF))
if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
(m_ptr->mflag2 & MFLAG_NOPET) ||
(r_ptr->flags3 & (RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING)) ||
- ((r_ptr->level+10) > randint(dam)))
+ ((r_ptr->level+10) > randint1(dam)))
{
/* Resist */
/* No obvious effect */
/* Attempt a saving throw */
if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
(r_ptr->flags3 & (RF3_NO_CONF)) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
/* Memorize a flag */
if (r_ptr->flags3 & (RF3_NO_CONF))
/* Attempt a saving throw */
if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
/* Resist */
do_stun = 0;
note = " resists.";
#endif
- dam *= 2; dam /= (randint(6)+6);
+ dam *= 2; dam /= (randint1(6)+6);
}
else if (r_ptr->flags3 & (RF3_HURT_LITE))
{
note = " resists.";
#endif
- dam *= 2; dam /= (randint(6)+6);
+ dam *= 2; dam /= (randint1(6)+6);
}
break;
}
resists_tele = TRUE;
}
- else if (r_ptr->level > randint(100))
+ else if (r_ptr->level > randint1(100))
{
if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
#ifdef JP
resists_tele = TRUE;
}
- else if (r_ptr->level > randint(100))
+ else if (r_ptr->level > randint1(100))
{
if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
#ifdef JP
resists_tele = TRUE;
}
- else if (r_ptr->level > randint(100))
+ else if (r_ptr->level > randint1(100))
{
if (seen) r_ptr->r_flags3 |= RF3_RES_TELE;
#ifdef JP
do_fear = damroll(3, (dam / 2)) + 1;
/* Attempt a saving throw */
- if (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
+ if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
{
/* No obvious effect */
#ifdef JP
do_fear = damroll(3, (dam / 2)) + 1;
/* Attempt a saving throw */
- if (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
+ if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
{
/* No obvious effect */
#ifdef JP
/* Attempt a saving throw */
if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
(r_ptr->flags3 & (RF3_NO_FEAR)) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
/* No obvious effect */
#ifdef JP
/* Attempt a saving throw */
if ((r_ptr->flags1 & RF1_UNIQUE) ||
(r_ptr->flags3 & RF3_NO_CONF) ||
- (r_ptr->level > randint((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
+ (r_ptr->level > randint1((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
{
/* Memorize a flag */
if (r_ptr->flags3 & (RF3_NO_CONF))
note_dies = " collapses, a mindless husk.";
#endif
- do_conf = rand_int(8) + 8;
+ do_conf = randint0(8) + 8;
}
break;
}
/* Attempt a saving throw */
if ((r_ptr->flags1 & RF1_UNIQUE) ||
(r_ptr->flags3 & RF3_NO_CONF) ||
- (r_ptr->level > randint((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
+ (r_ptr->level > randint1((p_ptr->lev*2 - 10) < 1 ? 1 : (p_ptr->lev*2 - 10)) + 10))
{
/* Memorize a flag */
if (r_ptr->flags3 & (RF3_NO_CONF))
note_dies = " collapses, a mindless husk.";
#endif
- do_conf = rand_int(8) + 8;
- do_stun = rand_int(8) + 8;
+ do_conf = randint0(8) + 8;
+ do_stun = randint0(8) + 8;
m_ptr->slow = MIN(200, m_ptr->slow + 10);
if (c_ptr->m_idx == p_ptr->riding)
p_ptr->update |= (PU_BONUS);
}
/* Attempt a saving throw */
- if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
+ if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
{
#ifdef JP
}
/* Attempt a saving throw */
- if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
+ if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
{
#ifdef JP
}
/* Attempt a saving throw */
- if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
+ if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
{
#ifdef JP
}
/* Attempt a saving throw */
- if (rand_int(100 + p_ptr->lev) < (r_ptr->level + 35))
+ if (randint0(100 + p_ptr->lev) < (r_ptr->level + 35))
{
#ifdef JP
}
else
{
- if ((p_ptr->lev + randint(dam)) >
- (r_ptr->level + randint(200)))
+ if ((p_ptr->lev + randint1(dam)) >
+ (r_ptr->level + randint1(200)))
{
- dam = ((40 + randint(20)) * m_ptr->hp) / 100;
+ dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
}
#endif
skipped = TRUE;
}
- else if (m_ptr->hp < rand_int(nokori_hp))
+ else if (m_ptr->hp < randint0(nokori_hp))
{
if (m_ptr->mflag2 & MFLAG_CHAMELEON) choose_new_monster(c_ptr->m_idx, FALSE, MON_CHAMELEON);
#ifdef JP
{
/* Powerful monsters can resist */
if ((r_ptr->flags1 & RF1_UNIQUE) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
#ifdef JP
note = "¤Ë¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª";
/* Attempt a saving throw */
if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
/* Resist */
do_stun = 0;
/* Attempt a saving throw */
if ((r_ptr->flags1 & RF1_UNIQUE) ||
(r_ptr->flags3 & RF3_NO_SLEEP) ||
- (r_ptr->level > randint((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
+ (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
{
/* Memorize a flag */
if (r_ptr->flags3 & RF3_NO_SLEEP)
}
else
{
- if ((r_ptr->level > rand_int(dam)) || (m_ptr->mflag2 & MFLAG_NOGENO))
+ if ((r_ptr->level > randint0(dam)) || (m_ptr->mflag2 & MFLAG_NOGENO))
{
dam = 0;
angry = TRUE;
#endif
#ifdef JP
- take_hit(DAMAGE_GENO, randint((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+ take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "¥â¥ó¥¹¥¿¡¼¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
#else
- take_hit(DAMAGE_GENO, randint((r_ptr->level+1)/2), "the strain of casting Genocide One", -1);
+ take_hit(DAMAGE_GENO, randint1((r_ptr->level+1)/2), "the strain of casting Genocide One", -1);
#endif
dam = 0;
}
/* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
- else if (do_poly && (randint(90) > r_ptr->level))
+ else if (do_poly && (randint1(90) > r_ptr->level))
{
if (polymorph_monster(y, x))
{
int count = 0;
do
{
- switch (randint(28))
+ switch (randint1(28))
{
case 1: case 2:
if (!count)
msg_print("The ground trembles...");
#endif
- earthquake(ty, tx, 4 + rand_int(4));
+ earthquake(ty, tx, 4 + randint0(4));
if (!one_in_(6)) break;
}
case 3: case 4: case 5: case 6:
{
pet = TRUE;
}
- count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint(p_ptr->lev/2) : dun_level), 0, TRUE, friendly, pet, FALSE, (bool)(!pet));
+ count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, TRUE, friendly, pet, FALSE, (bool)(!pet));
if (!one_in_(6)) break;
}
case 23: case 24: case 25:
- if (p_ptr->hold_life && (rand_int(100) < 75)) break;
+ if (p_ptr->hold_life && (randint0(100) < 75)) break;
#ifdef JP
msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
#else
}
else
{
- (void)do_dec_stat(rand_int(6));
+ (void)do_dec_stat(randint0(6));
}
break;
}
/* Player is not here */
if ((x != px) || (y != py)) return (FALSE);
- if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (rand_int(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
+ if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
{
kawarimi(TRUE);
return FALSE;
/* Choose 'new' target */
do
{
- t_y = m_list[who].fy - 1 + randint(3);
- t_x = m_list[who].fx - 1 + randint(3);
+ t_y = m_list[who].fy - 1 + randint1(3);
+ t_x = m_list[who].fx - 1 + randint1(3);
max_attempts--;
}
while (max_attempts && in_bounds2u(t_y, t_x) &&
if (!(double_resist || p_ptr->resist_pois))
{
- set_poisoned(p_ptr->poisoned + rand_int(dam) + 10);
+ set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
}
break;
}
take_hit(DAMAGE_ATTACK, dam, killer, monspell);
if (!(double_resist || p_ptr->resist_pois))
{
- set_poisoned(p_ptr->poisoned + rand_int(dam) + 10);
+ set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
if (one_in_(5)) /* 6 */
{
if (!p_ptr->resist_sound)
{
- int k = (randint((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
+ int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
(void)set_stun(p_ptr->stun + k);
}
if (p_ptr->resist_neth)
{
if (!prace_is_(RACE_SPECTRE))
- dam *= 6; dam /= (randint(4) + 7);
+ dam *= 6; dam /= (randint1(4) + 7);
}
else if (p_ptr->prace != RACE_ANDROID)
{
- if (p_ptr->hold_life && (rand_int(100) < 75))
+ if (p_ptr->hold_life && (randint0(100) < 75))
{
#ifdef JP
msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
if (!p_ptr->resist_sound)
{
- set_stun(p_ptr->stun + randint(40));
+ set_stun(p_ptr->stun + randint1(40));
}
if (!p_ptr->resist_conf)
{
- set_confused(p_ptr->confused + randint(5) + 5);
+ set_confused(p_ptr->confused + randint1(5) + 5);
}
if (one_in_(5))
if (p_ptr->resist_chaos)
{
- dam *= 6; dam /= (randint(4) + 7);
+ dam *= 6; dam /= (randint1(4) + 7);
}
if (!p_ptr->resist_conf)
{
- (void)set_confused(p_ptr->confused + rand_int(20) + 10);
+ (void)set_confused(p_ptr->confused + randint0(20) + 10);
}
if (!p_ptr->resist_chaos)
{
- (void)set_image(p_ptr->image + randint(10));
+ (void)set_image(p_ptr->image + randint1(10));
if (one_in_(3))
{
#ifdef JP
if (p_ptr->prace == RACE_ANDROID)
{
}
- else if (p_ptr->hold_life && (rand_int(100) < 75))
+ else if (p_ptr->hold_life && (randint0(100) < 75))
{
#ifdef JP
msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤¤Ã¤¿¡ª");
if (p_ptr->resist_shard)
{
- dam *= 6; dam /= (randint(4) + 7);
+ dam *= 6; dam /= (randint1(4) + 7);
}
else
{
if (p_ptr->resist_sound)
{
- dam *= 5; dam /= (randint(4) + 7);
+ dam *= 5; dam /= (randint1(4) + 7);
}
else
{
- int k = (randint((dam > 90) ? 35 : (dam / 3 + 5)));
+ int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
(void)set_stun(p_ptr->stun + k);
}
if (p_ptr->resist_conf)
{
- dam *= 5; dam /= (randint(4) + 7);
+ dam *= 5; dam /= (randint1(4) + 7);
}
if (!p_ptr->resist_conf)
{
- (void)set_confused(p_ptr->confused + randint(20) + 10);
+ (void)set_confused(p_ptr->confused + randint1(20) + 10);
}
take_hit(DAMAGE_ATTACK, dam, killer, monspell);
break;
if (p_ptr->resist_disen)
{
- dam *= 6; dam /= (randint(4) + 7);
+ dam *= 6; dam /= (randint1(4) + 7);
}
else
{
if (p_ptr->resist_nexus)
{
- dam *= 6; dam /= (randint(4) + 7);
+ dam *= 6; dam /= (randint1(4) + 7);
}
else
{
if (!p_ptr->resist_sound)
{
- (void)set_stun(p_ptr->stun + randint(20));
+ (void)set_stun(p_ptr->stun + randint1(20));
}
take_hit(DAMAGE_ATTACK, dam, killer, monspell);
break;
if (!p_ptr->resist_sound)
{
- (void)set_stun(p_ptr->stun + randint(20));
+ (void)set_stun(p_ptr->stun + randint1(20));
}
if (p_ptr->resist_shard)
{
if (fuzzy) msg_print("You are hit by something slow!");
#endif
- (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
+ (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
take_hit(DAMAGE_ATTACK, dam, killer, monspell);
break;
}
if (p_ptr->resist_lite)
{
- dam *= 4; dam /= (randint(4) + 7);
+ dam *= 4; dam /= (randint1(4) + 7);
}
else if (!blind && !p_ptr->resist_blind)
{
- (void)set_blind(p_ptr->blind + randint(5) + 2);
+ (void)set_blind(p_ptr->blind + randint1(5) + 2);
}
if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
{
if (p_ptr->resist_dark)
{
- dam *= 4; dam /= (randint(4) + 7);
+ dam *= 4; dam /= (randint1(4) + 7);
if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
}
else if (!blind && !p_ptr->resist_blind)
{
- (void)set_blind(p_ptr->blind + randint(5) + 2);
+ (void)set_blind(p_ptr->blind + randint1(5) + 2);
}
take_hit(DAMAGE_ATTACK, dam, killer, monspell);
break;
if (p_ptr->resist_time)
{
dam *= 4;
- dam /= (randint(4) + 7);
+ dam /= (randint1(4) + 7);
#ifdef JP
msg_print("»þ´Ö¤¬Ä̤ê²á¤®¤Æ¤¤¤¯µ¤¤¬¤¹¤ë¡£");
#else
}
else
{
- switch (randint(10))
+ switch (randint1(10))
{
case 1: case 2: case 3: case 4: case 5:
{
case 6: case 7: case 8: case 9:
{
- switch (randint(6))
+ switch (randint1(6))
{
#ifdef JP
case 1: k = A_STR; act = "¶¯¤¯"; break;
teleport_player(5);
if (!p_ptr->ffall)
- (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
+ (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
if (!(p_ptr->resist_sound || p_ptr->ffall))
{
- int k = (randint((dam > 90) ? 35 : (dam / 3 + 5)));
+ int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
(void)set_stun(p_ptr->stun + k);
}
if (p_ptr->ffall)
if (fuzzy) msg_print("You are hit by something!");
#endif
- (void)set_fast(p_ptr->fast + randint(5), FALSE);
+ (void)set_fast(p_ptr->fast + randint1(5), FALSE);
dam = 0;
break;
}
if (fuzzy) msg_print("You are hit by something slow!");
#endif
- (void)set_slow(p_ptr->slow + rand_int(4) + 4, FALSE);
+ (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
break;
}
}
if (!p_ptr->resist_sound)
{
- (void)set_stun(p_ptr->stun + randint(15));
+ (void)set_stun(p_ptr->stun + randint1(15));
}
if ((!(p_ptr->resist_cold || p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))) || one_in_(12))
cave_set_feat(y, x, FEAT_GRASS);
else
{
- cave[y][x].feat = floor_type[rand_int(100)];
+ cave[y][x].feat = floor_type[randint0(100)];
cave[y][x].info &= ~(CAVE_MASK);
cave[y][x].info |= CAVE_FLOOR;
}
cave_set_feat(y, x, FEAT_GRASS);
else
{
- cave[y][x].feat = floor_type[rand_int(100)];
+ cave[y][x].feat = floor_type[randint0(100)];
cave[y][x].info &= ~(CAVE_MASK);
cave[y][x].info |= CAVE_FLOOR;
}
/* Choose 'new' target */
do
{
- t_y = y_saver - 1 + randint(3);
- t_x = x_saver - 1 + randint(3);
+ t_y = y_saver - 1 + randint1(3);
+ t_x = x_saver - 1 + randint1(3);
max_attempts--;
}
if( mirror_num < 2 )return FALSE;
- point_x[0] = rand_int( mirror_num );
+ point_x[0] = randint0( mirror_num );
do {
- point_x[1] = rand_int( mirror_num );
+ point_x[1] = randint0( mirror_num );
}
while( point_x[0] == point_x[1] );
else if (i == p_ptr->riding) angry = TRUE;
- else if (player_cast && (r_ptr->level > rand_int(power))) angry = TRUE;
+ else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
else if (player_cast && (m_ptr->mflag2 & MFLAG_NOGENO)) angry = TRUE;
{
/* Take damage */
#ifdef JP
-take_hit(DAMAGE_GENO, randint(4), "Ëõ»¦¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+take_hit(DAMAGE_GENO, randint1(4), "Ëõ»¦¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
#else
- take_hit(DAMAGE_GENO, randint(4), "the strain of casting Genocide", -1);
+ take_hit(DAMAGE_GENO, randint1(4), "the strain of casting Genocide", -1);
#endif
}
else if (i == p_ptr->riding) angry = TRUE;
- else if (player_cast && (r_ptr->level > rand_int(power))) angry = TRUE;
+ else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
else if (player_cast && (m_ptr->mflag2 & MFLAG_NOGENO)) angry = TRUE;
{
/* Hack -- visual feedback */
#ifdef JP
-take_hit(DAMAGE_GENO, randint(3), "¼þÊÕËõ»¦¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+take_hit(DAMAGE_GENO, randint1(3), "¼þÊÕËõ»¦¤Î¼öʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
#else
- take_hit(DAMAGE_GENO, randint(3), "the strain of casting Mass Genocide", -1);
+ take_hit(DAMAGE_GENO, randint1(3), "the strain of casting Mass Genocide", -1);
#endif
}
else if (i == p_ptr->riding) angry = TRUE;
- else if (player_cast && (r_ptr->level > rand_int(power))) angry = TRUE;
+ else if (player_cast && (r_ptr->level > randint0(power))) angry = TRUE;
else if (player_cast && (m_ptr->mflag2 & MFLAG_NOGENO)) angry = TRUE;
{
/* Hack -- visual feedback */
#ifdef JP
-take_hit(DAMAGE_GENO, randint(3), "¥¢¥ó¥Ç¥Ã¥É¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
+take_hit(DAMAGE_GENO, randint1(3), "¥¢¥ó¥Ç¥Ã¥É¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
#else
- take_hit(DAMAGE_GENO, randint(3), "the strain of casting Mass Genocide", -1);
+ take_hit(DAMAGE_GENO, randint1(3), "the strain of casting Mass Genocide", -1);
#endif
}
if (!cave_perma_bold(y, x))
{
/* Wall (or floor) type */
- t = rand_int(200);
+ t = randint0(200);
/* Granite */
if (t < 20)
else
{
/* Create floor */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
}
if (!p_ptr->resist_blind && !p_ptr->resist_lite)
{
/* Become blind */
- (void)set_blind(p_ptr->blind + 10 + randint(10));
+ (void)set_blind(p_ptr->blind + 10 + randint1(10));
}
}
if (!dx && !dy) continue;
/* Skip most grids */
- if (rand_int(100) < 85) continue;
+ if (randint0(100) < 85) continue;
/* Damage this grid */
map[16+yy-cy][16+xx-cx] = TRUE;
sn++;
/* Randomize choice */
- if (rand_int(sn) > 0) continue;
+ if (randint0(sn) > 0) continue;
/* Save the safe location */
sy = y; sx = x;
}
/* Random message */
- switch (randint(3))
+ switch (randint1(3))
{
case 1:
{
else
{
/* Calculate results */
- switch (randint(3))
+ switch (randint1(3))
{
case 1:
{
#endif
damage = damroll(10, 4);
- (void)set_stun(p_ptr->stun + randint(50));
+ (void)set_stun(p_ptr->stun + randint1(50));
break;
}
case 3:
#endif
damage = damroll(10, 4);
- (void)set_stun(p_ptr->stun + randint(50));
+ (void)set_stun(p_ptr->stun + randint1(50));
break;
}
}
sn++;
/* Randomize choice */
- if (rand_int(sn) > 0) continue;
+ if (randint0(sn) > 0) continue;
/* Save the safe grid */
sy = y; sx = x;
delete_object(yy, xx);
/* Wall (or floor) type */
- t = (floor ? rand_int(100) : 200);
+ t = (floor ? randint0(100) : 200);
/* Granite */
if (t < 20)
else
{
/* Create floor */
- c_ptr->feat = floor_type[rand_int(100)];
+ c_ptr->feat = floor_type[randint0(100)];
c_ptr->info &= ~(CAVE_MASK);
c_ptr->info |= CAVE_FLOOR;
}
if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
/* Sometimes monsters wake up */
- if (m_ptr->csleep && (rand_int(100) < chance))
+ if (m_ptr->csleep && (randint0(100) < chance))
{
/* Wake up! */
m_ptr->csleep = 0;
*/
bool fire_bolt_or_beam(int prob, int typ, int dir, int dam)
{
- if (rand_int(100) < prob)
+ if (randint0(100) < prob)
{
return (fire_beam(typ, dir, dam));
}
bool wall_to_mud(int dir)
{
int flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
- return (project_hook(GF_KILL_WALL, dir, 20 + randint(30), flg));
+ return (project_hook(GF_KILL_WALL, dir, 20 + randint1(30), flg));
}
bool wizard_lock(int dir)
{
int flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
- return (project_hook(GF_JAM_DOOR, dir, 20 + randint(30), flg));
+ return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
}
GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
};
- Chaos_type = hurt_types[rand_int(31)];
+ Chaos_type = hurt_types[randint0(31)];
if (one_in_(4)) line_chaos = TRUE;
if (one_in_(6))
do
{
- switch (randint(34))
+ switch (randint1(34))
{
case 28: case 29:
if (!(*count))
msg_print("The ground trembles...");
#endif
- earthquake(py, px, 5 + rand_int(10));
+ earthquake(py, px, 5 + randint0(10));
if (!one_in_(6)) break;
}
case 30: case 31:
#endif
teleport_player(damroll(10, 10));
- if (rand_int(13)) (*count) += activate_hi_summon(py, px, FALSE);
+ if (randint0(13)) (*count) += activate_hi_summon(py, px, FALSE);
if (!one_in_(6)) break;
}
case 34:
#endif
wall_breaker();
- if (!rand_int(7))
+ if (!randint0(7))
{
project(0, 7, py, px, 50, GF_KILL_WALL, flg, -1);
#ifdef JP
lose_exp(p_ptr->exp / 16);
if (!one_in_(6)) break;
case 13: case 14: case 15: case 19: case 20:
- if (stop_ty || (p_ptr->free_act && (randint(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
+ if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
{
/* Do nothing */ ;
}
#endif
if (p_ptr->free_act)
- set_paralyzed(p_ptr->paralyzed + randint(3));
+ set_paralyzed(p_ptr->paralyzed + randint1(3));
else
- set_paralyzed(p_ptr->paralyzed + randint(13));
+ set_paralyzed(p_ptr->paralyzed + randint1(13));
stop_ty = TRUE;
}
if (!one_in_(6)) break;
case 21: case 22: case 23:
- (void)do_dec_stat(rand_int(6));
+ (void)do_dec_stat(randint0(6));
if (!one_in_(6)) break;
case 24:
#ifdef JP
}
not_pet = (bool)(!pet);
- summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint(p_ptr->lev / 2) : dun_level);
+ summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
- for (i = 0; i < (randint(7) + (dun_level / 40)); i++)
+ for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
{
- switch (randint(25) + (dun_level / 20))
+ switch (randint1(25) + (dun_level / 20))
{
case 1: case 2:
count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, TRUE, friendly, pet, FALSE, not_pet);
int summon_cyber(int who, int y, int x)
{
int i;
- int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint(2));
+ int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
int count = 0;
bool friendly = FALSE;
int y, x;
int attempts = 1000;
- if (randint(80 + p_ptr->lev) < 70)
+ if (randint1(80 + p_ptr->lev) < 70)
{
while(attempts--)
{
if ((y != py) || (x != px)) break;
}
- project(0, 0, y, x, 20 + randint(30), GF_KILL_WALL,
+ project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
(PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
}
- else if (randint(100) > 30)
+ else if (randint1(100) > 30)
{
earthquake(py, px, 1);
}
if ((y != py) && (x != px)) break;
}
- project(0, 0, y, x, 20 + randint(30), GF_KILL_WALL,
+ project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
(PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
}
}
int y, x;
if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return;
- if (rand_int(200) < p_ptr->stun) return;
+ if (randint0(200) < p_ptr->stun) return;
if (!success && one_in_(3))
{
y = py;
x = px;
- teleport_player(10+randint(90));
+ teleport_player(10+randint1(90));
object_wipe(q_ptr);
if (dec_valour &&
(((p_ptr->chp * 10) / p_ptr->mhp) > 5) &&
- (4+randint(5) < ((p_ptr->chp * 10) / p_ptr->mhp)))
+ (4+randint1(5) < ((p_ptr->chp * 10) / p_ptr->mhp)))
{
chg_virtue(V_VALOUR, -1);
}
if (!m_ptr->r_idx) return;
/* "Skill" test */
- if (randint(100) > power) return;
+ if (randint1(100) > power) return;
/* Initialize */
ny = m_ptr->fy;
p_ptr->inside_quest = 0;
p_ptr->leaving = TRUE;
}
- else if (rand_int(100) < 50)
+ else if (randint0(100) < 50)
{
#ifdef JP
msg_print("¤¢¤Ê¤¿¤ÏÅ·°æ¤òÆͤÇˤäÆÃè¤ØÉ⤤¤Æ¤¤¤¯¡£");
bool word_of_recall(void)
{
- return(recall_player(rand_int(21) + 15));
+ return(recall_player(randint0(21) + 15));
}
/* Pick a random slot */
- switch (randint(8))
+ switch (randint1(8))
{
case 1: t = INVEN_RARM; break;
case 2: t = INVEN_LARM; break;
/* Artifacts have 71% chance to resist */
- if ((artifact_p(o_ptr) || o_ptr->art_name) && (rand_int(100) < 71))
+ if ((artifact_p(o_ptr) || o_ptr->art_name) && (randint0(100) < 71))
{
/* Message */
#ifdef JP
/* Disenchant tohit */
if (o_ptr->to_h > 0) o_ptr->to_h--;
- if ((o_ptr->to_h > 5) && (rand_int(100) < 20)) o_ptr->to_h--;
+ if ((o_ptr->to_h > 5) && (randint0(100) < 20)) o_ptr->to_h--;
/* Disenchant todam */
if (o_ptr->to_d > 0) o_ptr->to_d--;
- if ((o_ptr->to_d > 5) && (rand_int(100) < 20)) o_ptr->to_d--;
+ if ((o_ptr->to_d > 5) && (randint0(100) < 20)) o_ptr->to_d--;
/* Disenchant toac */
if (o_ptr->to_a > 0) o_ptr->to_a--;
- if ((o_ptr->to_a > 5) && (rand_int(100) < 20)) o_ptr->to_a--;
+ if ((o_ptr->to_a > 5) && (randint0(100) < 20)) o_ptr->to_a--;
/* Message */
#ifdef JP
int max1, cur1, max2, cur2, ii, jj, i;
/* Pick a pair of stats */
- ii = rand_int(6);
- for (jj = ii; jj == ii; jj = rand_int(6)) /* loop */;
+ ii = randint0(6);
+ for (jj = ii; jj == ii; jj = randint0(6)) /* loop */;
max1 = p_ptr->stat_max[ii];
cur1 = p_ptr->stat_cur[ii];
*/
void apply_nexus(monster_type *m_ptr)
{
- switch (randint(7))
+ switch (randint1(7))
{
case 1: case 2: case 3:
{
case 6:
{
- if (rand_int(100) < p_ptr->skill_sav)
+ if (randint0(100) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
case 7:
{
- if (rand_int(100) < p_ptr->skill_sav)
+ if (randint0(100) < p_ptr->skill_sav)
{
#ifdef JP
msg_print("¤·¤«¤·¸úÎϤòÄ·¤ÍÊÖ¤·¤¿¡ª");
#endif
o_ptr->name2 = EGO_TRUMP;
- o_ptr->pval = randint(2);
+ o_ptr->pval = randint1(2);
break;
case 4:
#ifdef JP
#endif
- enchant(o_ptr, rand_int(3) + 4, ENCH_TOHIT | ENCH_TODAM);
+ enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
o_ptr->discount = 99;
chg_virtue(V_ENCHANT, 2);
#endif
- if (destroy_area(py, px, 15 + p_ptr->lev + rand_int(11), TRUE))
+ if (destroy_area(py, px, 15 + p_ptr->lev + randint0(11), TRUE))
#ifdef JP
msg_print("¥À¥ó¥¸¥ç¥ó¤¬Êø²õ¤·¤¿...");
#else
#ifdef JP
-take_hit(DAMAGE_NOESCAPE, 100 + randint(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1);
+take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "¼«»¦Åª¤Êµõ̵¾·Íè", -1);
#else
- take_hit(DAMAGE_NOESCAPE, 100 + randint(150), "a suicidal Call the Void", -1);
+ take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), "a suicidal Call the Void", -1);
#endif
}
/* Quest level */
cave_set_feat(py, px, FEAT_LESS);
}
- else if (rand_int(100) < 50)
+ else if (randint0(100) < 50)
{
cave_set_feat(py, px, FEAT_MORE);
}
/* Extract the flags */
object_flags(o_ptr, &f1, &f2, &f3);
- if (cursed_p(o_ptr) && !(f3 & TR3_PERMA_CURSE) && !(f3 & TR3_HEAVY_CURSE) && (rand_int(100) < 25))
+ if (cursed_p(o_ptr) && !(f3 & TR3_PERMA_CURSE) && !(f3 & TR3_HEAVY_CURSE) && (randint0(100) < 25))
{
#ifdef JP
msg_print("¤«¤±¤é¤ì¤Æ¤¤¤¿¼ö¤¤¤¬ÂǤÁÇˤé¤ì¤¿¡ª");
for (i = 0; i < n; i++)
{
/* Hack -- Roll for pile resistance */
- if (!force && rand_int(prob) >= 100) continue;
+ if (!force && randint0(prob) >= 100) continue;
/* Enchant to hit */
if (eflag & ENCH_TOHIT)
else if (o_ptr->to_h > 15) chance = 1000;
else chance = enchant_table[o_ptr->to_h];
- if (force || ((randint(1000) > chance) && (!a || (rand_int(100) < 50))))
+ if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
{
o_ptr->to_h++;
res = TRUE;
else if (o_ptr->to_d > 15) chance = 1000;
else chance = enchant_table[o_ptr->to_d];
- if (force || ((randint(1000) > chance) && (!a || (rand_int(100) < 50))))
+ if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
{
o_ptr->to_d++;
res = TRUE;
else if (o_ptr->to_a > 15) chance = 1000;
else chance = enchant_table[o_ptr->to_a];
- if (force || ((randint(1000) > chance) && (!a || (rand_int(100) < 50))))
+ if (force || ((randint1(1000) > chance) && (!a || (randint0(100) < 50))))
{
o_ptr->to_a++;
res = TRUE;
else
{
/* Recharge based on the standard number of charges. */
- recharge_amount = randint(1 + k_ptr->pval / 2);
+ recharge_amount = randint1(1 + k_ptr->pval / 2);
/* Multiple wands in a stack increase recharging somewhat. */
if ((o_ptr->tval == TV_WAND) && (o_ptr->number > 1))
{
recharge_amount +=
- (randint(recharge_amount * (o_ptr->number - 1))) / 2;
+ (randint1(recharge_amount * (o_ptr->number - 1))) / 2;
if (recharge_amount < 1) recharge_amount = 1;
if (recharge_amount > 12) recharge_amount = 12;
}
if (o_ptr->ident & IDENT_CURSED)
{
- if (((f3 & TR3_HEAVY_CURSE) && (randint(100) < 33)) ||
+ if (((f3 & TR3_HEAVY_CURSE) && (randint1(100) < 33)) ||
(f3 & TR3_PERMA_CURSE))
{
#ifdef JP
dis_happened = TRUE;
}
- if ((o_ptr->to_h > 5) && (rand_int(100) < 33)) o_ptr->to_h--;
+ if ((o_ptr->to_h > 5) && (randint0(100) < 33)) o_ptr->to_h--;
/* Disenchant todam */
if (o_ptr->to_d > 0)
dis_happened = TRUE;
}
- if ((o_ptr->to_d > 5) && (rand_int(100) < 33)) o_ptr->to_d--;
+ if ((o_ptr->to_d > 5) && (randint0(100) < 33)) o_ptr->to_d--;
/* Disenchant toac */
if (o_ptr->to_a > 0)
dis_happened = TRUE;
}
- if ((o_ptr->to_a > 5) && (rand_int(100) < 33)) o_ptr->to_a--;
+ if ((o_ptr->to_a > 5) && (randint0(100) < 33)) o_ptr->to_a--;
if (dis_happened)
{
((o_ptr->number > 1) ? "" : "s"));
#endif
o_ptr->name2 = EGO_REFLECTION;
- enchant(o_ptr, rand_int(3) + 4, ENCH_TOAC);
+ enchant(o_ptr, randint0(3) + 4, ENCH_TOAC);
o_ptr->discount = 99;
chg_virtue(V_ENCHANT, 2);
/* Count the casualties */
for (amt = j = 0; j < o_ptr->number; ++j)
{
- if (rand_int(100) < perc) amt++;
+ if (randint0(100) < perc) amt++;
}
/* Some casualities */
/* Pick a (possibly empty) inventory slot */
- switch (randint(7))
+ switch (randint1(7))
{
case 1: o_ptr = &inventory[INVEN_RARM]; break;
case 2: o_ptr = &inventory[INVEN_LARM]; break;
object_desc(o_name, o_ptr, FALSE, 3);
/* Attempt a saving throw for artifacts */
- if ((o_ptr->art_name || artifact_p(o_ptr)) && (rand_int(100) < 50))
+ if ((o_ptr->art_name || artifact_p(o_ptr)) && (randint0(100) < 50))
{
/* Cool */
#ifdef JP
/* Blast the armor */
o_ptr->name1 = 0;
o_ptr->name2 = EGO_BLASTED;
- o_ptr->to_a = 0 - randint(5) - randint(5);
+ o_ptr->to_a = 0 - randint1(5) - randint1(5);
o_ptr->to_h = 0;
o_ptr->to_d = 0;
o_ptr->ac = 0;
object_desc(o_name, o_ptr, FALSE, 3);
/* Attempt a saving throw */
- if ((artifact_p(o_ptr) || o_ptr->art_name) && (rand_int(100) < 50) && !force)
+ if ((artifact_p(o_ptr) || o_ptr->art_name) && (randint0(100) < 50) && !force)
{
/* Cool */
#ifdef JP
/* Shatter the weapon */
o_ptr->name1 = 0;
o_ptr->name2 = EGO_SHATTERED;
- o_ptr->to_h = 0 - randint(5) - randint(5);
- o_ptr->to_d = 0 - randint(5) - randint(5);
+ o_ptr->to_h = 0 - randint1(5) - randint1(5);
+ o_ptr->to_d = 0 - randint1(5) - randint1(5);
o_ptr->to_a = 0;
o_ptr->ac = 0;
o_ptr->dd = 0;
if (cursed_p(o_ptr) || broken_p(o_ptr)) continue;
/* Randomize */
- if (rand_int(100) < 75) continue;
+ if (randint0(100) < 75) continue;
/* Message */
#ifdef JP
o_ptr->name2 = EGO_FLAME;
/* Enchant */
- enchant(o_ptr, rand_int(3) + 4, ENCH_TOHIT | ENCH_TODAM);
+ enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
/* Notice */
return (TRUE);
return (r_idx);
/* Allowable range of "levels" for resulting monster */
- lev1 = r_ptr->level - ((randint(20) / randint(9)) + 1);
- lev2 = r_ptr->level + ((randint(20) / randint(9)) + 1);
+ lev1 = r_ptr->level - ((randint1(20) / randint1(9)) + 1);
+ lev2 = r_ptr->level + ((randint1(20) / randint1(9)) + 1);
/* Pick a (possibly new) non-unique race */
for (i = 0; i < 1000; i++)
if (!cave_empty_bold(y, x) || (cave[y][x].info & CAVE_ICKY) ||
(distance(y, x, py, px) > plev / 2 + 10) ||
- (!rand_int(plev / 10 + 10)))
+ (!randint0(plev / 10 + 10)))
{
if( p_ptr->pclass != CLASS_MIRROR_MASTER ){
#ifdef JP
#ifdef JP
/* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î¤È¤¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
if ( cur_store_num == STORE_BLACK ) {
- msg_print(comment_1_B[rand_int(MAX_COMMENT_1)]);
+ msg_print(comment_1_B[randint0(MAX_COMMENT_1)]);
}
else{
- msg_print(comment_1[rand_int(MAX_COMMENT_1)]);
+ msg_print(comment_1[randint0(MAX_COMMENT_1)]);
}
#else
- msg_print(comment_1[rand_int(MAX_COMMENT_1)]);
+ msg_print(comment_1[randint0(MAX_COMMENT_1)]);
#endif
if (annoyed > 0)
{
/* Formatted message */
- msg_format(comment_2a[rand_int(MAX_COMMENT_2A)], tmp_val);
+ msg_format(comment_2a[randint0(MAX_COMMENT_2A)], tmp_val);
}
/* Normal offer */
#ifdef JP
/* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
if ( cur_store_num == STORE_BLACK ){
- msg_format(comment_2b_B[rand_int(MAX_COMMENT_2B)], tmp_val);
+ msg_format(comment_2b_B[randint0(MAX_COMMENT_2B)], tmp_val);
}
else{
- msg_format(comment_2b[rand_int(MAX_COMMENT_2B)], tmp_val);
+ msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
}
#else
- msg_format(comment_2b[rand_int(MAX_COMMENT_2B)], tmp_val);
+ msg_format(comment_2b[randint0(MAX_COMMENT_2B)], tmp_val);
#endif
}
if (annoyed > 0)
{
/* Formatted message */
- msg_format(comment_3a[rand_int(MAX_COMMENT_3A)], tmp_val);
+ msg_format(comment_3a[randint0(MAX_COMMENT_3A)], tmp_val);
}
/* Normal offer */
#ifdef JP
/* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
if ( cur_store_num == STORE_BLACK ){
- msg_format(comment_3b_B[rand_int(MAX_COMMENT_3B)], tmp_val);
+ msg_format(comment_3b_B[randint0(MAX_COMMENT_3B)], tmp_val);
}
else{
- msg_format(comment_3b[rand_int(MAX_COMMENT_3B)], tmp_val);
+ msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
}
#else
- msg_format(comment_3b[rand_int(MAX_COMMENT_3B)], tmp_val);
+ msg_format(comment_3b[randint0(MAX_COMMENT_3B)], tmp_val);
#endif
}
#ifdef JP
/* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
if ( cur_store_num == STORE_BLACK ){
- msg_print(comment_4a_B[rand_int(MAX_COMMENT_4A)]);
- msg_print(comment_4b_B[rand_int(MAX_COMMENT_4B)]);
+ msg_print(comment_4a_B[randint0(MAX_COMMENT_4A)]);
+ msg_print(comment_4b_B[randint0(MAX_COMMENT_4B)]);
}
else{
- msg_print(comment_4a[rand_int(MAX_COMMENT_4A)]);
- msg_print(comment_4b[rand_int(MAX_COMMENT_4B)]);
+ msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
+ msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
}
#else
- msg_print(comment_4a[rand_int(MAX_COMMENT_4A)]);
- msg_print(comment_4b[rand_int(MAX_COMMENT_4B)]);
+ msg_print(comment_4a[randint0(MAX_COMMENT_4A)]);
+ msg_print(comment_4b[randint0(MAX_COMMENT_4B)]);
#endif
}
#ifdef JP
/* ¥Ö¥é¥Ã¥¯¥Þ¡¼¥±¥Ã¥È¤Î»þ¤ÏÊ̤Υá¥Ã¥»¡¼¥¸¤ò½Ð¤¹ */
if ( cur_store_num == STORE_BLACK ){
- msg_print(comment_5_B[rand_int(MAX_COMMENT_5)]);
+ msg_print(comment_5_B[randint0(MAX_COMMENT_5)]);
}
else{
- msg_print(comment_5[rand_int(MAX_COMMENT_5)]);
+ msg_print(comment_5[randint0(MAX_COMMENT_5)]);
}
#else
- msg_print(comment_5[rand_int(MAX_COMMENT_5)]);
+ msg_print(comment_5[randint0(MAX_COMMENT_5)]);
#endif
}
*/
static void say_comment_6(void)
{
- msg_print(comment_6[rand_int(MAX_COMMENT_6)]);
+ msg_print(comment_6[randint0(MAX_COMMENT_6)]);
}
if ((value <= 0) && (price > value))
{
/* Comment */
- msg_print(comment_7a[rand_int(MAX_COMMENT_7A)]);
+ msg_print(comment_7a[randint0(MAX_COMMENT_7A)]);
chg_virtue(V_HONOUR, -1);
chg_virtue(V_JUSTICE, -1);
else if ((value < guess) && (price > value))
{
/* Comment */
- msg_print(comment_7b[rand_int(MAX_COMMENT_7B)]);
+ msg_print(comment_7b[randint0(MAX_COMMENT_7B)]);
chg_virtue(V_JUSTICE, -1);
if (one_in_(4))
else if ((value > guess) && (value < (4 * guess)) && (price < value))
{
/* Comment */
- msg_print(comment_7c[rand_int(MAX_COMMENT_7C)]);
+ msg_print(comment_7c[randint0(MAX_COMMENT_7C)]);
if (one_in_(4))
chg_virtue(V_HONOUR, -1);
else if ((value > guess) && (price < value))
{
/* Comment */
- msg_print(comment_7d[rand_int(MAX_COMMENT_7D)]);
+ msg_print(comment_7d[randint0(MAX_COMMENT_7D)]);
if (one_in_(2))
chg_virtue(V_HONOUR, -1);
int what, num;
/* Pick a random slot */
- what = rand_int(st_ptr->stock_num);
+ what = randint0(st_ptr->stock_num);
/* Determine how many items are here */
num = st_ptr->stock[what].number;
/* Hack -- sometimes, only destroy half the items */
- if (rand_int(100) < 50) num = (num + 1) / 2;
+ if (randint0(100) < 50) num = (num + 1) / 2;
/* Hack -- sometimes, only destroy a single item */
- if (rand_int(100) < 50) num = 1;
+ if (randint0(100) < 50) num = 1;
/* Hack -- decrement the maximum timeouts and total charges of rods and wands. -LM- */
if ((st_ptr->stock[what].tval == TV_ROD) || (st_ptr->stock[what].tval == TV_WAND))
if (cur_store_num == STORE_BLACK)
{
/* Pick a level for object/magic */
- level = 25 + rand_int(25);
+ level = 25 + randint0(25);
/* Random item (usually of given level) */
i = get_obj_num(level);
else
{
/* Hack -- Pick an item to sell */
- i = st_ptr->table[rand_int(st_ptr->table_num)];
+ i = st_ptr->table[randint0(st_ptr->table_num)];
/* Hack -- fake level for apply_magic() */
level = rand_range(1, STORE_OBJ_LEVEL);
st_ptr->bad_buy = 0;
/* Open tomorrow */
- st_ptr->store_open = turn + 25000 + randint(25000);
+ st_ptr->store_open = turn + 25000 + randint1(25000);
/* Closed */
return (TRUE);
/* Pick a new owner */
while(1)
{
- st_ptr->owner = (byte)rand_int(MAX_OWNERS);
+ st_ptr->owner = (byte)randint0(MAX_OWNERS);
if (j == st_ptr->owner) continue;
for (i = 1;i < max_towns; i++)
{
j = st_ptr->stock_num;
/* Sell a few items */
- j = j - randint(STORE_TURNOVER);
+ j = j - randint1(STORE_TURNOVER);
/* Never keep more than "STORE_MAX_KEEP" slots */
if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
j = st_ptr->stock_num;
/* Buy some more items */
- j = j + randint(STORE_TURNOVER);
+ j = j + randint1(STORE_TURNOVER);
/* Never keep more than "STORE_MAX_KEEP" slots */
if (j > STORE_MAX_KEEP) j = STORE_MAX_KEEP;
{
int i;
- st_ptr->owner = (byte)rand_int(MAX_OWNERS);
+ st_ptr->owner = (byte)randint0(MAX_OWNERS);
for (i = 1;i < max_towns; i++)
{
if (i == town_num) continue;
if (dy != 0)
{
/* perturbation perpendicular to path */
- changex = randint(abs(dy)) * 2 - abs(dy);
+ changex = randint1(abs(dy)) * 2 - abs(dy);
}
else
{
if (dx != 0)
{
/* perturbation perpendicular to path */
- changey = randint(abs(dx)) * 2 - abs(dx);
+ changey = randint1(abs(dx)) * 2 - abs(dx);
}
else
{
/* Hack -- Choose starting point */
- y2 = randint(cur_hgt / 2 - 2) + cur_hgt / 2;
- x2 = randint(cur_wid / 2 - 2) + cur_wid / 2;
+ y2 = randint1(cur_hgt / 2 - 2) + cur_hgt / 2;
+ x2 = randint1(cur_wid / 2 - 2) + cur_wid / 2;
/* Hack -- Choose ending point somewhere on boundary */
- switch(randint(4))
+ switch(randint1(4))
{
case 1:
{
/* top boundary */
- x1 = randint(cur_wid-2)+1;
+ x1 = randint1(cur_wid-2)+1;
y1 = 1;
break;
}
{
/* left boundary */
x1 = 1;
- y1 = randint(cur_hgt-2)+1;
+ y1 = randint1(cur_hgt-2)+1;
break;
}
case 3:
{
/* right boundary */
x1 = cur_wid-1;
- y1 = randint(cur_hgt-2)+1;
+ y1 = randint1(cur_hgt-2)+1;
break;
}
case 4:
{
/* bottom boundary */
- x1 = randint(cur_wid-2)+1;
+ x1 = randint1(cur_wid-2)+1;
y1 = cur_hgt-1;
break;
}
}
- wid = randint(DUN_WAT_RNG);
+ wid = randint1(DUN_WAT_RNG);
recursive_river(x1, y1, x2, y2, feat1, feat2, wid);
/* Hack - Save the location as a "room" */
x = rand_spread(cur_wid / 2, 15);
/* Choose a random compass direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
/* Place streamer into dungeon */
while (dummy < SAFE_MAX_ATTEMPTS)
* Clear previous contents, add feature
* The border mainly gets trees, while the center gets rubble
*/
- if ((distance(j, i, y, x) > 1) || (randint(100) < 25))
+ if ((distance(j, i, y, x) > 1) || (randint1(100) < 25))
{
- if (randint(100) < 75)
+ if (randint1(100) < 75)
cave[j][i].feat = FEAT_TREES;
}
else
/* Drop a few epi-centers (usually about two) */
- for (n = 0; n < randint(5); n++)
+ for (n = 0; n < randint1(5); n++)
{
/* Pick an epi-center */
x1 = rand_range(5, cur_wid - 1 - 5);
delete_object(y, x);
/* Wall (or floor) type */
- t = rand_int(200);
+ t = randint0(200);
/* Granite */
if (t < 20)
* tmp is a random int +/- rough
*/
int tmp2 = rough*2 + 1;
- int tmp = randint(tmp2) - (rough + 1);
+ int tmp = randint1(tmp2) - (rough + 1);
int avg = ((x1 + x2 + x3 + x4) / 4) + tmp;
* tmp is a random int +/- rough
*/
int tmp2 = rough * 2 + 1;
- int tmp = rand_int(tmp2) - rough;
+ int tmp = randint0(tmp2) - rough;
int avg = ((x1 + x2 + x3) / 3) + tmp;
* ToDo: calculate the medium height of the adjacent
* terrains for every corner.
*/
- cave[1][1].feat = (byte)rand_int(table_size);
- cave[MAX_HGT-2][1].feat = (byte)rand_int(table_size);
- cave[1][MAX_WID-2].feat = (byte)rand_int(table_size);
- cave[MAX_HGT-2][MAX_WID-2].feat = (byte)rand_int(table_size);
+ cave[1][1].feat = (byte)randint0(table_size);
+ cave[MAX_HGT-2][1].feat = (byte)randint0(table_size);
+ cave[1][MAX_WID-2].feat = (byte)randint0(table_size);
+ cave[MAX_HGT-2][MAX_WID-2].feat = (byte)randint0(table_size);
if (!corner)
{
{
for (y = 0; y < max_wild_y; y++)
{
- wilderness[y][x].seed = rand_int(0x10000000);
+ wilderness[y][x].seed = randint0(0x10000000);
wilderness[y][x].entrance = 0;
}
}
for (i = 1; i < 4; i++)
{
- j = randint(p_ptr->hitdie);
+ j = randint1(p_ptr->hitdie);
player_hp[0] += j;
}
/* Collect values */
for (i = 1; i < PY_MAX_LEVEL; i++)
{
- player_hp[i] = randint(p_ptr->hitdie);
+ player_hp[i] = randint1(p_ptr->hitdie);
player_hp[i] += player_hp[i - 1];
}
screen_load();
}
else if(!(p_ptr->max_plv % 2))
- do_inc_stat(rand_int(6));
+ do_inc_stat(randint0(6));
}
if (level_mutation)
/* Bloodletters of Khorne may drop a blade of chaos */
else if (m_ptr->r_idx == MON_BLOODLETTER &&
- (randint(100) < 15) &&
+ (randint1(100) < 15) &&
!(p_ptr->inside_arena || p_ptr->inside_battle))
{
/* Get local object */
q_ptr = &forge;
/* Prepare to make a Blade of Chaos */
- object_prep(q_ptr, lookup_kind(TV_SWORD, randint(2)));
+ object_prep(q_ptr, lookup_kind(TV_SWORD, randint1(2)));
/* Drop it in the dungeon */
(void)drop_near(q_ptr, -1, y, x);
chance = 5;
}
- if ((a_idx > 0) && ((randint(99) < chance) || (wizard)))
+ if ((a_idx > 0) && ((randint1(99) < chance) || (wizard)))
{
if (a_info[a_idx].cur_num == 0)
{
}
/* Determine how much we can drop */
- if ((r_ptr->flags1 & RF1_DROP_60) && (rand_int(100) < 60)) number++;
- if ((r_ptr->flags1 & RF1_DROP_90) && (rand_int(100) < 90)) number++;
+ if ((r_ptr->flags1 & RF1_DROP_60) && (randint0(100) < 60)) number++;
+ if ((r_ptr->flags1 & RF1_DROP_90) && (randint0(100) < 90)) number++;
if (r_ptr->flags1 & RF1_DROP_1D2) number += damroll(1, 2);
if (r_ptr->flags1 & RF1_DROP_2D2) number += damroll(2, 2);
if (r_ptr->flags1 & RF1_DROP_3D2) number += damroll(3, 2);
object_wipe(q_ptr);
/* Make Gold */
- if (do_gold && (!do_item || (rand_int(100) < 50)))
+ if (do_gold && (!do_item || (randint0(100) < 50)))
{
/* Make some gold */
if (!make_gold(q_ptr)) continue;
/* Don't kill Amberites */
if ((r_ptr->flags3 & RF3_AMBERITE) && one_in_(2))
{
- int curses = 1 + randint(3);
+ int curses = 1 + randint1(3);
bool stop_ty = FALSE;
int count = 0;
}
else if (r_ptr->level > dun_level)
{
- if (randint(10) <= (r_ptr->level - dun_level))
+ if (randint1(10) <= (r_ptr->level - dun_level))
chg_virtue(V_VALOUR, 1);
}
if (r_ptr->level > 60)
}
if ((r_ptr->flags3 & RF3_GOOD) &&
- ((r_ptr->level) / 10 + (3 * dun_level) >= randint(100)))
+ ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100)))
chg_virtue(V_UNLIFE, 1);
{
if (r_ptr->flags1 & RF1_UNIQUE)
chg_virtue(V_FAITH, -2);
- else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint(100))
+ else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
{
if (r_ptr->flags3 & RF3_GOOD) chg_virtue(V_FAITH, -1);
else chg_virtue(V_FAITH, 1);
{
if (r_ptr->flags1 & RF1_UNIQUE)
chg_virtue(V_FAITH, 2);
- else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint(100))
+ else if ((r_ptr->level) / 10 + (3 * dun_level) >= randint1(100))
chg_virtue(V_FAITH, 1);
}
{
chg_virtue(V_HONOUR, 10);
}
- else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint(100))
+ else if ((r_ptr->level) / 10 + (2 * dun_level) >= randint1(100))
{
chg_virtue(V_HONOUR, 1);
}
if (r_ptr->flags1 & RF1_UNIQUE)
chg_virtue(V_JUSTICE, 3);
else if (1+((r_ptr->level) / 10 + (2 * dun_level))
- >= randint(100))
+ >= randint1(100))
chg_virtue(V_JUSTICE, 1);
}
/* Mega-Hack -- Pain cancels fear */
if (m_ptr->monfear && (dam > 0))
{
- int tmp = randint(dam);
+ int tmp = randint1(dam);
/* Cure a little fear */
if (tmp < m_ptr->monfear)
* Run (sometimes) if at 10% or less of max hit points,
* or (usually) when hit for half its current hit points
*/
- if (((percentage <= 10) && (rand_int(10) < percentage)) ||
- ((dam >= m_ptr->hp) && (rand_int(100) < 80)))
+ if (((percentage <= 10) && (randint0(10) < percentage)) ||
+ ((dam >= m_ptr->hp) && (randint0(100) < 80)))
{
/* Hack -- note fear */
(*fear) = TRUE;
/* XXX XXX XXX Hack -- Add some timed fear */
- m_ptr->monfear = (randint(10) +
+ m_ptr->monfear = (randint1(10) +
(((dam >= m_ptr->hp) && (percentage > 7)) ?
20 : ((11 - percentage) * 5)));
}
{
/* XXX XXX XXX */
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
/* Notice confusion */
if (p_ptr->confused)
{
/* Standard confusion */
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
{
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
}
else if (p_ptr->riding)
if (m_ptr->confused)
{
/* Standard confusion */
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
{
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
}
- else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (rand_int(100) < 50))
+ else if ((r_ptr->flags1 & RF1_RAND_50) && (r_ptr->flags1 & RF1_RAND_25) && (randint0(100) < 50))
{
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
- else if ((r_ptr->flags1 & RF1_RAND_50) && (rand_int(100) < 25))
+ else if ((r_ptr->flags1 & RF1_RAND_50) && (randint0(100) < 25))
{
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
}
if (p_ptr->confused)
{
/* Standard confusion */
- if (rand_int(100) < 75)
+ if (randint0(100) < 75)
{
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
}
else if (!(p_ptr->lev % 14)) nasty_chance = 12;
if (one_in_(nasty_chance))
- type = randint(20); /* Allow the 'nasty' effects */
+ type = randint1(20); /* Allow the 'nasty' effects */
else
- type = randint(15) + 5; /* Or disallow them */
+ type = randint1(15) + 5; /* Or disallow them */
if (type < 1) type = 1;
if (type > 20) type = 20;
/* Get local object */
q_ptr = &forge;
dummy = TV_SWORD;
- switch (randint(p_ptr->lev))
+ switch (randint1(p_ptr->lev))
{
case 0: case 1:
dummy2 = SV_DAGGER;
}
object_prep(q_ptr, lookup_kind(dummy, dummy2));
- q_ptr->to_h = 3 + randint(dun_level) % 10;
- q_ptr->to_d = 3 + randint(dun_level) % 10;
- random_resistance(q_ptr, FALSE, randint(34) + 4);
+ q_ptr->to_h = 3 + randint1(dun_level) % 10;
+ q_ptr->to_d = 3 + randint1(dun_level) % 10;
+ random_resistance(q_ptr, FALSE, randint1(34) + 4);
q_ptr->name2 = EGO_CHAOTIC;
/* Drop it in the dungeon */
msg_print("'Thy deed hath earned thee a worthy reward.'");
#endif
- acquirement(py, px, randint(2) + 1, FALSE, FALSE);
+ acquirement(py, px, randint1(2) + 1, FALSE, FALSE);
#ifdef JP
reward = "¾å¼Á¤Ê¥¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
#else
msg_print("'Behold, mortal, how generously I reward thy loyalty.'");
#endif
- acquirement(py, px, randint(2) + 1, TRUE, FALSE);
+ acquirement(py, px, randint1(2) + 1, TRUE, FALSE);
#ifdef JP
reward = "¹âµéÉʤΥ¢¥¤¥Æ¥à¤ò¼ê¤ËÆþ¤ì¤¿¡£";
#else
msg_print("'My pets, destroy the arrogant mortal!'");
#endif
- for (dummy = 0; dummy < randint(5) + 1; dummy++)
+ for (dummy = 0; dummy < randint1(5) + 1; dummy++)
{
(void)summon_specific(0, py, px, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE);
}
if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
do_inc_stat(chaos_stats[p_ptr->chaos_patron]);
else
- do_inc_stat(rand_int(6));
+ do_inc_stat(randint0(6));
#ifdef JP
reward = "ǽÎÏÃͤ¬¾å¤¬¤Ã¤¿¡£";
#else
if (one_in_(3) && !(chaos_stats[p_ptr->chaos_patron] < 0))
do_dec_stat(chaos_stats[p_ptr->chaos_patron]);
else
- (void)do_dec_stat(rand_int(6));
+ (void)do_dec_stat(randint0(6));
#ifdef JP
reward = "ǽÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
#else
for (dummy = 0; dummy < 6; dummy++)
{
- (void)dec_stat(dummy, 10 + randint(15), TRUE);
+ (void)dec_stat(dummy, 10 + randint1(15), TRUE);
}
#ifdef JP
reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
msg_print("'Now thou shalt pay for annoying me.'");
#endif
- switch (randint(4))
+ switch (randint1(4))
{
case 1:
(void)activate_ty_curse(FALSE, &count);
default:
for (dummy = 0; dummy < 6; dummy++)
{
- (void)dec_stat(dummy, 10 + randint(15), TRUE);
+ (void)dec_stat(dummy, 10 + randint1(15), TRUE);
}
#ifdef JP
reward = "Á´Ç½ÎÏÃͤ¬²¼¤¬¤Ã¤¿¡£";
take_hit(DAMAGE_LOSELIFE, p_ptr->lev * 4, wrath_reason, -1);
for (dummy = 0; dummy < 6; dummy++)
{
- (void)dec_stat(dummy, 10 + randint(15), FALSE);
+ (void)dec_stat(dummy, 10 + randint1(15), FALSE);
}
activate_hi_summon(py, px, FALSE);
(void)activate_ty_curse(FALSE, &count);
{
/* XXX XXX XXX */
/* Random direction */
- dir = ddd[rand_int(8)];
+ dir = ddd[randint0(8)];
}
/* Notice confusion */
s32b energy_result = 10;
s32b tmp;
- tmp = rand_int(Go_no_JuuJou);
+ tmp = randint0(Go_no_JuuJou);
for (i = 0; i < 9; i ++){
energy_result += tmp % 5;
* and is much less subject to low-bit-non-randomness problems.
*
* You can select your favorite flavor by proper definition of the
- * "rand_int()" macro in the "defines.h" file.
+ * "randint0()" macro in the "defines.h" file.
*
* Note that, in Angband 2.8.0, the "state" table will be saved in the
* savefile, so a special "initialization" phase will be necessary.
if (stand < 1) return (mean);
/* Roll for probability */
- tmp = (s16b)rand_int(32768);
+ tmp = (s16b)randint0(32768);
/* Binary Search */
while (low < high)
offset = (long)stand * (long)low / RANDNOR_STD;
/* One half should be negative */
- if (rand_int(100) < 50) return (mean - offset);
+ if (randint0(100) < 50) return (mean - offset);
/* One half should be positive */
return (mean + offset);
s16b damroll(int num, int sides)
{
int i, sum = 0;
- for (i = 0; i < num; i++) sum += randint(sides);
+ for (i = 0; i < num; i++) sum += randint1(sides);
return (sum);
}
* The integer X falls along a uniform distribution.
* For example, if M is 100, you get "percentile dice"
*/
-#define rand_int(M) \
+#define randint0(M) \
((s32b)Rand_div(M))
/*
* Generates a random long integer X where A<=X<=B
* The integer X falls along a uniform distribution.
- * Note: rand_range(0,N-1) == rand_int(N)
+ * Note: rand_range(0,N-1) == randint0(N)
*/
#define rand_range(A,B) \
- ((A) + (rand_int(1+(B)-(A))))
+ ((A) + (randint0(1+(B)-(A))))
/*
* Generate a random long integer X where A-D<=X<=A+D
* Note: rand_spread(A,D) == rand_range(A-D,A+D)
*/
#define rand_spread(A,D) \
- ((A) + (rand_int(1+(D)+(D))) - (D))
+ ((A) + (randint0(1+(D)+(D))) - (D))
/*
* Generate a random long integer X where 1<=X<=M
* Also, "correctly" handle the case of M<=1
*/
-#define randint(M) \
- (rand_int(M) + 1)
+#define randint1(M) \
+ (randint0(M) + 1)
/*
* Evaluate to TRUE "P" percent of the time
*/
#define magik(P) \
- (rand_int(100) < (P))
+ (randint0(100) < (P))
#define one_in_(X) \
- (rand_int(X) == 0)
+ (randint0(X) == 0)
/*
* Evaluate to TRUE "S" percent of the time
*/
#define saving_throw(S) \
- (rand_int(100) < (S))
+ (randint0(100) < (S))
/**** Available Variables ****/