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
00041 method_ret common_trap_type_move_on(ob_methods *context, object *trap, object *victim, object *originator) {
00042 if (common_pre_ob_move_on(trap, victim, originator) == METHOD_ERROR)
00043 return METHOD_OK;
00044 if (trap->level && QUERY_FLAG(victim, FLAG_ALIVE))
00045 spring_trap(trap, victim);
00046 common_post_ob_move_on(trap, victim, originator);
00047 return METHOD_OK;
00048 }
00049
00066 method_ret common_trap_type_process(ob_methods *context, object *op) {
00067 int det = 0;
00068
00069 if (!op->level) {
00070 return METHOD_OK;
00071 }
00072
00073 det = op->invisible;
00074 if (!(rndm(0, MAX(1, (op->stats.Cha))-1))) {
00075 op->invisible = 0;
00076 op->speed_left -= 1;
00077 } else
00078 op->invisible = 1;
00079 if (op->invisible != det)
00080 update_object(op, UP_OBJ_FACE);
00081 return METHOD_OK;
00082 }