void hunt_victim(struct char_data *ch) { int dir; byte found; struct char_data *tmp; if (!ch || !HUNTING(ch) || FIGHTING(ch)) return; /* make sure the char still exists */ for (found = FALSE, tmp = character_list; tmp && !found; tmp = tmp->next) if (HUNTING(ch) == tmp) found = TRUE; if (!found) { do_say(ch, "Damn! My prey is gone!", 0, 0); HUNTING(ch) = NULL; return; } if ((dir = find_first_step(IN_ROOM(ch), IN_ROOM(HUNTING(ch)))) < 0) { sprintf(buf, "Damn! I lost %s!", HMHR(HUNTING(ch))); do_say(ch, buf, 0, 0); HUNTING(ch) = NULL; } else { perform_move(ch, dir, 1); if (IN_ROOM(ch) == IN_ROOM(HUNTING(ch))) hit(ch, HUNTING(ch), TYPE_UNDEFINED); } }
void sub_write_to_char(char_data *ch, char *tokens[], void *otokens[], char type[]) { char sb[MAX_STRING_LENGTH]; int i; strcpy(sb,""); for (i = 0; tokens[i + 1]; i++) { strcat(sb,tokens[i]); switch (type[i]) { case '~': if (!otokens[i]) strcat(sb,"someone"); else if ((char_data *)otokens[i] == ch) strcat(sb,"you"); else { GET_PERS((char_data*) otokens[i], ch, chname); strcat(sb, chname); FREE_NAME(chname); } break; case '@': if (!otokens[i]) strcat(sb,"someone's"); else if ((char_data *)otokens[i] == ch) strcat(sb,"your"); else { GET_PERS((char_data*) otokens[i], ch, chname); strcat(sb, chname); FREE_NAME(chname); strcat(sb,"'s"); } break; case '^': if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i])) strcat(sb,"its"); else if (otokens[i] == ch) strcat(sb,"your"); else strcat(sb,HSHR((char_data *) otokens[i])); break; case '&': if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i])) strcat(sb,"it"); else if (otokens[i] == ch) strcat(sb,"you"); else strcat(sb,HSSH((char_data *) otokens[i])); break; case '*': if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i])) strcat(sb,"it"); else if (otokens[i] == ch) strcat(sb,"you"); else strcat(sb,HMHR((char_data *) otokens[i])); break; case '`': if (!otokens[i]) strcat(sb,"something"); else strcat(sb,OBJS(((obj_data *) otokens[i]), ch)); break; } } strcat(sb,tokens[i]); strcat(sb,"\n\r"); sb[0] = toupper(sb[0]); send_to_char(sb,ch); }
void hunt_victim(struct char_data * ch) { extern struct char_data *character_list; ACMD(do_open); int dir; byte found; struct char_data *tmp; struct char_data *hunted_ch; char abuf[80]; char doorname[80]; if (!ch || !HUNTING(ch) || AFF2_FLAGGED(ch, AFF2_MINOR_PARALIZED) || AFF_FLAGGED(ch, AFF_MAJOR_PARALIZED)) { return; } hunted_ch = find_hunted_char(HUNTING(ch)); /* make sure the char still exists */ for (found = 0, tmp = character_list; tmp && !found && hunted_ch; tmp = tmp->next) { if (HUNTING(ch) == GET_IDNUM(tmp)) { found = 1; } } if (!found) { act("$n says, 'Damn! My prey is gone!!'", TRUE, ch, 0, 0, TO_ROOM); /* don't forget vict until they die or I am dead HUNTING(ch) = 0; */ return; } /* dez 19980805 if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_SENTINEL)) { dir = find_first_step(ch->in_room, hunted_ch->in_room, 2); } else if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_STAY_ZONE)) { */ if (IS_NPC(ch) && MOB_FLAGGED(ch, MOB_STAY_ZONE)) { dir = find_first_step(ch->in_room, hunted_ch->in_room, 1); } else { dir = find_first_step(ch->in_room, hunted_ch->in_room, 0); } if (dir < 0) { sprintf(buf, "$n says 'Damn! Lost %s!'", HMHR(hunted_ch)); act(buf, TRUE, ch, 0, 0, TO_ROOM); /* don't forget vict until they die or I am dead HUNTING(ch) = 0; */ return; } else { if (IS_CLOSED(ch->in_room, dir)) { one_argument(EXIT(ch, dir)->keyword, doorname); sprintf(abuf, "%s %s", doorname, dirs[dir]); do_open(ch, abuf, 0, 0); } perform_move(ch, dir, 1); if (ch->in_room == hunted_ch->in_room && !ROOM_FLAGGED(hunted_ch->in_room, ROOM_PEACEFUL)) { if (CAN_SEE(ch, hunted_ch)) { hit(ch, hunted_ch, TYPE_UNDEFINED); } } return; } }