*/
#include "angband.h"
+#include "util.h"
+
#include "cmd-activate.h"
+#include "cmd-basic.h"
+#include "floor.h"
#include "object-hook.h"
-#include "spells-summon.h"
#include "sort.h"
-#include "projection.h"
#include "artifact.h"
#include "avatar.h"
+#include "spells.h"
+#include "spells-summon.h"
#include "spells-status.h"
#include "spells-object.h"
#include "spells-floor.h"
+#include "player-effects.h"
#include "realm-hex.h"
#include "player-status.h"
+#include "player-damage.h"
+#include "monster-status.h"
+#include "files.h"
+#include "objectkind.h"
+#include "object-ego.h"
+#include "grid.h"
+#include "targeting.h"
+#include "realm-song.h"
+#include "player-race.h"
+#include "player-class.h"
+#include "view-mainwindow.h"
+
+/*!
+ * @brief 装備耐性に準じたブレス効果の選択テーブル /
+ * Define flags, effect type, name for dragon breath activation
+ */
+const dragonbreath_type dragonbreath_info[] = {
+ { TR_RES_ACID, GF_ACID, _("酸", "acid") },
+ { TR_RES_ELEC, GF_ELEC, _("電撃", "lightning") },
+ { TR_RES_FIRE, GF_FIRE, _("火炎", "fire") },
+ { TR_RES_COLD, GF_COLD, _("冷気", "cold") },
+ { TR_RES_POIS, GF_POIS, _("毒", "poison") },
+ { TR_RES_LITE, GF_LITE, _("閃光", "light") },
+ { TR_RES_DARK, GF_DARK, _("暗黒", "dark") },
+ { TR_RES_SHARDS, GF_SHARDS, _("破片", "shard") },
+ { TR_RES_CONF, GF_CONFUSION, _("混乱", "confusion") },
+ { TR_RES_SOUND, GF_SOUND, _("轟音", "sound") },
+ { TR_RES_NEXUS, GF_NEXUS, _("因果混乱", "nexus") },
+ { TR_RES_NETHER, GF_NETHER, _("地獄", "nether") },
+ { TR_RES_CHAOS, GF_CHAOS, _("カオス", "chaos") },
+ { TR_RES_DISEN, GF_DISENCHANT, _("劣化", "disenchant") },
+ { 0, 0, NULL }
+};
/*!
* @brief アイテムの発動効果テーブル /
};
/*!
-* @brief ペット入りモンスターボールをソートするための比較関数
-* @param u 所持品配列の参照ポインタ
-* @param v 未使用
-* @param a 所持品ID1
-* @param b 所持品ID2
-* @return 1の方が大であればTRUE
-*/
-static bool ang_sort_comp_pet(vptr u, vptr v, int a, int b)
-{
- u16b *who = (u16b*)(u);
-
- int w1 = who[a];
- int w2 = who[b];
-
- monster_type *m_ptr1 = &m_list[w1];
- monster_type *m_ptr2 = &m_list[w2];
- 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;
-
- if ((r_ptr1->flags1 & RF1_UNIQUE) && !(r_ptr2->flags1 & RF1_UNIQUE)) return TRUE;
- if ((r_ptr2->flags1 & RF1_UNIQUE) && !(r_ptr1->flags1 & RF1_UNIQUE)) return FALSE;
-
- if (r_ptr1->level > r_ptr2->level) return TRUE;
- if (r_ptr2->level > r_ptr1->level) return FALSE;
-
- if (m_ptr1->hp > m_ptr2->hp) return TRUE;
- if (m_ptr2->hp > m_ptr1->hp) return FALSE;
-
- return w1 <= w2;
-}
-
-
-/*!
* @brief 装備を発動するコマンドのサブルーチン /
* Activate a wielded object. Wielded objects never stack.
* And even if they did, activatable objects never stack.
* <pre>
* Currently, only (some) artifacts, and Dragon Scale Mail, can be activated.
* But one could, for example, easily make an activatable "Ring of Plasma".
- * Note that it always takes a turn to activate an artifact, even if
+ * Note that it always takes a current_world_ptr->game_turn to activate an artifact, even if
* the user hits "escape" at the "direction" prompt.
* </pre>
*/
-void do_cmd_activate_aux(INVENTORY_IDX item)
+void do_cmd_activate_aux(player_type *user_ptr, INVENTORY_IDX item)
{
DIRECTION dir;
DEPTH lev;
/* Get the item (in the pack) */
if (item >= 0)
{
- o_ptr = &inventory[item];
+ o_ptr = &user_ptr->inventory_list[item];
}
/* Get the item (on the floor) */
else
{
- o_ptr = &o_list[0 - item];
+ o_ptr = ¤t_floor_ptr->o_list[0 - item];
}
- take_turn(p_ptr, 100);
+ take_turn(user_ptr, 100);
/* Extract the item level */
lev = k_info[o_ptr->k_idx].level;
else if (((o_ptr->tval == TV_RING) || (o_ptr->tval == TV_AMULET)) && o_ptr->name2) lev = e_info[o_ptr->name2].level;
/* Base chance of success */
- chance = p_ptr->skill_dev;
+ chance = user_ptr->skill_dev;
/* Confusion hurts skill */
- if (p_ptr->confused) chance = chance / 2;
+ if (user_ptr->confused) chance = chance / 2;
fail = lev+5;
if (chance > fail) fail -= (chance - fail)*2;
if (fail < USE_DEVICE) fail = USE_DEVICE;
if (chance < USE_DEVICE) chance = USE_DEVICE;
- if(cmd_limit_time_walk(p_ptr)) return;
+ if(cmd_limit_time_walk(user_ptr)) return;
- if (p_ptr->pclass == CLASS_BERSERKER) success = FALSE;
+ if (user_ptr->pclass == CLASS_BERSERKER) success = FALSE;
else if (chance > fail)
{
if (randint0(chance*2) < fail) success = FALSE;
((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN)))
{
msg_print(_("燃料がない。", "It has no fuel."));
- free_turn(p_ptr);
+ free_turn(user_ptr);
return;
}
{
(void)activate_artifact(o_ptr);
- p_ptr->window |= (PW_INVEN | PW_EQUIP);
+ user_ptr->window |= (PW_INVEN | PW_EQUIP);
/* Success */
return;
/* Special items */
else if (o_ptr->tval == TV_WHISTLE)
{
- if (music_singing_any()) stop_singing(p_ptr);
+ if (music_singing_any()) stop_singing(user_ptr);
if (hex_spelling_any()) stop_hex_spell_all();
{
- IDX pet_ctr, i;
+ MONSTER_IDX pet_ctr, i;
MONSTER_IDX *who;
int max_pet = 0;
u16b dummy_why;
/* Allocate the "who" array */
- C_MAKE(who, max_m_idx, MONSTER_IDX);
+ C_MAKE(who, current_floor_ptr->max_m_idx, MONSTER_IDX);
/* Process the monsters (backwards) */
- for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--)
+ for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--)
{
- if (is_pet(&m_list[pet_ctr]) && (p_ptr->riding != pet_ctr))
+ if (is_pet(¤t_floor_ptr->m_list[pet_ctr]) && (user_ptr->riding != pet_ctr))
who[max_pet++] = pet_ctr;
}
- /* Select the sort method */
- ang_sort_comp = ang_sort_comp_pet;
- ang_sort_swap = ang_sort_swap_hook;
-
- ang_sort(who, &dummy_why, max_pet);
+ ang_sort(who, &dummy_why, max_pet, ang_sort_comp_pet, ang_sort_swap_hook);
/* Process the monsters (backwards) */
for (i = 0; i < max_pet; i++)
{
pet_ctr = who[i];
- teleport_monster_to(pet_ctr, p_ptr->y, p_ptr->x, 100, TELEPORT_PASSIVE);
+ teleport_monster_to(pet_ctr, user_ptr->y, user_ptr->x, 100, TELEPORT_PASSIVE);
}
/* Free the "who" array */
- C_KILL(who, max_m_idx, IDX);
+ C_KILL(who, current_floor_ptr->max_m_idx, IDX);
}
o_ptr->timeout = 100 + randint1(100);
return;
{
success = FALSE;
if (!get_direction(&dir, FALSE, FALSE)) return;
- if (monster_can_enter(p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
+ if (monster_can_enter(user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], &r_info[o_ptr->pval], 0))
{
- if (place_monster_aux(0, p_ptr->y + ddy[dir], p_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
+ if (place_monster_aux(0, user_ptr->y + ddy[dir], user_ptr->x + ddx[dir], o_ptr->pval, (PM_FORCE_PET | PM_NO_KAGE)))
{
- if (o_ptr->xtra3) m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
- if (o_ptr->xtra5) m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
- if (o_ptr->xtra4) m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
- m_list[hack_m_idx_ii].maxhp = m_list[hack_m_idx_ii].max_maxhp;
+ if (o_ptr->xtra3) current_floor_ptr->m_list[hack_m_idx_ii].mspeed = o_ptr->xtra3;
+ if (o_ptr->xtra5) current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp = o_ptr->xtra5;
+ if (o_ptr->xtra4) current_floor_ptr->m_list[hack_m_idx_ii].hp = o_ptr->xtra4;
+ current_floor_ptr->m_list[hack_m_idx_ii].maxhp = current_floor_ptr->m_list[hack_m_idx_ii].max_maxhp;
if (o_ptr->inscription)
{
char buf[80];
s--;
#endif
*s = '\0';
- m_list[hack_m_idx_ii].nickname = quark_add(buf);
+ current_floor_ptr->m_list[hack_m_idx_ii].nickname = quark_add(buf);
t = quark_str(o_ptr->inscription);
s = buf;
while(*t && (*t != '#'))
q = _("どのアイテムを始動させますか? ", "Activate which item? ");
s = _("始動できるアイテムを装備していない。", "You have nothing to activate.");
- if (!choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT))) return;
+ if (!choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0)) return;
/* Activate the item */
- do_cmd_activate_aux(item);
+ do_cmd_activate_aux(p_ptr, item);
}
/*!
n++;
}
}
-
- /* Paranoia */
if (n == 0) return FALSE;
/* Stop speaking */
DIRECTION dir;
concptr name = k_name + k_info[o_ptr->k_idx].name;
const activation_type* const act_ptr = find_activation_info(o_ptr);
-
- /* Paranoia */
if (!act_ptr) {
/* Maybe forgot adding information to activation_info table ? */
msg_print("Activation information is not found.");
case ACT_QUAKE:
{
- earthquake(p_ptr->y, p_ptr->x, 5);
+ earthquake(p_ptr->y, p_ptr->x, 5, 0);
break;
}
case ACT_SUMMON_ANIMAL:
{
- (void)summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
+ (void)summon_specific(-1, p_ptr->y, p_ptr->x, plev, SUMMON_ANIMAL_RANGER, (PM_ALLOW_GROUP | PM_FORCE_PET));
break;
}
case ACT_SUMMON_PHANTOM:
{
msg_print(_("幻霊を召喚した。", "You summon a phantasmal servant."));
- (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
+ (void)summon_specific(-1, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_PHANTOM, (PM_ALLOW_GROUP | PM_FORCE_PET));
break;
}
case ACT_SUMMON_DAWN:
{
msg_print(_("暁の師団を召喚した。", "You summon the Legion of the Dawn."));
- (void)summon_specific(-1, p_ptr->y, p_ptr->x, dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET), '\0');
+ (void)summon_specific(-1, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DAWN, (PM_ALLOW_GROUP | PM_FORCE_PET));
break;
}
monster_race *r_ptr;
msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ..."));
/* Process the monsters (backwards) */
- for (i = m_max - 1; i >= 1; i--)
+ for (i = current_floor_ptr->m_max - 1; i >= 1; i--)
{
/* Access the monster */
- m_ptr = &m_list[i];
+ m_ptr = ¤t_floor_ptr->m_list[i];
/* Ignore "dead" monsters */
- if (!m_ptr->r_idx) continue;
+ if (!monster_is_valid(m_ptr)) continue;
r_ptr = &r_info[m_ptr->r_idx];
if (get_check(_("この階を去りますか?", "Leave this level? ")))
{
if (autosave_l) do_cmd_save_game(TRUE);
-
- /* Leaving */
p_ptr->leaving = TRUE;
}
}