#include "avatar.h"
#include "spells.h"
#include "spells-floor.h"
+#include "spell/technic-info-table.h"
#include "grid.h"
#include "market/building-util.h"
#include "monster-process.h"
#include "object/object-kind.h"
#include "autopick/autopick.h"
#include "targeting.h"
+#include "effect/spells-effect-util.h"
+#include "spell/spells-util.h"
+#include "spell/spells-execution.h"
+#include "spell/process-effect.h"
/*! テレポート先探索の試行数 / Maximum number of tries for teleporting */
#define MAX_TRIES 100
* Attempt to move the monster at least "dis/2" grids away.
* But allow variation to prevent infinite loops.
*/
-bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
+bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, teleport_flags mode)
{
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
if (!monster_is_valid(m_ptr)) return FALSE;
* @param mode オプション
* @return なし
*/
-void teleport_monster_to(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, BIT_FLAGS mode)
+void teleport_monster_to(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, teleport_flags mode)
{
monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
if(!m_ptr->r_idx) return;
* of candidates has equal possibility to be choosen as a destination.
* </pre>
*/
-bool teleport_player_aux(player_type *creature_ptr, POSITION dis, bool is_quantum_effect, BIT_FLAGS mode)
+bool teleport_player_aux(player_type *creature_ptr, POSITION dis, bool is_quantum_effect, teleport_flags mode)
{
if (creature_ptr->wild_mode) return FALSE;
if (!is_quantum_effect && creature_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
is_resistible &= MON_CSLEEP(m_ptr) == 0;
if (is_resistible)
{
- teleport_monster_to(creature_ptr, tmp_m_idx, creature_ptr->y, creature_ptr->x, r_ptr->level, 0L);
+ teleport_monster_to(creature_ptr, tmp_m_idx, creature_ptr->y, creature_ptr->x, r_ptr->level, TELEPORT_SPONTANEOUS);
}
}
}
is_resistible &= MON_CSLEEP(m_ptr) == 0;
if (is_resistible)
{
- teleport_monster_to(target_ptr, tmp_m_idx, target_ptr->y, target_ptr->x, r_ptr->level, 0L);
+ teleport_monster_to(target_ptr, tmp_m_idx, target_ptr->y, target_ptr->x, r_ptr->level, TELEPORT_SPONTANEOUS);
}
}
}
* This function allows teleporting into vaults (!)
* </pre>
*/
-void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mode)
+void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, teleport_flags mode)
{
if (creature_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
{
bool old_ml = m_ptr->ml;
POSITION old_cdis = m_ptr->cdis;
- teleport_away(tracer_ptr, m_idx, MAX_SIGHT * 2 + 5, 0L);
+ teleport_away(tracer_ptr, m_idx, MAX_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS);
bool is_followable = old_ml;
is_followable &= old_cdis <= MAX_SIGHT;
}
else
{
- teleport_player_to(tracer_ptr, m_ptr->fy, m_ptr->fx, 0L);
+ teleport_player_to(tracer_ptr, m_ptr->fy, m_ptr->fx, TELEPORT_SPONTANEOUS);
}
tracer_ptr->energy_need += ENERGY_NEED();
* This routine does *not* automatically combine objects.
* Returns TRUE if something was identified, else FALSE.
*/
-bool ident_spell(player_type *caster_ptr, bool only_equip)
+bool ident_spell(player_type *caster_ptr, bool only_equip, OBJECT_TYPE_VALUE item_tester_tval)
{
if (only_equip)
item_tester_hook = item_tester_hook_identify_weapon_armour;
* Fully "identify" an object in the inventory -BEN-
* This routine returns TRUE if an item was identified.
*/
-bool identify_fully(player_type *caster_ptr, bool only_equip)
+bool identify_fully(player_type *caster_ptr, bool only_equip, OBJECT_TYPE_VALUE item_tester_tval)
{
if (only_equip)
item_tester_hook = item_tester_hook_identify_fully_weapon_armour;
caster_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
- if (!cave_player_teleportable_bold(caster_ptr, y, x, 0L) ||
+ if (!cave_player_teleportable_bold(caster_ptr, y, x, TELEPORT_SPONTANEOUS) ||
(distance(y, x, caster_ptr->y, caster_ptr->x) > plev / 2 + 10) ||
(!randint0(plev / 10 + 10)))
{
return FALSE;
}
- teleport_player_to(caster_ptr, y, x, 0L);
+ teleport_player_to(caster_ptr, y, x, TELEPORT_SPONTANEOUS);
return TRUE;
}
return TRUE;
}
+bool fetch_monster(player_type *caster_ptr)
+{
+ monster_type *m_ptr;
+ MONSTER_IDX m_idx;
+ GAME_TEXT m_name[MAX_NLEN];
+ int i;
+ int path_n;
+ u16b path_g[512];
+ POSITION ty, tx;
+
+ if (!target_set(caster_ptr, TARGET_KILL)) return FALSE;
+ m_idx = caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
+ if (!m_idx) return FALSE;
+ if (m_idx == caster_ptr->riding) return FALSE;
+ if (!player_has_los_bold(caster_ptr, target_row, target_col)) return FALSE;
+ if (!projectable(caster_ptr, caster_ptr->y, caster_ptr->x, target_row, target_col)) return FALSE;
+ m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
+ monster_desc(caster_ptr, m_name, m_ptr, 0);
+ msg_format(_("%sを引き戻した。", "You pull back %s."), m_name);
+ path_n = project_path(caster_ptr, path_g, MAX_RANGE, target_row, target_col, caster_ptr->y, caster_ptr->x, 0);
+ ty = target_row, tx = target_col;
+ for (i = 1; i < path_n; i++)
+ {
+ POSITION ny = GRID_Y(path_g[i]);
+ POSITION nx = GRID_X(path_g[i]);
+ grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[ny][nx];
+
+ if (in_bounds(caster_ptr->current_floor_ptr, ny, nx) && is_cave_empty_bold(caster_ptr, ny, nx) &&
+ !(g_ptr->info & CAVE_OBJECT) &&
+ !pattern_tile(caster_ptr->current_floor_ptr, ny, nx))
+ {
+ ty = ny;
+ tx = nx;
+ }
+ }
+ /* Update the old location */
+ caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx = 0;
+
+ /* Update the new location */
+ caster_ptr->current_floor_ptr->grid_array[ty][tx].m_idx = m_idx;
+
+ /* Move the monster */
+ m_ptr->fy = ty;
+ m_ptr->fx = tx;
+
+ /* Wake the monster up */
+ (void)set_monster_csleep(caster_ptr, m_idx, 0);
+
+ update_monster(caster_ptr, m_idx, TRUE);
+ lite_spot(caster_ptr, target_row, target_col);
+ lite_spot(caster_ptr, ty, tx);
+
+ if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
+ caster_ptr->update |= (PU_MON_LITE);
+
+ if (m_ptr->ml)
+ {
+ /* Auto-Recall if possible and visible */
+ if (!caster_ptr->image) monster_race_track(caster_ptr, m_ptr->ap_r_idx);
+ health_track(caster_ptr, m_idx);
+ }
+ return TRUE;
+
+}
+
bool booze(player_type *creature_ptr)
{