/*!
* @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
* @param player_ptr プレイヤーへの参照ポインタ
- * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
+ * @param src_idx 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
* @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
* @param y 目標Y座標 / Target y location (or location to travel "towards")
* @param x 目標X座標 / Target x location (or location to travel "towards")
* Perhaps we should affect doors?
* </pre>
*/
-bool affect_feature(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ)
+bool affect_feature(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ)
{
const Pos2D pos(y, x);
auto &floor = *player_ptr->current_floor_ptr;
auto obvious = false;
auto known = grid.has_los();
- who = who ? who : 0;
+ src_idx = src_idx ? src_idx : 0;
dam = (dam + r) / (r + 1);
if (terrain.flags.has(TerrainCharacteristics::TREE)) {
#include "system/angband.h"
class PlayerType;
-bool affect_feature(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ);
+bool affect_feature(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ);
/*!
* @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
* @param player_ptr プレイヤーへの参照ポインタ
- * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
+ * @param src_idx 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
* @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
* @param y 目標Y座標 / Target y location (or location to travel "towards")
* @param x 目標X座標 / Target x location (or location to travel "towards")
* @param typ 効果属性 / Type of damage to apply to monsters (and objects)
* @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
*/
-bool affect_item(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ)
+bool affect_item(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ)
{
const auto &floor = *player_ptr->current_floor_ptr;
const Pos2D pos(y, x);
auto is_item_affected = false;
const auto known = grid.has_los();
- who = who ? who : 0;
+ src_idx = src_idx ? src_idx : 0;
dam = (dam + r) / (r + 1);
std::set<OBJECT_IDX> processed_list;
for (auto it = grid.o_idx_list.begin(); it != grid.o_idx_list.end();) {
}
BIT_FLAGS mode = 0L;
- if (!who || player_ptr->current_floor_ptr->m_list[who].is_pet()) {
+ if (!src_idx || player_ptr->current_floor_ptr->m_list[src_idx].is_pet()) {
mode |= PM_FORCE_PET;
}
}
continue;
- } else if (summon_named_creature(player_ptr, who, y, x, corpse_r_idx, mode)) {
+ } else if (summon_named_creature(player_ptr, src_idx, y, x, corpse_r_idx, mode)) {
note_kill = _("生き返った。", " revived.");
} else if (!note_kill) {
note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
const auto is_potion = o_ptr->is_potion();
delete_object_idx(player_ptr, this_o_idx);
if (is_potion) {
- (void)potion_smash_effect(player_ptr, who, y, x, bi_id);
+ (void)potion_smash_effect(player_ptr, src_idx, y, x, bi_id);
// 薬の破壊効果によりリストの次のアイテムが破壊された可能性があるのでリストの最初から処理をやり直す
// 処理済みのアイテムは processed_list に登録されており、スキップされる
#include "system/angband.h"
class PlayerType;
-bool affect_item(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ);
+bool affect_item(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ);
if (em_ptr->seen) {
em_ptr->obvious = true;
}
- if (!em_ptr->who) {
+ if (!em_ptr->src_idx) {
msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), em_ptr->m_name);
}
if (randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35)) {
if (em_ptr->seen) {
em_ptr->obvious = true;
}
- if (!em_ptr->who) {
+ if (!em_ptr->src_idx) {
msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), em_ptr->m_name);
}
if (em_ptr->seen) {
em_ptr->obvious = true;
}
- if (!em_ptr->who) {
+ if (!em_ptr->src_idx) {
msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), em_ptr->m_name);
}
if (em_ptr->seen) {
em_ptr->obvious = true;
}
- if (!em_ptr->who) {
+ if (!em_ptr->src_idx) {
msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
"You point at %s, screaming the word, 'DIE!'."),
em_ptr->m_name);
}
- if ((randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35)) && ((em_ptr->who <= 0) || (em_ptr->m_caster_ptr->r_idx != MonsterRaceId::KENSHIROU))) {
+ if ((randint0(100 + (em_ptr->caster_lev / 2)) < (em_ptr->r_ptr->level + 35)) && ((em_ptr->src_idx <= 0) || (em_ptr->m_caster_ptr->r_idx != MonsterRaceId::KENSHIROU))) {
em_ptr->note = _("には効果がなかった。", " is unaffected.");
em_ptr->dam = 0;
}
// who == 0ならばプレイヤーなので、それの判定.
static void effect_monster_old_heal_check_player(PlayerType *player_ptr, EffectMonster *em_ptr)
{
- if (em_ptr->who != 0) {
+ if (em_ptr->src_idx != 0) {
return;
}
effect_monster_old_heal_check_player(player_ptr, em_ptr);
if (em_ptr->m_ptr->r_idx == MonsterRaceId::LEPER) {
em_ptr->heal_leper = true;
- if (!em_ptr->who) {
+ if (!em_ptr->src_idx) {
chg_virtue(player_ptr, Virtue::COMPASSION, 5);
}
}
em_ptr->note = _("の動きが速くなった。", " starts moving faster.");
}
- if (!em_ptr->who) {
+ if (!em_ptr->src_idx) {
if (em_ptr->r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
chg_virtue(player_ptr, Virtue::INDIVIDUALISM, 1);
}
return ProcessResult::PROCESS_CONTINUE;
}
- if (em_ptr->who <= 0) {
+ if (em_ptr->src_idx <= 0) {
msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), em_ptr->m_name);
(void)hp_player(player_ptr, em_ptr->dam);
em_ptr->dam = 0;
}
auto &rfu = RedrawingFlagsUpdater::get_instance();
- if (player_ptr->health_who == em_ptr->who) {
+ if (player_ptr->health_who == em_ptr->src_idx) {
rfu.set_flag(MainWindowRedrawingFlag::HEALTH);
}
- if (player_ptr->riding == em_ptr->who) {
+ if (player_ptr->riding == em_ptr->src_idx) {
rfu.set_flag(MainWindowRedrawingFlag::UHEALTH);
}
if (em_ptr->seen) {
em_ptr->obvious = true;
}
- if (!em_ptr->who) {
+ if (!em_ptr->src_idx) {
msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), em_ptr->m_name);
}
em_ptr->note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
em_ptr->note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
- if (em_ptr->who > 0) {
+ if (em_ptr->src_idx > 0) {
em_ptr->do_conf = randint0(4) + 4;
} else {
em_ptr->do_conf = randint0(8) + 8;
if (em_ptr->seen) {
em_ptr->obvious = true;
}
- if (!em_ptr->who) {
+ if (!em_ptr->src_idx) {
msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), em_ptr->m_name);
}
} else {
em_ptr->note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
em_ptr->note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
- if (em_ptr->who > 0) {
+ if (em_ptr->src_idx > 0) {
em_ptr->do_conf = randint0(4) + 4;
em_ptr->do_stun = randint0(4) + 4;
} else {
return ProcessResult::PROCESS_CONTINUE;
}
- if ((em_ptr->who > 0) ? ((em_ptr->caster_lev + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + 10 + randint1(20)))
+ if ((em_ptr->src_idx > 0) ? ((em_ptr->caster_lev + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + 10 + randint1(20)))
: (((em_ptr->caster_lev / 2) + randint1(em_ptr->dam)) > (em_ptr->r_ptr->level + randint1(200)))) {
em_ptr->dam = ((40 + randint1(20)) * em_ptr->m_ptr->hp) / 100;
if (em_ptr->m_ptr->hp < em_ptr->dam) {
}
std::string_view spell_name(_("モンスター消滅", "Genocide One"));
- if (genocide_aux(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, !em_ptr->who, (em_ptr->r_ptr->level + 1) / 2, spell_name.data())) {
+ if (genocide_aux(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, !em_ptr->src_idx, (em_ptr->r_ptr->level + 1) / 2, spell_name.data())) {
if (em_ptr->seen_msg) {
msg_format(_("%sは消滅した!", "%s^ disappeared!"), em_ptr->m_name);
}
ProcessResult effect_monster_photo(PlayerType *player_ptr, EffectMonster *em_ptr)
{
- if (!em_ptr->who) {
+ if (!em_ptr->src_idx) {
msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), em_ptr->m_name);
}
* @brief EffectMonster構造体のコンストラクタ
* @param player_ptr プレイヤーへの参照ポインタ
* @param em_ptr モンスター効果構造体への参照ポインタ
- * @param who 魔法を発動したモンスター (0ならばプレイヤー)
+ * @param src_idx 魔法を発動したモンスター (0ならばプレイヤー)
* @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
* @param y 目標y座標 / Target y location (or location to travel "towards")
* @param x 目標x座標 / Target x location (or location to travel "towards")
* @param flag 効果フラグ
* @param see_s_msg TRUEならばメッセージを表示する
*/
-EffectMonster::EffectMonster(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, bool see_s_msg)
- : who(who)
+EffectMonster::EffectMonster(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, bool see_s_msg)
+ : src_idx(src_idx)
, r(r)
, y(y)
, x(x)
auto *floor_ptr = player_ptr->current_floor_ptr;
this->g_ptr = &floor_ptr->grid_array[this->y][this->x];
this->m_ptr = &floor_ptr->m_list[this->g_ptr->m_idx];
- this->m_caster_ptr = (this->who > 0) ? &floor_ptr->m_list[this->who] : nullptr;
+ this->m_caster_ptr = (this->src_idx > 0) ? &floor_ptr->m_list[this->src_idx] : nullptr;
this->r_ptr = &this->m_ptr->get_monrace();
this->seen = this->m_ptr->ml;
this->seen_msg = is_seen(player_ptr, this->m_ptr);
this->slept = this->m_ptr->is_asleep();
this->known = (this->m_ptr->cdis <= MAX_PLAYER_SIGHT) || AngbandSystem::get_instance().is_phase_out();
this->note_dies = this->m_ptr->get_died_message();
- this->caster_lev = (this->who > 0) ? this->m_caster_ptr->get_monrace().level : (player_ptr->lev * 2);
+ this->caster_lev = (this->src_idx > 0) ? this->m_caster_ptr->get_monrace().level : (player_ptr->lev * 2);
}
class PlayerType;
class EffectMonster {
public:
- EffectMonster(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, bool see_s_msg);
+ EffectMonster(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, bool see_s_msg);
char killer[MAX_MONSTER_NAME]{};
bool obvious = false;
short photo = 0;
std::string note = "";
- MONSTER_IDX who;
+ MONSTER_IDX src_idx;
POSITION r;
POSITION y;
POSITION x;
if (!em_ptr->g_ptr->m_idx) {
return ProcessResult::PROCESS_FALSE;
}
- if (em_ptr->who && (em_ptr->g_ptr->m_idx == em_ptr->who)) {
+ if (em_ptr->src_idx && (em_ptr->g_ptr->m_idx == em_ptr->src_idx)) {
return ProcessResult::PROCESS_FALSE;
}
if (sukekaku && ((em_ptr->m_ptr->r_idx == MonsterRaceId::SUKE) || (em_ptr->m_ptr->r_idx == MonsterRaceId::KAKU))) {
if (em_ptr->m_ptr->hp < 0) {
return ProcessResult::PROCESS_FALSE;
}
- if (em_ptr->who || em_ptr->g_ptr->m_idx != player_ptr->riding) {
+ if (em_ptr->src_idx || em_ptr->g_ptr->m_idx != player_ptr->riding) {
return ProcessResult::PROCESS_TRUE;
}
}
}
- if (em_ptr->who > 0) {
- monster_gain_exp(player_ptr, em_ptr->who, em_ptr->m_ptr->r_idx);
+ if (em_ptr->src_idx > 0) {
+ monster_gain_exp(player_ptr, em_ptr->src_idx, em_ptr->m_ptr->r_idx);
}
monster_death(player_ptr, em_ptr->g_ptr->m_idx, false, em_ptr->attribute);
*/
static bool deal_effect_damage_from_monster(PlayerType *player_ptr, EffectMonster *em_ptr)
{
- if (em_ptr->who <= 0) {
+ if (em_ptr->src_idx <= 0) {
return false;
}
*/
static void effect_makes_change_virtues(PlayerType *player_ptr, EffectMonster *em_ptr)
{
- if ((em_ptr->who > 0) || !em_ptr->slept) {
+ if ((em_ptr->src_idx > 0) || !em_ptr->slept) {
return;
}
auto should_alive = r_ptr->kind_flags.has(MonsterKindType::UNIQUE);
should_alive |= r_ptr->misc_flags.has(MonsterMiscType::QUESTOR);
should_alive |= r_ptr->population_flags.has(MonsterPopulationType::NAZGUL);
- if (should_alive && !AngbandSystem::get_instance().is_phase_out() && (em_ptr->who > 0) && (em_ptr->dam > em_ptr->m_ptr->hp)) {
+ if (should_alive && !AngbandSystem::get_instance().is_phase_out() && (em_ptr->src_idx > 0) && (em_ptr->dam > em_ptr->m_ptr->hp)) {
em_ptr->dam = em_ptr->m_ptr->hp;
}
}
em_ptr->note = _("が消え去った!", " disappears!");
- if (!em_ptr->who) {
+ if (!em_ptr->src_idx) {
chg_virtue(player_ptr, Virtue::VALOUR, -1);
}
- teleport_flags tflag = i2enum<teleport_flags>((!em_ptr->who ? TELEPORT_DEC_VALOUR : TELEPORT_SPONTANEOUS) | TELEPORT_PASSIVE);
+ teleport_flags tflag = i2enum<teleport_flags>((!em_ptr->src_idx ? TELEPORT_DEC_VALOUR : TELEPORT_SPONTANEOUS) | TELEPORT_PASSIVE);
teleport_away(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->do_dist, tflag);
em_ptr->y = em_ptr->m_ptr->fy;
return;
}
- if (em_ptr->who == 0) {
+ if (em_ptr->src_idx == 0) {
if (!(em_ptr->flag & PROJECT_NO_HANGEKI)) {
set_target(m_ptr, monster_target_y, monster_target_x);
}
}
const auto &m_caster_ref = *em_ptr->m_caster_ptr;
- if ((em_ptr->who > 0) && m_caster_ref.is_pet() && !player_ptr->is_located_at({ m_ptr->target_y, m_ptr->target_x })) {
+ if ((em_ptr->src_idx > 0) && m_caster_ref.is_pet() && !player_ptr->is_located_at({ m_ptr->target_y, m_ptr->target_x })) {
set_target(m_ptr, m_caster_ref.fy, m_caster_ref.fx);
}
}
/*!
* @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
* @param player_ptr プレイヤーへの参照ポインタ
- * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
+ * @param src_idx 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
* @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
* @param y 目標y座標 / Target y location (or location to travel "towards")
* @param x 目標x座標 / Target x location (or location to travel "towards")
* 3.ペット及び撮影による事後効果
*/
bool affect_monster(
- PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, bool see_s_msg,
+ PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType attribute, BIT_FLAGS flag, bool see_s_msg,
std::optional<CapturedMonsterType *> cap_mon_ptr)
{
- EffectMonster tmp_effect(player_ptr, who, r, y, x, dam, attribute, flag, see_s_msg);
+ EffectMonster tmp_effect(player_ptr, src_idx, r, y, x, dam, attribute, flag, see_s_msg);
auto *em_ptr = &tmp_effect;
auto target_m_idx = em_ptr->g_ptr->m_idx;
class CapturedMonsterType;
class PlayerType;
-bool affect_monster(PlayerType *player_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ, BIT_FLAGS flag, bool see_s_msg, std::optional<CapturedMonsterType *> cap_mon_ptr = std::nullopt);
+bool affect_monster(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION r, POSITION y, POSITION x, int dam, AttributeType typ, BIT_FLAGS flag, bool see_s_msg, std::optional<CapturedMonsterType *> cap_mon_ptr = std::nullopt);
return;
}
- if (ep_ptr->who > 0) {
+ if (ep_ptr->src_idx > 0) {
msg_format(_("%s^に精神エネルギーを吸い取られてしまった!", "%s^ draws psychic energy from you!"), ep_ptr->m_name);
} else {
msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drained!"));
};
rfu.set_flags(flags);
- if ((ep_ptr->who <= 0) || (ep_ptr->m_ptr->hp >= ep_ptr->m_ptr->maxhp)) {
+ if ((ep_ptr->src_idx <= 0) || (ep_ptr->m_ptr->hp >= ep_ptr->m_ptr->maxhp)) {
ep_ptr->dam = 0;
return;
}
ep_ptr->m_ptr->hp = ep_ptr->m_ptr->maxhp;
}
- if (player_ptr->health_who == ep_ptr->who) {
+ if (player_ptr->health_who == ep_ptr->src_idx) {
rfu.set_flag(MainWindowRedrawingFlag::HEALTH);
}
- if (player_ptr->riding == ep_ptr->who) {
+ if (player_ptr->riding == ep_ptr->src_idx) {
rfu.set_flag(MainWindowRedrawingFlag::UHEALTH);
}
/*!
* @brief EffectPlayerType構造体を初期化する
* @param ep_ptr 初期化前の構造体
- * @param who 魔法を唱えたモンスター (0ならプレイヤー自身)
+ * @param src_idx 魔法を唱えたモンスター (0ならプレイヤー自身)
* @param dam 基本威力
* @param attribute 効果属性
* @param flag 効果フラグ
* @param monspell 効果元のモンスター魔法ID
* @return 初期化後の構造体ポインタ
*/
-EffectPlayerType::EffectPlayerType(MONSTER_IDX who, int dam, AttributeType attribute, BIT_FLAGS flag)
+EffectPlayerType::EffectPlayerType(MONSTER_IDX src_idx, int dam, AttributeType attribute, BIT_FLAGS flag)
: rlev(0)
, m_ptr(nullptr)
, killer("")
, m_name("")
, get_damage(0)
- , who(who)
+ , src_idx(src_idx)
, dam(dam)
, attribute(attribute)
, flag(flag)
msg_print(mes);
POSITION t_y;
POSITION t_x;
- if (ep_ptr->who > 0) {
+ if (ep_ptr->src_idx > 0) {
auto *floor_ptr = player_ptr->current_floor_ptr;
- auto *m_ptr = &floor_ptr->m_list[ep_ptr->who];
+ auto *m_ptr = &floor_ptr->m_list[ep_ptr->src_idx];
do {
t_y = m_ptr->fy - 1 + randint1(3);
t_x = m_ptr->fx - 1 + randint1(3);
auto is_effective = ep_ptr->dam > 0;
is_effective &= randint0(55) < (player_ptr->lev * 3 / 5 + 20);
- is_effective &= ep_ptr->who > 0;
- is_effective &= ep_ptr->who != player_ptr->riding;
+ is_effective &= ep_ptr->src_idx > 0;
+ is_effective &= ep_ptr->src_idx != player_ptr->riding;
if (is_effective && kawarimi(player_ptr, true)) {
return ProcessResult::PROCESS_FALSE;
}
- if ((ep_ptr->who == 0) || (ep_ptr->who == player_ptr->riding)) {
+ if ((ep_ptr->src_idx == 0) || (ep_ptr->src_idx == player_ptr->riding)) {
return ProcessResult::PROCESS_FALSE;
}
* @brief 魔法を発したモンスター名を記述する
* @param player_ptr プレイヤーへの参照ポインタ
* @param ep_ptr プレイヤー効果構造体への参照ポインタ
- * @param who_name モンスター名
+ * @param src_name モンスター名
*/
-static void describe_effect_source(PlayerType *player_ptr, EffectPlayerType *ep_ptr, concptr who_name)
+static void describe_effect_source(PlayerType *player_ptr, EffectPlayerType *ep_ptr, concptr src_name)
{
- if (ep_ptr->who > 0) {
- ep_ptr->m_ptr = &player_ptr->current_floor_ptr->m_list[ep_ptr->who];
+ if (ep_ptr->src_idx > 0) {
+ ep_ptr->m_ptr = &player_ptr->current_floor_ptr->m_list[ep_ptr->src_idx];
ep_ptr->rlev = ep_ptr->m_ptr->get_monrace().level >= 1 ? ep_ptr->m_ptr->get_monrace().level : 1;
angband_strcpy(ep_ptr->m_name, monster_desc(player_ptr, ep_ptr->m_ptr, 0), sizeof(ep_ptr->m_name));
- angband_strcpy(ep_ptr->killer, who_name, sizeof(ep_ptr->killer));
+ angband_strcpy(ep_ptr->killer, src_name, sizeof(ep_ptr->killer));
return;
}
- switch (ep_ptr->who) {
+ switch (ep_ptr->src_idx) {
case PROJECT_WHO_UNCTRL_POWER:
strcpy(ep_ptr->killer, _("制御できない力の氾流", "uncontrollable power storm"));
break;
/*!
* @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
- * @param who 魔法を発動したモンスター(0ならばプレイヤー、負値ならば自然発生) / Index of "source" monster (zero for "player")
- * @param who_name 効果を起こしたモンスターの名前
+ * @param src_idx 魔法を発動したモンスター(0ならばプレイヤー、負値ならば自然発生) / Index of "source" monster (zero for "player")
+ * @param src_name 効果を起こしたモンスターの名前
* @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
* @param y 目標Y座標 / Target y location (or location to travel "towards")
* @param x 目標X座標 / Target x location (or location to travel "towards")
* @param monspell 効果元のモンスター魔法ID
* @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
*/
-bool affect_player(MONSTER_IDX who, PlayerType *player_ptr, concptr who_name, int r, POSITION y, POSITION x, int dam, AttributeType attribute,
+bool affect_player(MONSTER_IDX src_idx, PlayerType *player_ptr, concptr src_name, int r, POSITION y, POSITION x, int dam, AttributeType attribute,
BIT_FLAGS flag, project_func project)
{
- EffectPlayerType tmp_effect(who, dam, attribute, flag);
+ EffectPlayerType tmp_effect(src_idx, dam, attribute, flag);
auto *ep_ptr = &tmp_effect;
auto check_result = check_continue_player_effect(player_ptr, ep_ptr, { y, x }, project);
if (check_result != ProcessResult::PROCESS_CONTINUE) {
}
ep_ptr->dam = (ep_ptr->dam + r) / (r + 1);
- describe_effect_source(player_ptr, ep_ptr, who_name);
+ describe_effect_source(player_ptr, ep_ptr, src_name);
switch_effects_player(player_ptr, ep_ptr);
SpellHex(player_ptr).store_vengeful_damage(ep_ptr->get_damage);
- if ((player_ptr->tim_eyeeye || SpellHex(player_ptr).is_spelling_specific(HEX_EYE_FOR_EYE)) && (ep_ptr->get_damage > 0) && !player_ptr->is_dead && (ep_ptr->who > 0)) {
+ if ((player_ptr->tim_eyeeye || SpellHex(player_ptr).is_spelling_specific(HEX_EYE_FOR_EYE)) && (ep_ptr->get_damage > 0) && !player_ptr->is_dead && (ep_ptr->src_idx > 0)) {
const auto m_name_self = monster_desc(player_ptr, ep_ptr->m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
msg_print(_(format("攻撃が%s自身を傷つけた!", ep_ptr->m_name), format("The attack of %s has wounded %s!", ep_ptr->m_name, m_name_self.data())));
(*project)(player_ptr, 0, 0, ep_ptr->m_ptr->fy, ep_ptr->m_ptr->fx, ep_ptr->get_damage, AttributeType::MISSILE, PROJECT_KILL, std::nullopt);
}
disturb(player_ptr, true, true);
- if (ep_ptr->dam && ep_ptr->who && (ep_ptr->who != player_ptr->riding)) {
+ if (ep_ptr->dam && ep_ptr->src_idx && (ep_ptr->src_idx != player_ptr->riding)) {
(void)kawarimi(player_ptr, false);
}
GAME_TEXT m_name[MAX_NLEN];
int get_damage;
- MONSTER_IDX who;
+ MONSTER_IDX src_idx;
int dam;
AttributeType attribute;
BIT_FLAGS flag;
- EffectPlayerType(MONSTER_IDX who, int dam, AttributeType attribute, BIT_FLAGS flag);
+ EffectPlayerType(MONSTER_IDX src_idx, int dam, AttributeType attribute, BIT_FLAGS flag);
};
struct ProjectResult;
class CapturedMonsterType;
class PlayerType;
using project_func = ProjectResult (*)(
- PlayerType *player_ptr, MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, int dam, AttributeType typ, BIT_FLAGS flag, std::optional<CapturedMonsterType *> cap_mon_ptr);
+ PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION rad, POSITION y, POSITION x, int dam, AttributeType typ, BIT_FLAGS flag, std::optional<CapturedMonsterType *> cap_mon_ptr);
-bool affect_player(MONSTER_IDX who, PlayerType *player_ptr, concptr who_name, int r, POSITION y, POSITION x, int dam, AttributeType typ, BIT_FLAGS flag,
+bool affect_player(MONSTER_IDX src_idx, PlayerType *player_ptr, concptr src_name, int r, POSITION y, POSITION x, int dam, AttributeType typ, BIT_FLAGS flag,
project_func project);
/*!
* @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic
* "beam"/"bolt"/"ball" projection routine.
- * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source"
+ * @param src_idx 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source"
* monster (zero for "player")
* @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion
* (0 = beam/bolt, 1 to 9 = ball)
* @todo 似たような処理が山ほど並んでいる、何とかならないものか
* @todo 引数にそのまま再代入していてカオスすぎる。直すのは簡単ではない
*/
-ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX who, POSITION rad, const POSITION target_y, const POSITION target_x, const int dam,
+ProjectResult project(PlayerType *player_ptr, const MONSTER_IDX src_idx, POSITION rad, const POSITION target_y, const POSITION target_x, const int dam,
const AttributeType typ, BIT_FLAGS flag, std::optional<CapturedMonsterType *> cap_mon_ptr)
{
POSITION y1;
if (any_bits(flag, PROJECT_JUMP)) {
x1 = target_x;
y1 = target_y;
- } else if (who <= 0) {
+ } else if (src_idx <= 0) {
x1 = player_ptr->x;
y1 = player_ptr->y;
- } else if (who > 0) {
- x1 = player_ptr->current_floor_ptr->m_list[who].fx;
- y1 = player_ptr->current_floor_ptr->m_list[who].fy;
+ } else if (src_idx > 0) {
+ x1 = player_ptr->current_floor_ptr->m_list[src_idx].fx;
+ y1 = player_ptr->current_floor_ptr->m_list[src_idx].fy;
} else {
x1 = target_x;
y1 = target_y;
update_creature(player_ptr);
if (flag & PROJECT_KILL) {
- see_s_msg = (who > 0) ? is_seen(player_ptr, &player_ptr->current_floor_ptr->m_list[who])
- : (!who ? true : (player_can_see_bold(player_ptr, y1, x1) && projectable(player_ptr, player_ptr->y, player_ptr->x, y1, x1)));
+ see_s_msg = (src_idx > 0) ? is_seen(player_ptr, &player_ptr->current_floor_ptr->m_list[src_idx])
+ : (!src_idx ? true : (player_can_see_bold(player_ptr, y1, x1) && projectable(player_ptr, player_ptr->y, player_ptr->x, y1, x1)));
}
if (flag & (PROJECT_GRID)) {
auto x = gx[i];
if (breath) {
int d = dist_to_line(y, x, y1, x1, by, bx);
- if (affect_feature(player_ptr, who, d, y, x, dam, typ)) {
+ if (affect_feature(player_ptr, src_idx, d, y, x, dam, typ)) {
res.notice = true;
}
} else {
- if (affect_feature(player_ptr, who, dist, y, x, dam, typ)) {
+ if (affect_feature(player_ptr, src_idx, dist, y, x, dam, typ)) {
res.notice = true;
}
}
auto x = gx[i];
if (breath) {
int d = dist_to_line(y, x, y1, x1, by, bx);
- if (affect_item(player_ptr, who, d, y, x, dam, typ)) {
+ if (affect_item(player_ptr, src_idx, d, y, x, dam, typ)) {
res.notice = true;
}
} else {
- if (affect_item(player_ptr, who, dist, y, x, dam, typ)) {
+ if (affect_item(player_ptr, src_idx, dist, y, x, dam, typ)) {
res.notice = true;
}
}
if (grids <= 1) {
auto *m_ptr = &floor.m_list[grid.m_idx];
MonsterRaceInfo *ref_ptr = &m_ptr->get_monrace();
- if ((flag & PROJECT_REFLECTABLE) && grid.m_idx && ref_ptr->misc_flags.has(MonsterMiscType::REFLECTING) && ((grid.m_idx != player_ptr->riding) || !(flag & PROJECT_PLAYER)) && (!who || path_n > 1) && !one_in_(10)) {
+ if ((flag & PROJECT_REFLECTABLE) && grid.m_idx && ref_ptr->misc_flags.has(MonsterMiscType::REFLECTING) && ((grid.m_idx != player_ptr->riding) || !(flag & PROJECT_PLAYER)) && (!src_idx || path_n > 1) && !one_in_(10)) {
+
POSITION t_y, t_x;
int max_attempts = 10;
do {
} else {
msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
}
- } else if (who <= 0) {
+ } else if (src_idx <= 0) {
sound(SOUND_REFLECT);
}
}
}
- if (affect_monster(player_ptr, who, effective_dist, pos.y, pos.x, dam, typ, flag, see_s_msg, cap_mon_ptr)) {
+ if (affect_monster(player_ptr, src_idx, effective_dist, pos.y, pos.x, dam, typ, flag, see_s_msg, cap_mon_ptr)) {
res.notice = true;
}
}
/* Player affected one monster (without "jumping") */
- if (!who && (project_m_n == 1) && none_bits(flag, PROJECT_JUMP)) {
+ if (!src_idx && (project_m_n == 1) && none_bits(flag, PROJECT_JUMP)) {
const Pos2D pos_project(project_m_y, project_m_x);
const auto &grid = floor.get_grid(pos_project);
if (grid.m_idx > 0) {
}
std::string who_name;
- if (who > 0) {
- who_name = monster_desc(player_ptr, &floor.m_list[who], MD_WRONGDOER_NAME);
+ if (src_idx > 0) {
+ who_name = monster_desc(player_ptr, &floor.m_list[src_idx], MD_WRONGDOER_NAME);
}
- if (affect_player(who, player_ptr, who_name.data(), effective_dist, pos.y, pos.x, dam, typ, flag, project)) {
+ if (affect_player(src_idx, player_ptr, who_name.data(), effective_dist, pos.y, pos.x, dam, typ, flag, project)) {
res.notice = true;
res.affected_player = true;
}
class EffectPlayerType;
class PlayerType;
ProjectResult project(
- PlayerType *player_ptr, const MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, const int dam, const AttributeType typ,
+ PlayerType *player_ptr, const MONSTER_IDX src_idx, POSITION rad, POSITION y, POSITION x, const int dam, const AttributeType typ,
BIT_FLAGS flag, std::optional<CapturedMonsterType *> cap_mon_ptr = std::nullopt);
// Melee-post-process-type
struct mam_pp_type {
- mam_pp_type(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX who);
+ mam_pp_type(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX src_idx);
MONSTER_IDX m_idx;
MonsterEntity *m_ptr;
int dam;
bool *dead;
bool *fear;
std::string note;
- MONSTER_IDX who;
+ MONSTER_IDX src_idx;
bool seen;
bool known; /* Can the player be aware of this attack? */
std::string m_name;
};
-mam_pp_type::mam_pp_type(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX who)
+mam_pp_type::mam_pp_type(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX src_idx)
: m_idx(m_idx)
, m_ptr(&player_ptr->current_floor_ptr->m_list[m_idx])
, dam(dam)
, dead(dead)
, fear(fear)
, note(note)
- , who(who)
+ , src_idx(src_idx)
{
this->seen = is_seen(player_ptr, this->m_ptr);
this->known = this->m_ptr->cdis <= MAX_PLAYER_SIGHT;
*(mam_pp_ptr->dead) = true;
print_monster_dead_by_monster(player_ptr, mam_pp_ptr);
- monster_gain_exp(player_ptr, mam_pp_ptr->who, mam_pp_ptr->m_ptr->r_idx);
+ monster_gain_exp(player_ptr, mam_pp_ptr->src_idx, mam_pp_ptr->m_ptr->r_idx);
monster_death(player_ptr, mam_pp_ptr->m_idx, false, AttributeType::NONE);
delete_monster_idx(player_ptr, mam_pp_ptr->m_idx);
*(mam_pp_ptr->fear) = false;
* @param dead 目標となったモンスターの死亡状態を返す参照ポインタ
* @param fear 目標となったモンスターの恐慌状態を返す参照ポインタ
* @param note 目標モンスターが死亡した場合の特別メッセージ(nullptrならば標準表示を行う)
- * @param who 打撃を行ったモンスターの参照ID
+ * @param src_idx 打撃を行ったモンスターの参照ID
* @todo 打撃が当たった時の後処理 (爆発持ちのモンスターを爆発させる等)なので、関数名を変更する必要あり
*/
-void mon_take_hit_mon(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX who)
+void mon_take_hit_mon(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX src_idx)
{
auto *floor_ptr = player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[m_idx];
- mam_pp_type tmp_mam_pp(player_ptr, m_idx, dam, dead, fear, note, who);
+ mam_pp_type tmp_mam_pp(player_ptr, m_idx, dam, dead, fear, note, src_idx);
mam_pp_type *mam_pp_ptr = &tmp_mam_pp;
prepare_redraw(player_ptr, mam_pp_ptr);
(void)set_monster_csleep(player_ptr, m_idx, 0);
*dead = false;
cancel_fear_by_pain(player_ptr, mam_pp_ptr);
make_monster_fear(player_ptr, mam_pp_ptr);
- if ((dam > 0) && !m_ptr->is_pet() && !m_ptr->is_friendly() && (mam_pp_ptr->who != m_idx)) {
- const auto &m_ref = floor_ptr->m_list[who];
+ if ((dam > 0) && !m_ptr->is_pet() && !m_ptr->is_friendly() && (mam_pp_ptr->src_idx != m_idx)) {
+ const auto &m_ref = floor_ptr->m_list[src_idx];
if (m_ref.is_pet() && !player_ptr->is_located_at({ m_ptr->target_y, m_ptr->target_x })) {
set_target(m_ptr, m_ref.fy, m_ref.fx);
}
#include <string_view>
class PlayerType;
-void mon_take_hit_mon(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX who);
+void mon_take_hit_mon(PlayerType *player_ptr, MONSTER_IDX m_idx, int dam, bool *dead, bool *fear, std::string_view note, MONSTER_IDX src_idx);
return ProcessResult::PROCESS_TRUE;
}
- if (genocide_aux(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, !em_ptr->who, (em_ptr->r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One"))) {
+ if (genocide_aux(player_ptr, em_ptr->g_ptr->m_idx, em_ptr->dam, !em_ptr->src_idx, (em_ptr->r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One"))) {
if (em_ptr->seen_msg) {
msg_format(_("%sは消滅した!", "%s^ disappeared!"), em_ptr->m_name);
}
/*!
* @brief モンスターを目標地点に集団生成する / Attempt to place a "group" of monsters around the given location
- * @param who 召喚主のモンスター情報ID
+ * @param src_idx 召喚主のモンスター情報ID
* @param y 中心生成位置y座標
* @param x 中心生成位置x座標
* @param r_idx 生成モンスター種族
* @param mode 生成オプション
* @return 成功したらtrue
*/
-static bool place_monster_group(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode)
+static bool place_monster_group(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode)
{
auto *r_ptr = &monraces_info[r_idx];
auto total = randint1(10);
continue;
}
- if (place_monster_one(player_ptr, who, my, mx, r_idx, mode)) {
+ if (place_monster_one(player_ptr, src_idx, my, mx, r_idx, mode)) {
hack_y[hack_n] = my;
hack_x[hack_n] = mx;
hack_n++;
/*!
* @brief 特定モンスターを生成する
* @param player_ptr プレイヤーへの参照ポインタ
- * @param who 召喚主のモンスター情報ID
+ * @param src_idx 召喚主のモンスター情報ID
* @param y 生成地点y座標
* @param x 生成地点x座標
* @param r_idx 生成するモンスターの種族ID
* @return 生成に成功したらtrue
* @details 護衛も一緒に生成する
*/
-bool place_specific_monster(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode)
+bool place_specific_monster(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode)
{
auto *r_ptr = &monraces_info[r_idx];
mode |= PM_KAGE;
}
- if (!place_monster_one(player_ptr, who, y, x, r_idx, mode)) {
+ if (!place_monster_one(player_ptr, src_idx, y, x, r_idx, mode)) {
return false;
}
if (!(mode & PM_ALLOW_GROUP)) {
}
if (r_ptr->misc_flags.has(MonsterMiscType::HAS_FRIENDS)) {
- (void)place_monster_group(player_ptr, who, y, x, r_idx, mode);
+ (void)place_monster_group(player_ptr, src_idx, y, x, r_idx, mode);
}
if (r_ptr->misc_flags.has_not(MonsterMiscType::ESCORT)) {
bool mon_scatter(PlayerType *player_ptr, MonsterRaceId r_idx, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION max_dist);
bool multiply_monster(PlayerType *player_ptr, MONSTER_IDX m_idx, bool clone, BIT_FLAGS mode);
-bool place_specific_monster(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode);
+bool place_specific_monster(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode);
bool place_random_monster(PlayerType *player_ptr, POSITION y, POSITION x, BIT_FLAGS mode);
bool alloc_horde(PlayerType *player_ptr, POSITION y, POSITION x, summon_specific_pf summon_specific);
bool alloc_guardian(PlayerType *player_ptr, bool def_val);
/*!
* @brief モンスターを召喚により配置する / Place a monster (of the specified "type") near the given location. Return TRUE if a monster was actually summoned.
* @param player_ptr プレイヤーへの参照ポインタ
- * @param who 召喚主のモンスター情報ID
+ * @param src_idx 召喚主のモンスター情報ID
* @param y1 目標地点y座標
* @param x1 目標地点x座標
* @param lev 相当生成階
* @param mode 生成オプション
* @return 召喚できたらtrueを返す
*/
-bool summon_specific(PlayerType *player_ptr, MONSTER_IDX who, POSITION y1, POSITION x1, DEPTH lev, summon_type type, BIT_FLAGS mode)
+bool summon_specific(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y1, POSITION x1, DEPTH lev, summon_type type, BIT_FLAGS mode)
{
auto *floor_ptr = player_ptr->current_floor_ptr;
if (floor_ptr->inside_arena) {
return false;
}
- summon_specific_who = who;
+ summon_specific_who = src_idx;
summon_specific_type = type;
summon_unique_okay = (mode & PM_ALLOW_UNIQUE) != 0;
get_mon_num_prep(player_ptr, summon_specific_okay, get_monster_hook2(player_ptr, y, x));
mode |= PM_NO_KAGE;
}
- if (!place_specific_monster(player_ptr, who, y, x, r_idx, mode)) {
+ if (!place_specific_monster(player_ptr, src_idx, y, x, r_idx, mode)) {
summon_specific_type = SUMMON_NONE;
return false;
}
summon_specific_type = SUMMON_NONE;
bool notice = false;
- if (who <= 0) {
+ if (src_idx <= 0) {
notice = true;
} else {
- auto *m_ptr = &player_ptr->current_floor_ptr->m_list[who];
+ auto *m_ptr = &player_ptr->current_floor_ptr->m_list[src_idx];
if (m_ptr->is_pet()) {
notice = true;
} else if (is_seen(player_ptr, m_ptr)) {
/*!
* @brief 特定モンスター種族を召喚により生成する / A "dangerous" function, creates a pet of the specified type
* @param player_ptr プレイヤーへの参照ポインタ
- * @param who 召喚主のモンスター情報ID
+ * @param src_idx 召喚主のモンスター情報ID
* @param oy 目標地点y座標
* @param ox 目標地点x座標
* @param r_idx 生成するモンスター種族ID
* @param mode 生成オプション
* @return 召喚できたらtrueを返す
*/
-bool summon_named_creature(PlayerType *player_ptr, MONSTER_IDX who, POSITION oy, POSITION ox, MonsterRaceId r_idx, BIT_FLAGS mode)
+bool summon_named_creature(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION oy, POSITION ox, MonsterRaceId r_idx, BIT_FLAGS mode)
{
if (!MonsterRace(r_idx).is_valid() || (r_idx >= static_cast<MonsterRaceId>(monraces_info.size()))) {
return false;
return false;
}
- return place_specific_monster(player_ptr, who, y, x, r_idx, (mode | PM_NO_KAGE));
+ return place_specific_monster(player_ptr, src_idx, y, x, r_idx, (mode | PM_NO_KAGE));
}
enum summon_type : int;
enum class MonsterRaceId : int16_t;
class PlayerType;
-bool summon_specific(PlayerType *player_ptr, MONSTER_IDX who, POSITION y1, POSITION x1, DEPTH lev, summon_type type, BIT_FLAGS mode);
-bool summon_named_creature(PlayerType *player_ptr, MONSTER_IDX who, POSITION oy, POSITION ox, MonsterRaceId r_idx, BIT_FLAGS mode);
+bool summon_specific(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y1, POSITION x1, DEPTH lev, summon_type type, BIT_FLAGS mode);
+bool summon_named_creature(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION oy, POSITION ox, MonsterRaceId r_idx, BIT_FLAGS mode);
/*!
* @brief モンスターを一体生成する / Attempt to place a monster of the given race at the given location.
* @param player_ptr プレイヤーへの参照ポインタ
- * @param who 召喚を行ったモンスターID
+ * @param src_idx 召喚を行ったモンスターID
* @param y 生成位置y座標
* @param x 生成位置x座標
* @param r_idx 生成モンスター種族
* @param mode 生成オプション
* @return 成功したらtrue
*/
-bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode)
+bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode)
{
auto &floor = *player_ptr->current_floor_ptr;
auto *g_ptr = &floor.grid_array[y][x];
m_ptr->mflag.clear();
m_ptr->mflag2.clear();
- if (any_bits(mode, PM_MULTIPLY) && (who > 0) && !floor.m_list[who].is_original_ap()) {
- m_ptr->ap_r_idx = floor.m_list[who].ap_r_idx;
- if (floor.m_list[who].mflag2.has(MonsterConstantFlagType::KAGE)) {
+ if (any_bits(mode, PM_MULTIPLY) && (src_idx > 0) && !floor.m_list[src_idx].is_original_ap()) {
+ m_ptr->ap_r_idx = floor.m_list[src_idx].ap_r_idx;
+ if (floor.m_list[src_idx].mflag2.has(MonsterConstantFlagType::KAGE)) {
m_ptr->mflag2.set(MonsterConstantFlagType::KAGE);
}
}
- if ((who > 0) && r_ptr->kind_flags.has_none_of(alignment_mask)) {
- m_ptr->sub_align = floor.m_list[who].sub_align;
+ if ((src_idx > 0) && r_ptr->kind_flags.has_none_of(alignment_mask)) {
+ m_ptr->sub_align = floor.m_list[src_idx].sub_align;
} else {
m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
if (r_ptr->kind_flags.has(MonsterKindType::EVIL)) {
m_ptr->nickname.clear();
m_ptr->exp = 0;
- if (who > 0 && floor.m_list[who].is_pet()) {
+ if (src_idx > 0 && floor.m_list[src_idx].is_pet()) {
set_bits(mode, PM_FORCE_PET);
- m_ptr->parent_m_idx = who;
+ m_ptr->parent_m_idx = src_idx;
} else {
m_ptr->parent_m_idx = 0;
}
choose_new_monster(player_ptr, g_ptr->m_idx, true, MonsterRace::empty_id());
r_ptr = &m_ptr->get_monrace();
m_ptr->mflag2.set(MonsterConstantFlagType::CHAMELEON);
- if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (who <= 0)) {
+ if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (src_idx <= 0)) {
m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
}
} else if (any_bits(mode, PM_KAGE) && none_bits(mode, PM_FORCE_PET)) {
m_ptr->ml = false;
if (any_bits(mode, PM_FORCE_PET)) {
set_pet(player_ptr, m_ptr);
- } else if (((who == 0) && r_ptr->behavior_flags.has(MonsterBehaviorType::FRIENDLY)) || is_friendly_idx(player_ptr, who) || any_bits(mode, PM_FORCE_FRIENDLY)) {
+ } else if (((src_idx == 0) && r_ptr->behavior_flags.has(MonsterBehaviorType::FRIENDLY)) || is_friendly_idx(player_ptr, src_idx) || any_bits(mode, PM_FORCE_FRIENDLY)) {
if (!monster_has_hostile_align(player_ptr, nullptr, 0, -1, r_ptr) && !player_ptr->current_floor_ptr->inside_arena) {
set_friendly(m_ptr);
}
enum class MonsterRaceId : int16_t;
class PlayerType;
-bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode);
+bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode);
* @brief モンスターの時間停止処理
* @param player_ptr プレイヤーへの参照ポインタ
* @param num 時間停止を行った敵が行動できる回数
- * @param who 時間停止を行う敵の種族番号
+ * @param src_idx 時間停止を行う敵の種族番号
* @param vs_player TRUEならば時間停止開始処理を行う
* @return 時間停止が行われている状態ならばTRUEを返す
* @details monster_desc() は視認外のモンスターについて「何か」と返してくるので、この関数ではLOSや透明視等を判定する必要はない
*/
-bool set_monster_timewalk(PlayerType *player_ptr, int num, MonsterRaceId who, bool vs_player)
+bool set_monster_timewalk(PlayerType *player_ptr, int num, MonsterRaceId src_idx, bool vs_player)
{
auto &floor = *player_ptr->current_floor_ptr;
auto *m_ptr = &floor.m_list[hack_m_idx];
if (vs_player) {
const auto m_name = monster_desc(player_ptr, m_ptr, 0);
std::string mes;
- switch (who) {
+ switch (src_idx) {
case MonsterRaceId::DIO:
mes = _("「『ザ・ワールド』! 時は止まった!」", format("%s yells 'The World! Time has stopped!'", m_name.data()));
break;
should_output_message &= projectable(player_ptr, player_ptr->y, player_ptr->x, m_ptr->fy, m_ptr->fx);
if (vs_player || should_output_message) {
std::string mes;
- switch (who) {
+ switch (src_idx) {
case MonsterRaceId::DIAVOLO:
mes = _("これが我が『キング・クリムゾン』の能力! 『時間を消し去って』飛び越えさせた…!!",
"This is the ability of my 'King Crimson'! 'Erase the time' and let it jump over... !!");
* o_ptr --- pointer to the potion object.
* </pre>
*/
-bool potion_smash_effect(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, short bi_id)
+bool potion_smash_effect(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, short bi_id)
{
int radius = 2;
AttributeType dt = AttributeType::NONE;
break;
}
- (void)project(player_ptr, who, radius, y, x, dam, dt, (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL));
+ (void)project(player_ptr, src_idx, radius, y, x, dam, dt, (PROJECT_JUMP | PROJECT_ITEM | PROJECT_KILL));
return angry;
}
class ItemEntity;
class PlayerType;
-bool potion_smash_effect(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, short bi_id);
+bool potion_smash_effect(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, short bi_id);
PERCENTAGE breakage_chance(PlayerType *player_ptr, ItemEntity *o_ptr, bool has_archer_bonus, SPELL_IDX snipe_type);
class ObjectBreaker {
/*!
* @brief メテオ系スペルの発動 / Cast a meteor spell
* @param player_ptr プレイヤーへの参照ポインタ
- * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
+ * @param src_idx スぺル詠唱者のモンスターID(0=プレイヤー)
* @param typ 効果属性
* @param dam 威力
* @param rad 半径
* Option to hurt the player.
* </pre>
*/
-bool fire_meteor(PlayerType *player_ptr, MONSTER_IDX who, AttributeType typ, POSITION y, POSITION x, int dam, POSITION rad)
+bool fire_meteor(PlayerType *player_ptr, MONSTER_IDX src_idx, AttributeType typ, POSITION y, POSITION x, int dam, POSITION rad)
{
BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
- return project(player_ptr, who, rad, y, x, dam, typ, flg).notice;
+ return project(player_ptr, src_idx, rad, y, x, dam, typ, flg).notice;
}
/*!
bool fire_breath(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, int dam, POSITION rad);
bool fire_rocket(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, int dam, POSITION rad);
bool fire_ball_hide(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, int dam, POSITION rad);
-bool fire_meteor(PlayerType *player_ptr, MONSTER_IDX who, AttributeType typ, POSITION x, POSITION y, int dam, POSITION rad);
+bool fire_meteor(PlayerType *player_ptr, MONSTER_IDX src_idx, AttributeType typ, POSITION x, POSITION y, int dam, POSITION rad);
bool fire_bolt(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, int dam);
bool fire_blast(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev);
bool fire_beam(PlayerType *player_ptr, AttributeType typ, DIRECTION dir, int dam);
/*!
* @brief 死者復活処理(起点より周囲5マス)
* @param player_ptr プレイヤーへの参照ポインタ
- * @param who 術者モンスターID(0ならばプレイヤー)
+ * @param src_idx 術者モンスターID(0ならばプレイヤー)
* @param y 起点Y座標
* @param x 起点X座標
* @return 作用が実際にあった場合TRUEを返す
*/
-bool animate_dead(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x)
+bool animate_dead(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x)
{
BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
- return project(player_ptr, who, 5, y, x, 0, AttributeType::ANIM_DEAD, flg).notice;
+ return project(player_ptr, src_idx, 5, y, x, 0, AttributeType::ANIM_DEAD, flg).notice;
}
/*!
bool destroy_doors_touch(PlayerType *player_ptr);
bool disarm_traps_touch(PlayerType *player_ptr);
bool sleep_monsters_touch(PlayerType *player_ptr);
-bool animate_dead(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x);
+bool animate_dead(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x);
void wall_breaker(PlayerType *player_ptr);
/*!
* @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
* @param player_ptr プレイヤーへの参照ポインタ
- * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
+ * @param src_idx 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
*/
-void aggravate_monsters(PlayerType *player_ptr, MONSTER_IDX who)
+void aggravate_monsters(PlayerType *player_ptr, MONSTER_IDX src_idx)
{
auto sleep = false;
auto speed = false;
if (!monster.is_valid()) {
continue;
}
- if (i == who) {
+ if (i == src_idx) {
continue;
}
bool speed_monsters(PlayerType *player_ptr);
bool slow_monsters(PlayerType *player_ptr, int power);
bool sleep_monsters(PlayerType *player_ptr, int power);
-void aggravate_monsters(PlayerType *player_ptr, MONSTER_IDX who);
+void aggravate_monsters(PlayerType *player_ptr, MONSTER_IDX src_idx);
bool banish_evil(PlayerType *player_ptr, int dist);
bool turn_undead(PlayerType *player_ptr);
bool dispel_evil(PlayerType *player_ptr, int dam);
lev = plev * 2 / 3 + randint1(plev / 2);
}
- MONSTER_IDX who;
+ MONSTER_IDX src_idx;
if (pet) {
/* Become pet */
mode |= PM_FORCE_PET;
}
/* Player is who summons */
- who = -1;
+ src_idx = -1;
} else {
/* Prevent taming, allow unique monster */
mode |= PM_NO_PET;
/* Behave as if they appear by themselfs */
- who = 0;
+ src_idx = 0;
}
bool success = false;
for (int i = 0; i < num; i++) {
- if (summon_specific(player_ptr, who, y, x, lev, type, mode)) {
+ if (summon_specific(player_ptr, src_idx, y, x, lev, type, mode)) {
success = true;
}
}
/*!
* @brief サイバーデーモンの召喚
* @param player_ptr プレイヤーへの参照ポインタ
- * @param who 召喚主のモンスターID(0ならばプレイヤー)
+ * @param src_idx 召喚主のモンスターID(0ならばプレイヤー)
* @param y 召喚位置Y座標
* @param x 召喚位置X座標
* @return 作用が実際にあった場合TRUEを返す
*/
-int summon_cyber(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x)
+int summon_cyber(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x)
{
/* Summoned by a monster */
BIT_FLAGS mode = PM_ALLOW_GROUP;
auto *floor_ptr = player_ptr->current_floor_ptr;
- if (who > 0) {
- auto *m_ptr = &floor_ptr->m_list[who];
+ if (src_idx > 0) {
+ auto *m_ptr = &floor_ptr->m_list[src_idx];
if (m_ptr->is_pet()) {
mode |= PM_FORCE_PET;
}
int count = 0;
for (int i = 0; i < max_cyber; i++) {
- count += summon_specific(player_ptr, who, y, x, 100, SUMMON_CYBER, mode);
+ count += summon_specific(player_ptr, src_idx, y, x, 100, SUMMON_CYBER, mode);
}
return count;
bool cast_summon_greater_demon(PlayerType *player_ptr);
bool summon_kin_player(PlayerType *player_ptr, DEPTH level, POSITION y, POSITION x, BIT_FLAGS mode);
void mitokohmon(PlayerType *player_ptr);
-int summon_cyber(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x);
+int summon_cyber(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x);
int activate_hi_summon(PlayerType *player_ptr, POSITION y, POSITION x, bool can_pet);
void cast_invoke_spirits(PlayerType *player_ptr, DIRECTION dir);