/* File: cmd6.c */
-/* Purpose: Object commands */
-
/*
- * 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: Object commands */
+
#include "angband.h"
{
case SV_FOOD_POISON:
{
- if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
+ if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
{
if (set_poisoned(p_ptr->poisoned + randint0(10) + 10))
{
#endif
}
- else if ((p_ptr->prace == RACE_SKELETON ||
- p_ptr->prace == RACE_GOLEM ||
- p_ptr->prace == RACE_ZOMBIE ||
- p_ptr->prace == RACE_SPECTRE) &&
+ else if ((prace_is_(RACE_SKELETON) ||
+ prace_is_(RACE_GOLEM) ||
+ prace_is_(RACE_ZOMBIE) ||
+ prace_is_(RACE_SPECTRE)) &&
(o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND))
{
cptr staff;
/* Don't eat a staff/wand itself */
return;
}
- else if ((p_ptr->prace == RACE_DEMON ||
+ else if ((prace_is_(RACE_DEMON) ||
(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) &&
(o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE &&
strchr("pht", r_info[o_ptr->pval].d_char)))
#endif
(void)set_food(PY_FOOD_MAX - 1);
}
- else if (p_ptr->prace == RACE_SKELETON)
+ else if (prace_is_(RACE_SKELETON))
{
#if 0
if (o_ptr->tval == TV_SKELETON ||
}
}
- else if ((p_ptr->prace == RACE_GOLEM) ||
- (p_ptr->prace == RACE_ZOMBIE) ||
- (p_ptr->prace == RACE_ENT) ||
- (p_ptr->prace == RACE_DEMON) ||
- (p_ptr->prace == RACE_ANDROID) ||
- (p_ptr->prace == RACE_SPECTRE) ||
+ else if (prace_is_(RACE_GOLEM) ||
+ prace_is_(RACE_ZOMBIE) ||
+ prace_is_(RACE_ENT) ||
+ prace_is_(RACE_DEMON) ||
+ prace_is_(RACE_ANDROID) ||
+ prace_is_(RACE_SPECTRE) ||
(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
{
#ifdef JP
set_food(p_ptr->food + ((o_ptr->pval) / 20));
}
+ else if (o_ptr->tval == TV_FOOD && o_ptr->sval == SV_FOOD_WAYBREAD)
+ {
+ /* Waybread is always fully satisfying. */
+ set_food(MAX(p_ptr->food, PY_FOOD_MAX - 1));
+ }
else
{
+ /* Food can feed the player */
(void)set_food(p_ptr->food + o_ptr->pval);
}
if (o_ptr->tval==TV_FOOD) return TRUE;
#if 0
- if (p_ptr->prace == RACE_SKELETON)
+ if (prace_is_(RACE_SKELETON))
{
if (o_ptr->tval == TV_SKELETON ||
(o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
else
#endif
- if (p_ptr->prace == RACE_SKELETON ||
- p_ptr->prace == RACE_GOLEM ||
- p_ptr->prace == RACE_ZOMBIE ||
- p_ptr->prace == RACE_SPECTRE)
+ if (prace_is_(RACE_SKELETON) ||
+ prace_is_(RACE_GOLEM) ||
+ prace_is_(RACE_ZOMBIE) ||
+ prace_is_(RACE_SPECTRE))
{
if (o_ptr->tval == TV_STAFF || o_ptr->tval == TV_WAND)
return TRUE;
}
- else if ((p_ptr->prace == RACE_DEMON) ||
+ else if (prace_is_(RACE_DEMON) ||
(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON))
{
if (o_ptr->tval == TV_CORPSE &&
msg_print("The potion makes you vomit!");
#endif
- (void)set_food(PY_FOOD_STARVE - 1);
+ if (!(prace_is_(RACE_GOLEM) ||
+ prace_is_(RACE_ZOMBIE) ||
+ prace_is_(RACE_DEMON) ||
+ prace_is_(RACE_ANDROID) ||
+ prace_is_(RACE_SPECTRE) ||
+ (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)))
+ {
+ /* Only living creatures get thirsty */
+ (void)set_food(PY_FOOD_STARVE - 1);
+ }
+
(void)set_poisoned(0);
(void)set_paralyzed(p_ptr->paralyzed + 4);
ident = TRUE;
break;
case SV_POTION_POISON:
- if (!(p_ptr->resist_pois || p_ptr->oppose_pois))
+ if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
{
if (set_poisoned(p_ptr->poisoned + randint0(15) + 10))
{
chg_virtue(V_KNOWLEDGE, 1);
chg_virtue(V_ENLIGHTEN, 1);
- wiz_lite(FALSE, FALSE);
+ wiz_lite(FALSE);
ident = TRUE;
break;
chg_virtue(V_KNOWLEDGE, 1);
chg_virtue(V_ENLIGHTEN, 2);
msg_print(NULL);
- wiz_lite(TRUE, FALSE);
+ wiz_lite(FALSE);
(void)do_inc_stat(A_INT);
(void)do_inc_stat(A_WIS);
(void)detect_traps(DETECT_RAD_DEFAULT, TRUE);
}
}
- if (p_ptr->prace == RACE_SKELETON)
+ if (prace_is_(RACE_SKELETON))
{
#ifdef JP
msg_print("±ÕÂΤΰìÉô¤Ï¤¢¤Ê¤¿¤Î¥¢¥´¤òÁÇÄ̤ꤷ¤ÆÍî¤Á¤¿¡ª");
{
if (o_ptr->tval == TV_POTION) return TRUE;
- if (p_ptr->prace == RACE_ANDROID)
+ if (prace_is_(RACE_ANDROID))
{
if (o_ptr->tval == TV_FLASK && o_ptr->sval == SV_FLASK_OIL)
return TRUE;
case SV_SCROLL_TELEPORT_LEVEL:
{
- (void)teleport_player_level();
+ (void)teleport_level(0);
ident = TRUE;
break;
}
case SV_SCROLL_STAR_DESTRUCTION:
{
- if (destroy_area(py, px, 13+randint0(5), TRUE))
+ if (destroy_area(py, px, 13 + randint0(5), FALSE))
ident = TRUE;
else
#ifdef JP
{
fire_ball(GF_FIRE, 0, 666, 4);
/* Note: "Double" damage since it is centered on the player ... */
- if (!(p_ptr->oppose_fire || p_ptr->resist_fire || p_ptr->immune_fire))
+ if (!(IS_OPPOSE_FIRE() || p_ptr->resist_fire || p_ptr->immune_fire))
#ifdef JP
take_hit(DAMAGE_NOESCAPE, 50+randint1(50), "±ê¤Î´¬Êª", -1);
#else
case SV_SCROLL_ICE:
{
fire_ball(GF_ICE, 0, 777, 4);
- if (!(p_ptr->oppose_cold || p_ptr->resist_cold || p_ptr->immune_cold))
+ if (!(IS_OPPOSE_COLD() || p_ptr->resist_cold || p_ptr->immune_cold))
#ifdef JP
take_hit(DAMAGE_NOESCAPE, 100+randint1(100), "ɹ¤Î´¬Êª", -1);
#else
}
for (k = 0; k < num; k++)
{
- attempts = 1000;
+ attempts = 1000;
- while(attempts--)
+ while (attempts--)
{
scatter(&y, &x, py, px, 4, 0);
if (!cave_floor_bold(y, x)) continue;
- if ((y != py) || (x != px)) break;
+ if (!player_bold(y, x)) break;
}
project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
case SV_STAFF_DESTRUCTION:
{
- if (destroy_area(py, px, 13+randint0(5), TRUE))
+ if (destroy_area(py, px, 13 + randint0(5), FALSE))
ident = TRUE;
break;
#else
msg_print("Nothing happen.");
#endif
- if (p_ptr->prace == RACE_SKELETON || p_ptr->prace == RACE_GOLEM ||
- p_ptr->prace == RACE_ZOMBIE || p_ptr->prace == RACE_SPECTRE)
+ if (prace_is_(RACE_SKELETON) || prace_is_(RACE_GOLEM) ||
+ prace_is_(RACE_ZOMBIE) || prace_is_(RACE_SPECTRE))
#ifdef JP
msg_print("¤â¤Ã¤¿¤¤¤Ê¤¤»ö¤ò¤·¤¿¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£¿©¤Ùʪ¤ÏÂçÀڤˤ·¤Ê¤¯¤Æ¤Ï¡£");
#else
{
int ident = FALSE;
+ /* Unused */
+ (void)magic;
+
/* Analyze the rod */
switch (sval)
{
monster_race *r_ptr1 = &r_info[m_ptr1->r_idx];
monster_race *r_ptr2 = &r_info[m_ptr2->r_idx];
+ /* Unused */
+ (void)v;
+
if (m_ptr1->nickname && !m_ptr2->nickname) return TRUE;
if (m_ptr2->nickname && !m_ptr1->nickname) return FALSE;
chg_virtue(V_KNOWLEDGE, 1);
chg_virtue(V_ENLIGHTEN, 1);
- wiz_lite(FALSE, FALSE);
+ wiz_lite(FALSE);
#ifdef JP
msg_print("¤½¤ÎÊõÀФϤ¢¤Ê¤¿¤ÎÂÎÎϤòÃ¥¤Ã¤¿...");
take_hit(DAMAGE_LOSELIFE, damroll(3,8), "¿³È½¤ÎÊõÀÐ", -1);
for (k = 0; k < num; k++)
{
- attempts = 1000;
+ attempts = 1000;
- while(attempts--)
+ while (attempts--)
{
scatter(&y, &x, py, px, 4, 0);
if (!cave_floor_bold(y, x)) continue;
- if ((y != py) || (x != px)) break;
+ if (!player_bold(y, x)) break;
}
project(0, 3, y, x, 150, GF_ELEC,
detect_all(DETECT_RAD_DEFAULT);
probing();
identify_fully(FALSE);
- o_ptr->timeout = 1000;
+ o_ptr->timeout = 100;
break;
}
o_ptr->timeout = randint0(150) + 150;
break;
}
+ case ART_HELL:
+ {
+#ifdef JP
+ msg_print("¼óÎؤ¬¿¼¤¤°Ç¤Ëʤ¤ï¤ì¤¿...");
+#else
+ msg_print("Your collar harness is coverd in pitch-darkness...");
+#endif
+ if (!get_aim_dir(&dir)) return;
+ fire_ball(GF_DARK, dir, 250, 4);
+ o_ptr->timeout = randint0(150) + 150;
+ break;
+ }
+ case ART_SACRED_KNIGHTS:
+ {
+#ifdef JP
+ msg_print("¼ó¾þ¤ê¤¬¿¿¼Â¤ò¾È¤é¤·½Ð¤¹...");
+#else
+ msg_print("Your amulet exhibits the truth...");
+#endif
+ if (remove_all_curse())
+ {
+#ifdef JP
+ msg_print("狼¤Ë¸«¼é¤é¤ì¤Æ¤¤¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë¡£");
+#else
+ msg_print("You feel as if someone is watching over you.");
+#endif
+ }
+ (void)probing();
+ break;
+ }
+ case ART_CHARMED:
+ {
+#ifdef JP
+ msg_print("¥Ú¥ó¥À¥ó¥È¤¬ÀÄÇò¤¯¸÷¤Ã¤¿¡¥¡¥¡¥");
+#else
+ msg_print("Your pendant glows pale...");
+#endif
+ if (p_ptr->pclass == CLASS_MAGIC_EATER)
+ {
+ int i;
+ for (i = 0; i < EATER_EXT*2; i++)
+ {
+ p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i]*EATER_CHARGE/3;
+ if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i]*EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i]*EATER_CHARGE;
+ }
+ for (; i < EATER_EXT*3; i++)
+ {
+ int k_idx = lookup_kind(TV_ROD, i-EATER_EXT*2);
+ p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE*3 : p_ptr->magic_num2[i]*EATER_ROD_CHARGE/3)*k_info[k_idx].pval;
+ if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
+ }
+#ifdef JP
+ msg_print("Ƭ¤¬¥Ï¥Ã¥¥ê¤È¤·¤¿¡£");
+#else
+ msg_print("Your feel your head clear.");
+#endif
+ p_ptr->window |= (PW_PLAYER);
+ }
+ else if (p_ptr->csp < p_ptr->msp)
+ {
+ p_ptr->csp = p_ptr->msp;
+ p_ptr->csp_frac = 0;
+#ifdef JP
+ msg_print("Ƭ¤¬¥Ï¥Ã¥¥ê¤È¤·¤¿¡£");
+#else
+ msg_print("Your feel your head clear.");
+#endif
+
+ p_ptr->redraw |= (PR_MANA);
+ p_ptr->window |= (PW_PLAYER);
+ p_ptr->window |= (PW_SPELL);
+ }
+ o_ptr->timeout = 777;
+ break;
+ }
}
/* Window stuff */
return;
}
- else if ((o_ptr->tval > TV_CAPTURE) && (o_ptr->xtra3))
+ if (item_tester_hook_smith(o_ptr))
{
switch (o_ptr->xtra3-1)
{
}
- else if (o_ptr->name2 == EGO_TRUMP)
+ if (o_ptr->name2 == EGO_TRUMP)
{
teleport_player(100);
o_ptr->timeout = 50 + randint1(50);
}
- else if (o_ptr->name2 == EGO_LITE_ILLUMINATION)
+ if (o_ptr->name2 == EGO_LITE_ILLUMINATION)
{
if (!o_ptr->xtra4 && ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
{
}
- else if (o_ptr->name2 == EGO_EARTHQUAKES)
+ if (o_ptr->name2 == EGO_EARTHQUAKES)
{
earthquake(py, px, 5);
o_ptr->timeout = 100 + randint1(100);
}
- else if (o_ptr->name2 == EGO_JUMP)
+ if (o_ptr->name2 == EGO_JUMP)
{
teleport_player(10);
o_ptr->timeout = 10 + randint1(10);
/* Hack -- Dragon Scale Mail can be activated as well */
- else if (o_ptr->tval == TV_DRAG_ARMOR)
+ if (o_ptr->tval == TV_DRAG_ARMOR)
{
/* Get a direction for breathing (or abort) */
if (!get_aim_dir(&dir)) return;
for (i = 0; i < max_pet; i++)
{
pet_ctr = who[i];
- teleport_to_player(pet_ctr, 100);
+ teleport_monster_to(pet_ctr, py, px, 100);
}
/* Free the "who" array */
}
}
-static bool select_magic_eater(bool only_browse)
+static int select_magic_eater(bool only_browse)
{
int ext=0;
char choice;
- bool flag, redraw, request_list;
+ bool flag, request_list;
int tval = 0;
int ask = TRUE, i = 0;
char out_val[160];
/* Nothing chosen yet */
flag = FALSE;
- /* No redraw yet */
- redraw = FALSE;
-
/* Build a prompt */
#ifdef JP
(void) strnfmt(out_val, 78, "('*'¤Ç°ìÍ÷, ESC¤ÇÃæÃÇ) ¤É¤ÎËâÎϤò»È¤¤¤Þ¤¹¤«¡©");
}
}
- if(!get_com(out_val, &choice, FALSE)) break;
+ if (!get_com(out_val, &choice, FALSE)) break;
if (use_menu && choice != ' ')
{
- switch(choice)
+ switch (choice)
{
case '0':
{
screen_load();
- return (FALSE);
- break;
+ return 0;
}
case '8':
Term_erase(7, 21, 255);
Term_erase(7, 20, 255);
- roff_to_buf(k_text + k_info[lookup_kind(tval, i)].text, 62, temp);
+ roff_to_buf(k_text + k_info[lookup_kind(tval, i)].text, 62, temp, sizeof(temp));
for (j = 0, line = 21; temp[j]; j += 1 + strlen(&temp[j]))
{
prt(&temp[j], line, 10);