00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00027 #include <global.h>
00028 #include <ob_methods.h>
00029 #include <ob_types.h>
00030 #include <sounds.h>
00031 #include <sproto.h>
00032
00033 static method_ret poison_type_apply(ob_methods *context, object *op, object *applier, int aflags);
00034
00038 void init_type_poison(void) {
00039 register_apply(POISON, poison_type_apply);
00040 }
00041
00050 static method_ret poison_type_apply(ob_methods *context, object *op, object *applier, int aflags) {
00051
00052 if (applier->type == PLAYER) {
00053 play_sound_player_only(applier->contr, SOUND_TYPE_ITEM, op, 0, "poison");
00054 draw_ext_info(NDI_UNIQUE, 0, applier, MSG_TYPE_APPLY, MSG_TYPE_APPLY_CURSED,
00055 "Yech! That tasted poisonous!", NULL);
00056 snprintf(applier->contr->killer, BIG_NAME, "poisonous %s", op->name);
00057 }
00058
00059 if (op->stats.hp > 0) {
00060 LOG(llevDebug, "Trying to poison player/monster for %d hp\n", op->stats.hp);
00061 hit_player(applier, op->stats.hp, op, AT_POISON, 1);
00062 }
00063
00064 applier->stats.food -= applier->stats.food/4;
00065 handle_apply_yield(op);
00066 decrease_ob(op);
00067 return METHOD_OK;
00068 }