Attacks (both throwing and melee) by the player. More...
|typedef struct attack_result(*||ranged_attack )(struct player *p, struct object *obj, int y, int x)|
|ranged_attack is a function pointer, used to execute a kind of attack. More...|
|void||do_cmd_fire (struct command *cmd)|
|Fire an object from the quiver, pack or floor at a target. More...|
|Front-end command which fires at the nearest target with default ammo. More...|
|void||do_cmd_throw (struct command *cmd)|
|Throw an object from the quiver, pack or floor. More...|
|int||breakage_chance (const struct object *obj, bool hit_target)|
|Returns percent chance of an object breaking after throwing or shooting. More...|
|bool||test_hit (int chance, int ac, int vis)|
|Determine if the player "hits" a monster. More...|
|void||py_attack (struct player *p, int y, int x)|
|Attack the monster at the given location. More...|
|int||py_attack_hit_chance (const struct player *p, const struct object *weapon)|
|Return the player's chance to hit with a particular weapon. More...|
Attacks (both throwing and melee) by the player.
Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
This work is free software; you can redistribute it and/or modify it under the terms of either:
a) the GNU General Public License as published by the Free Software Foundation, version 2, or
b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.
ranged_attack is a function pointer, used to execute a kind of attack.
This allows us to abstract details of throwing, shooting, etc. out while keeping the core projectile tracking, monster cleanup, and display code in common.
Returns percent chance of an object breaking after throwing or shooting.
Artifacts will never break.
Beyond that, each item kind has a percent chance to break (0-100). When the object hits its target this chance is used.
When an object misses it also has a chance to break. This is determined by squaring the normaly breakage probability. So an item that breaks 100% of the time on hit will also break 100% of the time on a miss, whereas a 50% hit-breakage chance gives a 25% miss-breakage chance, and a 10% hit breakage chance gives a 1% miss-breakage chance.
Fire an object from the quiver, pack or floor at a target.
References player_state::ammo_mult, player_state::ammo_tval, cmd_get_item(), cmd_get_target(), CMD_OK, equipped_item_by_slot_name(), item_is_available(), make_ranged_shot(), angband_constants::max_range, MIN, msg, player_state::num_shots, obj_can_fire(), player_confuse_dir(), QUIVER_TAGS, ranged_helper(), player::state, object::tval, USE_FLOOR, USE_INVEN, USE_QUIVER, and z_info.
Referenced by do_cmd_use().
Front-end command which fires at the nearest target with default ammo.
References player_state::ammo_tval, CMD_FIRE, cmd_set_arg_item(), cmd_set_arg_target(), cmdq_peek(), cmdq_push(), DIR_TARGET, equipped_item_by_slot_name(), i, msg, NULL, player_upkeep::quiver, angband_constants::quiver_size, player::state, TARGET_KILL, TARGET_QUIET, target_set_closest(), object::tval, player::upkeep, and z_info.
Throw an object from the quiver, pack or floor.
References adj_str_blow, player::body, cmd_get_item(), cmd_get_target(), CMD_OK, make_ranged_throw(), MAX, MIN, msg, NULL, object_is_equipped(), player_confuse_dir(), QUIVER_TAGS, ranged_helper(), player_state::stat_ind, player::state, USE_FLOOR, USE_INVEN, USE_QUIVER, and object::weight.
Attack the monster at the given location.
We get blows until energy drops below that required for another blow, or until the target monster dies. Each blow is handled by py_attack_real(). We don't allow @ to spend more than 100 energy in one go, to avoid slower monsters getting double moves.
References add_monster_message(), cave, disturb(), player::energy, player_upkeep::energy_use, monster::mflag, mflag_has, angband_constants::move_energy, player_state::num_blows, py_attack_real(), square_monster(), player::state, player::upkeep, and z_info.