Enumerations | Functions
cmd-obj.c File Reference

Handle objects in various ways. More...

#include "angband.h"
#include "cave.h"
#include "cmd-core.h"
#include "cmds.h"
#include "effects.h"
#include "game-input.h"
#include "init.h"
#include "obj-desc.h"
#include "obj-gear.h"
#include "obj-ignore.h"
#include "obj-info.h"
#include "obj-knowledge.h"
#include "obj-make.h"
#include "obj-pile.h"
#include "obj-tval.h"
#include "obj-util.h"
#include "player-attack.h"
#include "player-calcs.h"
#include "player-spell.h"
#include "player-timed.h"
#include "player-util.h"
#include "target.h"
#include "trap.h"



Using items the traditional way



static int check_devices (struct object *obj)

Utility bits and bobs

static int beam_chance (int tval)
 Return the chance of an effect beaming, given a tval. More...
static void activation_message (struct object *obj)
 Print an artifact activation message. More...
void do_cmd_uninscribe (struct command *cmd)


void do_cmd_inscribe (struct command *cmd)
 Add inscription. More...
void do_cmd_autoinscribe (struct command *cmd)
 Autoinscribe all appropriate objects. More...
void do_cmd_takeoff (struct command *cmd)

Taking off/putting on

void do_cmd_wield (struct command *cmd)
 Wield or wear an item. More...
void do_cmd_drop (struct command *cmd)
 Drop an item. More...
static void use_aux (struct command *cmd, struct object *obj, enum use use, int snd)
 Use an object the right way. More...
void do_cmd_read_scroll (struct command *cmd)
 Read a scroll. More...
void do_cmd_use_staff (struct command *cmd)
 Use a staff. More...
void do_cmd_aim_wand (struct command *cmd)
 Aim a wand. More...
void do_cmd_zap_rod (struct command *cmd)
 Zap a rod. More...
void do_cmd_activate (struct command *cmd)
 Activate an object. More...
void do_cmd_eat_food (struct command *cmd)
 Eat some food. More...
void do_cmd_quaff_potion (struct command *cmd)
 Quaff a potion. More...
void do_cmd_use (struct command *cmd)
 Use any usable item. More...
static void refill_lamp (struct object *lamp, struct object *obj)


void do_cmd_refill (struct command *cmd)
void do_cmd_cast (struct command *cmd)

Spell casting

void do_cmd_study_spell (struct command *cmd)
 Gain a specific spell, specified by spell number (for mages). More...
void do_cmd_study_book (struct command *cmd)
 Gain a random spell from the given book (for priests) More...
void do_cmd_study (struct command *cmd)
 Choose the way to study. More...

Detailed Description

Handle objects in various ways.

Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke Copyright (c) 2007-9 Andi Sidwell, Chris Carr, Ed Graham, Erik Osheim

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.

Enumeration Type Documentation

◆ use

enum use

Using items the traditional way


Function Documentation

◆ activation_message()

static void activation_message ( struct object obj)

Print an artifact activation message.

References object::activation, artifact::alt_msg, object::artifact, activation::message, and print_custom_message().

Referenced by use_aux().

◆ beam_chance()

static int beam_chance ( int  tval)

Return the chance of an effect beaming, given a tval.

Referenced by use_aux().

◆ check_devices()

static int check_devices ( struct object obj)

Utility bits and bobs

Check to see if the player can use a rod/wand/staff/activatable object.

References action, object::activation, object::effect, EVENT_INPUT_FLUSH, event_signal(), get_use_device_chance(), object::known, msg, object::pval, randint1, tval_is_rod(), tval_is_staff(), and tval_is_wand().

Referenced by use_aux().

◆ do_cmd_activate()

void do_cmd_activate ( struct command cmd)

◆ do_cmd_aim_wand()

void do_cmd_aim_wand ( struct command cmd)

◆ do_cmd_autoinscribe()

void do_cmd_autoinscribe ( struct command cmd)

