From 09f056b8d06ee2302fdf62a0fbfff6bd4d6af4d0 Mon Sep 17 00:00:00 2001 From: nothere Date: Mon, 5 May 2003 00:01:06 +0000 Subject: [PATCH] =?utf8?q?=E7=B5=8C=E9=A8=93=E5=80=A4=E5=90=B8=E5=8F=8E?= =?utf8?q?=E9=83=A8=E5=88=86=E3=81=A7=E3=81=BE=E3=81=A8=E3=82=81=E3=82=89?= =?utf8?q?=E3=82=8C=E3=82=8B=E3=82=82=E3=81=AE=E3=81=AF=E9=96=A2=E6=95=B0?= =?utf8?q?=E3=81=AB=E3=81=BE=E3=81=A8=E3=82=81=E3=82=8B=E3=82=88=E3=81=86?= =?utf8?q?=E3=81=AB=E3=81=97=E3=81=A6=E6=95=B4=E7=90=86.=20=E3=81=93?= =?utf8?q?=E3=81=AE=E9=81=8E=E7=A8=8B=E3=81=A7,=20=E5=9C=B0=E7=8D=84?= =?utf8?q?=E5=B1=9E=E6=80=A7=E3=81=A8=E3=82=AB=E3=82=AA=E3=82=B9=E5=B1=9E?= =?utf8?q?=E6=80=A7=E3=81=AB=E3=82=88=E3=82=8B=E7=B5=8C=E9=A8=93=E5=80=A4?= =?utf8?q?=E5=90=B8=E5=8F=8E=E6=99=82=E3=81=AE=E5=92=8C=E6=96=87=E3=81=AF?= =?utf8?q?=E3=82=8F=E3=81=9A=E3=81=8B=E3=81=AB=E5=A4=89=E3=82=8F=E3=81=A3?= =?utf8?q?=E3=81=9F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/effects.c | 45 ++++++++++++++ src/externs.h | 1 + src/melee1.c | 196 +++++----------------------------------------------------- src/spells1.c | 66 +------------------- 4 files changed, 63 insertions(+), 245 deletions(-) diff --git a/src/effects.c b/src/effects.c index 3886a04f0..f1168d700 100644 --- a/src/effects.c +++ b/src/effects.c @@ -5483,6 +5483,51 @@ void lose_exp(s32b amount) check_experience(); } + +/* + * Drain experience + * If resisted to draining, return FALSE + */ +bool drain_exp(s32b drain, s32b slip, int hold_life_prob) +{ + /* Androids and their mimics are never drained */ + if (p_ptr->prace == RACE_ANDROID) return FALSE; + + if (p_ptr->hold_life && (randint0(100) < hold_life_prob)) + { + /* Hold experience */ +#ifdef JP + msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª"); +#else + msg_print("You keep hold of your life force!"); +#endif + return FALSE; + } + + /* Hold experience failed */ + if (p_ptr->hold_life) + { +#ifdef JP + msg_print("À¸Ì¿ÎϤò¾¯¤·µÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); +#else + msg_print("You feel your life slipping away!"); +#endif + lose_exp(slip); + } + else + { +#ifdef JP + msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); +#else + msg_print("You feel your life draining away!"); +#endif + lose_exp(drain); + } + + return TRUE; +} + + bool set_ultimate_res(int v, bool do_dec) { bool notice = FALSE; diff --git a/src/externs.h b/src/externs.h index 4bee6793d..baa7c8fed 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1289,6 +1289,7 @@ extern bool lose_all_info(void); extern void gain_exp(s32b amount); extern void calc_android_exp(void); extern void lose_exp(s32b amount); +extern bool drain_exp(s32b drain, s32b slip, int hold_life_prob); extern void do_poly_self(void); extern bool set_ultimate_res(int v, bool do_dec); extern bool set_tim_res_nether(int v, bool do_dec); diff --git a/src/melee1.c b/src/melee1.c index a71a57388..f8b10957c 100644 --- a/src/melee1.c +++ b/src/melee1.c @@ -1535,6 +1535,8 @@ bool make_attack_normal(int m_idx) case RBE_EXP_10: { + s32b d = damroll(10, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE; + /* Obvious */ obvious = TRUE; @@ -1543,47 +1545,14 @@ bool make_attack_normal(int m_idx) if (p_ptr->is_dead) break; - if (p_ptr->prace == RACE_ANDROID) - { - } - else if (p_ptr->hold_life && (randint0(100) < 95)) - { -#ifdef JP - msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª"); -#else - msg_print("You keep hold of your life force!"); -#endif - - } - else - { - s32b d = damroll(10, 6) + (p_ptr->exp/100) * MON_DRAIN_LIFE; - if (p_ptr->hold_life) - { -#ifdef JP - msg_print("À¸Ì¿ÎϤò¾¯¤·µÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life slipping away!"); -#endif - - lose_exp(d/10); - } - else - { -#ifdef JP - msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life draining away!"); -#endif - - lose_exp(d); - } - } + (void)drain_exp(d, d / 10, 95); break; } case RBE_EXP_20: { + s32b d = damroll(20, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE; + /* Obvious */ obvious = TRUE; @@ -1592,47 +1561,14 @@ bool make_attack_normal(int m_idx) if (p_ptr->is_dead) break; - if (p_ptr->prace == RACE_ANDROID) - { - } - else if (p_ptr->hold_life && (randint0(100) < 90)) - { -#ifdef JP - msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª"); -#else - msg_print("You keep hold of your life force!"); -#endif - - } - else - { - s32b d = damroll(20, 6) + (p_ptr->exp/100) * MON_DRAIN_LIFE; - if (p_ptr->hold_life) - { -#ifdef JP - msg_print("À¸Ì¿ÎϤò¾¯¤·µÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life slipping away!"); -#endif - - lose_exp(d/10); - } - else - { -#ifdef JP - msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life draining away!"); -#endif - - lose_exp(d); - } - } + (void)drain_exp(d, d / 10, 90); break; } case RBE_EXP_40: { + s32b d = damroll(40, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE; + /* Obvious */ obvious = TRUE; @@ -1641,47 +1577,14 @@ bool make_attack_normal(int m_idx) if (p_ptr->is_dead) break; - if (p_ptr->prace == RACE_ANDROID) - { - } - else if (p_ptr->hold_life && (randint0(100) < 75)) - { -#ifdef JP - msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª"); -#else - msg_print("You keep hold of your life force!"); -#endif - - } - else - { - s32b d = damroll(40, 6) + (p_ptr->exp/100) * MON_DRAIN_LIFE; - if (p_ptr->hold_life) - { -#ifdef JP - msg_print("À¸Ì¿ÎϤò¾¯¤·µÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life slipping away!"); -#endif - - lose_exp(d/10); - } - else - { -#ifdef JP - msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life draining away!"); -#endif - - lose_exp(d); - } - } + (void)drain_exp(d, d / 10, 75); break; } case RBE_EXP_80: { + s32b d = damroll(80, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE; + /* Obvious */ obvious = TRUE; @@ -1690,42 +1593,7 @@ bool make_attack_normal(int m_idx) if (p_ptr->is_dead) break; - if (p_ptr->prace == RACE_ANDROID) - { - } - else if (p_ptr->hold_life && (randint0(100) < 50)) - { -#ifdef JP - msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª"); -#else - msg_print("You keep hold of your life force!"); -#endif - - } - else - { - s32b d = damroll(80, 6) + (p_ptr->exp/100) * MON_DRAIN_LIFE; - if (p_ptr->hold_life) - { -#ifdef JP - msg_print("À¸Ì¿ÎϤò¾¯¤·µÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life slipping away!"); -#endif - - lose_exp(d/10); - } - else - { -#ifdef JP - msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life draining away!"); -#endif - - lose_exp(d); - } - } + (void)drain_exp(d, d / 10, 50); break; } @@ -1846,6 +1714,8 @@ bool make_attack_normal(int m_idx) } case RBE_EXP_VAMP: { + s32b d = damroll(60, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE; + /* Obvious */ obvious = TRUE; @@ -1854,43 +1724,7 @@ bool make_attack_normal(int m_idx) if (p_ptr->is_dead) break; - if (p_ptr->prace == RACE_ANDROID) - { - } - else if (p_ptr->hold_life && (randint0(100) < 50)) - { -#ifdef JP -msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª"); -#else - msg_print("You keep hold of your life force!"); -#endif - - resist_drain = TRUE; - } - else - { - s32b d = damroll(60, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE; - if (p_ptr->hold_life) - { -#ifdef JP -msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life slipping away!"); -#endif - - lose_exp(d / 10); - } - else - { -#ifdef JP -msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life draining away!"); -#endif - - lose_exp(d); - } - } + resist_drain = !drain_exp(d, d / 10, 50); /* Heal the attacker? */ if (p_ptr->mimic_form) diff --git a/src/spells1.c b/src/spells1.c index 4bfc987b3..afb3f4da1 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -6737,38 +6737,7 @@ if (fuzzy) msg_print(" if (!prace_is_(RACE_SPECTRE)) dam *= 6; dam /= (randint1(4) + 7); } - else if (p_ptr->prace != RACE_ANDROID) - { - if (p_ptr->hold_life && (randint0(100) < 75)) - { -#ifdef JP -msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª"); -#else - msg_print("You keep hold of your life force!"); -#endif - - } - else if (p_ptr->hold_life) - { -#ifdef JP -msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life slipping away!"); -#endif - - lose_exp(200 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE); - } - else - { -#ifdef JP -msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life draining away!"); -#endif - - lose_exp(200 + (p_ptr->exp / 100) * MON_DRAIN_LIFE); - } - } + else drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75); if (prace_is_(RACE_SPECTRE)) { @@ -6849,38 +6818,7 @@ msg_print(" } if (!p_ptr->resist_neth && !p_ptr->resist_chaos) { - if (p_ptr->prace == RACE_ANDROID) - { - } - else if (p_ptr->hold_life && (randint0(100) < 75)) - { -#ifdef JP -msg_print("¤·¤«¤·¼«¸Ê¤ÎÀ¸Ì¿ÎϤò¼é¤ê¤­¤Ã¤¿¡ª"); -#else - msg_print("You keep hold of your life force!"); -#endif - - } - else if (p_ptr->hold_life) - { -#ifdef JP -msg_print("À¸Ì¿ÎϤ¬¾¯¤·ÂΤ«¤éÈ´¤±Íî¤Á¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life slipping away!"); -#endif - - lose_exp(500 + (p_ptr->exp / 1000) * MON_DRAIN_LIFE); - } - else - { -#ifdef JP -msg_print("À¸Ì¿ÎϤ¬ÂΤ«¤éµÛ¤¤¼è¤é¤ì¤¿µ¤¤¬¤¹¤ë¡ª"); -#else - msg_print("You feel your life draining away!"); -#endif - - lose_exp(5000 + (p_ptr->exp / 100) * MON_DRAIN_LIFE); - } + drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75); } if (!p_ptr->resist_chaos || one_in_(9)) { -- 2.11.0