Go to the documentation of this file.
69 int arch_flag, name_flag, race_flag;
86 arch_flag =
op->subtype&1;
87 name_flag =
op->subtype&2;
88 race_flag =
op->subtype&4;
99 && (!(
victim->name && name_flag) || strcmp(
op->race,
victim->name))
100 && (!(
victim->race && race_flag) || strcmp(
op->race,
victim->race)))
107 && ((
victim->arch && arch_flag &&
victim->arch->name && !strcmp(
op->slaying,
victim->arch->name))
108 || (
victim->name && name_flag && !strcmp(
op->slaying,
victim->name))
109 || (
victim->race && race_flag && !strcmp(
op->slaying,
victim->race))))
147 const Face *newface =
op->arch->clone.face;
155 if (newface &&
op->face != newface) {
175 const Face *newface = NULL;
176 object *head =
op->head ?
op->head :
op;
184 if (
op->face !=
op->arch->clone.face) {
192 if (newface &&
op->face != newface) {
224 object *
tmp =
op->container;
230 LOG(
llevError,
"apply_container: '%s' tried to apply %s, which is not a container\n",
op->name, sack ? sack->
name :
"(null)");
241 if ( sack->
env !=
op ) {
243 "Not in your inventory: %s",
250 if (
op->container == sack ) {
251 op->container = NULL;
252 if (
op->contr != NULL)
253 op->contr->socket.container_position = 0;
269 "Already readied %s.",
279 if (
op->container == sack ) {
281 "Already opened %s.",
292 if (
op->container != sack ) {
303 "Already closed %s.",
320 tag_t tmp_tag =
op->container->count;
322 if (
op->container->env !=
op) {
323 object *part =
op->container->head ?
op->container->head :
op->container;
341 op->container = NULL;
342 if (
op->contr != NULL)
343 op->contr->socket.container_position = 0;
368 "You unlock %s with %s.",
369 name_sack, name_tmp);
373 "You don't have the key to unlock %s.",
391 if (sack->
env !=
op) {
404 if (sack->
nrof > 1) {
414 object *part = sack->
head ? sack->
head : sack;
426 op->container = sack;
427 if (
op->contr != NULL)
428 op->contr->socket.container_position = 0;
442 op->container = sack;
443 if (
op->contr != NULL)
444 op->contr->socket.container_position = 0;
488 LOG(
llevError,
"BUG: do_learn_spell(): not a player\n");
496 LOG(
llevError,
"BUG: do_learn_spell(): spell already known, but not marked as startequip\n");
511 "Type 'bind cast %s to store the spell in a key.",
529 LOG(
llevError,
"BUG: do_forget_spell(): not a player\n");
534 LOG(
llevError,
"BUG: do_forget_spell(): spell not known\n");
539 "You lose knowledge of %s.",
568 snprintf(
buf,
sizeof(
buf),
":%s:",
who->race);
569 buf[
sizeof(
buf)-1] =
'\0';
571 if (strstr(restriction,
buf) != NULL)
603 "You should pay for it first.");
644 "But you are floating high above the ground!");
657 "The object disappears in a puff of smoke!");
659 "It must have been an illusion.");
672 "I don't know how to apply the %s.",
676 "You must get it first!\n");
681 if (
op->anim_suffix != NULL)
707 tmp =
pl->container != NULL ?
pl->container->inv :
pl->below;
727 if (!
tmp->invisible || (
tmp->move_on&
pl->move_type)) {
765 who->current_weapon = NULL;
771 if (
op !=
who->chosen_skill)
772 LOG(
llevError,
"BUG: unapply_special(): applied skill is not a chosen skill\n");
776 if (!
op->invisible) {
779 "You stop using the %s.",
784 "You can no longer use the skill: %s.",
789 who->chosen_skill = NULL;
820 else if (
op->type ==
BOW)
887 &&
tmp->body_info[loc]
917 object *
tmp = NULL, *last;
937 "No matter how hard you try, you just can't remove %s.",
955 if (
op->body_info[i]) {
961 while (
who->body_used[i]+
op->body_info[i] < 0) {
985 "The %s just won't come off",
1018 object *
tmp = NULL, *ws = NULL;
1034 if (
op->body_info[i]) {
1036 if (
FABS(
op->body_info[i]) >
who->body_info[i]) {
1041 }
else if (
who->body_used[i]+
op->body_info[i] < 0) {
1057 if (
who->body_used[i]-ws->body_info[i]+
op->body_info[i] >= 0) {
1074 else if (
tmp != tmp1)
1082 &&
FABS(
op->body_info[i]) <
who->body_info[i])
1132 return (
who->level/5)+5 >= improves;
1162 LOG(
llevError,
"apply_special() from object without environment.\n");
1180 "No matter how hard you try, you just can't remove %s.",
1199 "You need the %s skill to use this item!",
1231 "That weapon is too powerful for you to use. It would consume your soul!");
1282 if (
who->chosen_skill) {
1283 LOG(
llevError,
"BUG: apply_special(): can't apply two skills\n");
1290 who->chosen_skill =
op;
1298 "That weapon is too powerful for you to use. It would consume your soul!");
1323 if (
op->type ==
BOW) {
1328 "You will now fire %s with %s.",
1329 op->race ?
op->race :
"nothing",
1336 if (
op->type ==
BOW)
1351 "You ready your %s.",
1381 "Oops, it feels deadly cold!");
1431 while (
op->stats.hp-- > 0)
1475 while (invtmp->stats.hp-- > 0)
1477 invtmp->randomitems = NULL;
1478 }
else if (invtmp && invtmp->arch
1480 && invtmp->type !=
SPELL
1481 && invtmp->type !=
CLASS
1487 invtmp->randomitems = NULL;
1510 tmp->randomitems = NULL;
1539 while (
tmp->stats.hp-- > 0)
1541 tmp->randomitems = NULL;
1567 tmp->randomitems = NULL;
1598 if (abs(failure/4) > power)
1599 power = abs(failure/4);
1601 if (failure <= -1 && failure > -15) {
1605 "Your spell warps!");
1608 if (
op->stats.sp < 0)
1616 if (failure <= -35 && failure > -60) {
1618 "The magic recoils on you!");
1623 if (failure <= -60 && failure > -70) {
1625 "The magic recoils and paralyzes you!");
1630 if (failure <= -70 && failure > -80) {
1632 "The magic recoils on you!");
1637 if (failure <= -80) {
1643 "You unleash uncontrolled mana!");
1651 "Your mana is drained!");
1653 if (
op->stats.sp < 0)
1670 int excess_stat = 0;
1688 if (stat > 20+race_bonus) {
1690 stat = 20+race_bonus;
1691 }
else if (stat < 1) {
1699 excess_stat += stat;
1709 if (excess_stat < 0) excess_stat = 0;
1715 for (j = 0; excess_stat > 0 && j < 100; j++) {
1725 if (stat < 20+race_bonus) {
1755 pl->anim_speed = -1;
1765 if ((!has_noclassfacechange) &&
anim == 0) {
1811 "You don't have the body to use a %s",
1823 "You have a prohibition against using a %s",
1838 "You need to unapply some item(s):");
1867 if (
op->item_power == 0
1873 "Equipping that combined with other items would consume your soul!");
1898 int damage_percentile;
1905 if (owner == NULL || strcmp(owner,
who->name) == 0)
1909 item_will = will != NULL ? atol(will) : 0;
1910 if (item_will >
who->stats.exp) {
1912 "This %s refuses to serve you - it keeps evading your hand !",
1917 margin = item_will != 0 ?
who->stats.exp/item_will :
who->stats.exp;
1919 if (random_effect > 80) {
1920 msg =
"You don't know why, but you have the feeling that the %s is angry at you !";
1921 damage_percentile = 60;
1922 }
else if (random_effect > 60) {
1923 msg =
"The %s seems to look at you nastily !";
1924 damage_percentile = 45;
1925 }
else if (random_effect > 40) {
1926 msg =
"You have the strange feeling that the %s is annoyed...";
1927 damage_percentile = 30;
1928 }
else if (random_effect > 20) {
1929 msg =
"The %s seems tired, or bored, in a way. Very strange !";
1930 damage_percentile = 15;
1931 }
else if (random_effect > 0) {
1932 msg =
"You hear the %s sighing !";
1933 damage_percentile = 0;
1936 damage_percentile = 0;
1941 if (damage_percentile > 0) {
1942 int weapon_bite = (
who->stats.hp*damage_percentile)/100;
1943 if (weapon_bite < 1)
1945 who->stats.hp -= weapon_bite;
1947 "You get a nasty bite in the hand !");
1968 const char *quotepos;
1973 quotepos = strstr(
op->name,
"'");
1974 if (quotepos == NULL || strncmp(
op->name,
who->name, quotepos-
op->name) == 0)
1979 "The weapon does not recognize you as its owner.");
2000 if (
op->invisible) {
2003 "Readied skill: %s.",
2004 op->skill ?
op->skill :
op->name);
2014 "You can now use the skill: %s.",
#define object_was_destroyed(op, old_tag)
void paralyze_living(object *op, int dam)
#define HAS_RANDOM_ITEMS(op)
#define FREE_OBJ_NO_DESTROY_CALLBACK
void object_free(object *ob, int flags)
static int apply_check_item_power(const object *who, const object *op, int aflags)
void object_remove(object *op)
#define NUM_BODY_LOCATIONS
void do_forget_spell(object *op, const char *spell)
int apply_container(object *op, object *sack, int aflags)
int apply_auto(object *op)
#define QUERY_FLAG(xyz, p)
int apply_check_weapon_power(const object *who, int improves)
void confuse_living(object *op, object *hitter, int dam)
void clear_skill(object *who)
object * object_new(void)
void esrv_send_inventory(object *pl, object *op)
static void apply_update_ranged_skill(const object *who, object *op, int aflags)
#define CAN_APPLY_RESTRICTION
#define MSG_TYPE_APPLY_CURSED
void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action)
object * object_find_by_type_applied(const object *who, int type)
void play_sound_map(int8_t sound_type, object *emitter, int dir, const char *action)
int change_skill(object *who, object *new_skill, int flag)
int should_director_abort(const object *op, const object *victim)
int8_t body_info[NUM_BODY_LOCATIONS]
void esrv_add_spells(player *pl, object *spell)
void create_treasure(treasurelist *t, object *op, int flag, int difficulty, int tries)
int events_execute_object_event(object *op, int eventcode, object *activator, object *third, const char *message, int fix)
static int apply_check_personalized_blessings(object *who, const object *op)
struct treasureliststruct * randomitems
method_ret ob_apply(object *op, object *applier, int aflags)
void cast_magic_storm(object *op, object *tmp, int lvl)
void animate_object(object *op, int dir)
void esrv_send_item(object *pl, object *op)
object * object_merge(object *op, object *top)
static void auto_apply_fix_inventory(mapstruct *m, object *tmp)
const char * object_get_value(const object *op, const char *const key)
#define FLAG_IS_A_TEMPLATE
object * identify(object *op)
static event_registration m
void give_initial_items(object *pl, treasurelist *items)
void esrv_remove_spell(player *pl, object *spell)
void drop(object *op, object *tmp)
void object_copy(const object *src_ob, object *dest_ob)
void blind_living(object *op, object *hitter, int dam)
#define MSG_TYPE_APPLY_SUCCESS
void scroll_failure(object *op, int failure, int power)
void query_name(const object *op, char *buf, size_t size)
int set_object_face_main(object *op)
#define FLAG_KNOWN_CURSED
void apply_handle_yield(object *tmp)
#define FOR_OB_AND_BELOW_FINISH()
void apply_changes_to_player(object *pl, object *change, int limit_stats)
void fix_object(object *op)
static object * get_item_from_body_location(object *start, int loc)
struct archt * other_arch
int apply_special(object *who, object *op, int aflags)
static int apply_check_apply_restrictions(object *who, object *op, int aflags)
#define INS_BELOW_ORIGINATOR
int object_set_value(object *op, const char *key, const char *value, int add_key)
const typedef char * sstring
int rndm(int min, int max)
object * find_key(object *pl, object *container, object *door)
#define AC_PLAYER_STAT_NO_CHANGE
#define MSG_TYPE_VICTIM_WAS_HIT
#define FOR_OB_AND_BELOW_PREPARE(op_)
#define CAN_APPLY_UNAPPLY_MULT
object * find_skill_by_name(object *who, const char *name)
object * create_archetype(const char *name)
void monster_check_apply_all(object *monster)
Animations * try_find_animation(const char *name)
int random_roll(int min, int max, const object *op, int goodbad)
uint8_t spell_failure_effects
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
#define MSG_TYPE_APPLY_BADBODY
int transport_can_hold(const object *transport, const object *op, int nrof)
#define CAN_APPLY_UNAPPLY
int apply_by_living(object *pl, object *op, int aflag, int quiet)
static int unapply_for_ob(object *who, object *op, int aflags)
void apply_anim_suffix(object *who, const char *suffix)
int apply_manual(object *op, object *tmp, int aflag)
void LOG(LogLevel logLevel, const char *format,...)
object * check_spell_known(object *op, const char *name)
#define AC_PLAYER_STAT_LIMIT
void apply_by_living_below(object *pl)
uint8_t personalized_blessings
void esrv_update_item(int flags, object *pl, object *op)
#define CAN_APPLY_UNAPPLY_CHOICE
#define FLAG_BEEN_APPLIED
#define CLEAR_FLAG(xyz, p)
void set_attr_value(living *stats, int attr, int8_t value)
object * object_insert_in_ob(object *op, object *where)
int cast_wonder(object *op, object *caster, int dir, object *spell_ob)
void object_update_speed(object *op)
#define MSG_TYPE_APPLY_FAILURE
static int unapply_special(object *who, object *op, int aflags)
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
int8_t get_attr_value(const living *stats, int attr)
void object_free_drop_inventory(object *ob)
void apply_auto_fix(mapstruct *m)
int apply_can_apply_object(const object *who, const object *op)
const Face * try_find_face(const char *name, const Face *error)
static int set_object_face_other(object *op)
object * generate_treasure(treasurelist *t, int difficulty)
object * object_find_by_name(const object *who, const char *name)
#define MSG_TYPE_APPLY_PROHIBITION
static int apply_check_owner(const object *who, const object *op, int aflags)
static int apply_check_race_restrictions(object *who, object *item)
int change_abil(object *op, object *tmp)
#define FLAG_READY_WEAPON
void player_unready_range_ob(player *pl, object *ob)
#define MSG_TYPE_APPLY_ERROR
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
void change_attr_value(living *stats, int attr, int8_t value)
#define FOR_INV_PREPARE(op_, it_)
#define METHOD_SILENT_ERROR
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...)
void do_learn_spell(object *op, object *spell, int special_prayer)
#define MSG_TYPE_APPLY_UNAPPLY