/* this function takes a real number for a room and returns: FALSE - mortals shouldn't be able to teleport to this destination TRUE - mortals CAN teleport to this destination * accepts NULL ch data */ int valid_mortal_tele_dest(struct char_data *ch, room_rnum dest, bool dim_lock) { if (dest == NOWHERE) return FALSE; if (IS_AFFECTED(ch, AFF_DIM_LOCK) && dim_lock) return FALSE; /* this function needs a vnum, not rnum */ if (ch && !House_can_enter(ch, GET_ROOM_VNUM(dest))) return FALSE; if (ZONE_FLAGGED(GET_ROOM_ZONE(dest), ZONE_NOASTRAL)) return FALSE; if (ROOM_FLAGGED(dest, ROOM_PRIVATE)) return FALSE; if (ROOM_FLAGGED(dest, ROOM_DEATH)) return FALSE; if (ROOM_FLAGGED(dest, ROOM_GODROOM)) return FALSE; if (ZONE_FLAGGED(GET_ROOM_ZONE(dest), ZONE_CLOSED)) return FALSE; if (ZONE_FLAGGED(GET_ROOM_ZONE(dest), ZONE_NOASTRAL)) return FALSE; //passed all tests! return TRUE; }
int weather_skill_modifier(CHAR_DATA * ch, int skillnum, int type, int value) { int modi = value, sky = weather_info.sky; if (IS_NPC(ch) || SECT(IN_ROOM(ch)) == SECT_INSIDE || SECT(IN_ROOM(ch)) == SECT_CITY || ROOM_FLAGGED(IN_ROOM(ch), ROOM_INDOORS) || ROOM_FLAGGED(IN_ROOM(ch), ROOM_NOWEATHER)) return (modi); sky = GET_ROOM_SKY(IN_ROOM(ch)); switch (type) { case GAPPLY_SKILL_SUCCESS: switch (skillnum) { case SKILL_THAC0: if (weather_info.sunlight == SUN_SET || weather_info.sunlight == SUN_DARK) { switch (sky) { case SKY_CLOUDLESS: modi = modi * 90 / 100; break; case SKY_CLOUDY: modi = modi * 80 / 100; break; case SKY_RAINING: modi = modi * 70 / 30; break; } } else { switch (sky) { case SKY_CLOUDY: modi = modi * number(85, 95) / 100; break; case SKY_RAINING: modi = modi * number(75, 85) / 100; break; } } break; } break; } if (WAITLESS(ch)) modi = MAX(modi, value); return (modi); }
/* Take an object from a room */ void obj_from_room(struct obj_data *object) { struct obj_data *temp; struct char_data *t, *tempch; if (!object || IN_ROOM(object) == NOWHERE) { log("SYSERR: NULL object (%p) or obj not in a room (%d) passed to obj_from_room", object, IN_ROOM(object)); return; } /* if people are sitting in it, toss their butt to the ground */ if (OBJ_SAT_IN_BY(object) != NULL) { for (tempch = OBJ_SAT_IN_BY(object); tempch; tempch = t) { t = NEXT_SITTING(tempch); SITTING(tempch) = NULL; NEXT_SITTING(tempch) = NULL; } } REMOVE_FROM_LIST(object, world[IN_ROOM(object)].contents, next_content); if (ROOM_FLAGGED(IN_ROOM(object), ROOM_HOUSE)) SET_BIT_AR(ROOM_FLAGS(IN_ROOM(object)), ROOM_HOUSE_CRASH); IN_ROOM(object) = NOWHERE; object->next_content = NULL; }
/* nb, also mess up anyone affected by AFF_POISON */ void pulse_heal(void) { CharData *ch; int gain = number(18,24); for (ch = character_list; ch; ch = ch->next) { if(ch->in_room == NOWHERE) continue; if(!(pvpFactor() > 1)) { if( GET_POS(ch) == POS_INCAP ) damage(ch, ch, 1, TYPE_SUFFERING); else if( GET_POS(ch) == POS_MORTALLYW ) damage(ch, ch, 2, TYPE_SUFFERING); else if( GET_POS(ch) == POS_DEAD) { if(IN_ARENA(ch) || IN_QUEST_FIELD(ch) || ZONE_FLAGGED(world[ch->in_room].zone, ZONE_ARENA) || ZONE_FLAGGED(world[ch->in_room].zone, ZONE_SLEEPTAG)) // If they're dying in the arena, they eventually get better (or killed by someone) { GET_HIT(ch) = number(GET_HIT(ch), 1); sendChar(ch, "You slowly recover.\r\n"); update_pos(ch); } else { raw_kill(ch, NULL); continue; } } } if (IS_AFFECTED(ch, AFF_PULSE_HIT)) if (GET_HIT(ch) < GET_MAX_HIT(ch)) GET_HIT(ch) += gain; if (IS_AFFECTED(ch, AFF_PULSE_MANA)) if (GET_MANA(ch) < GET_MAX_MANA(ch)) GET_MANA(ch) += gain; if (IS_AFFECTED(ch, AFF_POISON)) doPoison(ch); if (IS_AFFECTED(ch, AFF_DISEASE)) doDisease(ch); if (affected_by_spell(ch, SKILL_INVIGORATE)) doInvigorate(ch); if (IS_BOUNTY_HUNTER(ch) && GET_ADVANCE_LEVEL(ch) >= 1 && IS_AFFECTED(ch, AFF_HIDE)) GET_MOVE(ch) = MIN(GET_MOVE(ch) + 3*gain, GET_MAX_MOVE(ch)); if (IS_PRESTIDIGITATOR(ch)) GET_MANA(ch) = MIN(GET_MANA(ch) + GET_ADVANCE_LEVEL(ch) * 2, GET_MAX_MANA(ch)); if (affected_by_spell(ch, SPELL_HIPPOCRATIC_OATH)) GET_MANA(ch) = MIN(GET_MANA(ch) + 25, GET_MAX_MANA(ch)); if (affected_by_spell(ch, SKILL_PET_MEND)) GET_HIT(ch) = MIN(GET_HIT(ch) * 115 / 100, GET_MAX_HIT(ch)); if (IS_HOLY_PRIEST(ch)) GET_MANA(ch) = MIN(GET_MANA(ch) + 10 + 2*GET_ADVANCE_LEVEL(ch), GET_MAX_MANA(ch)); /* The room might be poisoned! (Or later, otherwise dangerous) */ if (ch->in_room != NOWHERE) { if (ROOM_FLAGGED(ch->in_room, ROOM_POISONED)) { if (!mag_savingthrow(ch, SAVING_SPELL)) { act("$n chokes and gags!", TRUE, ch, 0, 0, TO_ROOM); act("You choke and gag!", TRUE, ch, 0, 0, TO_CHAR); add_affect( ch, ch, SPELL_POISON, 30, APPLY_NONE, 0, 5 TICKS, AFF_POISON, FALSE, FALSE, FALSE, FALSE); } } } if(IS_DEFENDER(ch) && !affected_by_spell(ch, SKILL_DEFENDER_HEALTH)) add_affect(ch, ch, SKILL_DEFENDER_HEALTH, GET_LEVEL(ch), APPLY_HIT, GET_ADVANCE_LEVEL(ch)*5, -1, FALSE, FALSE, FALSE, FALSE, FALSE); } }
int calcManaMulti(CharData *ch) { int multi = 100; if(ROOM_FLAGGED(ch->in_room, ROOM_MANA_REGEN)) multi += 50; if(IS_AFFECTED(ch, AFF_WRAITHFORM)) multi += 25; if((GET_CLASS(ch) == CLASS_SHADOW_DANCER) && (IS_DARK(ch->in_room) || IS_AFFECTED(ch, AFF_SHADOW_SPHERE))) multi += 50; if(IS_AFFECTED(ch, AFF_POISON)) multi -= 100; if(!IS_NPC(ch)) { if( !IS_NPC(ch) && ROOM_FLAGGED(ch->in_room, ROOM_SUFFER) && ( GET_LEVEL(ch) < LVL_IMMORT )) multi -= 90; else if (!GET_COND(ch, THIRST) && IS_AMARA(ch)) multi -= 90; else if (IS_IZARTI(ch) && IS_EVIL(ch)) multi -= 90; else if (IS_DEMON(ch) && IS_GOOD(ch)) multi -= 90; } if(GET_RACE(ch) == RACE_STROLL) multi += 100; /* Position calculations */ switch (GET_POS(ch)) { case POS_MEDITATING: case POS_SLEEPING: multi += 120; break; case POS_RESTING: multi += 60; break; } multi += (int)GET_SKILL(ch, SKILL_DEVOTION); // Don't let a player's regeneration completely stagnate... multi = MAX(multi, 25); return multi; }
/* returns the real room number, or NOWHERE if not found or invalid */ room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr) { int tmp; room_rnum location; char_data *target_mob; obj_data *target_obj; char roomstr[MAX_INPUT_LENGTH]; one_argument(rawroomstr, roomstr); if (!*roomstr) return NOWHERE; if (isdigit(*roomstr) && !strchr(roomstr, '.')) { tmp = atoi(roomstr); if ((location = real_room(tmp)) == NOWHERE) return NOWHERE; } else if ((target_mob = get_char_by_obj(obj, roomstr))) location = IN_ROOM(target_mob); else if ((target_obj = get_obj_by_obj(obj, roomstr))) { if (IN_ROOM(target_obj) != NOWHERE) location = IN_ROOM(target_obj); else return NOWHERE; } else return NOWHERE; /* a room has been found. Check for permission */ if (ROOM_FLAGGED(location, ROOM_GODROOM) || #ifdef ROOM_IMPROOM ROOM_FLAGGED(location, ROOM_IMPROOM) || #endif ROOM_FLAGGED(location, ROOM_HOUSE)) return NOWHERE; if (ROOM_FLAGGED(location, ROOM_PRIVATE) && world[location].people && world[location].people->next_in_room) return NOWHERE; return location; }
bool show_worldmap(struct char_data *ch) { room_rnum rm = IN_ROOM(ch); zone_rnum zn = GET_ROOM_ZONE(rm); if (ROOM_FLAGGED(rm, ROOM_WORLDMAP)) return TRUE; if (ZONE_FLAGGED(zn, ZONE_WORLDMAP)) return TRUE; return FALSE; }
/* assign special procedures to rooms */ void assign_rooms(void) { room_rnum i; if (dts_are_dumps) for (i = 0; i <= top_of_world; i++) if (ROOM_FLAGGED(i, ROOM_DEATH)) world[i].func = dump; }
int is_tell_ok(struct char_data *ch, struct char_data *vict) { if (ch == vict) send_to_char(ch, "You try to tell yourself something.\r\n"); else if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOTELL)) send_to_char(ch, "You can't tell other people while you have notell on.\r\n"); else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_SOUNDPROOF)) send_to_char(ch, "The walls seem to absorb your words.\r\n"); else if (!IS_NPC(vict) && !vict->desc) /* linkless */ act("$E's linkless at the moment.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); else if (PLR_FLAGGED(vict, PLR_WRITING)) act("$E's writing a message right now; try again later.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); else if ((!IS_NPC(vict) && PRF_FLAGGED(vict, PRF_NOTELL)) || ROOM_FLAGGED(IN_ROOM(vict), ROOM_SOUNDPROOF)) act("$E can't hear you.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); else return (TRUE); return (FALSE); }
static int VALID_EDGE(room_rnum x, int y) { if (world[x].dir_option[y] == NULL || TOROOM(x, y) == NOWHERE) return 0; if (CONFIG_TRACK_T_DOORS == FALSE && IS_CLOSED(x, y)) return 0; if (ROOM_FLAGGED(TOROOM(x, y), ROOM_NOTRACK) || IS_MARKED(TOROOM(x, y))) return 0; return 1; }
int VALID_EDGE(room_rnum x, int y) { if (world[x].dir_option[y] == NULL || TOROOM(x, y) == NOWHERE) return 0; if (track_through_doors == FALSE && IS_CLOSED(x, y)) return 0; if (ROOM_FLAGGED(TOROOM(x, y), ROOM_NOTRACK) || IS_MARKED(TOROOM(x, y))) return 0; return 1; }
void check_object_killer(struct obj_data *obj, struct creature *vict) { struct creature *killer = NULL; bool loaded_killer = false; int obj_id; if (ROOM_FLAGGED(vict->in_room, ROOM_PEACEFUL)) { return; } if (IS_NPC(vict)) return; slog("Checking object killer %s -> %s. ", obj->name, GET_NAME(vict)); if (IS_BOMB(obj)) obj_id = BOMB_IDNUM(obj); else if (GET_OBJ_SIGIL_IDNUM(obj)) obj_id = GET_OBJ_SIGIL_IDNUM(obj); else { errlog("unknown damager in check_object_killer."); return; } if (!obj_id) return; killer = get_char_in_world_by_idnum(obj_id); // load the bastich from file. if (!killer) { killer = load_player_from_xml(obj_id); if (killer) { killer->account = account_by_idnum(player_account_by_idnum(obj_id)); loaded_killer = true; } } // the piece o shit has a bogus killer idnum on it! if (!killer) { errlog("bogus idnum %d on object %s damaging %s.", obj_id, obj->name, GET_NAME(vict)); return; } count_pkill(killer, vict); // save the sonuvabitch to file crashsave(killer); if (loaded_killer) free_creature(killer); }
int is_tell_ok(CHAR_DATA * ch, CHAR_DATA * vict) { if (ch == vict) { send_to_char("Вы начали потихоньку разговаривать с самим собой.\r\n", ch); return (FALSE); } else if (!IS_NPC(ch) && PLR_FLAGGED(ch, PLR_DUMB)) { send_to_char("Вам запрещено обращаться к другим игрокам.\r\n", ch); return (FALSE); } else if (!IS_NPC(vict) && !vict->desc) /* linkless */ { act("$N потерял$G связь в этот момент.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); return (FALSE); } else if (PLR_FLAGGED(vict, PLR_WRITING)) { act("$N пишет сообщение - повторите попозже.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); return (FALSE); } if (IS_GOD(ch) || Privilege::check_flag(ch, Privilege::KRODER)) return (TRUE); if (ROOM_FLAGGED(ch->in_room, ROOM_SOUNDPROOF)) send_to_char("Стены заглушили Ваши слова.\r\n", ch); else if ((!IS_NPC(vict) && (PRF_FLAGGED(vict, PRF_NOTELL) || ignores(vict, ch, IGNORE_TELL))) || ROOM_FLAGGED(vict->in_room, ROOM_SOUNDPROOF)) act("$N не сможет Вас услышать.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); else if (GET_POS(vict) < POS_RESTING || AFF_FLAGGED(vict, AFF_DEAFNESS)) act("$N Вас не услышит.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); else return (TRUE); return (FALSE); }
/* * auction_output : takes two strings and dispenses them to everyone connected * based on if they have color on or not. Note that the buf's are * commonly used *color and *black so I allocate my own buffer. */ void auction_output(char *color, char *black) { char buffer[MAX_STRING_LENGTH]; struct descriptor_data *d; if (!auction.auctioneer) auction.auctioneer = str_dup(DEFAULT_AUCTIONEER); for (d = descriptor_list; d; d = d->next) if (!d->connected && d->character && !PLR_FLAGGED(d->character, PLR_WRITING) && !PRF_FLAGGED(d->character, PRF_NOAUCT) && !ROOM_FLAGGED(d->character->in_room, ROOM_SOUNDPROOF) && !ROOM_FLAGGED(d->character->in_room, ROOM_PRISON)) { sprintf(buffer, "%s%s%s auctions, '%s%s%s'%s\r\n", CCMAG(d->character,C_NRM), auction.auctioneer, CCCYN(d->character,C_NRM), CCNRM(d->character,C_NRM), (COLOR_LEV(d->character) > C_NRM) ? color : black, CCMAG(d->character,C_NRM),CCNRM(d->character,C_NRM)); send_to_char(buffer, d->character); } }
/* assign special procedures to rooms */ void assign_rooms (void) { room_rnum i; ASSIGNROOM (3030, dump); ASSIGNROOM (3031, pet_shops); if (dts_are_dumps) for (i = 0; i <= top_of_world; i++) if (ROOM_FLAGGED (i, ROOM_DEATH)) world[i].func = dump; }
bool is_arena_combat(struct creature *ch, struct creature *vict) { if (!vict->in_room) return false; if (ROOM_FLAGGED(vict->in_room, ROOM_ARENA)) return true; //mobs don't quest if (!IS_NPC(vict)) { if (GET_QUEST(vict)) { struct quest *quest; quest = quest_by_vnum(GET_QUEST(vict)); if (quest && QUEST_FLAGGED(quest, QUEST_ARENA)) return true; } } if (!ch || !ch->in_room) return false; if (ROOM_FLAGGED(ch->in_room, ROOM_ARENA)) return true; //mobs don't quest if (!IS_NPC(ch)) { if (GET_QUEST(ch)) { struct quest *quest; quest = quest_by_vnum(GET_QUEST(ch)); if (quest && QUEST_FLAGGED(quest, QUEST_ARENA)) return true; } } return false; }
/* put an object in a room */ void obj_to_room(struct obj_data * object, room_rnum room) { if (!object || room < 0 || room > top_of_world) log("SYSERR: Illegal value(s) passed to obj_to_room"); else { object->next_content = world[room].contents; world[room].contents = object; object->in_room = room; object->carried_by = NULL; if (ROOM_FLAGGED(room, ROOM_HOUSE)) SET_BIT(ROOM_FLAGS(room), ROOM_HOUSE_CRASH); } }
// Returns true if the room is outside and sunny, otherwise returns false bool room_is_sunny(struct room_data *room) { int sunlight; // Explicitly dark if (ROOM_FLAGGED(room, ROOM_DARK)) return false; // Only the prime material plane has a sun if (!PRIME_MATERIAL_ROOM(room)) return false; // Sun doesn't reach indoors if (ROOM_FLAGGED(room, ROOM_INDOORS)) return false; // Or rooms that are inside if (SECT(room) == SECT_INSIDE) return false; // Actual sunlight check sunlight = room->zone->weather->sunlight; return (sunlight == SUN_RISE || sunlight == SUN_LIGHT); }
// Returns true if the room is too dark to see, false if the room has enough // light to see bool room_is_dark(struct room_data * room) { if (!room) { errlog("room_is_dark() called with NULL room"); return false; } if (!room->zone) { errlog("room_is_dark() called with NULL room->zone [%d]", room->number); return false; } if (!room->zone->weather) { errlog("room_is_dark() called with NULL room->zone->weather [%d]", room->number); return false; } if (room->light) return false; if (SECT(room) == SECT_ELEMENTAL_OOZE) return true; if (ROOM_FLAGGED(room, ROOM_DARK)) return true; if (!PRIME_MATERIAL_ROOM(room)) return false; if (ROOM_FLAGGED(room, ROOM_INDOORS)) return false; if (SECT(room) == SECT_INSIDE) return false; if (SECT(room) == SECT_VEHICLE) return false; if (SECT(room) == SECT_CITY) return false; return !room_is_sunny(room); }
/* put an object in a room */ void obj_to_room(struct obj_data *object, room_rnum room) { if (!object || room == NOWHERE || room > top_of_world) log("SYSERR: Illegal value(s) passed to obj_to_room. (Room #%d/%d, obj %p)", room, top_of_world, object); else { object->next_content = world[room].contents; world[room].contents = object; IN_ROOM(object) = room; object->carried_by = NULL; if (ROOM_FLAGGED(room, ROOM_HOUSE)) SET_BIT_AR(ROOM_FLAGS(room), ROOM_HOUSE_CRASH); } }
int is_tell_ok(Character *ch, Character *vict) { if( ch->IsPurged() ) return FALSE; else if( vict->IsPurged() ) ch->send(NOPERSON); else if(GET_RACE(vict) != GET_RACE(ch) && GET_LEVEL(ch) < LVL_IMMORT && GET_LEVEL(vict) < LVL_IMMORT && !IS_NPC(ch)) ch->send(NOPERSON); else if (ch == vict) ch->send("You try to tell yourself something.\r\n"); else if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOTELL)) ch->send("You can't tell other people while you have notell on.\r\n"); else if ( AFF_FLAGGED(ch, AFF_SILENCE) && GET_LEVEL(ch) <= LVL_IMMORT ) ch->send("You try to speak, but nothing comes out!\r\n"); /*else if(ch->in_room == ch->StartRoom() && GET_LEVEL(ch) < LVL_IMMORT && GET_LEVEL(vict) < LVL_IMMORT && GET_LEVEL(ch) > 5) ch->send("Your attempt to communicate into the Pattern fails.\r\n");*/ // else if(vict->in_room == vict->StartRoom() && GET_LEVEL(vict) < LVL_IMMORT && GET_LEVEL(ch) < LVL_IMMORT) // ch->send("Your attempt to communicate outside of the Pattern fails.\r\n"); else if (ROOM_FLAGGED(ch->in_room, ROOM_SOUNDPROOF)) ch->send("The walls seem to absorb your words.\r\n"); else if (!IS_NPC(vict) && !vict->desc) /* linkless */ Act("$E's linkless at the moment.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); else if (PRF_FLAGGED(ch, PRF_TELL_MUTE)) ch->send("You are mute to tells. You need an immortal to remove this.\r\n"); else if (PRF_FLAGGED(vict, PRF_TELL_MUTE)) Act("$E's is mute to tells... Try again later.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); else if (PLR_FLAGGED(vict, PLR_WRITING)) Act("$E's writing a message right now; try again later.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); else if ((!IS_NPC(vict) && PRF_FLAGGED(vict, PRF_NOTELL)) || ROOM_FLAGGED(vict->in_room, ROOM_SOUNDPROOF) || vict->IsIgnoring(GET_NAME(ch))) Act("$E can't hear you.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); else return TRUE; return FALSE; }
/* Take an object from a room */ void obj_from_room(struct obj_data * object) { struct obj_data *temp; if (!object || object->in_room == NOWHERE) { log("SYSERR: NULL object or obj not in a room passed to obj_from_room"); return; } REMOVE_FROM_LIST(object, world[object->in_room].contents, next_content); if (ROOM_FLAGGED(object->in_room, ROOM_HOUSE)) SET_BIT(ROOM_FLAGS(object->in_room), ROOM_HOUSE_CRASH); object->in_room = NOWHERE; object->next_content = NULL; }
/* Hitpoint gain per game hour */ int hit_gain(CharData * ch) { // Character is messed if (IN_ROOM(ch) == -1) return 0; // Delusion health deflates fairly quickly if(affected_by_spell(ch, SKILL_DELUSION)) return -(GET_MAX_HIT(ch) * spell_level(ch, SKILL_DELUSION) / 9); /* Are they rotting away ? */ if (!IS_NPC(ch) && IS_UNDEAD(ch)) { return ( (GET_LEVEL(ch) < 50) && (ch->desc) ) ? -GET_LEVEL(ch) : 0; } /* Race calculations */ /* vampires don't regenerate in sunlight, unless they're shadow sphered */ if (!IS_NPC(ch) && IS_VAMPIRE(ch) && IS_SUNLIGHT(IN_ROOM(ch)) && !IS_AFFECTED(ch, AFF_SHADOW_SPHERE)) return 0; if(!IS_NPC(ch)) { int suffer = 0; if(ROOM_FLAGGED(ch->in_room, ROOM_SUFFER) && ( GET_LEVEL(ch) < LVL_IMMORT )) suffer = 1; else if(!GET_COND(ch, THIRST) && IS_AMARA(ch)) suffer = 1; else if (IS_IZARTI(ch) && IS_EVIL(ch)) suffer = 1; else if (IS_DEMON(ch) && IS_GOOD(ch)) suffer = 1; if(suffer == 1) { if(percentSuccess(2)) damage(ch, ch, -SUFFER_RATE, TYPE_ROOM_SUFFER); return 0; } } int base = calcHitBase(ch); int multiplier = calcHitMulti(ch); int bonus = calcHitBonus(ch); int gain = base*multiplier/100 + bonus; return (gain); }/* hit_gain */
// Returns true if the player can see in the room bool check_sight_room(struct creature * self, struct room_data * room) { if (!room) { errlog("check_sight_room() called with NULL room"); return false; } if (room_is_dark(room) && !has_dark_sight(self)) return false; if (ROOM_FLAGGED(room, ROOM_SMOKE_FILLED) && !AFF3_FLAGGED(self, AFF3_SONIC_IMAGERY)) return false; return true; }
int VALID_EDGE(room_rnum x, int y, int edge_range, int through_doors) { if (world[x]->dir_option[y] == NULL || TOROOM(x, y) == NOWHERE) return 0; // Попытка уползти в другую зону if (edge_range == EDGE_ZONE && (world[x]->zone != world[TOROOM(x, y)]->zone)) return 0; if (through_doors == FALSE && IS_CLOSED(x, y)) return 0; if (ROOM_FLAGGED(TOROOM(x, y), ROOM_NOTRACK) || IS_MARKED(TOROOM(x, y))) return 0; return 1; }
int calcMoveMulti(CharData *ch) { int multi = 100; if(IS_AFFECTED(ch, AFF_PLAGUE) > 0) multi -= 50; /* vampires barely regen vigor in sunlight, unless they're shadow sphered */ if (!IS_NPC(ch) && IS_VAMPIRE(ch) && IS_SUNLIGHT(IN_ROOM(ch)) && !IS_AFFECTED(ch, AFF_SHADOW_SPHERE)) multi -= 90; else if (IS_AFFECTED(ch, AFF_POISON)) multi -= 90; else if ((GET_COND(ch, HUNGER) == 0 && !IS_VAMPIRE(ch)) || (GET_COND(ch, THIRST) == 0)) multi -= 90; if( ROOM_FLAGGED(ch->in_room, ROOM_SUFFER) && ( GET_LEVEL(ch) < LVL_IMMORT )) multi -= 90; else if (!GET_COND(ch, THIRST) && IS_AMARA(ch)) multi -= 90; else if (IS_IZARTI(ch) && IS_EVIL(ch)) multi -= 90; else if (IS_DEMON(ch) && IS_GOOD(ch)) multi -= 90; /* Position calculations */ switch (GET_POS(ch)) { case POS_MEDITATING: case POS_SLEEPING: multi += 120; break; case POS_RESTING: multi += 80; break; case POS_SITTING: multi += 40; /* Divide by 8 */ break; } // Don't let a player's regeneration completely stagnate... multi = MAX(multi, 25); return multi; }
int calcHitMulti(CharData *ch) { int multi = 100; if (GET_RACE(ch) == RACE_TROLL) multi += 200; /* Trolls regenerate VERY fast. */ if (GET_RACE(ch) == RACE_STROLL) multi += 300; if(IS_AFFECTED(ch, AFF_PLAGUE)) multi -= 50; if (IS_AFFECTED(ch, AFF_POISON) || IS_AFFECTED(ch, AFF_DISEASE)) multi -= 75; if( ROOM_FLAGGED( ch->in_room, ROOM_HEALTH_REGEN )) multi += 50; /* Position calculations */ switch (GET_POS(ch)) { case POS_MEDITATING: case POS_SLEEPING: multi += 120; break; case POS_RESTING: multi += 60; break; } // During the day, vampires have a difficult time regenerating mana if(!IS_NPC(ch) && ((GET_COND(ch, HUNGER) == 0 && !IS_VAMPIRE(ch)) || (GET_COND(ch, THIRST) == 0))) { multi = 25; return multi; } // Don't let a player's regeneration completely stagnate... multi = MAX(multi, 25); return multi; }
void map_search(int map[21][21], int x, int y, room_rnum room) { int exit; for(exit=0;exit < 12;exit++) { if(dirvals[exit].x == 2) continue; int tx = x + dirvals[exit].x; int ty = y + dirvals[exit].y; if(tx > 20 || tx < 0 || ty > 20 || ty < 0) continue; if(EXITN(room, exit)) { struct room_direction_data *nexit = EXITN(room,exit); room_rnum nroom = nexit->to_room; if(map[tx][ty] == 100 && !EXIT_FLAGGED(nexit, EX_CLOSED)) { if(ROOM_FLAGGED(nroom, ROOM_NO_MAP)) { map[tx][ty] = 75; } else { map[tx][ty] = SECT(nroom); map_search(map,tx,ty,nroom); } } } } }
int DamageItem(struct char_data *ch, struct obj_data *o) { int temp,i; if (!o) return 0; if (ROOM_FLAGGED(ch->in_room, ROOM_ARENA | ROOM_PEACEFUL)) return 0; temp = number(1, 2); if(GET_OBJ_COND(o) == 101){ return FALSE; } else{ for (i = 0; i < NUM_WEARS; i++) { if (GET_EQ(ch, i)) GET_AC(ch) += apply_ac(ch, i); } GET_OBJ_COND(o) -= temp; for (i = 0; i < NUM_WEARS; i++) { if (GET_EQ(ch, i)) GET_AC(ch) -= apply_ac(ch, i); } } save_char(ch, NOWHERE); sprintf(buf, "&G%s&g was &Gdamaged&g in the combat!&n\r\n", (CAN_SEE_OBJ(ch, o) ? CAP(o->short_description) : "Something")); send_to_char(buf, ch); if (GET_OBJ_COND(o) < 0) { GET_OBJ_COND(o) = 0; return TRUE; } return FALSE; }
/* This function is the very heart of the entire magic system. All invocations * of all types of magic -- objects, spoken and unspoken PC and NPC spells, the * works -- all come through this function eventually. This is also the entry * point for non-spoken or unrestricted spells. Spellnum 0 is legal but silently * ignored here, to make callers simpler. */ int call_magic(struct char_data *caster, struct char_data *cvict, struct obj_data *ovict, int spellnum, int level, int casttype) { int savetype; if (spellnum < 1 || spellnum > TOP_SPELL_DEFINE) return (0); if (!cast_wtrigger(caster, cvict, ovict, spellnum)) return 0; if (!cast_otrigger(caster, ovict, spellnum)) return 0; if (!cast_mtrigger(caster, cvict, spellnum)) return 0; if (ROOM_FLAGGED(IN_ROOM(caster), ROOM_NOMAGIC)) { send_to_char(caster, "Your magic fizzles out and dies.\r\n"); act("$n's magic fizzles out and dies.", FALSE, caster, 0, 0, TO_ROOM); return (0); } if (ROOM_FLAGGED(IN_ROOM(caster), ROOM_PEACEFUL) && (SINFO.violent || IS_SET(SINFO.routines, MAG_DAMAGE))) { send_to_char(caster, "A flash of white light fills the room, dispelling your violent magic!\r\n"); act("White light from no particular source suddenly fills the room, then vanishes.", FALSE, caster, 0, 0, TO_ROOM); return (0); } if (cvict && MOB_FLAGGED(cvict, MOB_NOKILL)) { send_to_char(caster, "This mob is protected.\r\n"); return (0); } /* determine the type of saving throw */ switch (casttype) { case CAST_STAFF: case CAST_SCROLL: case CAST_POTION: case CAST_WAND: savetype = SAVING_ROD; break; case CAST_SPELL: savetype = SAVING_SPELL; break; default: savetype = SAVING_BREATH; break; } if (IS_SET(SINFO.routines, MAG_DAMAGE)) if (mag_damage(level, caster, cvict, spellnum, savetype) == -1) return (-1); /* Successful and target died, don't cast again. */ if (IS_SET(SINFO.routines, MAG_AFFECTS)) mag_affects(level, caster, cvict, spellnum, savetype); if (IS_SET(SINFO.routines, MAG_UNAFFECTS)) mag_unaffects(level, caster, cvict, spellnum, savetype); if (IS_SET(SINFO.routines, MAG_POINTS)) mag_points(level, caster, cvict, spellnum, savetype); if (IS_SET(SINFO.routines, MAG_ALTER_OBJS)) mag_alter_objs(level, caster, ovict, spellnum, savetype); if (IS_SET(SINFO.routines, MAG_GROUPS)) mag_groups(level, caster, spellnum, savetype); if (IS_SET(SINFO.routines, MAG_MASSES)) mag_masses(level, caster, spellnum, savetype); if (IS_SET(SINFO.routines, MAG_AREAS)) mag_areas(level, caster, spellnum, savetype); if (IS_SET(SINFO.routines, MAG_SUMMONS)) mag_summons(level, caster, ovict, spellnum, savetype); if (IS_SET(SINFO.routines, MAG_CREATIONS)) mag_creations(level, caster, spellnum); if (IS_SET(SINFO.routines, MAG_ROOMS)) mag_rooms(level, caster, spellnum); if (IS_SET(SINFO.routines, MAG_MANUAL)) switch (spellnum) { case SPELL_CHARM: MANUAL_SPELL(spell_charm); break; case SPELL_CREATE_WATER: MANUAL_SPELL(spell_create_water); break; case SPELL_DETECT_POISON: MANUAL_SPELL(spell_detect_poison); break; case SPELL_ENCHANT_WEAPON: MANUAL_SPELL(spell_enchant_weapon); break; case SPELL_IDENTIFY: MANUAL_SPELL(spell_identify); break; case SPELL_LOCATE_OBJECT: MANUAL_SPELL(spell_locate_object); break; case SPELL_SUMMON: MANUAL_SPELL(spell_summon); break; case SPELL_WORD_OF_RECALL: MANUAL_SPELL(spell_recall); break; case SPELL_TELEPORT: MANUAL_SPELL(spell_teleport); break; } return (1); }