*/
#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 "realm-hex.h"
#include "player-status.h"
+#include "player-effects.h"
+#include "monster-status.h"
+#include "files.h"
+#include "objectkind.h"
+#include "object-ego.h"
+#include "grid.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>
*/
/* Get the item (in the pack) */
if (item >= 0)
{
- o_ptr = &inventory[item];
+ o_ptr = &p_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(p_ptr, 100);
/* Extract the item level */
lev = k_info[o_ptr->k_idx].level;
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]) && (p_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++)
}
/* 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;
{
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 (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 != '#'))
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_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), '\0');
break;
}
case ACT_SUMMON_ELEMENTAL:
- {
- bool pet = one_in_(3);
- BIT_FLAGS mode = 0L;
-
- if (!(pet && (plev < 50))) mode |= PM_ALLOW_GROUP;
- if (pet) mode |= PM_FORCE_PET;
- else mode |= PM_NO_PET;
-
- if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), SUMMON_ELEMENTAL, mode, '\0'))
- {
- msg_print(_("エレメンタルが現れた...", "An elemental materializes..."));
- if (pet)
- msg_print(_("あなたに服従しているようだ。", "It seems obedient to you."));
- else
- msg_print(_("それをコントロールできなかった!", "You fail to control it!"));
- }
-
+ if (!cast_summon_elemental(p_ptr, (plev * 3) / 2)) return FALSE;
break;
- }
case ACT_SUMMON_DEMON:
{
}
case ACT_SUMMON_UNDEAD:
- {
- bool pet = one_in_(3);
- int type;
- BIT_FLAGS mode = 0L;
-
- type = (plev > 47 ? SUMMON_HI_UNDEAD : SUMMON_UNDEAD);
-
- if (!pet || ((plev > 24) && one_in_(3))) mode |= PM_ALLOW_GROUP;
- if (pet) mode |= PM_FORCE_PET;
- else mode |= (PM_ALLOW_UNIQUE | PM_NO_PET);
-
- if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((plev * 3) / 2), type, mode, '\0'))
- {
- msg_print(_("冷たい風があなたの周りに吹き始めた。それは腐敗臭を運んでいる...",
- "Cold winds begin to blow around you, carrying with them the stench of decay..."));
- if (pet)
- msg_print(_("古えの死せる者共があなたに仕えるため土から甦った!",
- "Ancient, long-dead forms arise from the ground to serve you!"));
- else
- msg_print(_("死者が甦った。眠りを妨げるあなたを罰するために!",
- "'The dead arise... to punish you for disturbing them!'"));
- }
-
+ if (!cast_summon_undead(p_ptr, (plev * 3) / 2)) return FALSE;
break;
- }
case ACT_SUMMON_HOUND:
- {
- BIT_FLAGS mode = PM_ALLOW_GROUP;
- bool pet = !one_in_(5);
- if (pet) mode |= PM_FORCE_PET;
- else mode |= PM_NO_PET;
-
- if (summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, ((p_ptr->lev * 3) / 2), SUMMON_HOUND, mode, '\0'))
- {
-
- if (pet)
- msg_print(_("ハウンドがあなたの下僕として出現した。",
- "A group of hounds appear as your servant."));
- else
- msg_print(_("ハウンドはあなたに牙を向けている!",
- "A group of hounds appear as your enemy!"));
- }
-
+ if (!cast_summon_hound(p_ptr, (plev * 3) / 2)) return FALSE;
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), '\0');
break;
}
case ACT_SUMMON_OCTOPUS:
- {
- BIT_FLAGS mode = PM_ALLOW_GROUP;
- bool pet = !one_in_(5);
- if (pet) mode |= PM_FORCE_PET;
-
- if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_JIZOTAKO, mode))
- {
- if (pet)
- msg_print(_("蛸があなたの下僕として出現した。", "A group of octopuses appear as your servant."));
- else
- msg_print(_("蛸はあなたを睨んでいる!", "A group of octopuses appear as your enemy!"));
- }
-
+ if(!cast_summon_octopus(p_ptr)) return FALSE;
break;
- }
/* Activate for healing */
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;
}
}
}
case ACT_LORE:
- {
msg_print(_("石が隠された秘密を写し出した...", "The stone reveals hidden mysteries..."));
- if (!ident_spell(FALSE)) return FALSE;
-
- if (mp_ptr->spell_book)
- {
- /* Sufficient mana */
- if (20 <= p_ptr->csp)
- {
- /* Use some mana */
- p_ptr->csp -= 20;
- }
-
- /* Over-exert the player */
- else
- {
- int oops = 20 - p_ptr->csp;
-
- /* No mana left */
- p_ptr->csp = 0;
- p_ptr->csp_frac = 0;
-
- msg_print(_("石を制御できない!", "You are too weak to control the stone!"));
- /* Hack -- Bypass free action */
- (void)set_paralyzed(p_ptr->paralyzed + randint1(5 * oops + 1));
-
- /* Confusing. */
- (void)set_confused(p_ptr->confused + randint1(5 * oops + 1));
- }
- p_ptr->redraw |= (PR_MANA);
- }
- take_hit(DAMAGE_LOSELIFE, damroll(1, 12), _("危険な秘密", "perilous secrets"), -1);
- /* Confusing. */
- if (one_in_(5)) (void)set_confused(p_ptr->confused + randint1(10));
-
- /* Exercise a little care... */
- if (one_in_(20)) take_hit(DAMAGE_LOSELIFE, damroll(4, 10), _("危険な秘密", "perilous secrets"), -1);
+ if(!perilous_secrets(p_ptr)) return FALSE;
break;
- }
case ACT_SHIKOFUMI:
{
break;
}
-
- /* Unique activation */
case ACT_CAST_OFF:
- {
- INVENTORY_IDX inv;
- int t;
- OBJECT_IDX o_idx;
- GAME_TEXT o_name[MAX_NLEN];
- object_type forge;
-
- /* Cast off activated item */
- for (inv = INVEN_RARM; inv <= INVEN_FEET; inv++)
- {
- if (o_ptr == &inventory[inv]) break;
- }
-
- /* Paranoia */
- if (inv > INVEN_FEET) return FALSE;
-
- object_copy(&forge, o_ptr);
- inven_item_increase(inv, (0 - o_ptr->number));
- inven_item_optimize(inv);
- o_idx = drop_near(&forge, 0, p_ptr->y, p_ptr->x);
- o_ptr = &o_list[o_idx];
-
- object_desc(o_name, o_ptr, OD_NAME_ONLY);
- msg_format(_("%sを脱ぎ捨てた。", "You cast off %s."), o_name);
-
- /* Get effects */
- msg_print(_("「燃え上がれ俺の小宇宙!」", "You say, 'Burn up my cosmo!"));
- t = 20 + randint1(20);
- (void)set_blind(p_ptr->blind + t);
- (void)set_afraid(0);
- (void)set_tim_esp(p_ptr->tim_esp + t, FALSE);
- (void)set_tim_regen(p_ptr->tim_regen + t, FALSE);
- (void)set_hero(p_ptr->hero + t, FALSE);
- (void)set_blessed(p_ptr->blessed + t, FALSE);
- (void)set_fast(p_ptr->fast + t, FALSE);
- (void)set_shero(p_ptr->shero + t, FALSE);
- if (p_ptr->pclass == CLASS_FORCETRAINER)
- {
- P_PTR_KI = plev * 5 + 190;
- msg_print(_("気が爆発寸前になった。", "Your force are immediatly before explosion."));
- }
-
+ cosmic_cast_off(p_ptr, o_ptr);
break;
- }
case ACT_FALLING_STAR:
{
}
case ACT_FISHING:
- {
- POSITION x, y;
-
- if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
- y = p_ptr->y + ddy[dir];
- x = p_ptr->x + ddx[dir];
- p_ptr->fishing_dir = dir;
- if (!cave_have_flag_bold(y, x, FF_WATER))
- {
- msg_print(_("そこは水辺ではない。", "There is no fishing place."));
- return FALSE;
- }
- else if (grid_array[y][x].m_idx)
- {
- GAME_TEXT m_name[MAX_NLEN];
- monster_desc(m_name, &m_list[grid_array[y][x].m_idx], 0);
- msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name);
- free_turn(p_ptr);
- return FALSE;
- }
- set_action(ACTION_FISH);
- p_ptr->redraw |= (PR_STATE);
+ if(!fishing(p_ptr)) return FALSE;
break;
- }
case ACT_INROU:
- {
- int count = 0, i;
- monster_type *m_ptr;
- concptr kakusan = "";
-
- if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_SUKE, PM_FORCE_PET))
- {
- msg_print(_("『助さん』が現れた。", "Suke-san apperars."));
- kakusan = "Suke-san";
- count++;
- }
- if (summon_named_creature(0, p_ptr->y, p_ptr->x, MON_KAKU, PM_FORCE_PET))
- {
- msg_print(_("『格さん』が現れた。", "Kaku-san appears."));
- kakusan = "Kaku-san";
- count++;
- }
- if (!count)
- {
- for (i = m_max - 1; i > 0; i--)
- {
- m_ptr = &m_list[i];
- if (!m_ptr->r_idx) continue;
- if (!((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) continue;
- if (!los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
- if (!projectable(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)) continue;
- count++;
- break;
- }
- }
-
- if (count)
- {
- msg_format(_("「者ども、ひかえおろう!!!このお方をどなたとこころえる。」",
- "%^s says 'WHO do you think this person is! Bow your head, down your knees!'"), kakusan);
- sukekaku = TRUE;
- stun_monsters(120);
- confuse_monsters(120);
- turn_monsters(120);
- stasis_monsters(120);
- sukekaku = FALSE;
- }
- else
- {
- msg_print(_("しかし、何も起きなかった。", "Nothing happen."));
- }
+ mitokohmon();
break;
- }
case ACT_MURAMASA:
{
}
case ACT_CRIMSON:
- {
- int num = 1;
- int i;
- BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
- int tx, ty;
-
- /* Only for Crimson */
if (o_ptr->name1 != ART_CRIMSON) return FALSE;
-
msg_print(_("せっかくだから『クリムゾン』をぶっぱなすぜ!", "I'll fire CRIMSON! SEKKAKUDAKARA!"));
-
- if (!get_aim_dir(&dir)) return FALSE;
-
- /* Use the given direction */
- tx = p_ptr->x + 99 * ddx[dir];
- ty = p_ptr->y + 99 * ddy[dir];
-
- /* Hack -- Use an actual "target" */
- if ((dir == 5) && target_okay())
- {
- tx = target_col;
- ty = target_row;
- }
-
- if (p_ptr->pclass == CLASS_ARCHER)
- {
- /* Extra shot at level 10 */
- if (p_ptr->lev >= 10) num++;
-
- /* Extra shot at level 30 */
- if (p_ptr->lev >= 30) num++;
-
- /* Extra shot at level 45 */
- if (p_ptr->lev >= 45) num++;
- }
-
- for (i = 0; i < num; i++)
- project(0, p_ptr->lev / 20 + 1, ty, tx, p_ptr->lev*p_ptr->lev * 6 / 50, GF_ROCKET, flg, -1);
+ if(!fire_crimson()) return FALSE;
break;
- }
default:
{
return TRUE;
}
-/*!
- * @brief 固定アーティファクト『ブラッディムーン』の特性を変更する。
- * @details スレイ2d2種、及びone_resistance()による耐性1d2種、pval2種を得る。
- * @param o_ptr 対象のオブジェクト構造体(ブラッディムーン)のポインタ
- * @return なし
- */
-void get_bloody_moon_flags(object_type *o_ptr)
-{
- int dummy, i;
-
- for (i = 0; i < TR_FLAG_SIZE; i++)
- o_ptr->art_flags[i] = a_info[ART_BLOOD].flags[i];
-
- dummy = randint1(2) + randint1(2);
- for (i = 0; i < dummy; i++)
- {
- int flag = randint0(26);
- if (flag >= 20) add_flag(o_ptr->art_flags, TR_KILL_UNDEAD + flag - 20);
- else if (flag == 19) add_flag(o_ptr->art_flags, TR_KILL_ANIMAL);
- else if (flag == 18) add_flag(o_ptr->art_flags, TR_SLAY_HUMAN);
- else add_flag(o_ptr->art_flags, TR_CHAOTIC + flag);
- }
-
- dummy = randint1(2);
- for (i = 0; i < dummy; i++) one_resistance(o_ptr);
-
- for (i = 0; i < 2; i++)
- {
- int tmp = randint0(11);
- if (tmp < A_MAX) add_flag(o_ptr->art_flags, TR_STR + tmp);
- else add_flag(o_ptr->art_flags, TR_STEALTH + tmp - 6);
- }
-}
-
-