Atrinik Server 2.5
Defines | Functions
types/weapon_improver.c File Reference
#include <global.h>

Go to the source code of this file.

Defines

#define IMPROVE_PREPARE   1
#define IMPROVE_DAMAGE   2
#define IMPROVE_WEIGHT   3
#define IMPROVE_ENCHANT   4
#define IMPROVE_STR   5
#define IMPROVE_DEX   6
#define IMPROVE_CON   7
#define IMPROVE_WIS   8
#define IMPROVE_CHA   9
#define IMPROVE_INT   10
#define IMPROVE_POW   11

Functions

static int improve_weapon_stat (object *op, object *improver, object *weapon, signed char *stat, int sacrifice_count, char *statname)
static int prepare_weapon (object *op, object *improver, object *weapon)
static int improve_weapon (object *op, object *improver, object *weapon)
static void eat_item (object *op, const char *item)
static int check_item (object *op, const char *item)
static int check_sacrifice (object *op, object *improver)
void apply_weapon_improver (object *op, object *tmp)
int check_weapon_power (object *who, int improvs)

Detailed Description

Handles the code for using weapon improvers.

Todo:
Test how the code works and perhaps make use of it for Atrinik.

Definition in file weapon_improver.c.


Function Documentation

void apply_weapon_improver ( object op,
object tmp 
)

Apply a weapon improver.

Parameters:
opThe player object applying the improver.
tmpThe weapon improver scroll.

Definition at line 74 of file weapon_improver.c.

static int check_item ( object op,
const char *  item 
) [static]

Counts suitable items with specified archetype name. Will not consider unpaid/cursed items.

Parameters:
opObject just before the bottom of the pile, others will be checked through object->below.
itemWhat archetype to check for.
Returns:
Count of matching items.

Definition at line 390 of file weapon_improver.c.

static int check_sacrifice ( object op,
object improver 
) [static]

Returns how many items of type improver->slaying there are under op.

Will display a message if none found.

Parameters:
opItem just below the bottom of the pile.
improverSacrifice object.
Returns:
Count of matching items.

Definition at line 432 of file weapon_improver.c.

int check_weapon_power ( object who,
int  improvs 
)

This checks to see of the player (who) is sufficient level to use a weapon with improvs improvements (typically last_eat).

We take an int here instead of the object so that the improvement code can pass along the increased value to see if the object is usuable. we return 1 (true) if the player can use the weapon.

Parameters:
whoThe player object.
improvsThe improvement value.
Returns:
1 if the player can use the weapon, 0 otherwise.

Definition at line 112 of file weapon_improver.c.

static void eat_item ( object op,
const char *  item 
) [static]

Removes specified item.

Parameters:
opItem at the bottom to check.
itemArchetype to look for.

Definition at line 364 of file weapon_improver.c.

static int improve_weapon ( object op,
object improver,
object weapon 
) [static]

Does the dirty job for 'improve weapon' scroll, prepare or add something.

Checks if weapon was prepared, if enough potions on the floor, etc.

We are hiding extra information about the weapon in the level and last_eat numbers for an object. Hopefully this won't break anything?

level == max improve, last_eat == current improve

Parameters:
opPlayer improving.
improverThe scroll that was read.
weaponWeapon to improve.
Returns:
1 if weapon was improved, 0 otherwise.

Definition at line 241 of file weapon_improver.c.

static int improve_weapon_stat ( object op,
object improver,
object weapon,
signed char *  stat_id,
int  sacrifice_count,
char *  stat_name 
) [static]

Actually improves the weapon, and tells the player.

Parameters:
opPlayer improving.
improverScroll used to improve.
weaponImproved weapon.
stat_idWhat statistic to improve.
sacrifice_countHow much to improve stat by.
stat_nameName of stat to display to player.
Returns:
Always returns 1.

Definition at line 156 of file weapon_improver.c.

static int prepare_weapon ( object op,
object improver,
object weapon 
) [static]

This does the prepare weapon scroll.

Checks for sacrifice, and so on. Will inform the player of failures or success.

Parameters:
opPlayer using the scroll.
improverThe improvement scroll.
weaponWeapon to improve.
Returns:
1 if weapon was prepared, 0 otherwise.

Definition at line 178 of file weapon_improver.c.