/* Update PCs, NPCs, and objects */ void point_update(void) { struct char_data *i, *next_char; struct obj_data *j, *next_thing, *jj, *next_thing2; /* characters */ for (i = character_list; i; i = next_char) { next_char = i->next; gain_condition(i, FULL, -1); gain_condition(i, DRUNK, -1); gain_condition(i, THIRST, -1); if (GET_POS(i) >= POS_STUNNED) { GET_HIT(i) = MIN(GET_HIT(i) + hit_gain(i), GET_MAX_HIT(i)); GET_MANA(i) = MIN(GET_MANA(i) + mana_gain(i), GET_MAX_MANA(i)); GET_MOVE(i) = MIN(GET_MOVE(i) + move_gain(i), GET_MAX_MOVE(i)); if (AFF_FLAGGED(i, AFF_POISON)) if (damage(i, i, 2, SPELL_POISON) == -1) continue; /* Oops, they died. -gg 6/24/98 */ if (GET_POS(i) <= POS_STUNNED) update_pos(i); } else if (GET_POS(i) == POS_INCAP) { if (damage(i, i, 1, TYPE_SUFFERING) == -1) continue; } else if (GET_POS(i) == POS_MORTALLYW) { if (damage(i, i, 2, TYPE_SUFFERING) == -1) continue; } if (!IS_NPC(i)) { update_char_objects(i); if (GET_LEVEL(i) < idle_max_level) check_idling(i); } } /* objects */ for (j = object_list; j; j = next_thing) { next_thing = j->next; /* Next in object list */ /* If this is a corpse */ if (IS_CORPSE(j)) { /* timer count down */ if (GET_OBJ_TIMER(j) > 0) GET_OBJ_TIMER(j)--; if (!GET_OBJ_TIMER(j)) { if (j->carried_by) act("$p decays in your hands.", FALSE, j->carried_by, j, 0, TO_CHAR); else if ((IN_ROOM(j) != NOWHERE) && (world[IN_ROOM(j)].people)) { act("A quivering horde of maggots consumes $p.", TRUE, world[IN_ROOM(j)].people, j, 0, TO_ROOM); act("A quivering horde of maggots consumes $p.", TRUE, world[IN_ROOM(j)].people, j, 0, TO_CHAR); } for (jj = j->contains; jj; jj = next_thing2) { next_thing2 = jj->next_content; /* Next in inventory */ obj_from_obj(jj); if (j->in_obj) obj_to_obj(jj, j->in_obj); else if (j->carried_by) obj_to_room(jj, IN_ROOM(j->carried_by)); else if (IN_ROOM(j) != NOWHERE) obj_to_room(jj, IN_ROOM(j)); else core_dump(); } extract_obj(j); } } /* If the timer is set, count it down and at 0, try the trigger */ /* note to .rej hand-patchers: make this last in your point-update() */ else if (GET_OBJ_TIMER(j)>0) { GET_OBJ_TIMER(j)--; if (!GET_OBJ_TIMER(j)) timer_otrigger(j); } } }
/* ** Update PCs, NPCs, and objects */ void point_update( void ) { int slot; void update_char_objects(CharData * ch); /* handler.c */ void extract_obj(ObjData * obj); /* handler.c */ void update_char_quests(CharData * ch); /* quest.c */ CharData *i, *next_char; ObjData *j, *next_thing, *jj, *next_thing2, *debugnext; int loopvar; /* characters */ for( i = character_list; i; i = next_char ) { next_char = i->next; // state flags i->tickstate = 0; /* dismount anyone who's gotten separated from their steed */ /* Note that it's superfluous to check for both rider AND mount */ if (i->rider && i->rider->in_room != i->in_room) { i->rider->mount = NULL; i->rider = NULL; } /* Prayer timer */ if (i->player_specials->saved.prayer_time > 0) { if (i->player_specials->saved.prayer_time == 1) { i->player_specials->saved.prayer_time = 0; send_to_char("Your prayers will be heard once again.\r\n", i); } else i->player_specials->saved.prayer_time -= 1; } for(slot = 0; slot<4; slot++) { if (COOLDOWN(i, slot) ) { COOLDOWN(i, slot) -= 1; if (!COOLDOWN(i, slot) ) { switch( GET_CLASS(i) ) { case CLASS_DEATH_KNIGHT: break; case CLASS_SOLAMNIC_KNIGHT: break; case CLASS_MAGIC_USER: break; case CLASS_SHADOW_DANCER: if(slot == SLOT_SLIPPERY_MIND) break; else if(slot == SLOT_NODESHIFT) sendChar(i, "You may once again shift your spectrum.\r\n"); else sendChar(i, "ERROR!\r\n"); break; case CLASS_THIEF: if(slot== SLOT_BLACKJACK) { sendChar(i, "You are able to use blackjack again.\r\n"); break; } else sendChar(i, "ERROR!\r\n"); case CLASS_ASSASSIN: if(slot == SLOT_DETERRENCE) sendChar(i, "You are able to use deterrence again.\r\n"); else sendChar(i, "ERROR!\r\n"); break; case CLASS_CLERIC: if(slot == SLOT_SHADOW_FORM) sendChar(i, "You are ready to enter shadow form again..\r\n"); else sendChar(i, "ERROR!\r\n"); case CLASS_WARRIOR: if(slot == SLOT_REDOUBT) sendChar(i, "You can shield yourself again.\r\n"); else if(slot == SLOT_COMMANDING_SHOUT) sendChar(i, "You can shout commands again.\r\n"); else sendChar(i, "ERROR!\r\n"); break; case CLASS_SHOU_LIN: break; case CLASS_RANGER: break; case CLASS_NECROMANCER: if(slot == SLOT_QUICKEN) sendChar(i, "You may once again rise from the grave.\r\n"); else if(slot == SLOT_METAMORPHOSIS) sendChar(i, "You may once again metamorphisize.\r\n"); else sendChar(i, "ERROR!\r\n"); break; default: sendChar(i, "ERROR!\r\n"); break; } } } } if( IS_AFFECTED(i, AFF_PLAGUE )) infectious(i); if( !IS_NPC(i) ) { update_char_objects(i); if( GET_LEVEL(i) < LVL_GOD ) check_idling(i); update_char_quests(i); } gain_condition(i, HUNGER, IS_AFFECTED(i, AFF_REGENERATE)? -2:-1); gain_condition(i, DRUNK, -1); /* Amara get thirsty in different ways */ if (IS_AMARA(i)) { if (IN_ROOM(i) >= 0 && IN_ROOM(i) <= top_of_world) { switch (SECT(IN_ROOM(i))) { case SECT_WATER_SWIM: case SECT_WATER_NOSWIM: gain_condition(i, THIRST, 1); break; case SECT_UNDERWATER: case SECT_UNDERWATER_RIVER: gain_condition(i, THIRST, 24); break; default: gain_condition(i, THIRST, -2); break; } } else gain_condition(i, THIRST, -2); } else gain_condition(i, THIRST, -1); }/* for */ debugnext = NULL; /* objects */ for( j = object_list; j; j = next_thing ) { next_thing = j->next; /* Next in object list */ debugnext = j; // we didn't crash if we got here if( IS_SET_AR( j->obj_flags.extra_flags, ITEM_TIMED )) { if( GET_OBJ_TIMER(j) > 0 ) GET_OBJ_TIMER(j)--; if (GET_OBJ_TIMER(j) == 0) { if(contains_soulbound(j)) { GET_OBJ_TIMER(j) = 1; continue; } if (SCRIPT_CHECK(j, OTRIG_TIMER)) { REMOVE_BIT_AR(j->obj_flags.extra_flags, ITEM_TIMED); timer_otrigger(j); continue; // don't do anything more with this } } if( GET_OBJ_TYPE(j) == ITEM_KEY ) { static char *keyVaporMsgs[] = { "$p vanishes with a flash.", "$p begins to shake violently.", "$p begins to vibrate.", "$p begins to hum.", "$p begins to glow." }; if( GET_OBJ_TIMER(j) < (sizeof( keyVaporMsgs )/sizeof( *keyVaporMsgs ))) { int vaporMsg = GET_OBJ_TIMER(j); if( j->carried_by ) act( keyVaporMsgs[ vaporMsg ], FALSE, j->carried_by, j, 0, TO_CHAR); else if( j->worn_by ) { act( keyVaporMsgs[ vaporMsg ], FALSE, j->worn_by, j, 0, TO_CHAR); for( loopvar = 0; loopvar < NUM_WEARS; loopvar++ ) { if( j->worn_by->equipment[loopvar] == j ) j->worn_by->equipment[loopvar] = 0; } } else if( j->in_room != NOWHERE && world[j->in_room].people ) { act( keyVaporMsgs[ vaporMsg ], FALSE, world[j->in_room].people, j, 0, TO_CHAR); act( keyVaporMsgs[ vaporMsg ], FALSE, world[j->in_room].people, j, 0, TO_ROOM); } extract_obj(j); continue; }/* ITEM_KEY has timed out */ }/* if ITEM_KEY */ else if (GET_OBJ_TYPE(j) == ITEM_AFFECT) { if (!GET_OBJ_TIMER(j)) { if (j->in_room != NOWHERE && world[j->in_room].people) { act(j->action_description, FALSE, world[j->in_room].people, j, 0, TO_CHAR); act(j->action_description, FALSE, world[j->in_room].people, j, 0, TO_ROOM); } extract_obj(j); continue; // object gone, don't act further on it! } } else if( !GET_OBJ_TIMER(j) ) { /* The object timed out - delete it */ if( j->carried_by ) act( "$p crumbles to dust and is blown away.", FALSE, j->carried_by, j, 0, TO_CHAR ); else if( j->worn_by ) { act("$p crumbles to dust and is blown away.", FALSE, j->worn_by, j, 0, TO_CHAR); unequip_char( j->worn_by, j->worn_at ); } else if( j->in_room != NOWHERE && world[j->in_room].people ) { act( "$p crumbles to dust and is blown away.", FALSE, world[j->in_room].people, j, 0, TO_CHAR); act( "$p crumbles to dust and is blown away.", FALSE, world[j->in_room].people, j, 0, TO_ROOM); } extract_obj(j); continue; // object gone, don't act further on it! } } /* if OBJ_TIMED */ /* if this looks like a portal */ if ( (GET_OBJ_RNUM(j) >= 0 && GET_OBJ_RNUM(j) <= top_of_objt) && obj_index[GET_OBJ_RNUM(j)].func == portal_proc && GET_OBJ_TYPE(j) == ITEM_OTHER ) { /* Mage created portals are type other, permanent portals are type portal. */ /* Permanent portals thus don't decay. */ if (GET_OBJ_VAL(j, 2) > 0) GET_OBJ_VAL(j,2)--; } /* ** Digger */ /* If this is a corpse */ if ((GET_OBJ_TYPE(j) == ITEM_CONTAINER) && GET_OBJ_VAL(j, 3)) { /* timer count down */ if (GET_OBJ_TIMER(j) > 0) GET_OBJ_TIMER(j)--; // PC corpses which are empty will decay eventually.. if(!CAN_WEAR(j, ITEM_WEAR_TAKE) && !(j->contains)) { GET_OBJ_TIMER(j) = MAX(GET_OBJ_TIMER(j) / 3, 0); } if (!GET_OBJ_TIMER(j)) { if(contains_soulbound(j)) { GET_OBJ_TIMER(j) = 1; continue; } if (j->carried_by) act("$p decays in your hands.", FALSE, j->carried_by, j, 0, TO_CHAR); else if ((j->in_room != NOWHERE) && (world[j->in_room].people)) { static char *decay_messages[] = { "A quivering hoard of maggots consumes $p.", "A flock of vultures swoop down from the sky to devour $p.", "The $p rots and decays as the shards of bone are blown to the four winds.", "The $p rots and decays leaving behind the pungent stench of death.", "A bolt of holy fire streaks from the heavens to burn the corpse of $p to ash.", "The $p rots to ash and is swept away by the winds of time." }; int decay_idx = (int)( random() % ( sizeof( decay_messages ) / sizeof( *decay_messages ))); act( decay_messages[ decay_idx ], TRUE, world[j->in_room].people, j, 0, TO_ROOM); act( decay_messages[ decay_idx ], TRUE, world[j->in_room].people, j, 0, TO_CHAR); }/* JBP */ for (jj = j->contains; jj; jj = next_thing2) { next_thing2 = jj->next_content; /* Next in inventory */ obj_from_obj(jj); if (j->in_obj) { if ( GET_OBJ_TYPE(j) != ITEM_KEY && GET_OBJ_TYPE(j) != ITEM_SCROLL && GET_OBJ_TYPE(j) != ITEM_POTION && GET_OBJ_TYPE(j) != ITEM_DUST && (GET_OBJ_VNUM(j) == 1460 || GET_OBJ_VNUM(j) == 1461 || GET_OBJ_VNUM(j) == 1462 ) ) continue; // Refrigeration to keep food from rotting. obj_to_obj(jj, j->in_obj); } else if (j->carried_by) obj_to_room(jj, j->carried_by->in_room); else if (j->in_room != NOWHERE) obj_to_room(jj, j->in_room); else { /* OLD WAY: assert(FALSE); */ mudlog(NRM, LVL_IMMORT, TRUE, "SYSERR: Something is wrong with a container." ); obj_to_room(jj, real_room(1201)); } } extract_obj(j); } } /* Imhotep: Added support for ITEM_TROPHY pieces that decay after * a given MUD date */ if(IS_OBJ_STAT(j, ITEM_TROPHY)) { if(GET_OBJ_TIMER(j) < TICKS_SO_FAR) { if (j->carried_by) act("$p shimmers and vanishes out of your hands!", FALSE, j->carried_by, j, 0, TO_CHAR); else if (j->worn_by) { act("$p shimmers and vanishes!", FALSE, j->worn_by, j, 0, TO_CHAR); unequip_char(j->worn_by, j->worn_at); } else if (j->in_room != NOWHERE && world[j->in_room].people) { act("$p shimmers and vanishes!", FALSE, world[j->in_room].people, j, 0, TO_CHAR); act("$p shimmers and vanishes!", FALSE, world[j->in_room].people, j, 0, TO_ROOM); } extract_obj(j); continue; } } } }/* point_update */