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)
699 if (
pl->contr->transport &&
pl->contr->transport->type ==
TRANSPORT) {
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!");
1435 while (
op->stats.hp-- > 0)
1479 while (invtmp->stats.hp-- > 0)
1481 invtmp->randomitems = NULL;
1482 }
else if (invtmp && invtmp->arch
1484 && invtmp->type !=
SPELL
1485 && invtmp->type !=
CLASS
1491 invtmp->randomitems = NULL;
1514 tmp->randomitems = NULL;
1543 while (
tmp->stats.hp-- > 0)
1545 tmp->randomitems = NULL;
1571 tmp->randomitems = NULL;
1602 if (abs(failure/4) > power)
1603 power = abs(failure/4);
1605 if (failure <= -1 && failure > -15) {
1609 "Your spell warps!");
1612 if (
op->stats.sp < 0)
1620 if (failure <= -35 && failure > -60) {
1622 "The magic recoils on you!");
1627 if (failure <= -60 && failure > -70) {
1629 "The magic recoils and paralyzes you!");
1634 if (failure <= -70 && failure > -80) {
1636 "The magic recoils on you!");
1641 if (failure <= -80) {
1647 "You unleash uncontrolled mana!");
1655 "Your mana is drained!");
1657 if (
op->stats.sp < 0)
1674 int excess_stat = 0;
1692 if (stat > 20+race_bonus) {
1694 stat = 20+race_bonus;
1695 }
else if (stat < 1) {
1703 excess_stat += stat;
1713 if (excess_stat < 0) excess_stat = 0;
1719 for (j = 0; excess_stat > 0 && j < 100; j++) {
1729 if (stat < 20+race_bonus) {
1759 pl->anim_speed = -1;
1769 if ((!has_noclassfacechange) &&
anim == 0) {
1815 "You don't have the body to use a %s",
1827 "You have a prohibition against using a %s",
1842 "You need to unapply some item(s):");
1871 if (
op->item_power == 0
1877 "Equipping that combined with other items would consume your soul!");
1902 int damage_percentile;
1909 if (owner == NULL || strcmp(owner,
who->name) == 0)
1913 item_will = will != NULL ? atol(will) : 0;
1914 if (item_will >
who->stats.exp) {
1916 "This %s refuses to serve you - it keeps evading your hand !",
1921 margin = item_will != 0 ?
who->stats.exp/item_will :
who->stats.exp;
1923 if (random_effect > 80) {
1924 msg =
"You don't know why, but you have the feeling that the %s is angry at you !";
1925 damage_percentile = 60;
1926 }
else if (random_effect > 60) {
1927 msg =
"The %s seems to look at you nastily !";
1928 damage_percentile = 45;
1929 }
else if (random_effect > 40) {
1930 msg =
"You have the strange feeling that the %s is annoyed...";
1931 damage_percentile = 30;
1932 }
else if (random_effect > 20) {
1933 msg =
"The %s seems tired, or bored, in a way. Very strange !";
1934 damage_percentile = 15;
1935 }
else if (random_effect > 0) {
1936 msg =
"You hear the %s sighing !";
1937 damage_percentile = 0;
1940 damage_percentile = 0;
1945 if (damage_percentile > 0) {
1946 int weapon_bite = (
who->stats.hp*damage_percentile)/100;
1947 if (weapon_bite < 1)
1949 who->stats.hp -= weapon_bite;
1951 "You get a nasty bite in the hand !");
1972 const char *quotepos;
1977 quotepos = strstr(
op->name,
"'");
1978 if (quotepos == NULL || strncmp(
op->name,
who->name, quotepos-
op->name) == 0)
1983 "The weapon does not recognize you as its owner.");
2004 if (
op->invisible) {
2007 "Readied skill: %s.",
2008 op->skill ?
op->skill :
op->name);
2018 "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)
static int unapply_special(object *who, object *op, int aflags)
#define FREE_OBJ_NO_DESTROY_CALLBACK
object * object_find_by_type_applied(const object *who, int type)
#define NUM_BODY_LOCATIONS
void LOG(LogLevel logLevel, const char *format,...)
#define QUERY_FLAG(xyz, p)
int apply_special(object *who, object *op, int aflags)
void confuse_living(object *op, object *hitter, int dam)
void clear_skill(object *who)
static int apply_check_apply_restrictions(object *who, object *op, int aflags)
object * object_merge(object *op, object *top)
void esrv_send_inventory(object *pl, object *op)
static int apply_check_owner(const object *who, const object *op, int aflags)
static int apply_check_race_restrictions(object *who, object *item)
static int set_object_face_other(object *op)
#define CAN_APPLY_RESTRICTION
#define MSG_TYPE_APPLY_CURSED
int apply_by_living(object *pl, object *op, int aflag, int quiet)
void apply_changes_to_player(object *pl, object *change, int limit_stats)
static int unapply_for_ob(object *who, object *op, int aflags)
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
uint8_t spell_failure_effects
void play_sound_player_only(player *pl, int8_t sound_type, object *emitter, int dir, const char *action)
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)
void object_copy(const object *src_ob, object *dest_ob)
void fix_object(object *op)
void scroll_failure(object *op, int failure, int power)
void esrv_add_spells(player *pl, object *spell)
const char * object_get_value(const object *op, const char *const key)
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)
static void auto_apply_fix_inventory(mapstruct *m, object *tmp)
void do_learn_spell(object *op, object *spell, int special_prayer)
object * object_insert_in_ob(object *op, object *where)
Plugin animator file specs[Config] name
void cast_magic_storm(object *op, object *tmp, int lvl)
void esrv_send_item(object *pl, object *op)
#define FLAG_IS_A_TEMPLATE
static event_registration m
void object_free_drop_inventory(object *ob)
void give_initial_items(object *pl, treasurelist *items)
object * object_find_by_name(const object *who, const char *name)
void esrv_remove_spell(player *pl, object *spell)
void apply_handle_yield(object *tmp)
void drop(object *op, object *tmp)
void blind_living(object *op, object *hitter, int dam)
object * object_present_in_ob_by_name(int type, const char *str, const object *op)
#define MSG_TYPE_APPLY_SUCCESS
void query_name(const object *op, char *buf, size_t size)
#define FLAG_KNOWN_CURSED
void apply_by_living_below(object *pl)
void apply_anim_suffix(object *who, const char *suffix)
#define FOR_OB_AND_BELOW_FINISH()
void set_attr_value(living *stats, int attr, int8_t value)
static int apply_check_item_power(const object *who, const object *op, int aflags)
void object_update_speed(object *op)
int apply_manual(object *op, object *tmp, int aflag)
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)
void do_forget_spell(object *op, const char *spell)
#define INS_BELOW_ORIGINATOR
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 * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
struct archetype * other_arch
object * find_skill_by_name(object *who, const char *name)
int should_director_abort(const object *op, const object *victim)
object * object_new(void)
uint8_t personalized_blessings
int apply_container(object *op, object *sack, int aflags)
object * create_archetype(const char *name)
void monster_check_apply_all(object *monster)
int apply_check_weapon_power(const object *who, int improves)
Animations * try_find_animation(const char *name)
int apply_auto(object *op)
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
#define FLAG_KNOWN_MAGICAL
int change_abil(object *op, object *tmp)
#define MSG_TYPE_APPLY_BADBODY
#define CAN_APPLY_UNAPPLY
int apply_can_apply_object(const object *who, const object *op)
int is_magical(const object *op)
void change_attr_value(living *stats, int attr, int8_t value)
object * check_spell_known(object *op, const char *name)
#define AC_PLAYER_STAT_LIMIT
const typedef char * sstring
void animate_object(object *op, int dir)
object * object_split(object *orig_ob, uint32_t nr, char *err, size_t size)
int set_object_face_main(object *op)
void esrv_update_item(int flags, object *pl, object *op)
#define CAN_APPLY_UNAPPLY_CHOICE
#define FLAG_BEEN_APPLIED
static object * get_item_from_body_location(object *start, int loc)
#define CLEAR_FLAG(xyz, p)
int random_roll(int min, int max, const object *op, int goodbad)
method_ret ob_apply(object *op, object *applier, int aflags)
int cast_wonder(object *op, object *caster, int dir, object *spell_ob)
#define MSG_TYPE_APPLY_FAILURE
void apply_auto_fix(mapstruct *m)
int8_t body_info[NUM_BODY_LOCATIONS]
struct treasurelist * randomitems
void object_remove(object *op)
int transport_can_hold(const object *transport, const object *op, int nrof)
const Face * try_find_face(const char *name, const Face *error)
object * generate_treasure(treasurelist *t, int difficulty)
int rndm(int min, int max)
#define MSG_TYPE_APPLY_PROHIBITION
int object_set_value(object *op, const char *key, const char *value, int add_key)
int8_t get_attr_value(const living *stats, int attr)
static void apply_update_ranged_skill(const object *who, object *op, int aflags)
#define FLAG_READY_WEAPON
void player_unready_range_ob(player *pl, object *ob)
#define MSG_TYPE_APPLY_ERROR
#define FOR_INV_PREPARE(op_, it_)
#define METHOD_SILENT_ERROR
object * identify(object *op)
#define MSG_TYPE_APPLY_UNAPPLY