o_ptr->art_flags3 |= (TR3_HEAVY_CURSE | TR3_CURSED);
- if (randint(4) == 1) o_ptr->art_flags3 |= TR3_PERMA_CURSE;
- if (randint(3) == 1) o_ptr->art_flags3 |= TR3_TY_CURSE;
- if (randint(2) == 1) o_ptr->art_flags3 |= TR3_AGGRAVATE;
- if (randint(3) == 1) o_ptr->art_flags3 |= TR3_DRAIN_EXP;
- if (randint(2) == 1) o_ptr->art_flags3 |= TR3_TELEPORT;
- else if (randint(3) == 1) o_ptr->art_flags3 |= TR3_NO_TELE;
-
- if ((p_ptr->pclass != CLASS_WARRIOR) && (p_ptr->pclass != CLASS_ARCHER) && (p_ptr->pclass != CLASS_CAVALRY) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH) && (randint(3) == 1))
+ if (one_in_(4)) o_ptr->art_flags3 |= TR3_PERMA_CURSE;
+ if (one_in_(3)) o_ptr->art_flags3 |= TR3_TY_CURSE;
+ if (one_in_(2)) o_ptr->art_flags3 |= TR3_AGGRAVATE;
+ if (one_in_(3)) o_ptr->art_flags3 |= TR3_DRAIN_EXP;
+ if (one_in_(2)) o_ptr->art_flags3 |= TR3_TELEPORT;
+ else if (one_in_(3)) o_ptr->art_flags3 |= TR3_NO_TELE;
+
+ if ((p_ptr->pclass != CLASS_WARRIOR) && (p_ptr->pclass != CLASS_ARCHER) && (p_ptr->pclass != CLASS_CAVALRY) && (p_ptr->pclass != CLASS_BERSERKER) && (p_ptr->pclass != CLASS_SMITH) && one_in_(3))
o_ptr->art_flags3 |= TR3_NO_MAGIC;
o_ptr->ident |= IDENT_CURSED;
if (!(o_ptr->art_flags1 & TR1_STR))
{
o_ptr->art_flags1 |= TR1_STR;
- if (randint(2) == 1) return; /* 50% chance of being a "free" power */
+ if (one_in_(2)) return; /* 50% chance of being a "free" power */
}
if (!(o_ptr->art_flags1 & TR1_CON))
{
o_ptr->art_flags1 |= TR1_CON;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if (!(o_ptr->art_flags1 & TR1_DEX))
{
o_ptr->art_flags1 |= TR1_DEX;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_MAGE)
if (!(o_ptr->art_flags1 & TR1_INT))
{
o_ptr->art_flags1 |= TR1_INT;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if ((o_ptr->tval == TV_GLOVES) && !(o_ptr->art_flags1 & TR1_MAGIC_MASTERY))
{
o_ptr->art_flags1 |= TR1_MAGIC_MASTERY;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_PRIESTLY)
if (!(o_ptr->art_flags1 & TR1_WIS))
{
o_ptr->art_flags1 |= TR1_WIS;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_RANGER)
if (!(o_ptr->art_flags1 & TR1_DEX))
{
o_ptr->art_flags1 |= TR1_DEX;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if (!(o_ptr->art_flags1 & TR1_CON))
{
o_ptr->art_flags1 |= TR1_CON;
- if (randint(2) == 1) return; /* 50% chance of being a "free" power */
+ if (one_in_(2)) return; /* 50% chance of being a "free" power */
}
if (!(o_ptr->art_flags1 & TR1_STR))
{
o_ptr->art_flags1 |= TR1_STR;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_ROGUE)
if (!(o_ptr->art_flags1 & TR1_STEALTH))
{
o_ptr->art_flags1 |= TR1_STEALTH;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if (!(o_ptr->art_flags1 & TR1_SEARCH))
{
o_ptr->art_flags1 |= TR1_SEARCH;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_STR)
if (!(o_ptr->art_flags1 & TR1_STR))
{
o_ptr->art_flags1 |= TR1_STR;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_WIS)
if (!(o_ptr->art_flags1 & TR1_WIS))
{
o_ptr->art_flags1 |= TR1_WIS;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_INT)
if (!(o_ptr->art_flags1 & TR1_INT))
{
o_ptr->art_flags1 |= TR1_INT;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_DEX)
if (!(o_ptr->art_flags1 & TR1_DEX))
{
o_ptr->art_flags1 |= TR1_DEX;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_CON)
if (!(o_ptr->art_flags1 & TR1_CON))
{
o_ptr->art_flags1 |= TR1_CON;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_CHR)
if (!(o_ptr->art_flags1 & TR1_CHR))
{
o_ptr->art_flags1 |= TR1_CHR;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
if (!(o_ptr->art_flags3 & TR3_DEC_MANA) && one_in_(3))
{
o_ptr->art_flags3 |= TR3_DEC_MANA;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
case 1: case 2:
o_ptr->art_flags1 |= TR1_STR;
/* if (is_scroll) msg_print("It makes you feel strong!"); */
- if (!artifact_bias && randint(13) != 1)
+ if (!artifact_bias && !one_in_(13))
artifact_bias = BIAS_STR;
- else if (!artifact_bias && randint(7) == 1)
+ else if (!artifact_bias && one_in_(7))
artifact_bias = BIAS_WARRIOR;
break;
case 3: case 4:
o_ptr->art_flags1 |= TR1_INT;
/* if (is_scroll) msg_print("It makes you feel smart!"); */
- if (!artifact_bias && randint(13) != 1)
+ if (!artifact_bias && !one_in_(13))
artifact_bias = BIAS_INT;
- else if (!artifact_bias && randint(7) == 1)
+ else if (!artifact_bias && one_in_(7))
artifact_bias = BIAS_MAGE;
break;
case 5: case 6:
o_ptr->art_flags1 |= TR1_WIS;
/* if (is_scroll) msg_print("It makes you feel wise!"); */
- if (!artifact_bias && randint(13) != 1)
+ if (!artifact_bias && !one_in_(13))
artifact_bias = BIAS_WIS;
- else if (!artifact_bias && randint(7) == 1)
+ else if (!artifact_bias && one_in_(7))
artifact_bias = BIAS_PRIESTLY;
break;
case 7: case 8:
o_ptr->art_flags1 |= TR1_DEX;
/* if (is_scroll) msg_print("It makes you feel nimble!"); */
- if (!artifact_bias && randint(13) != 1)
+ if (!artifact_bias && !one_in_(13))
artifact_bias = BIAS_DEX;
- else if (!artifact_bias && randint(7) == 1)
+ else if (!artifact_bias && one_in_(7))
artifact_bias = BIAS_ROGUE;
break;
case 9: case 10:
o_ptr->art_flags1 |= TR1_CON;
/* if (is_scroll) msg_print("It makes you feel healthy!"); */
- if (!artifact_bias && randint(13) != 1)
+ if (!artifact_bias && !one_in_(13))
artifact_bias = BIAS_CON;
- else if (!artifact_bias && randint(9) == 1)
+ else if (!artifact_bias && one_in_(9))
artifact_bias = BIAS_RANGER;
break;
case 11: case 12:
o_ptr->art_flags1 |= TR1_CHR;
/* if (is_scroll) msg_print("It makes you look great!"); */
- if (!artifact_bias && randint(13) != 1)
+ if (!artifact_bias && !one_in_(13))
artifact_bias = BIAS_CHR;
break;
case 13: case 14:
o_ptr->art_flags1 |= TR1_STEALTH;
/* if (is_scroll) msg_print("It looks muffled."); */
- if (!artifact_bias && randint(3) == 1)
+ if (!artifact_bias && one_in_(3))
artifact_bias = BIAS_ROGUE;
break;
case 15: case 16:
o_ptr->art_flags1 |= TR1_SEARCH;
/* if (is_scroll) msg_print("It makes you see better."); */
- if (!artifact_bias && randint(9) == 1)
+ if (!artifact_bias && one_in_(9))
artifact_bias = BIAS_RANGER;
break;
case 17: case 18:
case 19:
o_ptr->art_flags1 |= TR1_SPEED;
/* if (is_scroll) msg_print("It makes you move faster!"); */
- if (!artifact_bias && randint(11) == 1)
+ if (!artifact_bias && one_in_(11))
artifact_bias = BIAS_ROGUE;
break;
case 20: case 21:
{
o_ptr->art_flags1 |= TR1_BLOWS;
/* if (is_scroll) msg_print("It seems faster!"); */
- if (!artifact_bias && randint(11) == 1)
+ if (!artifact_bias && one_in_(11))
artifact_bias = BIAS_WARRIOR;
}
break;
if (!(o_ptr->art_flags2 & TR2_RES_ACID))
{
o_ptr->art_flags2 |= TR2_RES_ACID;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
- if ((randint(BIAS_LUCK) == 1) && !(o_ptr->art_flags2 & TR2_IM_ACID))
+ if (one_in_(BIAS_LUCK) && !(o_ptr->art_flags2 & TR2_IM_ACID))
{
o_ptr->art_flags2 |= TR2_IM_ACID;
if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ELEC | TR2_IM_COLD | TR2_IM_FIRE);
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_ELEC)
if (!(o_ptr->art_flags2 & TR2_RES_ELEC))
{
o_ptr->art_flags2 |= TR2_RES_ELEC;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if ((o_ptr->tval >= TV_CLOAK) && (o_ptr->tval <= TV_HARD_ARMOR) &&
!(o_ptr->art_flags3 & TR3_SH_ELEC))
{
o_ptr->art_flags3 |= TR3_SH_ELEC;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
- if (randint(BIAS_LUCK) == 1 && !(o_ptr->art_flags2 & TR2_IM_ELEC))
+ if (one_in_(BIAS_LUCK) && !(o_ptr->art_flags2 & TR2_IM_ELEC))
{
o_ptr->art_flags2 |= TR2_IM_ELEC;
if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ACID | TR2_IM_COLD | TR2_IM_FIRE);
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_FIRE)
if (!(o_ptr->art_flags2 & TR2_RES_FIRE))
{
o_ptr->art_flags2 |= TR2_RES_FIRE;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if ((o_ptr->tval >= TV_CLOAK) &&
(o_ptr->tval <= TV_HARD_ARMOR) &&
!(o_ptr->art_flags3 & TR3_SH_FIRE))
{
o_ptr->art_flags3 |= TR3_SH_FIRE;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
- if ((randint(BIAS_LUCK) == 1) &&
+ if (one_in_(BIAS_LUCK) &&
!(o_ptr->art_flags2 & TR2_IM_FIRE))
{
o_ptr->art_flags2 |= TR2_IM_FIRE;
if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ELEC | TR2_IM_COLD | TR2_IM_ACID);
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_COLD)
if (!(o_ptr->art_flags2 & TR2_RES_COLD))
{
o_ptr->art_flags2 |= TR2_RES_COLD;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if ((o_ptr->tval >= TV_CLOAK) &&
(o_ptr->tval <= TV_HARD_ARMOR) &&
!(o_ptr->art_flags3 & TR3_SH_COLD))
{
o_ptr->art_flags3 |= TR3_SH_COLD;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
- if (randint(BIAS_LUCK) == 1 && !(o_ptr->art_flags2 & TR2_IM_COLD))
+ if (one_in_(BIAS_LUCK) && !(o_ptr->art_flags2 & TR2_IM_COLD))
{
o_ptr->art_flags2 |= TR2_IM_COLD;
if (!one_in_(IM_LUCK)) o_ptr->art_flags2 &= ~(TR2_IM_ELEC | TR2_IM_ACID | TR2_IM_FIRE);
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_POIS)
if (!(o_ptr->art_flags2 & TR2_RES_POIS))
{
o_ptr->art_flags2 |= TR2_RES_POIS;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_WARRIOR)
{
- if (randint(3) != 1 && (!(o_ptr->art_flags2 & TR2_RES_FEAR)))
+ if (!one_in_(3) && (!(o_ptr->art_flags2 & TR2_RES_FEAR)))
{
o_ptr->art_flags2 |= TR2_RES_FEAR;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
- if ((randint(3) == 1) && (!(o_ptr->art_flags3 & TR3_NO_MAGIC)))
+ if (one_in_(3) && (!(o_ptr->art_flags3 & TR3_NO_MAGIC)))
{
o_ptr->art_flags3 |= TR3_NO_MAGIC;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_NECROMANTIC)
if (!(o_ptr->art_flags2 & TR2_RES_NETHER))
{
o_ptr->art_flags2 |= TR2_RES_NETHER;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if (!(o_ptr->art_flags2 & TR2_RES_POIS))
{
o_ptr->art_flags2 |= TR2_RES_POIS;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if (!(o_ptr->art_flags2 & TR2_RES_DARK))
{
o_ptr->art_flags2 |= TR2_RES_DARK;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_CHAOS)
if (!(o_ptr->art_flags2 & TR2_RES_CHAOS))
{
o_ptr->art_flags2 |= TR2_RES_CHAOS;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if (!(o_ptr->art_flags2 & TR2_RES_CONF))
{
o_ptr->art_flags2 |= TR2_RES_CONF;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if (!(o_ptr->art_flags2 & TR2_RES_DISEN))
{
o_ptr->art_flags2 |= TR2_RES_DISEN;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
}
switch (specific ? specific : randint(42))
{
case 1:
- if (randint(WEIRD_LUCK) != 1)
+ if (!one_in_(WEIRD_LUCK))
random_resistance(o_ptr, is_scroll, specific);
else
{
}
break;
case 2:
- if (randint(WEIRD_LUCK) != 1)
+ if (!one_in_(WEIRD_LUCK))
random_resistance(o_ptr, is_scroll, specific);
else
{
}
break;
case 3:
- if (randint(WEIRD_LUCK) != 1)
+ if (!one_in_(WEIRD_LUCK))
random_resistance(o_ptr, is_scroll, specific);
else
{
}
break;
case 4:
- if (randint(WEIRD_LUCK) != 1)
+ if (!one_in_(WEIRD_LUCK))
random_resistance(o_ptr, is_scroll, specific);
else
{
case 18:
o_ptr->art_flags2 |= TR2_RES_POIS;
/* if (is_scroll) msg_print("It makes breathing easier for you."); */
- if (!artifact_bias && randint(4) != 1)
+ if (!artifact_bias && !one_in_(4))
artifact_bias = BIAS_POIS;
- else if (!artifact_bias && randint(2) == 1)
+ else if (!artifact_bias && one_in_(2))
artifact_bias = BIAS_NECROMANTIC;
- else if (!artifact_bias && randint(2) == 1)
+ else if (!artifact_bias && one_in_(2))
artifact_bias = BIAS_ROGUE;
break;
case 19:
case 20:
o_ptr->art_flags2 |= TR2_RES_FEAR;
/* if (is_scroll) msg_print("It makes you feel brave!"); */
- if (!artifact_bias && randint(3) == 1)
+ if (!artifact_bias && one_in_(3))
artifact_bias = BIAS_WARRIOR;
break;
case 21:
case 26:
o_ptr->art_flags2 |= TR2_RES_CONF;
/* if (is_scroll) msg_print("It makes you feel very determined.");*/
- if (!artifact_bias && randint(6) == 1)
+ if (!artifact_bias && one_in_(6))
artifact_bias = BIAS_CHAOS;
break;
case 27:
case 32:
o_ptr->art_flags2 |= TR2_RES_NETHER;
/* if (is_scroll) msg_print("It makes you feel like visiting a graveyard!");*/
- if (!artifact_bias && randint(3) == 1)
+ if (!artifact_bias && one_in_(3))
artifact_bias = BIAS_NECROMANTIC;
break;
case 33:
case 36:
o_ptr->art_flags2 |= TR2_RES_CHAOS;
/* if (is_scroll) msg_print("It makes you feel very firm.");*/
- if (!artifact_bias && randint(2) == 1)
+ if (!artifact_bias && one_in_(2))
artifact_bias = BIAS_CHAOS;
break;
case 37:
if (!(o_ptr->art_flags2 & TR2_SUST_CON))
{
o_ptr->art_flags2 |= TR2_SUST_CON;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_STR)
if (!(o_ptr->art_flags2 & TR2_SUST_STR))
{
o_ptr->art_flags2 |= TR2_SUST_STR;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_WIS)
if (!(o_ptr->art_flags2 & TR2_SUST_WIS))
{
o_ptr->art_flags2 |= TR2_SUST_WIS;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_INT)
if (!(o_ptr->art_flags2 & TR2_SUST_INT))
{
o_ptr->art_flags2 |= TR2_SUST_INT;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_DEX)
if (!(o_ptr->art_flags2 & TR2_SUST_DEX))
{
o_ptr->art_flags2 |= TR2_SUST_DEX;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_CON)
if (!(o_ptr->art_flags2 & TR2_SUST_CON))
{
o_ptr->art_flags2 |= TR2_SUST_CON;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_CHR)
if (!(o_ptr->art_flags2 & TR2_SUST_CHR))
{
o_ptr->art_flags2 |= TR2_SUST_CHR;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_CHAOS)
if (!(o_ptr->art_flags3 & TR3_TELEPORT))
{
o_ptr->art_flags3 |= TR3_TELEPORT;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
else if (artifact_bias == BIAS_FIRE)
case 9:
o_ptr->art_flags2 |= TR2_HOLD_LIFE;
/* if (is_scroll) msg_print("It makes you feel immortal.");*/
- if (!artifact_bias && (randint(5) == 1))
+ if (!artifact_bias && one_in_(5))
artifact_bias = BIAS_PRIESTLY;
- else if (!artifact_bias && (randint(6) == 1))
+ else if (!artifact_bias && one_in_(6))
artifact_bias = BIAS_NECROMANTIC;
break;
case 10:
/* if (is_scroll) msg_print("It makes you see the air!");*/
break;
case 18:
- if (randint(3) == 1) break;
+ if (one_in_(3)) break;
o_ptr->art_flags3 |= TR3_TELEPATHY;
/* if (is_scroll) msg_print("It makes you hear voices inside your head!");*/
- if (!artifact_bias && (randint(9) == 1))
+ if (!artifact_bias && one_in_(9))
artifact_bias = BIAS_MAGE;
break;
case 19:
if (!(o_ptr->art_flags1 & TR1_CHAOTIC))
{
o_ptr->art_flags1 |= TR1_CHAOTIC;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
if (!(o_ptr->art_flags1 & TR1_VAMPIRIC))
{
o_ptr->art_flags1 |= TR1_VAMPIRIC;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
- if (!(o_ptr->art_flags1 & TR1_BRAND_POIS) && (randint(2) == 1))
+ if (!(o_ptr->art_flags1 & TR1_BRAND_POIS) && one_in_(2))
{
o_ptr->art_flags1 |= TR1_BRAND_POIS;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
if (!(o_ptr->art_flags1 & TR1_SLAY_ANIMAL))
{
o_ptr->art_flags1 |= TR1_SLAY_ANIMAL;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
if (!(o_ptr->art_flags1 & TR1_BRAND_POIS))
{
o_ptr->art_flags1 |= TR1_BRAND_POIS;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
if (!(o_ptr->art_flags1 & TR1_BRAND_POIS))
{
o_ptr->art_flags1 |= TR1_BRAND_POIS;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
if (!(o_ptr->art_flags1 & TR1_BRAND_FIRE))
{
o_ptr->art_flags1 |= TR1_BRAND_FIRE;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
if (!(o_ptr->art_flags1 & TR1_BRAND_COLD))
{
o_ptr->art_flags1 |= TR1_BRAND_COLD;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
if (!(o_ptr->art_flags1 & TR1_BRAND_ELEC))
{
o_ptr->art_flags1 |= TR1_BRAND_ELEC;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
if (!(o_ptr->art_flags1 & TR1_BRAND_ACID))
{
o_ptr->art_flags1 |= TR1_BRAND_ACID;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
if (!(o_ptr->art_flags1 & TR1_SLAY_EVIL))
{
o_ptr->art_flags1 |= TR1_SLAY_EVIL;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if (!(o_ptr->art_flags1 & TR1_SLAY_UNDEAD))
{
o_ptr->art_flags1 |= TR1_SLAY_UNDEAD;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
if (!(o_ptr->art_flags1 & TR1_SLAY_DEMON))
{
o_ptr->art_flags1 |= TR1_SLAY_DEMON;
- if (randint(2) == 1) return;
+ if (one_in_(2)) return;
}
}
case 4:
o_ptr->art_flags1 |= TR1_SLAY_EVIL;
/* if (is_scroll) msg_print("You hate evil creatures.");*/
- if (!artifact_bias && (randint(2) == 1))
+ if (!artifact_bias && one_in_(2))
artifact_bias = BIAS_LAW;
- else if (!artifact_bias && (randint(9) == 1))
+ else if (!artifact_bias && one_in_(9))
artifact_bias = BIAS_PRIESTLY;
break;
case 5:
case 6:
o_ptr->art_flags1 |= TR1_SLAY_UNDEAD;
/* if (is_scroll) msg_print("You hate undead creatures.");*/
- if (!artifact_bias && (randint(9) == 1))
+ if (!artifact_bias && one_in_(9))
artifact_bias = BIAS_PRIESTLY;
break;
case 7:
case 8:
o_ptr->art_flags1 |= TR1_SLAY_DEMON;
/* if (is_scroll) msg_print("You hate demons.");*/
- if (!artifact_bias && (randint(9) == 1))
+ if (!artifact_bias && one_in_(9))
artifact_bias = BIAS_PRIESTLY;
break;
case 9:
{
o_ptr->art_flags1 |= TR1_VORPAL;
/* if (is_scroll) msg_print("It looks extremely sharp!");*/
- if (!artifact_bias && (randint(9) == 1))
+ if (!artifact_bias && one_in_(9))
artifact_bias = BIAS_WARRIOR;
}
else
case 30:
o_ptr->art_flags1 |= TR1_BRAND_POIS;
/* if (is_scroll) msg_print("It smells rotten.");*/
- if (!artifact_bias && (randint(3) != 1))
+ if (!artifact_bias && !one_in_(3))
artifact_bias = BIAS_POIS;
- else if (!artifact_bias && randint(6) == 1)
+ else if (!artifact_bias && one_in_(6))
artifact_bias = BIAS_NECROMANTIC;
else if (!artifact_bias)
artifact_bias = BIAS_ROGUE;
o_ptr->art_flags1 |= TR1_FORCE_WEPON;
/* if (is_scroll) msg_print("It looks consuming your MP!");*/
if (!artifact_bias)
- artifact_bias = ((randint(2)==1) ? BIAS_MAGE : BIAS_PRIESTLY);
+ artifact_bias = (one_in_(2) ? BIAS_MAGE : BIAS_PRIESTLY);
break;
default:
o_ptr->art_flags1 |= TR1_CHAOTIC;
o_ptr->art_flags3 |= TR3_XTRA_MIGHT;
if (!one_in_(7)) o_ptr->art_flags3 &= ~(TR3_XTRA_SHOTS);
/* if (is_scroll) msg_print("It looks mightier than before."); */
- if (!artifact_bias && randint(9) == 1)
+ if (!artifact_bias && one_in_(9))
artifact_bias = BIAS_RANGER;
break;
default:
o_ptr->art_flags3 |= TR3_XTRA_SHOTS;
if (!one_in_(7)) o_ptr->art_flags3 &= ~(TR3_XTRA_MIGHT);
/* if (is_scroll) msg_print("It seems faster!"); */
- if (!artifact_bias && randint(9) == 1)
+ if (!artifact_bias && one_in_(9))
artifact_bias = BIAS_RANGER;
break;
}
{
if (artifact_bias == BIAS_ELEC)
{
- if (randint(3) != 1)
+ if (!one_in_(3))
{
type = ACT_BO_ELEC_1;
}
- else if (randint(5) != 1)
+ else if (!one_in_(5))
{
type = ACT_BA_ELEC_2;
}
}
else if (artifact_bias == BIAS_FIRE)
{
- if (randint(3) != 1)
+ if (!one_in_(3))
{
type = ACT_BO_FIRE_1;
}
- else if (randint(5) != 1)
+ else if (!one_in_(5))
{
type = ACT_BA_FIRE_1;
}
else if (artifact_bias == BIAS_COLD)
{
chance = 101;
- if (randint(3) != 1)
+ if (!one_in_(3))
type = ACT_BO_COLD_1;
- else if (randint(3) != 1)
+ else if (!one_in_(3))
type = ACT_BA_COLD_1;
- else if (randint(3) != 1)
+ else if (!one_in_(3))
type = ACT_BA_COLD_2;
else
type = ACT_BA_COLD_3;
else if (artifact_bias == BIAS_CHAOS)
{
chance = 50;
- if (randint(6) == 1)
+ if (one_in_(6))
type = ACT_SUMMON_DEMON;
else
type = ACT_CALL_CHAOS;
{
chance = 101;
- if (randint(13) == 1)
+ if (one_in_(13))
type = ACT_CHARM_UNDEAD;
- else if (randint(12) == 1)
+ else if (one_in_(12))
type = ACT_BANISH_EVIL;
- else if (randint(11) == 1)
+ else if (one_in_(11))
type = ACT_DISP_EVIL;
- else if (randint(10) == 1)
+ else if (one_in_(10))
type = ACT_PROT_EVIL;
- else if (randint(9) == 1)
+ else if (one_in_(9))
type = ACT_CURE_1000;
- else if (randint(8) == 1)
+ else if (one_in_(8))
type = ACT_CURE_700;
- else if (randint(7) == 1)
+ else if (one_in_(7))
type = ACT_REST_ALL;
- else if (randint(6) == 1)
+ else if (one_in_(6))
type = ACT_REST_LIFE;
else
type = ACT_CURE_MW;
else if (artifact_bias == BIAS_NECROMANTIC)
{
chance = 101;
- if (randint(66) == 1)
+ if (one_in_(66))
type = ACT_WRAITH;
- else if (randint(13) == 1)
+ else if (one_in_(13))
type = ACT_DISP_GOOD;
- else if (randint(9) == 1)
+ else if (one_in_(9))
type = ACT_MASS_GENO;
- else if (randint(8) == 1)
+ else if (one_in_(8))
type = ACT_GENOCIDE;
- else if (randint(13) == 1)
+ else if (one_in_(13))
type = ACT_SUMMON_UNDEAD;
- else if (randint(9) == 1)
+ else if (one_in_(9))
type = ACT_VAMPIRE_2;
- else if (randint(6) == 1)
+ else if (one_in_(6))
type = ACT_CHARM_UNDEAD;
else
type = ACT_VAMPIRE_1;
else if (artifact_bias == BIAS_LAW)
{
chance = 101;
- if (randint(8) == 1)
+ if (one_in_(8))
type = ACT_BANISH_EVIL;
- else if (randint(4) == 1)
+ else if (one_in_(4))
type = ACT_DISP_EVIL;
else
type = ACT_PROT_EVIL;
else if (artifact_bias == BIAS_ROGUE)
{
chance = 101;
- if (randint(50) == 1)
+ if (one_in_(50))
type = ACT_SPEED;
- else if (randint(4) == 1)
+ else if (one_in_(4))
type = ACT_SLEEP;
- else if (randint(3) == 1)
+ else if (one_in_(3))
type = ACT_DETECT_ALL;
- else if (randint(8) == 1)
+ else if (one_in_(8))
type = ACT_ID_FULL;
else
type = ACT_ID_PLAIN;
else if (artifact_bias == BIAS_MAGE)
{
chance = 66;
- if (randint(20) == 1)
+ if (one_in_(20))
type = ACT_SUMMON_ELEMENTAL;
- else if (randint(10) == 1)
+ else if (one_in_(10))
type = ACT_SUMMON_PHANTOM;
- else if (randint(5) == 1)
+ else if (one_in_(5))
type = ACT_RUNE_EXPLO;
else
type = ACT_ESP;
else if (artifact_bias == BIAS_WARRIOR)
{
chance = 80;
- if (randint(100) == 1)
+ if (one_in_(100))
type = ACT_INVULN;
else
type = ACT_BERSERK;
else if (artifact_bias == BIAS_RANGER)
{
chance = 101;
- if (randint(20) == 1)
+ if (one_in_(20))
type = ACT_CHARM_ANIMALS;
- else if (randint(7) == 1)
+ else if (one_in_(7))
type = ACT_SUMMON_ANIMAL;
- else if (randint(6) == 1)
+ else if (one_in_(6))
type = ACT_CHARM_ANIMAL;
- else if (randint(4) == 1)
+ else if (one_in_(4))
type = ACT_RESIST_ALL;
- else if (randint(3) == 1)
+ else if (one_in_(3))
type = ACT_SATIATE;
else
type = ACT_CURE_POISON;
o_ptr->art_flags3 |= k_info[o_ptr->k_idx].flags3;
if (o_ptr->pval) has_pval = TRUE;
- if (a_scroll && (randint(4) == 1))
+ if (a_scroll && one_in_(4))
{
switch (p_ptr->pclass)
{
strcpy(new_name, "");
- if (!a_scroll && (randint(A_CURSED) == 1))
+ if (!a_scroll && one_in_(A_CURSED))
a_cursed = TRUE;
if (((o_ptr->tval == TV_AMULET) || (o_ptr->tval == TV_RING)) && cursed_p(o_ptr))
a_cursed = TRUE;
- while ((randint(powers) == 1) || (randint(7) == 1) || (randint(10) == 1))
+ while (one_in_(powers) || one_in_(7) || one_in_(10))
powers++;
- if (!a_cursed && (randint(WEIRD_LUCK) == 1))
+ if (!a_cursed && one_in_(WEIRD_LUCK))
powers *= 2;
if (a_cursed) powers /= 2;
{
o_ptr->pval++;
}
- while (o_ptr->pval < randint(5) || randint(o_ptr->pval) == 1);
+ while (o_ptr->pval < randint(5) || one_in_(o_ptr->pval));
}
- if ((o_ptr->pval > 4) && (randint(WEIRD_LUCK) != 1))
+ if ((o_ptr->pval > 4) && !one_in_(WEIRD_LUCK))
o_ptr->pval = 4;
}
case ACT_SUMMON_ELEMENTAL:
{
- bool pet = (randint(3) == 1);
+ bool pet = one_in_(3);
bool group = !(pet && (plev < 50));
if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), SUMMON_ELEMENTAL, group, FALSE, pet, FALSE, (bool)(!pet)))
case ACT_SUMMON_DEMON:
{
- bool pet = (randint(3) == 1);
+ bool pet = one_in_(3);
bool group = !(pet && (plev < 50));
if (summon_specific((pet ? -1 : 0), py, px, ((plev * 3) / 2), SUMMON_DEMON, group, FALSE, pet, FALSE, (bool)(!pet)))
case ACT_SUMMON_UNDEAD:
{
- bool pet = (randint(3) == 1);
+ bool pet = one_in_(3);
bool group;
bool unique_okay;
int type;
type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
if (pet)
{
- group = (((plev > 24) && (randint(3) == 1)) ? TRUE : FALSE);
+ group = (((plev > 24) && one_in_(3)) ? TRUE : FALSE);
unique_okay = FALSE;
}
else
case ART_AZAGHAL:
{
/* Give a resistance OR a power */
- if (randint(2) == 1) give_resistance = TRUE;
+ if (one_in_(2)) give_resistance = TRUE;
else give_power = TRUE;
}
break;
}
else
{
- (*cp) = (randint(25) == 1 ?
+ (*cp) = (one_in_(25) ?
image_object_hack[rand_int(strlen(image_object_hack))] :
image_monster_hack[rand_int(strlen(image_monster_hack))]);
}
{
stop_ty = activate_ty_curse(stop_ty, &count);
}
- while (randint(6) == 1);
+ while (one_in_(6));
}
break;
}
{
if (p_ptr->migite && p_ptr->hidarite)
{
- success_hit = (randint(2) == 1);
+ success_hit = one_in_(2);
}
else success_hit = TRUE;
}
object_flags(o_ptr, &f1, &f2, &f3);
/* Select a chaotic effect (50% chance) */
- if ((f1 & TR1_CHAOTIC) && (randint(2) == 1))
+ if ((f1 & TR1_CHAOTIC) && one_in_(2))
{
- if (randint(10)==1)
+ if (one_in_(10))
chg_virtue(V_CHANCE, 1);
if (randint(5) < 3)
/* Vampiric (20%) */
chaos_effect = 1;
}
- else if (randint(250) == 1)
+ else if (one_in_(250))
{
/* Quake (0.12%) */
chaos_effect = 2;
}
- else if (randint(10) != 1)
+ else if (!one_in_(10))
{
/* Confusion (26.892%) */
chaos_effect = 3;
}
- else if (randint(2) == 1)
+ else if (one_in_(2))
{
/* Teleport away (1.494%) */
chaos_effect = 4;
k = (3 * k) / 2;
}
- if ((p_ptr->impact[hand] && ((k > 50) || randint(7) == 1)) ||
+ if ((p_ptr->impact[hand] && ((k > 50) || one_in_(7))) ||
(chaos_effect == 2) || (mode == HISSATSU_QUAKE))
{
do_quake = TRUE;
int inc_chance = (o_ptr->name1 == ART_VORPAL_BLADE) ? 2 : 4;
- if ((o_ptr->name1 == ART_CHAINSWORD) && (randint(2) != 1))
+ if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2))
{
char chainsword_noise[1024];
#ifdef JP
msg_format("You critically injured %s!", m_name);
#endif
}
- else if (((m_ptr->hp < maxhp/2) && one_in_((p_ptr->num_blow[0]+p_ptr->num_blow[1]+1)*10)) || (((one_in_(666)) || ((backstab || fuiuchi) && one_in_(11))) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2)))
+ else if (((m_ptr->hp < maxhp/2) && one_in_((p_ptr->num_blow[0]+p_ptr->num_blow[1]+1)*10)) || ((one_in_(666) || ((backstab || fuiuchi) && one_in_(11))) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2)))
{
if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp/2))
{
backstab = FALSE; /* Clumsy! */
fuiuchi = FALSE; /* Clumsy! */
- if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && (randint(3) == 1))
+ if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
{
u32b f1, f2, f3;
}
k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
- if (randint(6) == 1)
+ if (one_in_(6))
{
int mult = 2;
#ifdef JP
if (drain_left != MAX_VAMPIRIC_DRAIN)
{
- if (randint(4)==1)
+ if (one_in_(4))
{
chg_virtue(V_UNLIFE, 1);
}
if (trap & (CHEST_H_SUMMON))
{
/* Summon demons. */
- if (rand_int(4) == 0)
+ if (one_in_(4))
{
#ifdef JP
msg_print("±ê¤Èⲫ¤Î±À¤ÎÃæ¤Ë°Ë⤬»Ñ¤ò¸½¤·¤¿¡ª");
}
/* Summon dragons. */
- else if (rand_int(3) == 0)
+ else if (one_in_(3))
{
#ifdef JP
msg_print("°Å°Ç¤Ë¥É¥é¥´¥ó¤Î±Æ¤¬¤Ü¤ó¤ä¤ê¤È¸½¤ì¤¿¡ª");
}
/* Summon hybrids. */
- else if (rand_int(2) == 0)
+ else if (one_in_(2))
{
#ifdef JP
msg_print("´ñ̯¤Ê»Ñ¤Î²øʪ¤¬½±¤Ã¤ÆÍ褿¡ª");
if (randint(100+o_ptr->pval*2) > p_ptr->skill_sav)
{
#ifdef JP
- if (rand_int(6) == 0) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), "ÇËÌǤΥȥé¥Ã¥×¤ÎÊõÈ¢", -1);
+ if (one_in_(6)) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), "ÇËÌǤΥȥé¥Ã¥×¤ÎÊõÈ¢", -1);
#else
- if (rand_int(6) == 0) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), "a chest dispel-player trap", -1);
+ if (one_in_(6)) take_hit(DAMAGE_NOESCAPE, damroll(5, 20), "a chest dispel-player trap", -1);
#endif
- else if (rand_int(5) == 0) (void)set_cut(p_ptr->cut + 200);
- else if (rand_int(4) == 0)
+ else if (one_in_(5)) (void)set_cut(p_ptr->cut + 200);
+ else if (one_in_(4))
{
if (!p_ptr->free_act)
(void)set_paralyzed(p_ptr->paralyzed + 2 +
(void)set_stun(p_ptr->stun + 10 +
rand_int(100));
}
- else if (rand_int(3) == 0) apply_disenchant(0);
- else if (rand_int(2) == 0)
+ else if (one_in_(3)) apply_disenchant(0);
+ else if (one_in_(2))
{
(void)do_dec_stat(A_STR);
(void)do_dec_stat(A_DEX);
if (super_boomerang) back_chance += 100;
object_desc(o2_name, q_ptr, FALSE, 0);
- if((back_chance > 30) && ((randint(100) != 1) || super_boomerang))
+ if((back_chance > 30) && (!one_in_(100) || super_boomerang))
{
for (i = cur_dis-1;i>0;i--)
{
k++;
/* Hack -- Apply the randomizer */
- if (rand_int(k) == 0) gift = spell;
+ if (one_in_(k)) gift = spell;
}
}
break;
case 23: /* Summon monster, demon */
{
- bool pet = (randint(3) == 1);
+ bool pet = one_in_(3);
bool group = !(pet && (plev < 50));
if (summon_specific((pet ? -1 : 0), py, px, (plev * 3) / 2, SUMMON_DEMON, group, FALSE, pet, FALSE, (bool)(!pet)))
fire_ball(GF_HELL_FIRE, dir,
damroll(3 + ((plev - 1) / 5), 4), 0);
- if (randint(5) == 1)
+ if (one_in_(5))
{ /* Special effect first */
dummy = randint(1000);
if (dummy == 666)
break;
case 25: /* Raise the Dead */
{
- bool pet = (randint(3) == 1);
+ bool pet = one_in_(3);
bool group;
int type;
type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
if (pet)
{
- group = (((plev > 24) && (randint(3) == 1)) ? TRUE : FALSE);
+ group = (((plev > 24) && one_in_(3)) ? TRUE : FALSE);
}
else
{
case 22: /* Living Trump */
if (success)
{
- if (randint(7) == 1)
+ if (one_in_(7))
/* Teleport control */
dummy = 12;
else
brand_weapon(rand_int(17));
break;
case 30: /* Living Trump */
- if (randint(7) == 1)
+ if (one_in_(7))
/* Teleport control */
dummy = 12;
else
break;
case 15: /* Summon monster, demon */
{
- bool pet = (randint(3) != 1);
+ 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)))
}
else if ((o_ptr->tval == TV_DEATH_BOOK) && (randint(100) < spell))
{
- if ((sval == 3) && (randint(2) == 1))
+ if ((sval == 3) && one_in_(2))
{
sanity_blast(0, TRUE);
}
take_hit(DAMAGE_LOSELIFE, damroll(o_ptr->sval + 1, 6), "a miscast Death spell", -1);
#endif
- if ((spell > 15) && (randint(6) == 1) && !p_ptr->hold_life)
+ if ((spell > 15) && one_in_(6) && !p_ptr->hold_life)
lose_exp(spell * 250);
}
}
chance = chance - lev;
/* Give everyone a (slight) chance */
- if ((chance < USE_DEVICE) && (rand_int(USE_DEVICE - chance + 1) == 0))
+ if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
{
chance = USE_DEVICE;
}
chance = chance - lev;
/* Give everyone a (slight) chance */
- if ((chance < USE_DEVICE) && (rand_int(USE_DEVICE - chance + 1) == 0))
+ if ((chance < USE_DEVICE) && one_in_(USE_DEVICE - chance + 1))
{
chance = USE_DEVICE;
}
#endif
/* Confusing. */
- if (rand_int(5) == 0) (void)set_confused(p_ptr->confused +
+ if (one_in_(5)) (void)set_confused(p_ptr->confused +
randint(10));
/* Exercise a little care... */
- if (rand_int(20) == 0)
+ if (one_in_(20))
#ifdef JP
take_hit(DAMAGE_LOSELIFE, damroll(4, 10), "´í¸±¤ÊÈëÌ©", -1);
#else
}
case ART_ARRYU:
{
- bool pet = (randint(5) != 1);
+ bool pet = !one_in_(5);
if (summon_specific((pet ? -1 : 0), py, px, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, TRUE, FALSE, pet, FALSE, (bool)(!pet)))
{
}
case ART_JIZO:
{
- bool pet = (randint(5) != 1);
+ bool pet = !one_in_(5);
if (summon_named_creature(py, px, MON_JIZOTAKO, FALSE, TRUE, FALSE, pet))
{
return FALSE;
if ((prace_is_(RACE_AMBERITE)) &&
- (p_ptr->cut > 0) && (randint(10) == 1))
+ (p_ptr->cut > 0) && one_in_(10))
{
wreck_the_pattern();
}
}
else
{
- if ((prace_is_(RACE_AMBERITE)) && (randint(2) != 1))
+ if ((prace_is_(RACE_AMBERITE)) && !one_in_(2))
return TRUE;
else if (!p_ptr->invuln)
#ifdef JP
frac = m_ptr->maxhp / 100;
/* Hack -- Minimal regeneration rate */
- if (!frac) if (randint(2) == 1) frac = 1;
+ if (!frac) if (one_in_(2)) frac = 1;
/* Hack -- Some monsters regenerate quickly */
if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
frac = o_ptr->xtra5 / 100;
/* Hack -- Minimal regeneration rate */
- if (!frac) if (randint(2) == 1) frac = 1;
+ if (!frac) if (one_in_(2)) frac = 1;
/* Hack -- Some monsters regenerate quickly */
if (r_ptr->flags2 & RF2_REGENERATE) frac *= 2;
/*** Process the monsters ***/
/* Check for creature generation. */
- if ((rand_int(d_info[dungeon_type].max_m_alloc_chance) == 0) &&
+ if (one_in_(d_info[dungeon_type].max_m_alloc_chance) &&
!p_ptr->inside_arena && !p_ptr->inside_quest && !p_ptr->inside_battle)
{
/* Make a new monster */
/*** Process mutation effects ***/
if (p_ptr->muta2 && !p_ptr->inside_battle && !p_ptr->wild_mode)
{
- if ((p_ptr->muta2 & MUT2_BERS_RAGE) && (randint(3000) == 1))
+ if ((p_ptr->muta2 & MUT2_BERS_RAGE) && one_in_(3000))
{
disturb(0, 0);
#ifdef JP
}
if ((p_ptr->muta2 & MUT2_PROD_MANA) &&
- !p_ptr->anti_magic && (randint(9000) == 1))
+ !p_ptr->anti_magic && one_in_(9000))
{
int dire = 0;
disturb(0, 0);
if ((p_ptr->muta2 & MUT2_ATT_DEMON) &&
!p_ptr->anti_magic && (randint(6666) == 666))
{
- bool pet = (randint(6) == 1);
+ bool pet = one_in_(6);
bool not_pet = (bool)(!pet);
if (summon_specific((pet ? -1 : 0), py, px,
}
}
- if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && (randint(6000) == 1))
+ if ((p_ptr->muta2 & MUT2_SPEED_FLUX) && one_in_(6000))
{
disturb(0, 0);
- if (randint(2) == 1)
+ if (one_in_(2))
{
#ifdef JP
msg_print("ÀºÎÏŪ¤Ç¤Ê¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£");
}
msg_print(NULL);
}
- if ((p_ptr->muta2 & MUT2_BANISH_ALL) && (randint(9000) == 1))
+ if ((p_ptr->muta2 & MUT2_BANISH_ALL) && one_in_(9000))
{
disturb(0, 0);
#ifdef JP
if ((p_ptr->muta2 & MUT2_ATT_ANIMAL) &&
!p_ptr->anti_magic && one_in_(7000))
{
- bool pet = (randint(3) == 1);
+ bool pet = one_in_(3);
bool not_pet = (bool)(!pet);
if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_ANIMAL,
#endif
msg_print(NULL);
- (void)dec_stat(which_stat, randint(6) + 6, randint(3) == 1);
+ (void)dec_stat(which_stat, randint(6) + 6, one_in_(3));
}
}
if ((p_ptr->muta2 & MUT2_ATT_DRAGON) &&
!p_ptr->anti_magic && one_in_(3000))
{
- bool pet = (randint(5) == 1);
+ bool pet = one_in_(5);
bool not_pet = (bool)(!pet);
if (summon_specific((pet ? -1 : 0), py, px, dun_level, SUMMON_DRAGON,
}
/* Rarely, take damage from the Jewel of Judgement */
- if ((randint(999) == 1) && !p_ptr->anti_magic)
+ if (one_in_(999) && !p_ptr->anti_magic)
{
if ((inventory[INVEN_LITE].tval) &&
(inventory[INVEN_LITE].sval == SV_LITE_THRAIN))
if (!p_ptr->inside_battle)
{
/* TY Curse */
- if ((f3 & TR3_TY_CURSE) && (randint(TY_CURSE_CHANCE) == 1))
+ if ((f3 & TR3_TY_CURSE) && one_in_(TY_CURSE_CHANCE))
{
int count = 0;
}
/* Make a chainsword noise */
- if ((o_ptr->name1 == ART_CHAINSWORD) && randint(CHAINSWORD_NOISE) == 1)
+ if ((o_ptr->name1 == ART_CHAINSWORD) && one_in_(CHAINSWORD_NOISE))
{
char noise[1024];
#ifdef JP
default:
{
if (flush_failure) flush();
- if (randint(2) == 1)
+ if (one_in_(2))
{
char error_m[1024];
sound(SOUND_ILLEGAL);
break;
}
- if (randint(1000) < v || randint(16) == 1)
+ if (randint(1000) < v || one_in_(16))
{
#ifdef JP
msg_print("³ä¤ì¤ë¤è¤¦¤ÊƬÄˤ¬¤¹¤ë¡£");
msg_print("A vicious blow hits your head.");
#endif
- if (randint(3) == 1)
+ if (one_in_(3))
{
if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
if (!p_ptr->sustain_wis) (void)do_dec_stat(A_WIS);
}
- else if (randint(2) == 1)
+ else if (one_in_(2))
{
if (!p_ptr->sustain_int) (void)do_dec_stat(A_INT);
}
/* Notice */
notice = TRUE;
- if (randint(1000) < v || randint(16) == 1)
+ if (randint(1000) < v || one_in_(16))
{
if (!p_ptr->sustain_chr)
{
s16b wounds = p_ptr->cut;
s16b hit_p = (p_ptr->mhp - p_ptr->chp);
s16b change = damroll(p_ptr->lev, 5);
- bool Nasty_effect = (randint(5) == 1);
+ bool Nasty_effect = one_in_(5);
if (!(wounds || hit_p || Nasty_effect)) return;
chg_virtue(V_CHANCE, 1);
- if ((power > rand_int(20)) && (rand_int(3) == 1) && (p_ptr->prace != RACE_ANDROID))
+ if ((power > rand_int(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)) && (rand_int(4) == 1))
+ if ((power > rand_int(5)) && one_in_(4))
{
/* sex change */
power -= 2;
}
}
- if ((power > rand_int(30)) && (rand_int(5) == 1))
+ if ((power > rand_int(30)) && one_in_(5))
{
int tmp = 0;
while (tmp < 6)
{
- if (rand_int(2) == 1)
+ if (one_in_(2))
{
- (void)dec_stat(tmp, randint(6) + 6, (randint(3) == 1));
+ (void)dec_stat(tmp, randint(6) + 6, one_in_(3));
power -= 1;
}
tmp++;
}
}
- while ((power > rand_int(20)) && (rand_int(10) == 1))
+ while ((power > rand_int(20)) && one_in_(10))
{
/* Polymorph into a less mutated form */
power -= 10;
lite_spot(py, px);
}
- if ((power > rand_int(30)) && (rand_int(6) == 1))
+ if ((power > rand_int(30)) && one_in_(6))
{
int tmp = 0;
while (tmp < 6)
{
- (void)dec_stat(tmp, randint(6) + 6, (randint(3) == 1));
+ (void)dec_stat(tmp, randint(6) + 6, one_in_(3));
tmp++;
}
- if (randint(6) == 1)
+ if (one_in_(6))
{
#ifdef JP
msg_print("¸½ºß»Ñ¤ÇÀ¸¤¤Æ¤¤¤¯¤Î¤Ïº¤Æñ¤Ê¤è¤¦¤À¡ª");
}
}
- if ((power > rand_int(20)) && (rand_int(4) == 1))
+ if ((power > rand_int(20)) && one_in_(4))
{
power -= 10;
do_cmd_rerate(FALSE);
}
- while ((power > rand_int(15)) && (rand_int(3) == 1))
+ while ((power > rand_int(15)) && one_in_(3))
{
power -= 7;
(void)gain_random_mutation(0);
msg_print("The attack cuts your shield of invulnerability open!");
#endif
}
- else if (randint(PENETRATE_INVULNERABILITY) == 1)
+ else if (one_in_(PENETRATE_INVULNERABILITY))
{
#ifdef JP
msg_print("̵Ũ¤Î¥Ð¥ê¥¢¤òÇˤäƹ¶·â¤µ¤ì¤¿¡ª");
else
{
damage /= 2;
- if ((damage == 0) && (randint(2) == 1)) damage = 1;
+ if ((damage == 0) && one_in_(2)) damage = 1;
}
}
if ((p_ptr->special_defense & KATA_MUSOU))
{
damage /= 2;
- if ((damage == 0) && (randint(2) == 1)) damage = 1;
+ if ((damage == 0) && one_in_(2)) damage = 1;
}
} /* not if LOSELIFE USELIFE */
dun_tun_jct = rand_range(DUN_TUN_JCT_MIN, DUN_TUN_JCT_MAX);
/* Empty arena levels */
- if (ironman_empty_levels || ((d_info[dungeon_type].flags1 & DF1_ARENA) && (empty_levels && (randint(EMPTY_LEVEL) == 1))))
+ if (ironman_empty_levels || ((d_info[dungeon_type].flags1 & DF1_ARENA) && (empty_levels && one_in_(EMPTY_LEVEL))))
{
empty_level = TRUE;
#ifdef ALLOW_CAVERNS_AND_LAKES
/* Possible "destroyed" level */
- if ((dun_level > 30) && (rand_int(DUN_DEST*2) == 0) && (small_levels) && (d_info[dungeon_type].flags1 & DF1_DESTROY))
+ if ((dun_level > 30) && one_in_(DUN_DEST*2) && (small_levels) && (d_info[dungeon_type].flags1 & DF1_DESTROY))
{
destroyed = TRUE;
}
/* Make a lake some of the time */
- if ((rand_int(LAKE_LEVEL) == 0) && !empty_level && !destroyed &&
+ if (one_in_(LAKE_LEVEL) && !empty_level && !destroyed &&
(d_info[dungeon_type].flags1 & DF1_LAKE_MASK))
{
int count = 0;
/* Make a hole in the dungeon roof sometimes at level 1 */
if ((dun_level == 1) && terrain_streams)
{
- while (randint(DUN_MOS_DEN) == 1)
+ while (one_in_(DUN_MOS_DEN))
{
place_trees(randint(cur_wid - 2), randint(cur_hgt - 2));
}
if (destroyed) destroy_level();
/* Hack -- Add some rivers */
- if ((randint(3) == 1) && (randint(dun_level) > 5) && terrain_streams)
+ if (one_in_(3) && (randint(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 ((empty_level && ((randint(DARK_EMPTY) != 1) || (randint(100) > dun_level))) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
+ if ((empty_level && (!one_in_(DARK_EMPTY) || (randint(100) > dun_level))) && !(d_info[dungeon_type].flags1 & DF1_DARKNESS))
{
/* Lite the cave */
for (y = 0; y < cur_hgt; y++)
int level_height, level_width;
if ((always_small_levels || ironman_small_levels ||
- ((randint(SMALL_LEVEL) == 1) && small_levels) ||
+ (one_in_(SMALL_LEVEL) && small_levels) ||
(d_info[dungeon_type].flags1 & DF1_BEGINNER) ||
(d_info[dungeon_type].flags1 & DF1_SMALLEST)) &&
!(d_info[dungeon_type].flags1 & DF1_BIG))
#endif
}
- else if (randint(2) == 1)
+ else if (one_in_(2))
{
#ifdef JP
msg_format("%s¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤Ã¤¿¡£", m_name);
}
else
{
- if (randint(3) == 1)
+ if (one_in_(3))
#ifdef JP
act = "¤Ï¢öËͤé¤Ï³Ú¤·¤¤²È²¢ö¤È²Î¤Ã¤Æ¤¤¤ë¡£";
else
if ((randint(100) < 11) && (p_ptr->prace != RACE_ANDROID))
{
/* 1% chance for perm. damage */
- bool perm = (randint(10) == 1);
+ bool perm = one_in_(10);
if (dec_stat(A_CON, randint(10), perm)) obvious = TRUE;
}
if(dam > 0)
{
dam /= 100;
- if((dam == 0) && (randint(3) == 1)) dam = 1;
+ if((dam == 0) && one_in_(3)) dam = 1;
}
if (dam==0)
{
case RBE_EAT_GOLD:
{
pt = damage = 0;
- if (randint(2) == 1) blinked = TRUE;
+ if (one_in_(2)) blinked = TRUE;
break;
}
{
/* Hack! "Cyber" monster makes noise... */
if (m_ptr->r_idx == MON_CYBER &&
- (randint(CYBERNOISE) == 1) &&
+ one_in_(CYBERNOISE) &&
!m_ptr->ml && (m_ptr->cdis <= MAX_SIGHT))
{
if (disturb_minor) disturb(FALSE, FALSE);
/* Some monsters can speak */
if ((r_ptr->flags2 & RF2_CAN_SPEAK) && aware &&
- (randint(SPEAK_CHANCE) == 1) &&
+ one_in_(SPEAK_CHANCE) &&
player_has_los_bold(oy, ox))
{
char m_name[80];
/* Monster destroyed a wall */
did_kill_wall = TRUE;
- if (randint(GRINDNOISE) == 1)
+ if (one_in_(GRINDNOISE))
{
#ifdef JP
msg_print("¥®¥·¥®¥·¤¤¤¦²»¤¬Ê¹¤³¤¨¤ë¡£");
if (!(r_ptr->flags1 & RF1_UNIQUE) && !p_ptr->inside_arena)
{
/* Allow some small variation per monster */
- if(rand_int(4) == 1){
+ if(one_in_(4)){
i = extract_energy[r_ptr->speed] / 3;
if (i) m_ptr->mspeed += rand_spread(0, i);
}
/* Are we hallucinating? (Idea from Nethack...) */
if (p_ptr->image)
{
- if (randint(2) == 1)
+ if (one_in_(2))
{
#ifdef JP
if (!get_rnd_line("silly_j.txt", m_ptr->r_idx, silly_name))
funny_desc[rand_int(MAX_SAN_FUNNY)], m_name);
- if (randint(3) == 1)
+ if (one_in_(3))
{
msg_print(funny_comments[rand_int(MAX_SAN_COMMENT)]);
p_ptr->image = p_ptr->image + randint(r_ptr->level);
m_ptr->mspeed = r_ptr->speed;
/* Hack -- small racial variety */
/* Allow some small variation per monster */
- if(rand_int(4) == 1){
+ if(one_in_(4)){
i = extract_energy[r_ptr->speed] / 3;
if (i) m_ptr->mspeed += rand_spread(0, i);
}
if (!(r_ptr->flags1 & RF1_UNIQUE) && !p_ptr->inside_arena)
{
/* Allow some small variation per monster */
- if(rand_int(4) == 1){
+ if(one_in_(4)){
i = extract_energy[r_ptr->speed] / 3;
if (i) m_ptr->mspeed += rand_spread(0, i);
}
/* Do not summon enemies of the pets */
if ((p_ptr->align < -9) && (r_ptr->flags3 & RF3_GOOD))
{
- if (!(one_in_((0-p_ptr->align)/2+1))) return FALSE;
+ if (!one_in_((0-p_ptr->align)/2+1)) return FALSE;
}
else if ((p_ptr->align > 9) && (r_ptr->flags3 & RF3_EVIL))
{
- if (!(one_in_(p_ptr->align/2+1))) return FALSE;
+ if (!one_in_(p_ptr->align/2+1)) return FALSE;
}
}
if(get_check_strict("Do you follow it? ", 1))
#endif
{
- if (randint(3) == 1)
+ if (one_in_(3))
{
teleport_player(200);
#ifdef JP
if(get_check_strict("Do you follow it? ", 1))
#endif
{
- if (randint(3) == 1)
+ if (one_in_(3))
{
teleport_player(200);
#ifdef JP
#endif
}
- else if (randint(2) == 1)
+ else if (one_in_(2))
{
#ifdef JP
msg_format("%s¤Ï¾²¤òÆͤÇˤäÆÄÀ¤ó¤Ç¤¤¤Ã¤¿¡£", m_name);
if ((level > 0) && !(d_info[dungeon_type].flags1 & DF1_BEGINNER))
{
/* Occasional "boost" */
- if (rand_int(GREAT_OBJ) == 0)
+ if (one_in_(GREAT_OBJ))
{
/* What a bizarre calculation */
level = 1 + (level * MAX_DEPTH / randint(MAX_DEPTH));
int d = (a_ptr->level - dun_level) * 2;
/* Roll for out-of-depth creation */
- if (rand_int(d) != 0) continue;
+ if (!one_in_(d)) continue;
}
/* Artifact "rarity roll" */
- if (rand_int(a_ptr->rarity) != 0) continue;
+ if (!one_in_(a_ptr->rarity)) continue;
/* Find the base object */
k_idx = lookup_kind(a_ptr->tval, a_ptr->sval);
int d = (k_info[k_idx].level - object_level) * 5;
/* Roll for out-of-depth creation */
- if (rand_int(d) != 0) continue;
+ if (!one_in_(d)) continue;
}
/* Assign the template */
int d = (a_ptr->level - dun_level) * 2;
/* Roll for out-of-depth creation */
- if (rand_int(d) != 0) continue;
+ if (!one_in_(d)) continue;
}
/* We must make the "rarity roll" */
- if (rand_int(a_ptr->rarity) != 0) continue;
+ if (!one_in_(a_ptr->rarity)) continue;
/* Hack -- mark the item as an artifact */
o_ptr->name1 = i;
/* Very good */
if (power > 1)
{
- if (randint(30) == 1)
+ if (one_in_(30))
create_artifact(o_ptr, FALSE);
else
/* Special Ego-item */
switch (o_ptr->name2)
{
case EGO_HA:
- if ((randint(4) == 1) && (level > 40))
+ if (one_in_(4) && (level > 40))
o_ptr->art_flags1 |= TR1_BLOWS;
break;
case EGO_DF:
- if (randint(3) == 1)
+ if (one_in_(3))
o_ptr->art_flags2 |= TR2_RES_POIS;
random_resistance(o_ptr, FALSE, randint(22)+16);
break;
break;
case EGO_KILL_DRAGON:
random_resistance(o_ptr, FALSE, randint(12) + 4);
- if (randint(3) == 1)
+ if (one_in_(3))
o_ptr->art_flags2 |= TR2_RES_POIS;
random_resistance(o_ptr, FALSE, randint(14) + 4);
case EGO_WEST:
- if (randint(3) == 1)
+ if (one_in_(3))
o_ptr->art_flags2 |= TR2_RES_FEAR;
break;
case EGO_CHAOTIC:
random_resistance(o_ptr, FALSE, (randint(34) + 4));
break;
case EGO_SLAYING_WEAPON:
- if (randint(3) == 1) /* double damage */
+ if (one_in_(3)) /* double damage */
o_ptr->dd *= 2;
else
{
{
o_ptr->dd++;
}
- while (randint(o_ptr->dd) == 1);
+ while (one_in_(o_ptr->dd));
do
{
o_ptr->ds++;
}
- while (randint(o_ptr->ds) == 1);
+ while (one_in_(o_ptr->ds));
}
- if (randint(5) == 1)
+ if (one_in_(5))
{
o_ptr->art_flags1 |= TR1_BRAND_POIS;
}
- if (o_ptr->tval == TV_SWORD && (randint(3) == 1))
+ if (o_ptr->tval == TV_SWORD && one_in_(3))
{
o_ptr->art_flags1 |= TR1_VORPAL;
}
break;
case EGO_TRUMP:
random_resistance(o_ptr, FALSE, (randint(22) + 16));
- if (randint(5) == 1)
+ if (one_in_(5))
o_ptr->art_flags1 |= TR1_SLAY_DEMON;
break;
case EGO_PATTERN:
- if (randint(3) == 1)
+ if (one_in_(3))
o_ptr->art_flags2 |= TR2_HOLD_LIFE;
- if (randint(3) == 1)
+ if (one_in_(3))
o_ptr->art_flags1 |= TR1_DEX;
- if (randint(5) == 1)
+ if (one_in_(5))
o_ptr->art_flags2 |= TR2_RES_FEAR;
random_resistance(o_ptr, FALSE, (randint(22) + 16));
break;
o_ptr->pval = m_bonus(5, level) + 1;
break;
case EGO_EARTHQUAKES:
- if ((randint(3) == 1) && (level > 60))
+ if (one_in_(3) && (level > 60))
o_ptr->art_flags1 |= TR1_BLOWS;
else
o_ptr->pval = m_bonus(3, level);
if (!o_ptr->art_name)
{
/* Hack -- Super-charge the damage dice */
- while (rand_int(10L * o_ptr->dd * o_ptr->ds) == 0) o_ptr->dd++;
+ while (one_in_(10L * o_ptr->dd * o_ptr->ds)) o_ptr->dd++;
/* Hack -- Lower the damage dice */
if (o_ptr->dd > 9) o_ptr->dd = 9;
}
/* Hack -- super-charge the damage dice */
- while (rand_int(10L * o_ptr->dd * o_ptr->ds) == 0) o_ptr->dd++;
+ while (one_in_(10L * o_ptr->dd * o_ptr->ds)) o_ptr->dd++;
/* Hack -- restrict the damage dice */
if (o_ptr->dd > 9) o_ptr->dd = 9;
{
artifact_bias = 0;
- if (randint(4) == 1)
+ if (one_in_(4))
random_resistance(o_ptr, FALSE, (randint(14) + 4));
else
random_resistance(o_ptr, FALSE, (randint(22) + 16));
}
- while (randint(2) == 1);
+ while (one_in_(2));
}
{
/* Rating boost */
rating += 30;
- if(rand_int(50) == 1)
+ if(one_in_(50))
create_artifact(o_ptr, FALSE);
/* Mention the item */
}
else
{
- if (randint(4) == 1)
+ if (one_in_(4))
o_ptr->art_flags1 |= TR1_CON;
break;
}
/* Mention the item */
if (cheat_peek) object_mention(o_ptr);
dragon_resist(o_ptr);
- if (randint(3) != 1) break;
+ if (!one_in_(3)) break;
}
/* Very good */
/* Mention the item */
if (cheat_peek) object_mention(o_ptr);
dragon_resist(o_ptr);
- if (randint(3) != 1) break;
+ if (!one_in_(3)) break;
}
if (power > 1)
{
/* Mention the item */
if (cheat_peek) object_mention(o_ptr);
dragon_resist(o_ptr);
- if (randint(3) != 1) break;
+ if (!one_in_(3)) break;
}
/* Very good */
if (power > 1)
/* Mention the item */
if (cheat_peek) object_mention(o_ptr);
dragon_resist(o_ptr);
- if (randint(3) != 1) break;
+ if (!one_in_(3)) break;
}
/* Very good */
{
random_resistance(o_ptr, FALSE, randint(20) + 18);
}
- while (randint(4) == 1);
+ while (one_in_(4));
/* Bonus to armor class */
o_ptr->to_a = 10 + randint(5) + m_bonus(10, level);
break;
}
}
- if (randint(400) == 1 && (power > 0) && !(o_ptr->ident & IDENT_CURSED) && (level > 79))
+ if (one_in_(400) && (power > 0) && !(o_ptr->ident & IDENT_CURSED) && (level > 79))
{
o_ptr->pval = MIN(o_ptr->pval,4);
/* Randart amulet */
case SV_AMULET_RESISTANCE:
{
- if (randint(3) == 1) random_resistance(o_ptr, FALSE, (randint(34) + 4));
- if (randint(5) == 1) o_ptr->art_flags2 |= TR2_RES_POIS;
+ if (one_in_(3)) random_resistance(o_ptr, FALSE, (randint(34) + 4));
+ if (one_in_(5)) o_ptr->art_flags2 |= TR2_RES_POIS;
}
break;
break;
}
}
- if (randint(150) == 1 && (power > 0) && !(o_ptr->ident & IDENT_CURSED) && (level > 79))
+ if (one_in_(150) && (power > 0) && !(o_ptr->ident & IDENT_CURSED) && (level > 79))
{
o_ptr->pval = MIN(o_ptr->pval,4);
/* Randart amulet */
/* Trump weapon */
case EGO_TRUMP:
{
- if (randint(7) == 1) o_ptr->xtra1 = EGO_XTRA_ABILITY;
+ if (one_in_(7)) o_ptr->xtra1 = EGO_XTRA_ABILITY;
break;
}
/* Generate a special object, or a normal object */
- if ((rand_int(prob) != 0) || !make_artifact_special(j_ptr))
+ if (!one_in_(prob) || !make_artifact_special(j_ptr))
{
int k_idx;
i = ((randint(object_level + 2) + 2) / 2) - 1;
/* Apply "extra" magic */
- if (rand_int(GREAT_OBJ) == 0)
+ if (one_in_(GREAT_OBJ))
{
i += randint(object_level + 1);
}
if (s > bs) bn = 0;
/* Apply the randomizer to equivalent values */
- if ((++bn >= 2) && (rand_int(bn) != 0)) continue;
+ if ((++bn >= 2) && !one_in_(bn)) continue;
/* Keep score */
bs = s;
else old_damage = old_damage/2;
c_ptr = &cave[yy][xx];
- if (((is_trap(c_ptr->feat) && !easy_disarm) || (c_ptr->info & CAVE_TRAP)) && randint(13)!=1)
+ if (((is_trap(c_ptr->feat) && !easy_disarm) || (c_ptr->info & CAVE_TRAP)) && !one_in_(13))
{
object_type *o_ptr = choose_warning_item();
case RACE_DRACONIAN:
if (racial_aux(1, plev, A_CON, 12))
{
- int Type = ((randint(3) == 1) ? GF_COLD : GF_FIRE);
+ int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
#ifdef JP
cptr Type_desc = ((Type == GF_COLD) ? "Î䵤" : "±ê");
#else
case CLASS_IMITATOR:
case CLASS_ARCHER:
case CLASS_SMITH:
- if (randint(3) == 1)
+ if (one_in_(3))
{
Type = GF_MISSILE;
#ifdef JP
case CLASS_RED_MAGE:
case CLASS_BLUE_MAGE:
case CLASS_MIRROR_MASTER:
- if (randint(3) == 1)
+ if (one_in_(3))
{
Type = GF_MANA;
#ifdef JP
}
break;
case CLASS_CHAOS_WARRIOR:
- if (randint(3) != 1)
+ if (!one_in_(3))
{
Type = GF_CONFUSION;
#ifdef JP
case CLASS_MONK:
case CLASS_SAMURAI:
case CLASS_FORCETRAINER:
- if (randint(3) != 1)
+ if (!one_in_(3))
{
Type = GF_CONFUSION;
#ifdef JP
}
break;
case CLASS_MINDCRAFTER:
- if (randint(3) != 1)
+ if (!one_in_(3))
{
Type = GF_CONFUSION;
#ifdef JP
break;
case CLASS_PRIEST:
case CLASS_PALADIN:
- if (randint(3) == 1)
+ if (one_in_(3))
{
Type = GF_HELL_FIRE;
#ifdef JP
break;
case CLASS_ROGUE:
case CLASS_NINJA:
- if (randint(3) == 1)
+ if (one_in_(3))
{
Type = GF_DARK;
#ifdef JP
}
break;
case CLASS_BARD:
- if (randint(3) != 1)
+ if (!one_in_(3))
{
Type = GF_SOUND;
#ifdef JP
/* Hack -- Occasional pillar room */
- if (rand_int(20) == 0)
+ if (one_in_(20))
{
for (y = y1; y <= y2; y += 2)
{
}
/* Hack -- Occasional room with four pillars */
- else if (rand_int(20) == 0)
+ else if (one_in_(20))
{
if ((y1 + 4 < y2) && (x1 + 4 < x2))
{
}
/* Hack -- Occasional ragged-edge room */
- else if (rand_int(50) == 0)
+ else if (one_in_(50))
{
for (y = y1 + 2; y <= y2 - 2; y += 2)
{
}
}
/* Hack -- Occasional divided room */
- else if (rand_int(50) == 0)
+ else if (one_in_(50))
{
if (randint(100) < 50)
{
case 3:
{
/* Occasionally pinch the center shut */
- if (rand_int(3) == 0)
+ if (one_in_(3))
{
/* Pinch the east/west sides */
for (y = y1b; y <= y2b; y++)
}
/* Sometimes shut using secret doors */
- if (rand_int(3) == 0)
+ if (one_in_(3))
{
place_secret_door(yval, x1a - 1);
place_secret_door(yval, x2a + 1);
}
/* Occasionally put a "plus" in the center */
- else if (rand_int(3) == 0)
+ else if (one_in_(3))
{
c_ptr = &cave[yval][xval];
place_inner_grid(c_ptr);
}
/* Occasionally put a pillar in the center */
- else if (rand_int(3) == 0)
+ else if (one_in_(3))
{
c_ptr = &cave[yval][xval];
place_inner_grid(c_ptr);
}
/* Occasionally, two more Large Inner Pillars */
- if (rand_int(2) == 0)
+ if (one_in_(2))
{
tmp = randint(2);
for (y = yval - 1; y <= yval + 1; y++)
}
/* Occasionally, some Inner rooms */
- if (rand_int(3) == 0)
+ if (one_in_(3))
{
/* Long horizontal walls */
for (x = xval - 5; x <= xval + 5; x++)
vault_monsters(yval, xval + 2, randint(2));
/* Objects */
- if (rand_int(3) == 0) place_object(yval, xval - 2, FALSE, FALSE);
- if (rand_int(3) == 0) place_object(yval, xval + 2, FALSE, FALSE);
+ if (one_in_(3)) place_object(yval, xval - 2, FALSE, FALSE);
+ if (one_in_(3)) place_object(yval, xval + 2, FALSE, FALSE);
}
break;
place_floor_bold(y, x);
/* setup order of adjacent node visits */
- if (rand_int(3) == 0)
+ if (one_in_(3))
{
/* pick a random ordering */
for (i = 0; i < 4; i++)
}
/* Make a couple of entrances */
- if (randint(2) == 1)
+ if (one_in_(2))
{
/* left and right */
y = randint(dy) + dy / 2;
}
/* Make a couple of entrances */
- if (randint(2) == 1)
+ if (one_in_(2))
{
/* left and right */
y = randint(ysize) + y1;
/* Make a door */
y = randint(ysize - 3) + y1 + 1;
- if (randint(2) == 1)
+ if (one_in_(2))
{
/* left */
place_floor_bold(y, x1 + 1);
}
}
- if (emptyflag && (randint(2) == 1))
+ if (emptyflag && one_in_(2))
{
/* Build the vault */
build_small_room(x0, y0);
dam *= 3; dam /= randint(6) + 6;
if (seen) r_ptr->r_flags3 |= (RF3_IM_POIS);
}
- else if (randint(3) == 1) do_poly = TRUE;
+ else if (one_in_(3)) do_poly = TRUE;
break;
}
do_conf = (5 + randint(11) + r) / (r + 1);
if ((r_ptr->flags4 & RF4_BR_CHAO) ||
(m_ptr->r_idx == MON_STORMBRINGER) ||
- ((r_ptr->flags3 & RF3_DEMON) && (randint(3) == 1)))
+ ((r_ptr->flags3 & RF3_DEMON) && one_in_(3)))
{
#ifdef JP
note = "¤Ë¤ÏÂÑÀ¤¬¤¢¤ë¡£";
if (((r_ptr->flags3 & RF3_UNDEAD) ||
(r_ptr->flags3 & RF3_DEMON)) &&
(r_ptr->level > p_ptr->lev / 2) &&
- (randint(2) == 1))
+ one_in_(2))
{
note = NULL;
#ifdef JP
/* Injure +/- confusion */
monster_desc(killer, m_ptr, 0x88);
take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
- if (randint(4) == 1)
+ if (one_in_(4))
{
switch (randint(4))
{
}
}
- if ((dam > 0) && (randint(4) == 1))
+ if ((dam > 0) && one_in_(4))
{
switch (randint(4))
{
if (((r_ptr->flags3 & RF3_UNDEAD) ||
(r_ptr->flags3 & RF3_DEMON)) &&
(r_ptr->level > p_ptr->lev / 2) &&
- (randint(2) == 1))
+ (one_in_(2)))
{
note = NULL;
#ifdef JP
if (((r_ptr->flags3 & RF3_UNDEAD) ||
(r_ptr->flags3 & RF3_DEMON)) &&
(r_ptr->level > p_ptr->lev / 2) &&
- (randint(2) == 1))
+ (one_in_(2)))
{
note = NULL;
#ifdef JP
#endif
earthquake(ty, tx, 4 + rand_int(4));
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
}
case 3: case 4: case 5: case 6:
if (!count)
#endif
project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
}
case 7: case 8:
if (!count)
if (m_ptr->r_idx) teleport_away(c_ptr->m_idx, damroll(10, 10), FALSE);
if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
}
case 9: case 10: case 11:
#ifdef JP
#endif
project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
case 12: case 13: case 14: case 15: case 16:
aggravate_monsters(0);
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
case 17: case 18:
count += activate_hi_summon(ty, tx, TRUE);
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
case 19: case 20: case 21: case 22:
{
bool pet = FALSE, friendly = FALSE;
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));
- if (randint(6) != 1) break;
+ 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) lose_exp(p_ptr->exp / 160);
else lose_exp(p_ptr->exp / 16);
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
case 26: case 27: case 28:
{
int i = 0;
{
(void)do_dec_stat(i);
}
- while (randint(2) == 1);
+ while (one_in_(2));
i++;
}
}
}
}
- while (randint(5) == 1);
+ while (one_in_(5));
}
if (p_ptr->inside_battle)
if (!who) return (FALSE);
if (who == p_ptr->riding) return (FALSE);
- if ((p_ptr->reflect || p_ptr->tim_reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && !a_rad && (randint(10) != 1) && (typ != GF_PSY_SPEAR))
+ if ((p_ptr->reflect || p_ptr->tim_reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && !a_rad && !one_in_(10) && (typ != GF_PSY_SPEAR))
{
byte t_y, t_x;
int max_attempts = 10;
if (double_resist) dam = (dam + 2) / 3;
if ((!(double_resist || p_ptr->resist_pois)) &&
- randint(HURT_CHANCE) == 1)
+ one_in_(HURT_CHANCE))
{
do_dec_stat(A_CON);
}
{
set_poisoned(p_ptr->poisoned + rand_int(dam) + 10);
- if (randint(5) == 1) /* 6 */
+ if (one_in_(5)) /* 6 */
{
#ifdef JP
msg_print("´ñ·ÁŪ¤ÊÊѿȤò¿ë¤²¤¿¡ª");
msg_print("You undergo a freakish metamorphosis!");
#endif
- if (randint(4) == 1) /* 4 */
+ if (one_in_(4)) /* 4 */
do_poly_self();
else
mutate_player();
}
- if (randint(6) == 1)
+ if (one_in_(6))
{
inven_damage(set_acid_destroy, 2);
}
set_confused(p_ptr->confused + randint(5) + 5);
}
- if (randint(5) == 1)
+ if (one_in_(5))
{
inven_damage(set_cold_destroy, 3);
}
if (!p_ptr->resist_chaos)
{
(void)set_image(p_ptr->image + randint(10));
- if (randint(3) == 1)
+ if (one_in_(3))
{
#ifdef JP
msg_print("¤¢¤Ê¤¿¤Î¿ÈÂΤϥ«¥ª¥¹¤ÎÎϤÇDZ¤¸¶Ê¤²¤é¤ì¤¿¡ª");
lose_exp(5000 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
}
}
- if (!p_ptr->resist_chaos || (randint(9) == 1))
+ if (!p_ptr->resist_chaos || one_in_(9))
{
inven_damage(set_elec_destroy, 2);
inven_damage(set_fire_destroy, 2);
(void)set_cut(p_ptr->cut + dam);
}
- if (!p_ptr->resist_shard || (randint(13) == 1))
+ if (!p_ptr->resist_shard || one_in_(13))
{
inven_damage(set_cold_destroy, 2);
}
(void)set_stun(p_ptr->stun + k);
}
- if (!p_ptr->resist_sound || (randint(13) == 1))
+ if (!p_ptr->resist_sound || one_in_(13))
{
inven_damage(set_cold_destroy, 2);
}
(void)set_cut(p_ptr-> cut + ( dam / 2));
}
- if ((!p_ptr->resist_shard) || (randint(12) == 1))
+ if ((!p_ptr->resist_shard) || one_in_(12))
{
inven_damage(set_cold_destroy, 3);
}
dam = (dam * 2) / 3;
}
- if (!p_ptr->ffall || (randint(13) == 1))
+ if (!p_ptr->ffall || one_in_(13))
{
inven_damage(set_cold_destroy, 2);
}
#endif
take_hit(DAMAGE_ATTACK, dam, killer, monspell);
- if (!p_ptr->resist_shard || (randint(13) == 1))
+ if (!p_ptr->resist_shard || one_in_(13))
{
if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
inven_damage(set_cold_destroy, 2);
(void)set_stun(p_ptr->stun + randint(15));
}
- if ((!(p_ptr->resist_cold || p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))) || (randint(12) == 1))
+ if ((!(p_ptr->resist_cold || p_ptr->oppose_cold || music_singing(MUSIC_RESIST) || (p_ptr->special_defense & KATA_MUSOU))) || one_in_(12))
{
if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
}
{
monster_race *ref_ptr = &r_info[m_list[cave[y][x].m_idx].r_idx];
- if ((ref_ptr->flags2 & RF2_REFLECTING) && (randint(10) != 1 && !(flg & PROJECT_NO_REF) && (!who || dist_hack > 1)))
+ if ((ref_ptr->flags2 & RF2_REFLECTING) && (!one_in_(10) && !(flg & PROJECT_NO_REF) && (!who || dist_hack > 1)))
{
byte t_y, t_x;
int max_attempts = 10;
};
Chaos_type = hurt_types[rand_int(31)];
- if (randint(4) == 1) line_chaos = TRUE;
+ if (one_in_(4)) line_chaos = TRUE;
- if (randint(6) == 1)
+ if (one_in_(6))
{
for (dummy = 1; dummy < 10; dummy++)
{
}
}
}
- else if (randint(3) == 1)
+ else if (one_in_(3))
{
fire_ball(Chaos_type, 0, 500, 8);
}
#endif
earthquake(py, px, 5 + rand_int(10));
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
}
case 30: case 31:
if (!(*count))
#else
take_hit(DAMAGE_NOESCAPE, dam, "released pure mana", -1);
#endif
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
}
case 32: case 33:
if (!(*count))
teleport_player(damroll(10, 10));
if (rand_int(13)) (*count) += activate_hi_summon(py, px, FALSE);
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
}
case 34:
#ifdef JP
take_hit(DAMAGE_NOESCAPE, 50, "surge of energy", -1);
#endif
}
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
case 1: case 2: case 3: case 16: case 17:
aggravate_monsters(0);
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
case 4: case 5: case 6:
(*count) += activate_hi_summon(py, px, FALSE);
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
case 7: case 8: case 9: case 18:
(*count) += summon_specific(0, py, px, dun_level, 0, TRUE, FALSE, FALSE, TRUE, TRUE);
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
case 10: case 11: case 12:
#ifdef JP
msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª");
#endif
lose_exp(p_ptr->exp / 16);
- if (randint(6) != 1) break;
+ 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))
{
set_paralyzed(p_ptr->paralyzed + randint(13));
stop_ty = TRUE;
}
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
case 21: case 22: case 23:
(void)do_dec_stat(rand_int(6));
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
case 24:
#ifdef JP
msg_print("¤Û¤¨¡©»ä¤Ïï¡©¤³¤³¤Ç²¿¤·¤Æ¤ë¡©");
#endif
lose_all_info();
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
case 25:
/*
* Only summon Cyberdemons deep in the dungeon.
stop_ty = TRUE;
break;
}
- if (randint(6) != 1) break;
+ if (!one_in_(6)) break;
default:
while (i < 6)
{
{
(void)do_dec_stat(i);
}
- while (randint(2) == 1);
+ while (one_in_(2));
i++;
}
}
}
- while ((randint(3) == 1) && !stop_ty);
+ while (one_in_(3) && !stop_ty);
return stop_ty;
}
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. */
#endif
- if (randint(RUMOR_CHANCE) == 1)
+ if (one_in_(RUMOR_CHANCE))
{
#ifdef JP
msg_print("Ź¼ç¤Ï¼ª¤¦¤Á¤·¤¿:");
msg_print(comment_7b[rand_int(MAX_COMMENT_7B)]);
chg_virtue(V_JUSTICE, -1);
- if (randint(4)==1)
+ if (one_in_(4))
chg_virtue(V_HONOUR, -1);
/* Sound */
/* Comment */
msg_print(comment_7c[rand_int(MAX_COMMENT_7C)]);
- if (randint(4)==1)
+ if (one_in_(4))
chg_virtue(V_HONOUR, -1);
- else if (randint(4)==1)
+ else if (one_in_(4))
chg_virtue(V_HONOUR, 1);
/* Sound */
/* Comment */
msg_print(comment_7d[rand_int(MAX_COMMENT_7D)]);
- if (randint(2)==1)
+ if (one_in_(2))
chg_virtue(V_HONOUR, -1);
- if (randint(4)==1)
+ if (one_in_(4))
chg_virtue(V_HONOUR, 1);
if (10 * price < value)
case TV_WAND:
case TV_STAFF:
{
- if ((cur_store_num == STORE_BLACK) && (randint(3) == 1))
+ if ((cur_store_num == STORE_BLACK) && one_in_(3))
{
if (cost < 1601L) size += damroll(1, 5);
else if (cost < 3201L) size += damroll(1, 3);
{
discount = 0;
}
- else if (rand_int(25) == 0)
+ else if (one_in_(25))
{
discount = 25;
}
- else if (rand_int(150) == 0)
+ else if (one_in_(150))
{
discount = 50;
}
- else if (rand_int(300) == 0)
+ else if (one_in_(300))
{
discount = 75;
}
- else if (rand_int(500) == 0)
+ else if (one_in_(500))
{
discount = 90;
}
if (st_ptr->stock_num == 0)
{
/* Shuffle */
- if (rand_int(STORE_SHUFFLE) == 0)
+ if (one_in_(STORE_SHUFFLE))
{
char buf[80];
/* Message */
recursive_river(x1 + dx + changex, y1 + dy + changey, x2, y2, feat1, feat2, width);
/* Split the river some of the time - junctions look cool */
- if ((randint(DUN_WAT_CHG) == 1) && (width > 0))
+ if (one_in_(DUN_WAT_CHG) && (width > 0))
{
recursive_river(x1 + dx + changex, y1 + dy + changey,
x1 + 8 * (dx + changex), y1 + 8 * (dy + changey),
c_ptr->feat = feat;
/* Hack -- Add some (known) treasure */
- if (treasure && (rand_int(chance) == 0)) c_ptr->feat += 0x04;
+ if (treasure && one_in_(chance)) c_ptr->feat += 0x04;
}
if (dummy >= SAFE_MAX_ATTEMPTS)
}
/* No up stairs in ironman mode */
- if (!ironman_downward && (randint(3) == 1))
+ if (!ironman_downward && one_in_(3))
{
/* up stair */
cave[y][x].feat = FEAT_LESS;
}
if (p_ptr->prace == RACE_BEASTMAN)
{
- if (randint(5) == 1) level_mutation = TRUE;
+ if (one_in_(5)) level_mutation = TRUE;
}
level_inc_stat = TRUE;
}
/* Drop a dead corpse? */
- if ((randint(r_ptr->flags1 & RF1_UNIQUE ? 1 : 4) == 1) &&
+ if (one_in_(r_ptr->flags1 & RF1_UNIQUE ? 1 : 4) &&
((r_ptr->flags9 & RF9_DROP_CORPSE) ||
(r_ptr->flags9 & RF9_DROP_SKELETON)) &&
!(p_ptr->inside_arena || p_ptr->inside_battle || (m_ptr->smart & SM_CLONED) || ((m_ptr->r_idx == today_mon) && is_pet(m_ptr))))
/* Lots of damage in one blow */
if ((0 - ((m_ptr->maxhp) / 4)) > m_ptr->hp)
{
- if (randint(5) == 1) corpse = TRUE;
+ if (one_in_(5)) corpse = TRUE;
}
else
{
- if (randint(5) != 1) corpse = TRUE;
+ if (!one_in_(5)) corpse = TRUE;
}
}
if (m_ptr->r_idx == MON_DAWN &&
!(p_ptr->inside_arena || p_ptr->inside_battle))
{
- if (randint(7) != 1)
+ if (!one_in_(7))
{
int wy = py, wx = px;
int attempts = 100;
if (m_ptr->r_idx == MON_OBERON)
{
- if (randint(3) == 1)
+ if (one_in_(3))
{
a_idx = ART_THRAIN;
chance = 33;
}
else if (m_ptr->r_idx == MON_SAURON)
{
- if (randint(10) == 1)
+ if (one_in_(10))
{
a_idx = ART_POWER;
chance = 100;
}
else if (m_ptr->r_idx == MON_BRAND)
{
- if (randint(3) != 1)
+ if (!one_in_(3))
{
a_idx = ART_BRAND;
chance = 25;
}
else if (m_ptr->r_idx == MON_CORWIN)
{
- if (randint(3) != 1)
+ if (!one_in_(3))
{
a_idx = ART_GRAYSWANDIR;
chance = 33;
if ((r_ptr->flags3 & RF3_RES_ALL) && dam > 0)
{
dam /= 100;
- if((dam == 0) && (randint(3) == 1)) dam = 1;
+ if((dam == 0) && one_in_(3)) dam = 1;
}
if (m_ptr->invulner)
#endif
}
}
- else if (!(randint(PENETRATE_INVULNERABILITY) == 1))
+ else if (!one_in_(PENETRATE_INVULNERABILITY))
{
return (0);
}
monster_desc(m_name, m_ptr, 0x100);
/* Don't kill Amberites */
- if ((r_ptr->flags3 & RF3_AMBERITE) && (randint(2) == 1))
+ if ((r_ptr->flags3 & RF3_AMBERITE) && one_in_(2))
{
int curses = 1 + randint(3);
bool stop_ty = FALSE;
chg_virtue(V_VITALITY, -2);
}
- if ((r_ptr->flags1 & RF1_UNIQUE) & (randint(3)==1))
+ if ((r_ptr->flags1 & RF1_UNIQUE) && one_in_(3))
chg_virtue(V_INDIVIDUALISM, -1);
if (m_ptr->r_idx == MON_BEGGAR || m_ptr->r_idx == MON_LEPER)
if ((r_ptr->flags3 & RF3_ANIMAL) && !(r_ptr->flags3 & RF3_EVIL) && !(r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) && !(r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) && !(r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
{
- if (randint(4)==1) chg_virtue(V_NATURE, -1);
+ if (one_in_(4)) chg_virtue(V_NATURE, -1);
}
if((r_ptr->flags1 & RF1_UNIQUE) && record_destroy_uniq)
else if (!(p_ptr->lev % 13)) nasty_chance = 3;
else if (!(p_ptr->lev % 14)) nasty_chance = 12;
- if (randint(nasty_chance) == 1)
+ if (one_in_(nasty_chance))
type = randint(20); /* Allow the 'nasty' effects */
else
type = randint(15) + 5; /* Or disallow them */
effect = chaos_rewards[p_ptr->chaos_patron][type];
- if ((randint(6) == 1) && !chosen_reward)
+ if (one_in_(6) && !chosen_reward)
{
#ifdef JP
msg_format("%^s¤ÏË«Èþ¤È¤·¤Æ¤¢¤Ê¤¿¤òÆÍÁ³ÊÑ°Û¤µ¤»¤¿¡£",
msg_print("'Stay, mortal, and let me mold thee.'");
#endif
- if ((randint(3) == 1) && !(chaos_stats[p_ptr->chaos_patron] < 0))
+ 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));
msg_print("'I grow tired of thee, mortal.'");
#endif
- if ((randint(3) == 1) && !(chaos_stats[p_ptr->chaos_patron] < 0))
+ 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));
#endif
break;
case 3:
- if (randint(2) == 1)
+ if (one_in_(2))
{
if (!buki_motteruka(INVEN_RARM)) break;
object_desc(o_name, &inventory[INVEN_RARM], TRUE, 0);
}
activate_hi_summon(py, px, FALSE);
(void)activate_ty_curse(FALSE, &count);
- if (randint(2) == 1) (void)curse_weapon(FALSE, INVEN_RARM);
- if (randint(2) == 1) (void)curse_armor();
+ if (one_in_(2)) (void)curse_weapon(FALSE, INVEN_RARM);
+ if (one_in_(2)) (void)curse_armor();
break;
case REW_DESTRUCT:
#ifdef JP