Angband
Functions | Variables
obj-slays.c File Reference

Functions for manipulating slays/brands. More...

#include "angband.h"
#include "init.h"
#include "mon-lore.h"
#include "mon-predicate.h"
#include "obj-desc.h"
#include "obj-init.h"
#include "obj-knowledge.h"
#include "obj-slays.h"
#include "obj-util.h"

Functions

bool same_monsters_slain (int slay1, int slay2)
 Check if two slays affect the same set of monsters. More...
 
void copy_slays (bool **dest, bool *source)
 Add all the slays from one structure to another. More...
 
void copy_brands (bool **dest, bool *source)
 Add all the brands from one structure to another. More...
 
bool append_random_brand (bool **current, struct brand **brand)
 Append a random brand, currently to a randart This will later change so that selection is done elsewhere. More...
 
bool append_random_slay (bool **current, struct slay **slay)
 Append a random slay, currently to a randart This will later change so that selection is done elsewhere. More...
 
int brand_count (bool *brands)
 Count a set of brands. More...
 
int slay_count (bool *slays)
 Count a set of slays. More...
 
bool react_to_specific_slay (struct slay *slay, const struct monster *mon)
 React to slays which hurt a monster. More...
 
void improve_attack_modifier (struct object *obj, const struct monster *mon, int *brand_used, int *slay_used, char *verb, bool range, bool real)
 Extract the multiplier from a given object hitting a given monster. More...
 
bool react_to_slay (struct object *obj, const struct monster *mon)
 React to slays which hurt a monster. More...
 

Variables

struct slayslays
 
struct brandbrands
 

Detailed Description

Functions for manipulating slays/brands.

Copyright (c) 2010 Chris Carr and Peter Denison Copyright (c) 2014 Nick McConnell

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.

Function Documentation

bool append_random_brand ( bool **  current,
struct brand **  brand 
)

Append a random brand, currently to a randart This will later change so that selection is done elsewhere.

Parameters
currentthe list of brands the object already has
namethe name to report for randart logging

References angband_constants::brand_max, i, mem_zalloc(), brand::multiplier, randint1, streq, and z_info.

Referenced by add_brand().

bool append_random_slay ( bool **  current,
struct slay **  slay 
)

Append a random slay, currently to a randart This will later change so that selection is done elsewhere.

Parameters
currentthe list of slays the object already has
namethe name to report for randart logging

References i, mem_zalloc(), slay::multiplier, slay::race_flag, randint1, angband_constants::slay_max, streq, and z_info.

Referenced by add_slay().

int brand_count ( bool *  brands)

Count a set of brands.

Parameters
brandsThe brands to count.

References angband_constants::brand_max, i, and z_info.

Referenced by count_bow_abilities(), count_nonweapon_abilities(), and count_weapon_abilities().

void copy_brands ( bool **  dest,
bool *  source 
)

Add all the brands from one structure to another.

Parameters
destthe address the brands are going to
sourcethe brands being copied

References angband_constants::brand_max, i, mem_zalloc(), and z_info.

Referenced by artifact_prep(), copy_artifact_data(), ego_apply_magic(), obj_known_damage(), and object_prep().

void copy_slays ( bool **  dest,
bool *  source 
)

Add all the slays from one structure to another.

Parameters
destthe address the slays are going to
sourcethe slays being copied

References i, mem_zalloc(), angband_constants::slay_max, and z_info.

Referenced by artifact_prep(), copy_artifact_data(), ego_apply_magic(), obj_known_damage(), and object_prep().

void improve_attack_modifier ( struct object obj,
const struct monster mon,
int brand_used,
int slay_used,
char *  verb,
bool  range,
bool  real 
)

Extract the multiplier from a given object hitting a given monster.

Parameters
objis the object being used to attack
monis the monster being attacked
brand_usedis the brand that gave the best multiplier, or NULL
slay_usedis the slay that gave the best multiplier, or NULL
verbis the verb used in the attack ("smite", etc)
realis whether this is a real attack (where we update lore) or a simulation (where we don't)

References angband_constants::brand_max, object::brands, monster_lore::flags, monster_race::flags, get_lore(), i, slay::melee_verb, monster_is_visible(), brand::multiplier, slay::multiplier, my_strcat(), my_strcpy(), object_learn_brand(), object_learn_slay(), player_knows_brand(), player_knows_slay(), monster::race, slay::race_flag, slay::range_verb, react_to_specific_slay(), brand::resist_flag, rf_has, rf_on, angband_constants::slay_max, object::slays, brand::verb, and z_info.

Referenced by make_ranged_shot(), make_ranged_throw(), and py_attack_real().

bool react_to_slay ( struct object obj,
const struct monster mon 
)

React to slays which hurt a monster.

Parameters
objis the object we're testing for slays
monis the monster we're testing for being slain

References i, react_to_specific_slay(), angband_constants::slay_max, object::slays, and z_info.

Referenced by process_monster_grab_objects().

bool react_to_specific_slay ( struct slay slay,
const struct monster mon 
)

React to slays which hurt a monster.

Parameters
slayis the slay we're testing for effectiveness
monis the monster we're testing for being slain

References slay::base, monster_race::base, monster_race::flags, slay::name, monster_base::name, monster::race, slay::race_flag, rf_has, and streq.

Referenced by improve_attack_modifier(), and react_to_slay().

bool same_monsters_slain ( int  slay1,
int  slay2 
)

Check if two slays affect the same set of monsters.

References streq.

Referenced by init_rune(), object_has_rune(), object_learn_slay(), and player_learn_rune().

int slay_count ( bool *  slays)

Count a set of slays.

Parameters
slaysThe slays to count.

References i, angband_constants::slay_max, and z_info.

Referenced by count_bow_abilities(), count_nonweapon_abilities(), and count_weapon_abilities().

Variable Documentation

struct brand* brands
struct slay* slays