X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fmutation.c;h=bd74d3dfcf0446ee582c875f57e811583cb25472;hb=a4b117f8098e97cad8d0ee308b073e0f2716c3f7;hp=a34a8bf5c438cc0030400445916907435d081717;hpb=2236a858ecf93d5f0d411468c70cb9708aad9bdd;p=hengband%2Fhengband.git diff --git a/src/mutation.c b/src/mutation.c index a34a8bf5c..bd74d3dfc 100644 --- a/src/mutation.c +++ b/src/mutation.c @@ -1,15 +1,15 @@ /* File: mutation.c */ -/* Purpose: Mutation effects (and racial powers) */ - /* - * Copyright (c) 1989 James E. Wilson, Robert A. Koeneke + * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke * - * This software may be copied and distributed for educational, research, and - * not for profit purposes provided that this copyright and statement are - * included in all such copies. + * This software may be copied and distributed for educational, research, + * and not for profit purposes provided that this copyright and statement + * are included in all such copies. Other copyrights may also apply. */ +/* Purpose: Mutation effects (and racial powers) */ + #include "angband.h" @@ -25,7 +25,7 @@ bool gain_random_mutation(int choose_mut) 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); @@ -211,7 +211,7 @@ muta_desc = " muta_class = &(p_ptr->muta1); muta_which = MUT1_MIDAS_TCH; #ifdef JP -muta_desc = "¡Ö¥ß¥À¥¹²¦¤Î¼ê¡×¤ÎǽÎϤòÆÀ¤¿¡£";/*¥È¥¥¡¼¥à¥ì¥¤¥À¡¼¥¹¤Ë¤¢¤ê¤Þ¤·¤¿¤Í¡£*/ +muta_desc = "¡Ö¥ß¥À¥¹²¦¤Î¼ê¡×¤ÎǽÎϤòÆÀ¤¿¡£";/*¥È¥¥¡¼¥à¥ì¥¤¥À¡¼¥¹¤Ë¤¢¤ê¤Þ¤·¤¿¤Í¡£ */ #else muta_desc = "You gain the Midas touch."; #endif @@ -1021,76 +1021,82 @@ msg_print(" { chg_virtue(V_CHANCE, 1); - if (p_ptr->prace == RACE_VAMPIRE && - !(p_ptr->muta1 & MUT1_HYPN_GAZE) && - (randint(10) < 7)) - { - muta_class = &(p_ptr->muta1); - muta_which = MUT1_HYPN_GAZE; + /* + some races are apt to gain specified mutations + This should be allowed only if "choose_mut" is 0. + --- henkma + */ + if(!choose_mut){ + if (p_ptr->prace == RACE_VAMPIRE && + !(p_ptr->muta1 & MUT1_HYPN_GAZE) && + (randint1(10) < 7)) + { + muta_class = &(p_ptr->muta1); + muta_which = MUT1_HYPN_GAZE; #ifdef JP muta_desc = "´ã¤¬¸¸ÏÇŪ¤Ë¤Ê¤Ã¤¿..."; #else - muta_desc = "Your eyes look mesmerizing..."; + muta_desc = "Your eyes look mesmerizing..."; #endif - } + } - else if (p_ptr->prace == RACE_IMP && - !(p_ptr->muta2 & MUT2_HORNS) && - (randint(10) < 7)) - { - muta_class = &(p_ptr->muta2); - muta_which = MUT2_HORNS; + else if (p_ptr->prace == RACE_IMP && + !(p_ptr->muta2 & MUT2_HORNS) && + (randint1(10) < 7)) + { + muta_class = &(p_ptr->muta2); + muta_which = MUT2_HORNS; #ifdef JP muta_desc = "³Ñ¤¬³Û¤«¤éÀ¸¤¨¤Æ¤­¤¿¡ª"; #else - muta_desc = "Horns pop forth into your forehead!"; + muta_desc = "Horns pop forth into your forehead!"; #endif - } + } - else if (p_ptr->prace == RACE_YEEK && - !(p_ptr->muta1 & MUT1_SHRIEK) && - (randint(10) < 7)) - { - muta_class = &(p_ptr->muta1); - muta_which = MUT1_SHRIEK; + else if (p_ptr->prace == RACE_YEEK && + !(p_ptr->muta1 & MUT1_SHRIEK) && + (randint1(10) < 7)) + { + muta_class = &(p_ptr->muta1); + muta_which = MUT1_SHRIEK; #ifdef JP muta_desc = "À¼¼Á¤¬¤«¤Ê¤ê¶¯¤¯¤Ê¤Ã¤¿¡£"; #else - muta_desc = "Your vocal cords get much tougher."; + muta_desc = "Your vocal cords get much tougher."; #endif - } + } - else if (p_ptr->prace == RACE_BEASTMAN && - !(p_ptr->muta1 & MUT1_POLYMORPH) && - (randint(10) < 2)) - { - muta_class = &(p_ptr->muta1); - muta_which = MUT1_POLYMORPH; + else if (p_ptr->prace == RACE_BEASTMAN && + !(p_ptr->muta1 & MUT1_POLYMORPH) && + (randint1(10) < 2)) + { + muta_class = &(p_ptr->muta1); + muta_which = MUT1_POLYMORPH; #ifdef JP muta_desc = "¤¢¤Ê¤¿¤ÎÆùÂΤÏÊѲ½¤Ç¤­¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡¢"; #else - muta_desc = "Your body seems mutable."; + muta_desc = "Your body seems mutable."; #endif - } + } - else if (p_ptr->prace == RACE_MIND_FLAYER && - !(p_ptr->muta2 & MUT2_TENTACLES) && - (randint(10) < 7)) - { - muta_class = &(p_ptr->muta2); - muta_which = MUT2_TENTACLES; + else if (p_ptr->prace == RACE_MIND_FLAYER && + !(p_ptr->muta2 & MUT2_TENTACLES) && + (randint1(10) < 7)) + { + muta_class = &(p_ptr->muta2); + muta_which = MUT2_TENTACLES; #ifdef JP muta_desc = "¼Ù°­¤Ê¿¨¼ê¤¬¸ý¤Î¼þ¤ê¤ËÀ¸¤¨¤¿¡£"; #else - muta_desc = "Evil-looking tentacles sprout from your mouth."; + muta_desc = "Evil-looking tentacles sprout from your mouth."; #endif + } } - #ifdef JP msg_print("ÆÍÁ³ÊÑ°Û¤·¤¿¡ª"); #else @@ -1330,7 +1336,7 @@ bool lose_mutation(int choose_mut) 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); @@ -3254,8 +3260,8 @@ int count_bits(u32b x) static int count_mutations(void) { return (count_bits(p_ptr->muta1) + - count_bits(p_ptr->muta2) + - count_bits(p_ptr->muta3)); + count_bits(p_ptr->muta2) + + count_bits(p_ptr->muta3)); } @@ -3293,7 +3299,14 @@ int calc_mutant_regenerate_mod(void) } -void mutation_power_aux(u32b power) +void mutation_stop_mouth() +{ + if (music_singing_any()) stop_singing(); + if (hex_spelling_any()) stop_hex_spell_all(); +} + + +bool mutation_power_aux(u32b power) { int dir = 0; int lvl = p_ptr->lev; @@ -3302,117 +3315,99 @@ void mutation_power_aux(u32b power) switch (power) { case MUT1_SPIT_ACID: - if (racial_aux(9, 9, A_DEX, 15)) - { + if (!get_aim_dir(&dir)) return FALSE; + mutation_stop_mouth(); #ifdef JP -msg_print("»À¤òÅǤ­¤«¤±¤¿..."); + msg_print("»À¤òÅǤ­¤«¤±¤¿..."); #else - msg_print("You spit acid..."); + msg_print("You spit acid..."); #endif - if (get_aim_dir(&dir)) - fire_ball(GF_ACID, dir, lvl, 1 + (lvl / 30)); - } + fire_ball(GF_ACID, dir, lvl, 1 + (lvl / 30)); break; case MUT1_BR_FIRE: - if (racial_aux(20, lvl, A_CON, 18)) - { + if (!get_aim_dir(&dir)) return FALSE; + mutation_stop_mouth(); #ifdef JP -msg_print("¤¢¤Ê¤¿¤Ï²Ð±ê¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿..."); + msg_print("¤¢¤Ê¤¿¤Ï²Ð±ê¤Î¥Ö¥ì¥¹¤òÅǤ¤¤¿..."); #else - msg_print("You breathe fire..."); + msg_print("You breathe fire..."); #endif - if (get_aim_dir(&dir)) - fire_ball(GF_FIRE, dir, lvl * 2, 1 + (lvl / 20)); - } + fire_ball(GF_FIRE, dir, lvl * 2, 1 + (lvl / 20)); break; case MUT1_HYPN_GAZE: - if (racial_aux(12, 12, A_CHR, 18)) - { + if (!get_aim_dir(&dir)) return FALSE; #ifdef JP -msg_print("¤¢¤Ê¤¿¤ÎÌܤϸ¸ÏÇŪ¤Ë¤Ê¤Ã¤¿..."); + msg_print("¤¢¤Ê¤¿¤ÎÌܤϸ¸ÏÇŪ¤Ë¤Ê¤Ã¤¿..."); #else - msg_print("Your eyes look mesmerizing..."); + msg_print("Your eyes look mesmerizing..."); #endif - if (get_aim_dir(&dir)) - (void)charm_monster(dir, lvl); - } + (void)charm_monster(dir, lvl); break; case MUT1_TELEKINES: - if (racial_aux(9, 9, A_WIS, 14)) - { + if (!get_aim_dir(&dir)) return FALSE; #ifdef JP -msg_print("½¸Ã椷¤Æ¤¤¤ë..."); + msg_print("½¸Ã椷¤Æ¤¤¤ë..."); #else - msg_print("You concentrate..."); + msg_print("You concentrate..."); #endif - if (get_aim_dir(&dir)) - fetch(dir, lvl * 10, TRUE); - } + fetch(dir, lvl * 10, TRUE); break; case MUT1_VTELEPORT: - if (racial_aux(7, 7, A_WIS, 15)) - { #ifdef JP -msg_print("½¸Ã椷¤Æ¤¤¤ë..."); + msg_print("½¸Ã椷¤Æ¤¤¤ë..."); #else - msg_print("You concentrate..."); + msg_print("You concentrate..."); #endif - teleport_player(10 + 4 * lvl); - } + teleport_player(10 + 4 * lvl, 0L); break; case MUT1_MIND_BLST: - if (racial_aux(5, 3, A_WIS, 15)) - { + if (!get_aim_dir(&dir)) return FALSE; #ifdef JP -msg_print("½¸Ã椷¤Æ¤¤¤ë..."); + msg_print("½¸Ã椷¤Æ¤¤¤ë..."); #else - msg_print("You concentrate..."); + msg_print("You concentrate..."); #endif - if (!get_aim_dir(&dir)) return; - fire_bolt(GF_PSI, dir, damroll(3 + ((lvl - 1) / 5), 3)); - } + fire_bolt(GF_PSI, dir, damroll(3 + ((lvl - 1) / 5), 3)); break; case MUT1_RADIATION: - if (racial_aux(15, 15, A_CON, 14)) - { #ifdef JP -msg_print("ÂΤ«¤éÊü¼Íǽ¤¬È¯À¸¤·¤¿¡ª"); + msg_print("ÂΤ«¤éÊü¼Íǽ¤¬È¯À¸¤·¤¿¡ª"); #else - msg_print("Radiation flows from your body!"); + msg_print("Radiation flows from your body!"); #endif - fire_ball(GF_NUKE, 0, (lvl * 2), 3 + (lvl / 20)); - } + fire_ball(GF_NUKE, 0, (lvl * 2), 3 + (lvl / 20)); break; case MUT1_VAMPIRISM: - if (racial_aux(2, (1 + (lvl / 3)), A_CON, 9)) { int x, y, dummy; cave_type *c_ptr; /* Only works on adjacent monsters */ - if (!get_rep_dir2(&dir)) break; + if (!get_rep_dir2(&dir)) return FALSE; y = py + ddy[dir]; x = px + ddx[dir]; c_ptr = &cave[y][x]; + mutation_stop_mouth(); + if (!(c_ptr->m_idx)) { #ifdef JP -msg_print("²¿¤â¤Ê¤¤¾ì½ê¤Ë³ú¤ß¤Ä¤¤¤¿¡ª"); + msg_print("²¿¤â¤Ê¤¤¾ì½ê¤Ë³ú¤ß¤Ä¤¤¤¿¡ª"); #else msg_print("You bite into thin air!"); #endif @@ -3421,7 +3416,7 @@ msg_print(" } #ifdef JP -msg_print("¤¢¤Ê¤¿¤Ï¥Ë¥ä¥ê¤È¤·¤Æ²ç¤ò¤à¤¤¤¿..."); + msg_print("¤¢¤Ê¤¿¤Ï¥Ë¥ä¥ê¤È¤·¤Æ²ç¤ò¤à¤¤¤¿..."); #else msg_print("You grin and bare your fangs..."); #endif @@ -3436,22 +3431,22 @@ msg_print(" (void)hp_player(dummy); else #ifdef JP -msg_print("¤¢¤Ê¤¿¤Ï¶õÊ¢¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£"); + msg_print("¤¢¤Ê¤¿¤Ï¶õÊ¢¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£"); #else msg_print("You were not hungry."); #endif - /* Gain nutritional sustenance: 150/hp drained */ - /* A Food ration gives 5000 food points (by contrast) */ - /* Don't ever get more than "Full" this way */ - /* But if we ARE Gorged, it won't cure us */ - dummy = p_ptr->food + MIN(5000, 100 * dummy); + /* Gain nutritional sustenance: 150/hp drained */ + /* A Food ration gives 5000 food points (by contrast) */ + /* Don't ever get more than "Full" this way */ + /* But if we ARE Gorged, it won't cure us */ + dummy = p_ptr->food + MIN(5000, 100 * dummy); if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */ (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX-1 : dummy); } else #ifdef JP -msg_print("¤²¤§¡ª¤Ò¤É¤¤Ì£¤À¡£"); + msg_print("¤²¤§¡ª¤Ò¤É¤¤Ì£¤À¡£"); #else msg_print("Yechh. That tastes foul."); #endif @@ -3460,156 +3455,130 @@ msg_print(" break; case MUT1_SMELL_MET: - if (racial_aux(3, 2, A_INT, 12)) - { - (void)detect_treasure(DETECT_RAD_DEFAULT); - } + mutation_stop_mouth(); + (void)detect_treasure(DETECT_RAD_DEFAULT); break; case MUT1_SMELL_MON: - if (racial_aux(5, 4, A_INT, 15)) - { - (void)detect_monsters_normal(DETECT_RAD_DEFAULT); - } + mutation_stop_mouth(); + (void)detect_monsters_normal(DETECT_RAD_DEFAULT); break; case MUT1_BLINK: - if (racial_aux(3, 3, A_WIS, 12)) - { - teleport_player(10); - } + teleport_player(10, 0L); break; case MUT1_EAT_ROCK: - if (racial_aux(8, 12, A_CON, 18)) { - int x, y, ox, oy; + int x, y; cave_type *c_ptr; + feature_type *f_ptr, *mimic_f_ptr; - if (!get_rep_dir2(&dir)) break; + if (!get_rep_dir2(&dir)) return FALSE; y = py + ddy[dir]; x = px + ddx[dir]; c_ptr = &cave[y][x]; - if (cave_floor_bold(y, x)) + f_ptr = &f_info[c_ptr->feat]; + mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)]; + + mutation_stop_mouth(); + + if (!have_flag(mimic_f_ptr->flags, FF_HURT_ROCK)) { #ifdef JP -msg_print("²¿¤â¤Ê¤¤¾ì½ê¤Ë³ú¤ß¤Ä¤¤¤¿¡ª"); + msg_print("¤³¤ÎÃÏ·Á¤Ï¿©¤Ù¤é¤ì¤Ê¤¤¡£"); #else - msg_print("You bite into thin air!"); + msg_print("You cannot eat this feature."); #endif - break; } - else if (((c_ptr->feat >= FEAT_PERM_EXTRA) && - (c_ptr->feat <= FEAT_PERM_SOLID)) || - (c_ptr->feat == FEAT_MOUNTAIN)) + else if (have_flag(f_ptr->flags, FF_PERMANENT)) { #ifdef JP -msg_print("¤¤¤Æ¤Ã¡ª¤³¤ÎÊɤϤ¢¤Ê¤¿¤Î»õ¤è¤ê¹Å¤¤¡ª"); + msg_format("¤¤¤Æ¤Ã¡ª¤³¤Î%s¤Ï¤¢¤Ê¤¿¤Î»õ¤è¤ê¹Å¤¤¡ª", f_name + mimic_f_ptr->name); #else - msg_print("Ouch! This wall is harder than your teeth!"); + msg_format("Ouch! This %s is harder than your teeth!", f_name + mimic_f_ptr->name); #endif - break; } else if (c_ptr->m_idx) { + monster_type *m_ptr = &m_list[c_ptr->m_idx]; #ifdef JP -msg_print("²¿¤«¤¬¼ÙË⤷¤Æ¤¤¤Þ¤¹¡ª"); + msg_print("²¿¤«¤¬¼ÙË⤷¤Æ¤¤¤Þ¤¹¡ª"); #else msg_print("There's something in the way!"); #endif + if (!m_ptr->ml || !is_pet(m_ptr)) py_attack(y, x, 0); break; } - else if (c_ptr->feat == FEAT_TREES) + else if (have_flag(f_ptr->flags, FF_TREE)) { #ifdef JP -msg_print("ÌڤϤ¢¤Þ¤êÈþÌ£¤·¤¯¤Ê¤¤¡ª"); + msg_print("ÌÚ¤ÎÌ£¤Ï¹¥¤­¤¸¤ã¤Ê¤¤¡ª"); #else msg_print("You don't like the woody taste!"); #endif - break; } - else + else if (have_flag(f_ptr->flags, FF_GLASS)) { - if ((c_ptr->feat >= FEAT_DOOR_HEAD) && - (c_ptr->feat <= FEAT_RUBBLE)) - { - (void)set_food(p_ptr->food + 3000); - } - else if ((c_ptr->feat >= FEAT_MAGMA) && - (c_ptr->feat <= FEAT_QUARTZ_K)) - { - (void)set_food(p_ptr->food + 5000); - } - else - { #ifdef JP -msg_print("¤³¤Î²ÖÖ¾´ä¤Ï¤È¤Æ¤â¤ª¤¤¤·¤¤¡ª"); + msg_print("¥¬¥é¥¹¤ÎÌ£¤Ï¹¥¤­¤¸¤ã¤Ê¤¤¡ª"); #else - msg_print("This granite is very filling!"); + msg_print("You don't like the glassy taste!"); #endif - - (void)set_food(p_ptr->food + 10000); - } + break; } - (void)wall_to_mud(dir); - - oy = py; - ox = px; - - py = y; - px = x; - - if (p_ptr->riding) + else if (have_flag(f_ptr->flags, FF_DOOR) || have_flag(f_ptr->flags, FF_CAN_DIG)) { - m_list[p_ptr->riding].fy = py; - m_list[p_ptr->riding].fx = px; - cave[py][px].m_idx = p_ptr->riding; - cave[oy][ox].m_idx = 0; - update_mon(cave[py][px].m_idx, TRUE); + (void)set_food(p_ptr->food + 3000); + } + else if (have_flag(f_ptr->flags, FF_MAY_HAVE_GOLD) || have_flag(f_ptr->flags, FF_HAS_GOLD)) + { + (void)set_food(p_ptr->food + 5000); + } + else + { +#ifdef JP + msg_format("¤³¤Î%s¤Ï¤È¤Æ¤â¤ª¤¤¤·¤¤¡ª", f_name + mimic_f_ptr->name); +#else + msg_format("This %s is very filling!", f_name + mimic_f_ptr->name); +#endif + (void)set_food(p_ptr->food + 10000); } - lite_spot(py, px); - lite_spot(oy, ox); - - verify_panel(); + /* Destroy the wall */ + cave_alter_feat(y, x, FF_HURT_ROCK); - p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE); - p_ptr->update |= (PU_DISTANCE); - p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); + /* Move the player */ + (void)move_player_effect(y, x, MPE_DONT_PICKUP); } break; case MUT1_SWAP_POS: - if (racial_aux(15, 12, A_DEX, 16)) + project_length = -1; + if (!get_aim_dir(&dir)) { - project_length = -1; - if (get_aim_dir(&dir)) - (void)teleport_swap(dir); project_length = 0; + return FALSE; } + (void)teleport_swap(dir); + project_length = 0; break; case MUT1_SHRIEK: - if (racial_aux(20, 14, A_CON, 16)) - { - (void)fire_ball(GF_SOUND, 0, 2 * lvl, 8); - (void)aggravate_monsters(0); - } + mutation_stop_mouth(); + (void)fire_ball(GF_SOUND, 0, 2 * lvl, 8); + (void)aggravate_monsters(0); break; case MUT1_ILLUMINE: - if (racial_aux(3, 2, A_INT, 10)) - { - (void)lite_area(damroll(2, (lvl / 2)), (lvl / 10) + 1); - } + (void)lite_area(damroll(2, (lvl / 2)), (lvl / 10) + 1); break; case MUT1_DET_CURSE: - if (racial_aux(7, 14, A_WIS, 14)) { int i; @@ -3618,7 +3587,7 @@ msg_print(" object_type *o_ptr = &inventory[i]; if (!o_ptr->k_idx) continue; - if (!cursed_p(o_ptr)) continue; + if (!object_is_cursed(o_ptr)) continue; o_ptr->feeling = FEEL_CURSED; } @@ -3626,63 +3595,56 @@ msg_print(" break; case MUT1_BERSERK: - if (racial_aux(8, 8, A_STR, 14)) - { - (void)set_shero(randint(25) + 25, FALSE); - (void)hp_player(30); - (void)set_afraid(0); - } + (void)set_shero(randint1(25) + 25, FALSE); + (void)hp_player(30); + (void)set_afraid(0); break; case MUT1_POLYMORPH: - if (racial_aux(18, 20, A_CON, 18)) - { - if (!get_check("ÊѿȤ·¤Þ¤¹¡£¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) return; - do_poly_self(); - } +#ifdef JP + if (!get_check("ÊѿȤ·¤Þ¤¹¡£¤è¤í¤·¤¤¤Ç¤¹¤«¡©")) return FALSE; +#else + if (!get_check("You will polymorph your self. Are you sure? ")) return FALSE; +#endif + do_poly_self(); break; case MUT1_MIDAS_TCH: - if (racial_aux(10, 5, A_INT, 12)) - { - (void)alchemy(); - } + if (!alchemy()) return FALSE; break; /* Summon pet molds around the player */ case MUT1_GROW_MOLD: - if (racial_aux(1, 6, A_CON, 14)) { int i; for (i = 0; i < 8; i++) { - summon_specific(-1, py, px, lvl, SUMMON_BIZARRE1, FALSE, TRUE, TRUE, FALSE, FALSE); + summon_specific(-1, py, px, lvl, SUMMON_BIZARRE1, PM_FORCE_PET); } } break; case MUT1_RESIST: - 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--; @@ -3696,65 +3658,52 @@ msg_print(" break; case MUT1_EARTHQUAKE: - if (racial_aux(12, 12, A_STR, 16)) - { - earthquake(py, px, 10); - } + (void)earthquake(py, px, 10); break; case MUT1_EAT_MAGIC: - if (racial_aux(17, 1, A_WIS, 15)) - { - eat_magic(p_ptr->lev * 2); - } + if (!eat_magic(p_ptr->lev * 2)) return FALSE; break; case MUT1_WEIGH_MAG: - if (racial_aux(6, 6, A_INT, 10)) - { - report_magics(); - } + report_magics(); break; case MUT1_STERILITY: - if (racial_aux(12, 23, A_CHR, 15)) - { - /* Fake a population explosion. */ + /* Fake a population explosion. */ #ifdef JP -msg_print("ÆÍÁ³Æ¬¤¬Äˤ¯¤Ê¤Ã¤¿¡ª"); -take_hit(DAMAGE_LOSELIFE, randint(17) + 17, "¶ØÍߤò¶¯¤¤¤¿ÈèÏ«", -1); + msg_print("ÆÍÁ³Æ¬¤¬Äˤ¯¤Ê¤Ã¤¿¡ª"); + 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); + msg_print("You suddenly have a headache!"); + take_hit(DAMAGE_LOSELIFE, randint1(17) + 17, "the strain of forcing abstinence", -1); #endif - num_repro += MAX_REPRO; - } + num_repro += MAX_REPRO; break; case MUT1_PANIC_HIT: - if (racial_aux(10, 12, A_DEX, 14)) { int x, y; - if (!get_rep_dir2(&dir)) return; + if (!get_rep_dir2(&dir)) return FALSE; y = py + ddy[dir]; x = px + ddx[dir]; 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("¤¦¤Þ¤¯Æ¨¤²¤é¤ì¤Ê¤«¤Ã¤¿¡£"); + msg_print("¤¦¤Þ¤¯Æ¨¤²¤é¤ì¤Ê¤«¤Ã¤¿¡£"); #else msg_print("You failed to teleport."); #endif - else teleport_player(30); + else teleport_player(30, 0L); } else { #ifdef JP -msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£"); + msg_print("¤½¤ÎÊý¸þ¤Ë¤Ï¥â¥ó¥¹¥¿¡¼¤Ï¤¤¤Þ¤»¤ó¡£"); #else msg_print("You don't see any monster in this direction"); #endif @@ -3765,38 +3714,28 @@ msg_print(" break; case MUT1_DAZZLE: - if (racial_aux(7, 15, A_CHR, 8)) - { - stun_monsters(lvl * 4); - confuse_monsters(lvl * 4); - turn_monsters(lvl * 4); - } + stun_monsters(lvl * 4); + confuse_monsters(lvl * 4); + turn_monsters(lvl * 4); break; case MUT1_LASER_EYE: - if (racial_aux(7, 10, A_WIS, 9)) - { - if (get_aim_dir(&dir)) - fire_beam(GF_LITE, dir, 2 * lvl); - } + if (!get_aim_dir(&dir)) return FALSE; + fire_beam(GF_LITE, dir, 2 * lvl); break; case MUT1_RECALL: - if (racial_aux(17, 50, A_INT, 16)) - { - (void)word_of_recall(); - } + if (!word_of_recall()) return FALSE; break; case MUT1_BANISH: - if (racial_aux(25, 25, A_WIS, 18)) { int x, y; cave_type *c_ptr; monster_type *m_ptr; monster_race *r_ptr; - if (!get_rep_dir2(&dir)) return; + if (!get_rep_dir2(&dir)) return FALSE; y = py + ddy[dir]; x = px + ddx[dir]; c_ptr = &cave[y][x]; @@ -3804,7 +3743,7 @@ msg_print(" if (!c_ptr->m_idx) { #ifdef JP -msg_print("¼Ù°­¤Ê¸ºß¤ò´¶¤¸¤È¤ì¤Þ¤»¤ó¡ª"); + msg_print("¼Ù°­¤Ê¸ºß¤ò´¶¤¸¤È¤ì¤Þ¤»¤ó¡ª"); #else msg_print("You sense no evil there!"); #endif @@ -3819,13 +3758,21 @@ msg_print(" !(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)) && - !(m_ptr->mflag2 & MFLAG_NOGENO)) + (r_ptr->level < randint1(p_ptr->lev+50)) && + !(m_ptr->mflag2 & MFLAG2_NOGENO)) { + if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname) + { + char m_name[80]; + + monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE); + do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name); + } + /* Delete the monster, rather than killing it. */ delete_monster_idx(c_ptr->m_idx); #ifdef JP -msg_print("¤½¤Î¼Ù°­¤Ê¥â¥ó¥¹¥¿¡¼¤Ïⲫ½­¤¤±ì¤È¤È¤â¤Ë¾Ã¤¨µî¤Ã¤¿¡ª"); + msg_print("¤½¤Î¼Ù°­¤Ê¥â¥ó¥¹¥¿¡¼¤Ïⲫ½­¤¤±ì¤È¤È¤â¤Ë¾Ã¤¨µî¤Ã¤¿¡ª"); #else msg_print("The evil creature vanishes in a puff of sulfurous smoke!"); #endif @@ -3834,23 +3781,22 @@ msg_print(" else { #ifdef JP -msg_print("µ§¤ê¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª"); + msg_print("µ§¤ê¤Ï¸ú²Ì¤¬¤Ê¤«¤Ã¤¿¡ª"); #else msg_print("Your invocation is ineffectual!"); #endif - if (one_in_(13)) m_ptr->mflag2 |= MFLAG_NOGENO; + if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO; } } break; case MUT1_COLD_TOUCH: - if (racial_aux(2, 2, A_CON, 11)) { int x, y; cave_type *c_ptr; - if (!get_rep_dir2(&dir)) return; + if (!get_rep_dir2(&dir)) return FALSE; y = py + ddy[dir]; x = px + ddx[dir]; c_ptr = &cave[y][x]; @@ -3858,7 +3804,7 @@ msg_print(" if (!c_ptr->m_idx) { #ifdef JP -msg_print("¤¢¤Ê¤¿¤Ï²¿¤â¤Ê¤¤¾ì½ê¤Ç¼ê¤ò¿¶¤Ã¤¿¡£"); + msg_print("¤¢¤Ê¤¿¤Ï²¿¤â¤Ê¤¤¾ì½ê¤Ç¼ê¤ò¿¶¤Ã¤¿¡£"); #else msg_print("You wave your hands in the air."); #endif @@ -3871,20 +3817,19 @@ msg_print(" /* XXX_XXX_XXX Hack! MUT1_LAUNCHER is negative, see above */ case 3: /* MUT1_LAUNCHER */ - if (racial_aux(1, lvl, A_STR, 6)) - { - /* Gives a multiplier of 2 at first, up to 3 at 40th */ - do_cmd_throw_aux(2 + lvl / 40, FALSE, 0); - } + /* Gives a multiplier of 2 at first, up to 3 at 40th */ + if (!do_cmd_throw_aux(2 + lvl / 40, FALSE, -1)) return FALSE; break; default: energy_use = 0; #ifdef JP -msg_format("ǽÎÏ %s ¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£", power); + msg_format("ǽÎÏ %s ¤Ï¼ÂÁõ¤µ¤ì¤Æ¤¤¤Þ¤»¤ó¡£", power); #else msg_format("Power %s not implemented. Oops.", power); #endif } + + return TRUE; }