 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
69 int arch_flag, name_flag, race_flag;
99 && (!(victim->
name && name_flag) || strcmp(op->
race, victim->
name))
100 && (!(victim->
race && race_flag) || strcmp(op->
race, victim->
race)))
150 LOG(
llevError,
"BUG: do_learn_spell(): not a player\n");
158 LOG(
llevError,
"BUG: do_learn_spell(): spell already known, but not marked as startequip\n");
173 "Type 'bind cast %s to store the spell in a key.",
191 LOG(
llevError,
"BUG: do_forget_spell(): not a player\n");
196 LOG(
llevError,
"BUG: do_forget_spell(): spell not known\n");
201 "You lose knowledge of %s.",
230 snprintf(
buf,
sizeof(
buf),
":%s:", who->
race);
231 buf[
sizeof(
buf)-1] =
'\0';
233 if (strstr(restriction,
buf) != NULL)
265 "You should pay for it first.");
306 "But you are floating high above the ground!");
319 "The object disappears in a puff of smoke!");
321 "It must have been an illusion.");
334 "I don't know how to apply the %s.",
338 "You must get it first!\n");
434 LOG(
llevError,
"BUG: unapply_special(): applied skill is not a chosen skill\n");
441 "You stop using the %s.",
446 "You can no longer use the skill: %s.",
579 object *tmp = NULL, *last;
599 "No matter how hard you try, you just can't remove %s.",
647 "The %s just won't come off",
680 object *tmp = NULL, *ws = NULL;
736 else if (tmp != tmp1)
794 return (who->
level/5)+5 >= improves;
824 LOG(
llevError,
"apply_special() from object without environment.\n");
842 "No matter how hard you try, you just can't remove %s.",
861 "You need the %s skill to use this item!",
893 "That weapon is too powerful for you to use. It would consume your soul!");
945 LOG(
llevError,
"BUG: apply_special(): can't apply two skills\n");
960 "That weapon is too powerful for you to use. It would consume your soul!");
990 "You will now fire %s with %s.",
1013 "You ready your %s.",
1043 "Oops, it feels deadly cold!");
1131 while (invtmp->stats.hp-- > 0)
1133 invtmp->randomitems = NULL;
1134 }
else if (invtmp && invtmp->arch
1136 && invtmp->type !=
SPELL
1137 && invtmp->type !=
CLASS
1143 invtmp->randomitems = NULL;
1196 while (tmp->stats.hp-- > 0)
1198 tmp->randomitems = NULL;
1200 object *head =
HEAD(tmp);
1219 && tmp->type !=
SPELL
1221 && tmp->type !=
CLASS
1224 tmp->randomitems = NULL;
1255 if (abs(failure/4) > power)
1256 power = abs(failure/4);
1258 if (failure <= -1 && failure > -15) {
1262 "Your spell warps!");
1273 if (failure <= -35 && failure > -60) {
1275 "The magic recoils on you!");
1280 if (failure <= -60 && failure > -70) {
1282 "The magic recoils and paralyzes you!");
1287 if (failure <= -70 && failure > -80) {
1289 "The magic recoils on you!");
1294 if (failure <= -80) {
1300 "You unleash uncontrolled mana!");
1308 "Your mana is drained!");
1327 int excess_stat = 0;
1345 if (stat > 20+race_bonus) {
1347 stat = 20+race_bonus;
1348 }
else if (stat < 1) {
1356 excess_stat += stat;
1366 if (excess_stat < 0) excess_stat = 0;
1372 for (j = 0; excess_stat > 0 && j < 100; j++) {
1382 if (stat < 20+race_bonus) {
1422 if ((!has_noclassfacechange) && anim == 0) {
1468 "You don't have the body to use a %s",
1480 "You have a prohibition against using a %s",
1495 "You need to unapply some item(s):");
1530 "Equipping that combined with other items would consume your soul!");
1555 int damage_percentile;
1562 if (owner == NULL || strcmp(owner, who->
name) == 0)
1566 item_will = will != NULL ? atol(will) : 0;
1569 "This %s refuses to serve you - it keeps evading your hand !",
1575 random_effect =
random_roll(0, 100, who, 1)-margin*20;
1576 if (random_effect > 80) {
1577 msg =
"You don't know why, but you have the feeling that the %s is angry at you !";
1578 damage_percentile = 60;
1579 }
else if (random_effect > 60) {
1580 msg =
"The %s seems to look at you nastily !";
1581 damage_percentile = 45;
1582 }
else if (random_effect > 40) {
1583 msg =
"You have the strange feeling that the %s is annoyed...";
1584 damage_percentile = 30;
1585 }
else if (random_effect > 20) {
1586 msg =
"The %s seems tired, or bored, in a way. Very strange !";
1587 damage_percentile = 15;
1588 }
else if (random_effect > 0) {
1589 msg =
"You hear the %s sighing !";
1590 damage_percentile = 0;
1593 damage_percentile = 0;
1598 if (damage_percentile > 0) {
1599 int weapon_bite = (who->
stats.
hp*damage_percentile)/100;
1600 if (weapon_bite < 1)
1604 "You get a nasty bite in the hand !");
1625 const char *quotepos;
1630 quotepos = strstr(op->
name,
"'");
1631 if (quotepos == NULL || strncmp(op->
name, who->
name, quotepos-op->
name) == 0)
1636 "The weapon does not recognize you as its owner.");
1660 "Readied skill: %s.",
1671 "You can now use the skill: %s.",
void paralyze_living(object *op, int dam)
Paralyze a living thing.
@ CLASS
Object for applying character class modifications to someone.
#define FLAG_USE_BOW
(Monster) can apply and fire bows
#define HAS_RANDOM_ITEMS(op)
This return TRUE if object has still randomitems which could be expanded.
static int unapply_special(object *who, object *op, int aflags)
Unapplies specified item.
struct Settings settings
Global settings.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
#define FLAG_USE_RANGE
(Monster) can apply and use range items
object * object_find_by_type_applied(const object *who, int type)
Find applied object in inventory.
#define NUM_BODY_LOCATIONS
Number of body locations.
@ llevError
Error, serious thing.
#define FABS(x)
Decstations have trouble with fabs()...
#define FLAG_ANIMATE
The object looks at archetype for faces.
uint16_t difficulty
What level the player should be to play here.
#define MOVE_FLYING
Combo of fly_low and fly_high.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
#define FLAG_IS_LINKED
The object is linked with other objects.
object * inv
Pointer to the first object in the inventory.
#define QUERY_FLAG(xyz, p)
int apply_special(object *who, object *op, int aflags)
Apply an object.
void confuse_living(object *op, object *hitter, int dam)
Confuse a living thing.
void clear_skill(object *who)
This function just clears the chosen_skill and range_skill values in the player.
static int apply_check_apply_restrictions(object *who, object *op, int aflags)
Checks for general apply restrictions (no body, prohibited by god, conflicts with other items,...
object * object_merge(object *op, object *top)
This function goes through all objects below and including top, and merges op to the first matching o...
#define AP_APPLY
Item is to be applied.
int8_t item_power
Power rating of the object.
static int apply_check_owner(const object *who, const object *op, int aflags)
Checks that the item's owner matches the applier.
static int apply_check_race_restrictions(object *who, object *item)
Checks if an item is restricted to a race.
struct archetype * arch
Pointer to archetype.
int16_t invisible
How much longer the object will be invis.
#define CAN_APPLY_UNAPPLY_MULT
#define CAN_APPLY_RESTRICTION
object * transport
Transport the player is in.
#define FLAG_USE_ARMOUR
(Monster) can wear armour/shield/helmet
struct mapstruct * map
Pointer to the map in which this object is present.
sstring anim_suffix
Used to determine combined animations.
#define AP_UNAPPLY
Item is to be remvoed.
#define MSG_TYPE_APPLY_CURSED
Applied a cursed object (BAD)
int apply_by_living(object *pl, object *op, int aflag, int quiet)
Living thing is applying an object.
@ GT_ONLY_GOOD
Don't generate bad/cursed items.
@ range_none
No range selected.
void apply_changes_to_player(object *pl, object *change, int limit_stats)
Applies (race) changes to a player.
static int unapply_for_ob(object *who, object *op, int aflags)
Remove equipment so an object can be applied.
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
#define FLAG_WIZ
Object has special privilegies.
#define FLAG_BEEN_APPLIED
Object was ever applied, for identification purposes.
void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound for specified player only.
@ SKILL
Also see SKILL_TOOL (74) below.
#define FLAG_READY_RANGE
(Monster) has a range attack readied...
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
Plays a sound on a map.
int change_skill(object *who, object *new_skill, int flag)
This changes the object's skill to new_skill.
void object_copy(const object *src_ob, object *dest_ob)
Copy object first frees everything allocated by the second object, and then copies the contents of th...
#define AP_IGNORE_CURSE
Apply/unapply regardless of cursed/damned status.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
@ TRANSPORT
see doc/Developers/objects
@ unapply_always
Will unapply whatever is necessary - this goes beyond no choice - if there are multiple ojbect of the...
void scroll_failure(object *op, int failure, int power)
op made some mistake with a scroll, this takes care of punishment.
int rndm(int min, int max)
Returns a number between min and max.
#define FLAG_READY_BOW
not implemented yet
void esrv_add_spells(player *pl, object *spell)
This tells the client to add the spell *spell, if spell is NULL, then add all spells in the player's ...
#define FLAG_CURSED
The object is cursed.
#define FLAG_BLESSED
Item has a blessing, opposite of cursed/damned.
int16_t level
Level of creature or object.
static int apply_check_personalized_blessings(object *who, const object *op)
If personalized blessings are activated, the weapon can bite the wielder if he/she is not the one who...
static void auto_apply_fix_inventory(mapstruct *m, object *tmp)
Go through one object on a map and process any special treasure creation or such for anything in it's...
void do_learn_spell(object *op, object *spell, int special_prayer)
Actually makes op learn spell.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
#define MSG_TYPE_VICTIM
Something bad is happening to the player.
Plugin animator file specs[Config] name
void cast_magic_storm(object *op, object *tmp, int lvl)
This is really used mostly for spell fumbles and the like.
#define FLAG_KNOWN_CURSED
The object is known to be cursed.
@ range_builder
Map builder.
int32_t carrying
How much weight this object contains.
int16_t y
Position in the map for this object.
static event_registration m
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects,...
void give_initial_items(object *pl, treasurelist *items)
Gives a new player her initial items.
struct player * contr
Pointer to the player which control this object.
object * object_find_by_name(const object *who, const char *name)
Finds an object in inventory name.
void esrv_remove_spell(player *pl, object *spell)
void apply_handle_yield(object *tmp)
This checks whether the object has a "on_use_yield" field, and if so generated and drops matching ite...
#define FLAG_READY_SKILL
(Monster or Player) has a skill readied
object * chosen_skill
The skill chosen to use.
uint8_t subtype
Subtype of object.
void drop(object *op, object *tmp)
Drop an item, either on the floor or in a container.
#define AP_PRINT
Print what to do, don't actually do it Note this is supported in all the functions.
uint8_t anim_speed
Ticks between animation-frames.
#define FLAG_UNPAID
Object hasn't been paid for yet.
void blind_living(object *op, object *hitter, int dam)
Blind a living thing.
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
Searches for any objects with a matching type & name variable in the inventory of the given object.
#define MSG_TYPE_APPLY_SUCCESS
Was able to apply object.
void query_name(const object *op, char *buf, size_t size)
Describes an item.
#define FREE_OBJ_NO_DESTROY_CALLBACK
Do not run the destroy callback.
@ BUILDER
Generic item builder, see subtypes below.
object * ranges[range_size]
Object for each range.
object clone
An object from which to do object_copy()
#define AC_PLAYER_STAT_NO_CHANGE
Do not make any stat adjustments.
void apply_by_living_below(object *pl)
Attempt to apply the object 'below' the player.
int32_t weight_limit
Weight-limit of object.
void apply_anim_suffix(object *who, const char *suffix)
Applies a compound animation to an object.
#define FLAG_MONSTER
Will attack players.
#define FOR_OB_AND_BELOW_FINISH()
Finishes FOR_OB_AND_BELOW_PREPARE().
#define HEAD(op)
Returns the head part of an object.
object * below
Pointer to the object stacked below this one.
MoveType move_type
Type of movement this object uses.
void set_attr_value(living *stats, int attr, int8_t value)
Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW).
const Face * face
Face with colors.
static int apply_check_item_power(const object *who, const object *op, int aflags)
Checks for item power restrictions when applying an item.
int32_t last_eat
How long since we last ate.
void object_update_speed(object *op)
Updates the speed of an object.
uint8_t type
PLAYER, BULLET, etc.
int apply_manual(object *op, object *tmp, int aflag)
Main apply handler.
with a maximum of six This is not so if you are wearing plate you receive no benefit Armour is additive with all the supplementry forms of which means that it lasts until the next semi permanent spell effect is cast upon the character spell
void object_free(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects,...
void do_forget_spell(object *op, const char *spell)
Erases spell from player's inventory.
float item_power_factor
See note in setings file.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
int16_t item_power
Total item power of objects equipped.
MoveType move_on
Move types affected moving on to this space.
#define FLAG_IS_A_TEMPLATE
Object has no ingame life until instantiated.
rangetype shoottype
Which range-attack is being used by player.
#define MSG_TYPE_VICTIM_WAS_HIT
Player was hit by something.
#define FLAG_IS_FLOOR
Can't see what's underneath this object.
#define FOR_OB_AND_BELOW_PREPARE(op_)
Constructs a loop iterating over an object and all objects below it in the same pile.
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
sstring race
Human, goblin, dragon, etc.
int8_t facing
Object is oriented/facing that way.
const Animations * animation
Animation of this item, NULL if not animated.
#define INS_NO_WALK_ON
Don't call check_walk_on against the originator.
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
object * find_skill_by_name(object *who, const char *name)
This returns the skill pointer of the given name (the one that accumulates exp, has the level,...
#define MAP_WIDTH(m)
Map width.
int should_director_abort(const object *op, const object *victim)
Check if op should abort moving victim because of it's race or slaying.
#define FLAG_USE_WEAPON
(Monster) can wield weapons
#define MAX_BUF
Used for all kinds of things.
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
living orig_stats
Permanent real stats of player.
object * current_weapon
Pointer to the weapon currently used.
int32_t weight
Attributes of the object.
void monster_check_apply_all(object *monster)
Calls monster_check_apply() for all inventory objects.
int apply_check_weapon_power(const object *who, int improves)
This checks to see of the player (who) is sufficient level to use a weapon with improves improvements...
unapplymode unapply
Method for auto unapply.
Animations * try_find_animation(const char *name)
int apply_auto(object *op)
Map was just loaded, handle op's initialization.
#define FLAG_DAMNED
The object is very cursed.
uint8_t spell_failure_effects
Nasty backlash to spell failures.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
int change_abil(object *op, object *tmp)
Permanently alters an object's stats/flags based on another object.
#define MSG_TYPE_APPLY_BADBODY
Don't have body to use object.
#define NDI_UNIQUE
Print immediately, don't buffer.
sstring slaying
Which race to do double damage to.
#define FLAG_READY_WEAPON
(Monster or Player) has a weapon readied
sstring name
The name of the object, obviously...
@ unapply_nochoice
Will unapply objects when there no choice to unapply.
int apply_can_apply_object(const object *who, const object *op)
Checks to see if 'who' can apply object 'op'.
void change_attr_value(living *stats, int attr, int8_t value)
Like set_attr_value(), but instead the value (which can be negative) is added to the specified stat.
object * env
Pointer to the object which is the environment.
object * check_spell_known(object *op, const char *name)
Checks to see if player knows the spell.
#define FLAG_AUTO_APPLY
Will be applied when created.
#define AP_NOPRINT
Don't print messages - caller will do that may be some that still print.
const typedef char * sstring
This represents one animation.
uint8_t personalized_blessings
If 1, blessed weapons get an owner and a willpower value.
sstring skill
Name of the skill this object uses/grants.
void animate_object(object *op, int dir)
Updates the face-variable of an object.
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
object_split(ob,nr) splits up ob into two parts.
#define FLAG_APPLIED
Object is ready for use by living.
void esrv_update_item(int flags, object *pl, object *op)
Updates object *op for player *pl.
@ SKILL_TOOL
Allows the use of a skill.
sstring object_get_value(const object *op, const char *const key)
Get an extra value by key.
#define AP_NO_MERGE
Don't try to merge object after (un)applying it.
static object * get_item_from_body_location(object *start, int loc)
Returns the object that is using body location 'loc'.
#define CLEAR_FLAG(xyz, p)
method_ret ob_apply(object *op, object *applier, int aflags)
Apply an object by running an event hook or an object method.
#define FLAG_STARTEQUIP
Object was given to player at start.
#define MAP_HEIGHT(m)
Map height.
int cast_wonder(object *op, object *caster, int dir, object *spell_ob)
wonder is really just a spell that will likely cast another spell.
#define CAN_APPLY_UNAPPLY
#define MSG_TYPE_APPLY_FAILURE
Apply OK, but no/bad result.
void apply_auto_fix(mapstruct *m)
Go through the entire map (only the first time when an original map is loaded) and performs special a...
int8_t body_info[NUM_BODY_LOCATIONS]
Body info as loaded from the file.
struct treasurelist * randomitems
Items to be generated.
object * container
Current container being used.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to.
int transport_can_hold(const object *transport, const object *op, int nrof)
Can transport hold object op? This is a pretty trivial function, but in the future,...
#define FLAG_USE_SHIELD
Can this creature use a shield?
sstring name
More definite name, like "generate_kobold".
uint32_t nrof
Number of objects.
#define FLAG_WAS_WIZ
Player was once a wiz.
int8_t body_used[NUM_BODY_LOCATIONS]
Calculated value based on items equipped.
#define MSG_TYPE_APPLY_PROHIBITION
Class/god prohibiiton on obj.
living stats
Str, Con, Dex, etc.
@ unapply_never
Will not unapply objects automatically.
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
#define FLAG_USE_RING
(Monster) can use rings, boots, gauntlets, etc
static void apply_update_ranged_skill(const object *who, object *op, int aflags)
Updates ranged skill information.
void player_unready_range_ob(player *pl, object *ob)
Unready an object for a player.
#define MSG_TYPE_APPLY
Applying objects.
#define MSG_TYPE_APPLY_ERROR
@ NUM_STATS
Number of statistics.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
This calls the appropriate treasure creation function.
#define AC_PLAYER_STAT_LIMIT
Limit stats to racial maximum.
#define CAN_APPLY_UNAPPLY_CHOICE
#define METHOD_SILENT_ERROR
Player was warned she can't use the item for now.
sstring name
Name of the animation sequence.
#define INS_BELOW_ORIGINATOR
Insert new object immediately below originator.
object * identify(object *op)
Identifies an item.
#define MSG_TYPE_APPLY_UNAPPLY
Unapply an object.