version 1.57 | | version 1.58 |
---|
| | |
/* | | /* |
* static char *rcsid_time_c = | | * static char *rcsid_time_c = |
* "$Id: time.c,v 1.57 2003/09/04 06:25:32 temitchell Exp $"; | | * "$Id: time.c,v 1.58 2003/09/13 05:02:13 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
*/ | | */ |
void generate_monster_inv(object *gen) { | | void generate_monster_inv(object *gen) { |
int i; | | int i; |
object *op,*head=NULL,*prev=NULL; | | object *op,*head=NULL; |
archetype *at=gen->other_arch; | | |
int qty=0; | | int qty=0; |
/* Code below assumes the generator is on a map, as it tries | | /* Code below assumes the generator is on a map, as it tries |
* to place the monster on the map. So if the generator | | * to place the monster on the map. So if the generator |
| | |
| | |
} | | } |
| | |
void regenerate_rod(object *rod) { | | |
if(++rod->stats.food > rod->stats.hp/10 || rod->type == HORN) { | | |
rod->stats.food = 0; | | |
if (rod->stats.hp < rod->stats.maxhp) { | | |
rod->stats.hp += 1 + rod->stats.maxhp/10; | | |
if (rod->stats.hp > rod->stats.maxhp) | | |
rod->stats.hp = rod->stats.maxhp; | | |
fix_rod_speed(rod); | | |
} | | |
} | | |
} | | |
| | |
void remove_force(object *op) { | | void remove_force(object *op) { |
if(op->env==NULL) { | | if (--op->duration > 0) return; |
remove_ob(op); | | |
free_object(op); | | switch (op->subtype) { |
return; | | case FORCE_CONFUSION: |
| | if(op->env!=NULL) { |
| | CLEAR_FLAG(op->env, FLAG_CONFUSED); |
| | new_draw_info(NDI_UNIQUE, 0,op->env, "You regain your senses.\n"); |
} | | } |
| | |
| | default: |
| | if(op->env!=NULL) { |
CLEAR_FLAG(op, FLAG_APPLIED); | | CLEAR_FLAG(op, FLAG_APPLIED); |
change_abil(op->env,op); | | change_abil(op->env,op); |
fix_player(op->env); | | fix_player(op->env); |
| | } |
| | } |
remove_ob(op); | | remove_ob(op); |
free_object(op); | | free_object(op); |
} | | } |
| | |
free_object(op); | | free_object(op); |
} | | } |
| | |
void remove_confusion(object *op) { | | |
if(--op->stats.food > 0) | | |
return; | | |
if(op->env!=NULL) { | | |
CLEAR_FLAG(op->env, FLAG_CONFUSED); | | |
new_draw_info(NDI_UNIQUE, 0,op->env, "You regain your senses.\n"); | | |
} | | |
remove_ob(op); | | |
free_object(op); | | |
} | | |
| | |
void execute_wor(object *op) { | | |
object *wor=op; | | |
while(op!=NULL&&op->type!=PLAYER) | | |
op=op->env; | | |
| | |
if(op!=NULL) { | | |
if (get_map_flags(op->map, NULL, op->x, op->y, NULL, NULL) & P_NO_CLERIC) | | |
new_draw_info(NDI_UNIQUE, 0,op,"You feel something fizzle inside you."); | | |
else | | |
enter_exit(op,wor); | | |
} | | |
remove_ob(wor); | | |
free_object(wor); | | |
} | | |
| | |
void poison_more(object *op) { | | void poison_more(object *op) { |
if(op->env==NULL||!QUERY_FLAG(op->env,FLAG_ALIVE)||op->env->stats.hp<0) { | | if(op->env==NULL||!QUERY_FLAG(op->env,FLAG_ALIVE)||op->env->stats.hp<0) { |
remove_ob(op); | | remove_ob(op); |
| | |
op = fix_stopped_arrow (op); | | op = fix_stopped_arrow (op); |
return op; | | return op; |
| | |
case CONE: | | |
if (op->speed < MIN_ACTIVE_SPEED) { | | |
return op; | | |
} else { | | |
return NULL; | | |
} | | |
| | |
default: | | default: |
return op; | | return op; |
} | | } |
| | |
op->stats.dam= op->stats.hp; | | op->stats.dam= op->stats.hp; |
op->attacktype = op->stats.grace; | | op->attacktype = op->stats.grace; |
if (op->slaying != NULL) | | if (op->slaying != NULL) |
free_string (op->slaying); | | FREE_AND_CLEAR_STR(op->slaying); |
| | |
| | if (op->skill != NULL) |
| | FREE_AND_CLEAR_STR(op->skill); |
| | |
if (op->spellarg != NULL) { | | if (op->spellarg != NULL) { |
op->slaying = add_string(op->spellarg); | | op->slaying = add_string(op->spellarg); |
free(op->spellarg); | | free(op->spellarg); |
| | op->spellarg = NULL; |
} else | | } else |
op->slaying = NULL; | | op->slaying = NULL; |
| | |
/* Reset these to zero, so that CAN_MERGE will work properly */ | | /* Reset these to zero, so that CAN_MERGE will work properly */ |
op->spellarg = NULL; | | op->spellarg = NULL; |
op->stats.sp = 0; | | op->stats.sp = 0; |
| | |
player=op->above; | | player=op->above; |
for(walk=op->inv;walk!=NULL;walk=walk->below) | | for(walk=op->inv;walk!=NULL;walk=walk->below) |
apply_changes_to_player(player,walk); | | apply_changes_to_player(player,walk); |
link_player_skills(op->above); | | |
esrv_send_inventory(op->above,op->above); | | esrv_send_inventory(op->above,op->above); |
esrv_update_item(UPD_FACE, op->above, op->above); | | esrv_update_item(UPD_FACE, op->above, op->above); |
| | |
| | |
} | | } |
} | | } |
| | |
/* peterm: firewalls generalized to be able to shoot any type | | /* firewalls fire other spells. |
of spell at all. the stats.dam field of a firewall object | | * The direction of the wall is stored in op->stats.sp. |
contains it's spelltype. The direction of the wall is stored | | * walls can have hp, so they can be torn down. |
in op->stats.sp. maxsp also has some meaning, i'm not sure what. | | */ |
walls can have hp, so they can be torn down. */ | | |
void move_firewall(object *op) { | | void move_firewall(object *op) { |
| | object *spell; |
| | |
if ( ! op->map) | | if ( ! op->map) |
return; /* dm has created a firewall in his inventory */ | | return; /* dm has created a firewall in his inventory */ |
cast_spell(op,op,op->stats.sp?op->stats.sp:rndm(1, 8),op->stats.dam, | | |
1,spellNormal,NULL); | | spell = op->inv; |
| | if (!spell || spell->type != SPELL) spell=&op->other_arch->clone; |
| | if (!spell) { |
| | LOG(llevError,"move_firewall: no spell specified (%s, %s, %d, %d)\n", |
| | op->name, op->map->name, op->x, op->y); |
| | return; |
} | | } |
| | |
void move_firechest(object *op) { | | cast_spell(op,op,op->stats.sp?op->stats.sp:rndm(1, 8),spell, NULL); |
if ( ! op->map) | | |
return; /* dm has created a firechest in his inventory */ | | |
fire_a_ball(op,rndm(1, 8),7); | | |
} | | } |
| | |
| | |
| | |
} | | } |
| | |
int process_object(object *op) { | | int process_object(object *op) { |
| | |
event *evt; | | event *evt; |
| | |
if(QUERY_FLAG(op, FLAG_MONSTER)) | | if(QUERY_FLAG(op, FLAG_MONSTER)) |
| | |
animate_object(op, op->facing); | | animate_object(op, op->facing); |
else | | else |
animate_object(op, op->direction); | | animate_object(op, op->direction); |
| | |
if (QUERY_FLAG(op, FLAG_SEE_ANYWHERE)) | | if (QUERY_FLAG(op, FLAG_SEE_ANYWHERE)) |
make_sure_seen(op); | | make_sure_seen(op); |
} | | } |
| | |
} | | } |
if(QUERY_FLAG(op, FLAG_GENERATOR)) | | if(QUERY_FLAG(op, FLAG_GENERATOR)) |
generate_monster(op); | | generate_monster(op); |
| | |
if(QUERY_FLAG(op, FLAG_IS_USED_UP)&&--op->stats.food<=0) { | | if(QUERY_FLAG(op, FLAG_IS_USED_UP)&&--op->stats.food<=0) { |
if(QUERY_FLAG(op, FLAG_APPLIED)) | | if(QUERY_FLAG(op, FLAG_APPLIED)) |
remove_force(op); | | remove_force(op); |
| | |
((PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP)); | | ((PlugList[findPlugin(evt->plugin)].eventfunc) (&CFP)); |
} | | } |
switch(op->type) { | | switch(op->type) { |
| | case SPELL_EFFECT: |
| | move_spell_effect(op); |
| | return 1; |
| | |
case ROD: | | case ROD: |
case HORN: | | case HORN: |
regenerate_rod(op); | | regenerate_rod(op); |
return 1; | | return 1; |
| | |
case FORCE: | | case FORCE: |
case POTION_EFFECT: | | case POTION_EFFECT: |
remove_force(op); | | remove_force(op); |
return 1; | | return 1; |
| | |
case BLINDNESS: | | case BLINDNESS: |
remove_blindness(op); | | remove_blindness(op); |
return 0; | | return 0; |
case CONFUSION: | | |
remove_confusion(op); | | |
return 0; | | |
case POISONING: | | case POISONING: |
poison_more(op); | | poison_more(op); |
return 0; | | return 0; |
| | |
case DISEASE: | | case DISEASE: |
move_disease(op); | | move_disease(op); |
return 0; | | return 0; |
| | |
case SYMPTOM: | | case SYMPTOM: |
move_symptom(op); | | move_symptom(op); |
return 0; | | return 0; |
case WORD_OF_RECALL: | | |
execute_wor(op); | | |
return 0; | | |
case BULLET: | | |
move_fired_arch(op); | | |
return 0; | | |
case MMISSILE: | | |
move_missile(op); | | |
return 0; | | |
case THROWN_OBJ: | | case THROWN_OBJ: |
case ARROW: | | case ARROW: |
move_arrow(op); | | move_arrow(op); |
return 0; | | return 0; |
case FBULLET: | | |
move_fired_arch(op); | | |
return 0; | | |
case FBALL: | | |
case POISONCLOUD: | | |
explosion(op); | | |
return 0; | | |
case LIGHTNING: /* It now moves twice as fast */ | | case LIGHTNING: /* It now moves twice as fast */ |
move_bolt(op); | | move_bolt(op); |
return 0; | | return 0; |
case CONE: | | |
move_cone(op); | | |
return 0; | | |
case DOOR: | | case DOOR: |
remove_door(op); | | remove_door(op); |
return 0; | | return 0; |
| | |
case LOCKED_DOOR: | | case LOCKED_DOOR: |
remove_door2(op); | | remove_door2(op); |
return 0; | | return 0; |
| | |
case TELEPORTER: | | case TELEPORTER: |
move_teleporter(op); | | move_teleporter(op); |
return 0; | | return 0; |
case BOMB: | | |
animate_bomb(op); | | |
return 0; | | |
case GOLEM: | | case GOLEM: |
move_golem(op); | | move_golem(op); |
return 0; | | return 0; |
| | |
case EARTHWALL: | | case EARTHWALL: |
hit_player(op, 2, op, AT_PHYSICAL); | | hit_player(op, 2, op, AT_PHYSICAL); |
return 0; | | return 0; |
| | |
case FIREWALL: | | case FIREWALL: |
move_firewall(op); | | move_firewall(op); |
if (op->stats.maxsp) | | if (op->stats.maxsp) |
animate_turning(op); | | animate_turning(op); |
return 0; | | return 0; |
case FIRECHEST: | | |
move_firechest(op); | | |
return 0; | | |
case MOOD_FLOOR: | | case MOOD_FLOOR: |
do_mood_floor(op, op); | | do_mood_floor(op, op); |
return 0; | | return 0; |
| | |
case GATE: | | case GATE: |
move_gate(op); | | move_gate(op); |
return 0; | | return 0; |
| | |
case TIMED_GATE: | | case TIMED_GATE: |
move_timed_gate(op); | | move_timed_gate(op); |
return 0; | | return 0; |
| | |
case TRIGGER: | | case TRIGGER: |
case TRIGGER_BUTTON: | | case TRIGGER_BUTTON: |
case TRIGGER_PEDESTAL: | | case TRIGGER_PEDESTAL: |
case TRIGGER_ALTAR: | | case TRIGGER_ALTAR: |
animate_trigger(op); | | animate_trigger(op); |
return 0; | | return 0; |
| | |
case DETECTOR: | | case DETECTOR: |
move_detector(op); | | move_detector(op); |
| | |
case DIRECTOR: | | case DIRECTOR: |
if (op->stats.maxsp) | | if (op->stats.maxsp) |
animate_turning(op); | | animate_turning(op); |
return 0; | | return 0; |
| | |
case HOLE: | | case HOLE: |
move_hole(op); | | move_hole(op); |
return 0; | | return 0; |
| | |
case DEEP_SWAMP: | | case DEEP_SWAMP: |
move_deep_swamp(op); | | move_deep_swamp(op); |
return 0; | | return 0; |
case CANCELLATION: | | |
move_cancellation(op); | | |
return 0; | | |
case BALL_LIGHTNING: | | |
move_ball_lightning(op); | | |
return 0; | | |
case SWARM_SPELL: | | |
move_swarm_spell(op); | | |
return 0; | | |
case RUNE: | | case RUNE: |
case TRAP: | | case TRAP: |
move_rune(op); | | move_rune(op); |
return 0; | | return 0; |
| | |
case PLAYERMOVER: | | case PLAYERMOVER: |
move_player_mover(op); | | move_player_mover(op); |
return 0; | | return 0; |
| | |
case CREATOR: | | case CREATOR: |
move_creator(op); | | move_creator(op); |
return 0; | | return 0; |
| | |
case MARKER: | | case MARKER: |
move_marker(op); | | move_marker(op); |
return 0; | | return 0; |
| | |
case PLAYER_CHANGER: | | case PLAYER_CHANGER: |
move_player_changer(op); | | move_player_changer(op); |
return 0; | | return 0; |
case AURA: | | |
move_aura(op); | | |
return 0; | | |
case PEACEMAKER: | | case PEACEMAKER: |
move_peacemaker(op); | | move_peacemaker(op); |
return 0; | | return 0; |