◆ do_cmd_cast()

void do_cmd_cast ( struct command cmd)

◆ do_cmd_drop()

void do_cmd_drop ( struct command cmd)

◆ do_cmd_eat_food()

void do_cmd_eat_food ( struct command cmd)

Eat some food.

References cmd_get_item(), CMD_OK, tval_is_edible(), use_aux(), USE_FLOOR, USE_INVEN, and USE_SINGLE.

Referenced by do_cmd_use().

◆ do_cmd_inscribe()

void do_cmd_inscribe ( struct command cmd)

◆ do_cmd_quaff_potion()

void do_cmd_quaff_potion ( struct command cmd)

◆ do_cmd_read_scroll()

void do_cmd_read_scroll ( struct command cmd)

◆ do_cmd_refill()

void do_cmd_refill ( struct command cmd)

◆ do_cmd_study()

void do_cmd_study ( struct command cmd)

Choose the way to study.

Choose life. Choose a career. Choose family. Choose a fucking big monster, choose orc shamans, kobolds, dark elven druids, and Mim, Betrayer of Turin.

References do_cmd_study_book(), do_cmd_study_spell(), get_check(), msg, player_shape::name, player_has, player_is_shapechanged(), player_resume_normal_shape(), and player::shape.

◆ do_cmd_study_book()

void do_cmd_study_book ( struct command cmd)

◆ do_cmd_study_spell()

void do_cmd_study_spell ( struct command cmd)

◆ do_cmd_takeoff()

void do_cmd_takeoff ( struct command cmd)

◆ do_cmd_uninscribe()

void do_cmd_uninscribe ( struct command cmd)

◆ do_cmd_use()

void do_cmd_use ( struct command cmd)

◆ do_cmd_use_staff()

void do_cmd_use_staff ( struct command cmd)

◆ do_cmd_wield()

void do_cmd_wield ( struct command cmd)

◆ do_cmd_zap_rod()

void do_cmd_zap_rod ( struct command cmd)

◆ refill_lamp()

static void refill_lamp ( struct object lamp,
struct object obj 

◆ use_aux()

static void use_aux ( struct command cmd,
struct object obj,
enum use  use,
int  snd 

Use an object the right way.

References object::activation, activation_message(), apply_autoinscription(), object::artifact, beam_chance(), cave, check_devices(), cmd_get_arg_item(), cmd_get_target(), CMD_OK, ddd, drop_near(), object::effect, effect_do(), object_kind::effect_msg, player_upkeep::energy_use, floor_item_charges(), floor_object_for_use(), gear_object_for_use(), gear_to_label(), player::grid, inven_carry(), inven_item_charges(), object::kind, object::known, object_kind::level, artifact::level, level, lookup_trap(), MAX, angband_constants::move_energy, msg, msgt(), player_upkeep::notice, object::number, obj_needs_aim(), object_copy(), object_delete(), object_desc(), object_effect(), object_flavor_is_aware(), object_flavor_tried(), object_is_carried(), object_learn_on_use(), object_new(), ODESC_FULL, ODESC_PREFIX, object::oidx, player_confuse_dir(), PN_COMBINE, PR_EQUIP, PR_INVEN, PR_OBJECT, push_object(), object::pval, randcalc(), randint0, RANDOMISE, player_upkeep::redraw, SKILL_DEVICE, player_state::skills, sound(), source_player(), square_object(), square_trap_specific(), player::state, target_fix(), target_release(), trap_kind::tidx, object::time, object::timeout, track_object(), object::tval, tval_is_rod(), tval_is_wand(), tval_is_wearable(), update_player_object_knowledge(), player::upkeep, USE_CHARGE, USE_SINGLE, USE_TIMEOUT, and z_info.

Referenced by do_cmd_activate(), do_cmd_aim_wand(), do_cmd_eat_food(), do_cmd_quaff_potion(), do_cmd_read_scroll(), do_cmd_use_staff(), and do_cmd_zap_rod().