msg_print("The enchantment failed.");
#endif
- if (randint(3)==1) chg_virtue(V_ENCHANT, -1);
+ if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
}
else
chg_virtue(V_ENCHANT, 1);
msg_print("The enchantment failed.");
#endif
- if (randint(3)==1) chg_virtue(V_ENCHANT, -1);
+ if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
}
else
chg_virtue(V_ENCHANT, 1);
/* Back-fire */
- if (rand_int(recharge_strength) == 0)
+ if (one_in_(recharge_strength))
{
/* Activate the failure code. */
fail = TRUE;
if (recharge_strength < 0) recharge_strength = 0;
/* Back-fire */
- if (rand_int(recharge_strength) == 0)
+ if (one_in_(recharge_strength))
{
/* Activate the failure code. */
fail = TRUE;
/* 10% chance to blow up one rod, otherwise draining. */
if (o_ptr->tval == TV_ROD)
{
- if (randint(10) == 1) fail_type = 2;
+ if (one_in_(10)) fail_type = 2;
else fail_type = 1;
}
/* 75% chance to blow up one wand, otherwise draining. */
else if (o_ptr->tval == TV_WAND)
{
- if (randint(3) != 1) fail_type = 2;
+ if (!one_in_(3)) fail_type = 2;
else fail_type = 1;
}
/* 50% chance to blow up one staff, otherwise no effect. */
else if (o_ptr->tval == TV_STAFF)
{
- if (randint(2) == 1) fail_type = 2;
+ if (one_in_(2)) fail_type = 2;
else fail_type = 0;
}
}
/* 33% chance to blow up one rod, otherwise draining. */
if (o_ptr->tval == TV_ROD)
{
- if (randint(3) == 1) fail_type = 2;
+ if (one_in_(3)) fail_type = 2;
else fail_type = 1;
}
/* 20% chance of the entire stack, else destroy one wand. */
else if (o_ptr->tval == TV_WAND)
{
- if (randint(5) == 1) fail_type = 3;
+ if (one_in_(5)) fail_type = 3;
else fail_type = 2;
}
/* Blow up one staff. */
return TRUE;
}
- if (!(o_ptr->art_name || o_ptr->name1 || o_ptr->name2) || (randint(3) == 1))
+ if (!(o_ptr->art_name || o_ptr->name1 || o_ptr->name2) || one_in_(3))
{
/* Describe */
#ifdef JP
if (double_resist) dam = (dam + 2) / 3;
if ((!(double_resist || p_ptr->resist_acid)) &&
- randint(HURT_CHANCE) == 1)
+ one_in_(HURT_CHANCE))
(void)do_dec_stat(A_CHR);
/* If any armor gets hit, defend the player */
if (double_resist) dam = (dam + 2) / 3;
if ((!(double_resist || p_ptr->resist_elec)) &&
- randint(HURT_CHANCE) == 1)
+ one_in_(HURT_CHANCE))
(void)do_dec_stat(A_DEX);
/* Take damage */
if (double_resist) dam = (dam + 2) / 3;
if ((!(double_resist || p_ptr->resist_fire)) &&
- randint(HURT_CHANCE) == 1)
+ one_in_(HURT_CHANCE))
(void)do_dec_stat(A_STR);
/* Take damage */
if (double_resist) dam = (dam + 2) / 3;
if ((!(double_resist || p_ptr->resist_cold)) &&
- randint(HURT_CHANCE) == 1)
+ one_in_(HURT_CHANCE))
(void)do_dec_stat(A_STR);
/* Take damage */
recharge_strength = ((power > lev/2) ? (power - lev/2) : 0) / 5;
/* Back-fire */
- if (rand_int(recharge_strength) == 0)
+ if (one_in_(recharge_strength))
{
/* Activate the failure code. */
fail = TRUE;
if (recharge_strength < 0) recharge_strength = 0;
/* Back-fire */
- if (rand_int(recharge_strength) == 0)
+ if (one_in_(recharge_strength))
{
/* Activate the failure code. */
fail = TRUE;
/* 10% chance to blow up one rod, otherwise draining. */
if (o_ptr->tval == TV_ROD)
{
- if (randint(10) == 1) fail_type = 2;
+ if (one_in_(10)) fail_type = 2;
else fail_type = 1;
}
/* 75% chance to blow up one wand, otherwise draining. */
else if (o_ptr->tval == TV_WAND)
{
- if (randint(3) != 1) fail_type = 2;
+ if (!one_in_(3)) fail_type = 2;
else fail_type = 1;
}
/* 50% chance to blow up one staff, otherwise no effect. */
else if (o_ptr->tval == TV_STAFF)
{
- if (randint(2) == 1) fail_type = 2;
+ if (one_in_(2)) fail_type = 2;
else fail_type = 0;
}
}
/* 33% chance to blow up one rod, otherwise draining. */
if (o_ptr->tval == TV_ROD)
{
- if (randint(3) == 1) fail_type = 2;
+ if (one_in_(3)) fail_type = 2;
else fail_type = 1;
}
/* 20% chance of the entire stack, else destroy one wand. */
else if (o_ptr->tval == TV_WAND)
{
- if (randint(5) == 1) fail_type = 3;
+ if (one_in_(5)) fail_type = 3;
else fail_type = 2;
}
/* Blow up one staff. */