Angband
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"

Enumerations

enum  art_tag_t {
  ART_TAG_NONE, ART_TAG_NAME, ART_TAG_KIND, ART_TAG_VERB,
  ART_TAG_VERB_IS
}
 
enum  use { USE_TIMEOUT, USE_CHARGE, USE_SINGLE }
 

Using items the traditional way

More...
 

Functions

static int check_devices (struct object *obj)
 

Utility bits and bobs

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

Inscriptions

More...
 
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

More...
 
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)
 

Refuelling

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

Spell casting

More...
 
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

◆ art_tag_t

enum art_tag_t
Enumerator
ART_TAG_NONE 
ART_TAG_NAME 
ART_TAG_KIND 
ART_TAG_VERB 
ART_TAG_VERB_IS 

◆ use

enum use


Using items the traditional way

Enumerator
USE_TIMEOUT 
USE_CHARGE 
USE_SINGLE 

Function Documentation

◆ activation_message()

static void activation_message ( struct object obj)
static

Print an artifact activation message.

In order to support randarts, with scrambled names, we re-write the message to replace instances of {name} with the artifact name and instances of {kind} with the type of object.

This code deals with plural and singular forms of verbs correctly when encountering {s}, though in fact both names and kinds are always singular in the current code (gloves are "Set of" and boots are "Pair of")

References object::activation, artifact::alt_msg, ART_TAG_KIND, art_tag_lookup(), ART_TAG_NAME, ART_TAG_VERB, ART_TAG_VERB_IS, object::artifact, buf, object::kind, activation::message, msg, object::number, object_desc(), object_kind_name(), ODESC_BASE, ODESC_PREFIX, strnfcat(), and tag.

Referenced by use_aux().

◆ art_tag_lookup()

static art_tag_t art_tag_lookup ( const char *  tag)
static

◆ beam_chance()

static int beam_chance ( int  tval)
static

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

Referenced by use_aux().

◆ check_devices()

static int check_devices ( struct object obj)
static


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, NULL, 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)

Autoinscribe all appropriate objects.

References autoinscribe_ground(), autoinscribe_pack(), PR_EQUIP, PR_INVEN, player_upkeep::redraw, and player::upkeep.

◆ 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)

Quaff a potion.

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

Referenced by do_cmd_use().

◆ 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(), and player_has.

◆ 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 
)
static

◆ use_aux()

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