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 altar_type_move_on(ob_methods *context, object *trap, object *victim, object *originator);
00034
00038 void init_type_altar(void) {
00039 register_move_on(ALTAR, altar_type_move_on);
00040 }
00041
00050 static method_ret altar_type_move_on(ob_methods *context, object *trap, object *victim, object *originator) {
00051 if (trap->head)
00052 trap = trap->head;
00053
00054 if (common_pre_ob_move_on(trap, victim, originator) == METHOD_ERROR)
00055 return METHOD_OK;
00056
00057
00058
00059 if (trap->inv && (!originator || originator->type != PLAYER)) {
00060 common_post_ob_move_on(trap, victim, originator);
00061 return METHOD_OK;
00062 }
00063 if (operate_altar(trap, &victim)) {
00064
00065
00066
00067
00068 if (trap->inv && trap->inv->type == SPELL) {
00069 draw_ext_info_format(NDI_BLACK, 0, originator, MSG_TYPE_APPLY, MSG_TYPE_APPLY_SUCCESS,
00070 "The altar casts %s.", "The altar casts %s.", trap->inv->name);
00071 cast_spell(originator, trap, 0, trap->inv, NULL);
00072 } else {
00073 trap->value = 1;
00074 push_button(trap);
00075 }
00076 }
00077 common_post_ob_move_on(trap, victim, originator);
00078 return METHOD_OK;
00079 }