#include "view/object-describer.h"
#include "wizard/wizard-messages.h"
-it_type::it_type(player_type *creature_ptr, object_type *q_ptr, const int delay_factor_val, const int mult, const bool boomerang, const OBJECT_IDX shuriken)
+ObjectThrowEntity::ObjectThrowEntity(player_type *creature_ptr, object_type *q_ptr, const int delay_factor_val, const int mult, const bool boomerang, const OBJECT_IDX shuriken)
: q_ptr(q_ptr)
, mult(mult)
, msec(delay_factor_val * delay_factor_val * delay_factor_val)
{
}
-bool it_type::check_can_throw()
+bool ObjectThrowEntity::check_can_throw()
{
if (!this->check_what_throw())
return false;
return true;
}
-void it_type::calc_throw_range()
+void ObjectThrowEntity::calc_throw_range()
{
this->q_ptr->copy_from(this->o_ptr);
object_flags(this->creature_ptr, this->q_ptr, this->obj_flags);
this->tdis = mul;
}
-bool it_type::calc_throw_grid()
+bool ObjectThrowEntity::calc_throw_grid()
{
if (this->shuriken >= 0) {
this->ty = randint0(101) - 50 + this->creature_ptr->y;
return true;
}
-void it_type::reflect_inventory_by_throw()
+void ObjectThrowEntity::reflect_inventory_by_throw()
{
if ((this->q_ptr->name1 == ART_MJOLLNIR) || (this->q_ptr->name1 == ART_AEGISFANG) || this->boomerang)
this->return_when_thrown = true;
inven_item_optimize(this->creature_ptr, this->item);
}
-void it_type::set_class_specific_throw_params()
+void ObjectThrowEntity::set_class_specific_throw_params()
{
PlayerEnergy energy(this->creature_ptr);
energy.set_player_turn_energy(100);
&& ((this->q_ptr->tval == TV_SPIKE) || ((has_flag(this->obj_flags, TR_THROW)) && (this->q_ptr->tval == TV_SWORD)));
}
-void it_type::set_racial_chance()
+void ObjectThrowEntity::set_racial_chance()
{
if (has_flag(this->obj_flags, TR_THROW))
this->chance = ((this->creature_ptr->skill_tht) + ((this->creature_ptr->to_h_b + this->q_ptr->to_h) * BTH_PLUS_ADJ));
this->chance *= 2;
}
-void it_type::exe_throw()
+void ObjectThrowEntity::exe_throw()
{
this->cur_dis = 0;
while (this->cur_dis <= this->tdis) {
}
}
-void it_type::display_figurine_throw()
+void ObjectThrowEntity::display_figurine_throw()
{
if ((this->q_ptr->tval != TV_FIGURINE) || this->creature_ptr->current_floor_ptr->inside_arena)
return;
msg_print(_("これはあまり良くない気がする。", "You have a bad feeling about this."));
}
-void it_type::display_potion_throw()
+void ObjectThrowEntity::display_potion_throw()
{
if (!object_is_potion(this->q_ptr))
return;
this->do_drop = false;
}
-void it_type::check_boomerang_throw()
+void ObjectThrowEntity::check_boomerang_throw()
{
if (!this->return_when_thrown)
return;
this->process_boomerang_throw();
}
-void it_type::process_boomerang_back()
+void ObjectThrowEntity::process_boomerang_back()
{
if (this->come_back) {
if ((this->item != INVEN_MAIN_HAND) && (this->item != INVEN_SUB_HAND)) {
}
}
-void it_type::drop_thrown_item()
+void ObjectThrowEntity::drop_thrown_item()
{
if (!this->do_drop)
return;
(void)drop_near(this->creature_ptr, this->q_ptr, this->corruption_possibility, this->prev_y, this->prev_x);
}
-bool it_type::check_what_throw()
+bool ObjectThrowEntity::check_what_throw()
{
if (this->shuriken >= 0) {
this->item = this->shuriken;
return true;
}
-bool it_type::check_throw_boomerang(concptr *q, concptr *s)
+bool ObjectThrowEntity::check_throw_boomerang(concptr *q, concptr *s)
{
if (!this->boomerang)
return true;
return true;
}
-bool it_type::check_racial_target_bold()
+bool ObjectThrowEntity::check_racial_target_bold()
{
this->ny[this->cur_dis] = this->y;
this->nx[this->cur_dis] = this->x;
|| (this->creature_ptr->current_floor_ptr->grid_array[this->ny[this->cur_dis]][this->nx[this->cur_dis]].m_idx == 0);
}
-void it_type::check_racial_target_seen()
+void ObjectThrowEntity::check_racial_target_seen()
{
if (!panel_contains(this->ny[this->cur_dis], this->nx[this->cur_dis])
|| !player_can_see_bold(this->creature_ptr, this->ny[this->cur_dis], this->nx[this->cur_dis])) {
}
}
-bool it_type::check_racial_target_monster()
+bool ObjectThrowEntity::check_racial_target_monster()
{
this->prev_y = this->y;
this->prev_x = this->x;
return this->creature_ptr->current_floor_ptr->grid_array[this->y][this->x].m_idx == 0;
}
-void it_type::attack_racial_power()
+void ObjectThrowEntity::attack_racial_power()
{
if (!test_hit_fire(this->creature_ptr, this->chance - this->cur_dis, this->m_ptr, this->m_ptr->ml, this->o_name))
return;
}
}
-void it_type::display_attack_racial_power()
+void ObjectThrowEntity::display_attack_racial_power()
{
if (!this->visible) {
msg_format(_("%sが敵を捕捉した。", "The %s finds a mark."), this->o_name);
health_track(this->creature_ptr, this->g_ptr->m_idx);
}
-void it_type::calc_racial_power_damage()
+void ObjectThrowEntity::calc_racial_power_damage()
{
int dd = this->q_ptr->dd;
int ds = this->q_ptr->ds;
this->tdam = mon_damage_mod(this->creature_ptr, this->m_ptr, this->tdam, false);
}
-void it_type::process_boomerang_throw()
+void ObjectThrowEntity::process_boomerang_throw()
{
if ((this->back_chance <= 30) || (one_in_(100) && !this->super_boomerang)) {
msg_format(_("%sが返ってこなかった!", "%s doesn't come back!"), this->o2_name);
this->display_boomerang_throw();
}
-void it_type::display_boomerang_throw()
+void ObjectThrowEntity::display_boomerang_throw()
{
if ((this->back_chance > 37) && !this->creature_ptr->blind && (this->item >= 0)) {
msg_format(_("%sが手元に返ってきた。", "%s comes back to you."), this->o2_name);
set_action(this->creature_ptr, ACTION_NONE);
object_type tmp_object;
- it_type tmp_it(this->creature_ptr, &tmp_object, delay_factor, mult, boomerang, shuriken);
- it_type *it_ptr = &tmp_it;
- if (!it_ptr->check_can_throw())
+ ObjectThrowEntity ote(this->creature_ptr, &tmp_object, delay_factor, mult, boomerang, shuriken);
+ if (!ote.check_can_throw())
return false;
- it_ptr->calc_throw_range();
- if (!it_ptr->calc_throw_grid())
+ ote.calc_throw_range();
+ if (!ote.calc_throw_grid())
return false;
- it_ptr->reflect_inventory_by_throw();
- if (it_ptr->item >= INVEN_MAIN_HAND) {
- it_ptr->equiped_item = true;
+ ote.reflect_inventory_by_throw();
+ if (ote.item >= INVEN_MAIN_HAND) {
+ ote.equiped_item = true;
this->creature_ptr->redraw |= PR_EQUIPPY;
}
- it_ptr->set_class_specific_throw_params();
- it_ptr->set_racial_chance();
- it_ptr->prev_y = it_ptr->y;
- it_ptr->prev_x = it_ptr->x;
- it_ptr->exe_throw();
- if (it_ptr->hit_body)
- torch_lost_fuel(it_ptr->q_ptr);
+ ote.set_class_specific_throw_params();
+ ote.set_racial_chance();
+ ote.prev_y = ote.y;
+ ote.prev_x = ote.x;
+ ote.exe_throw();
+ if (ote.hit_body)
+ torch_lost_fuel(ote.q_ptr);
- it_ptr->corruption_possibility = (it_ptr->hit_body ? breakage_chance(this->creature_ptr, it_ptr->q_ptr, this->creature_ptr->pclass == CLASS_ARCHER, 0) : 0);
- it_ptr->display_figurine_throw();
- it_ptr->display_potion_throw();
- it_ptr->check_boomerang_throw();
- it_ptr->process_boomerang_back();
- it_ptr->drop_thrown_item();
+ ote.corruption_possibility = (ote.hit_body ? breakage_chance(this->creature_ptr, ote.q_ptr, this->creature_ptr->pclass == CLASS_ARCHER, 0) : 0);
+ ote.display_figurine_throw();
+ ote.display_potion_throw();
+ ote.check_boomerang_throw();
+ ote.process_boomerang_back();
+ ote.drop_thrown_item();
return true;
}