6 #include "cmd-item/cmd-throw.h"
7 #include "game-option/special-options.h"
8 #include "inventory/inventory-slot-types.h"
9 #include "object-use/throw-execution.h"
10 #include "object/object-broken.h"
11 #include "player-base/player-class.h"
12 #include "player-info/samurai-data-type.h"
13 #include "player/attack-defense-types.h"
14 #include "player/special-defense-types.h"
15 #include "specific-object/torch.h"
16 #include "status/action-setter.h"
17 #include "system/item-entity.h"
18 #include "system/player-type-definition.h"
19 #include "system/redrawing-flags-updater.h"
21 ThrowCommand::ThrowCommand(PlayerType *player_ptr)
22 : player_ptr(player_ptr)
27 * @brief 投射処理メインルーチン /
28 * Throw an object from the pack or floor.
30 * @param player_ptr プレイヤーへの参照ポインタ
31 * @param boomerang ブーメラン処理ならばTRUE
32 * @param shuriken 忍者の手裏剣処理ならばTRUE ← 間違い、-1が渡されてくることがある。要調査.
33 * @return ターンを消費した場合TRUEを返す
36 * Note: "unseen" monsters are very hard to hit.
38 * Should throwing a weapon do full damage? Should it allow the magic
39 * to hit bonus of the weapon to have an effect? Should it ever cause
40 * the item to be destroyed? Should it do any damage at all?
43 bool ThrowCommand::do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
45 if (this->player_ptr->wild_mode) {
49 PlayerClass pc(this->player_ptr);
50 pc.break_samurai_stance({ SamuraiStanceType::MUSOU });
52 ItemEntity tmp_object;
53 ObjectThrowEntity ote(this->player_ptr, &tmp_object, delay_factor, mult, boomerang, shuriken);
54 if (!ote.check_can_throw()) {
58 ote.calc_throw_range();
59 if (!ote.calc_throw_grid()) {
63 ote.reflect_inventory_by_throw();
64 if (ote.item >= INVEN_MAIN_HAND) {
65 ote.equiped_item = true;
66 RedrawingFlagsUpdater::get_instance().set_flag(MainWindowRedrawingFlag::EQUIPPY);
69 ote.set_class_specific_throw_params();
70 ote.set_racial_chance();
75 torch_lost_fuel(ote.q_ptr);
78 ote.corruption_possibility = ote.hit_body ? breakage_chance(this->player_ptr, ote.q_ptr, pc.equals(PlayerClassType::ARCHER), 0) : 0;
79 ote.display_figurine_throw();
80 ote.display_potion_throw();
81 ote.check_boomerang_throw();
82 ote.process_boomerang_back();
83 ote.drop_thrown_item();