#include "action/throw-util.h"
#include "combat/attack-power-table.h"
+#include "effect/spells-effect-util.h"
#include "flavor/flavor-describer.h"
#include "flavor/object-flavor-types.h"
#include "floor/floor-object.h"
+#include "floor/geometry.h"
#include "inventory/inventory-slot-types.h"
#include "object-enchant/tr-types.h"
#include "object-hook/hook-checker.h"
#include "system/floor-type-definition.h"
#include "system/object-type-definition.h"
#include "system/player-type-definition.h"
+#include "target/target-checker.h"
+#include "target/target-getter.h"
#include "term/screen-processor.h"
#include "util/bit-flags-calculator.h"
#include "view/display-messages.h"
this->tdis = mul;
}
+bool it_type::calc_throw_grid()
+{
+ if (this->shuriken >= 0) {
+ this->ty = randint0(101) - 50 + this->creature_ptr->y;
+ this->tx = randint0(101) - 50 + this->creature_ptr->x;
+ return true;
+ }
+
+ project_length = this->tdis + 1;
+ DIRECTION dir;
+ if (!get_aim_dir(this->creature_ptr, &dir))
+ return false;
+
+ this->tx = this->creature_ptr->x + 99 * ddx[dir];
+ this->ty = this->creature_ptr->y + 99 * ddy[dir];
+ if ((dir == 5) && target_okay(this->creature_ptr)) {
+ this->tx = target_col;
+ this->ty = target_row;
+ }
+
+ project_length = 0;
+ return true;
+}
+
bool it_type::check_what_throw()
{
if (this->shuriken >= 0) {
{
}
-static bool calc_throw_grid(player_type *creature_ptr, it_type *it_ptr)
-{
- if (it_ptr->shuriken >= 0) {
- it_ptr->ty = randint0(101) - 50 + creature_ptr->y;
- it_ptr->tx = randint0(101) - 50 + creature_ptr->x;
- return true;
- }
-
- project_length = it_ptr->tdis + 1;
- DIRECTION dir;
- if (!get_aim_dir(creature_ptr, &dir))
- return false;
-
- it_ptr->tx = creature_ptr->x + 99 * ddx[dir];
- it_ptr->ty = creature_ptr->y + 99 * ddy[dir];
- if ((dir == 5) && target_okay(creature_ptr)) {
- it_ptr->tx = target_col;
- it_ptr->ty = target_row;
- }
-
- project_length = 0;
- return true;
-}
-
static void reflect_inventory_by_throw(player_type *creature_ptr, it_type *it_ptr)
{
if ((it_ptr->q_ptr->name1 == ART_MJOLLNIR) || (it_ptr->q_ptr->name1 == ART_AEGISFANG) || it_ptr->boomerang)
return false;
it_ptr->calc_throw_range();
- if (!calc_throw_grid(this->creature_ptr, it_ptr))
+ if (!it_ptr->calc_throw_grid())
return false;
reflect_inventory_by_throw(this->creature_ptr, it_ptr);