/* place a character in a room */ void char_to_room(struct char_data *ch, room_rnum room) { if (ch == NULL || room == NOWHERE || room > top_of_world) log("SYSERR: Illegal value(s) passed to char_to_room. (Room: %d/%d Ch: %p", room, top_of_world, ch); else { ch->next_in_room = world[room].people; world[room].people = ch; IN_ROOM(ch) = room; autoquest_trigger_check(ch, 0, 0, AQ_ROOM_FIND); autoquest_trigger_check(ch, 0, 0, AQ_MOB_FIND); if (GET_EQ(ch, WEAR_LIGHT)) if (GET_OBJ_TYPE(GET_EQ(ch, WEAR_LIGHT)) == ITEM_LIGHT) if (GET_OBJ_VAL(GET_EQ(ch, WEAR_LIGHT), 2)) /* Light ON */ world[room].light++; /* Stop fighting now, if we left. */ if (FIGHTING(ch) && IN_ROOM(ch) != IN_ROOM(FIGHTING(ch))) { stop_fighting(FIGHTING(ch)); stop_fighting(ch); } } }
int npc_rescue(struct char_data * ch_hero, struct char_data * ch_victim) { struct char_data *ch_bad_guy; for (ch_bad_guy = world[ch_hero->in_room].people; ch_bad_guy && (FIGHTING(ch_bad_guy) != ch_victim); ch_bad_guy = ch_bad_guy->next_in_room); if (ch_bad_guy) { if (ch_bad_guy == ch_hero) return FALSE; /* NO WAY I'll rescue the one I'm fighting! */ //act("Impavidamente Togli $N dai Guai!.\r\n", FALSE, ch_hero, 0, ch_victim, TO_CHAR); act("Vieni Salvato da $N, Tuo servitore Fedelissimo!\r\n", FALSE, ch_victim, 0, ch_hero, TO_CHAR); act("$n Eroicamente Salva $N.", FALSE, ch_hero, 0, ch_victim, TO_NOTVICT); if (FIGHTING(ch_bad_guy)) stop_fighting(ch_bad_guy); if (FIGHTING(ch_hero)!=ch_bad_guy) stop_fighting(ch_hero); set_fighting(ch_hero, ch_bad_guy); set_fighting(ch_bad_guy, ch_hero); return TRUE; } //End forif return FALSE; }
/* Used by Tim and Tom */ int do_npc_rescue(struct char_data * ch_hero, struct char_data * ch_victim) { struct char_data *ch_bad_guy; for (ch_bad_guy = world[ch_hero->in_room].people; ch_bad_guy && (FIGHTING(ch_bad_guy) != ch_victim); ch_bad_guy = ch_bad_guy->next_in_room); if (ch_bad_guy) { if (ch_bad_guy == ch_hero) return FALSE; /* NO WAY I'll rescue the one I'm fighting! */ act("You bravely rescue $N.\r\n", FALSE, ch_hero, 0, ch_victim, TO_CHAR); act("You are rescued by $N, your loyal friend!\r\n", FALSE, ch_victim, 0, ch_hero, TO_CHAR); act("$n heroically rescues $N.", FALSE, ch_hero, 0, ch_victim, TO_NOTVICT); if (FIGHTING(ch_bad_guy)) stop_fighting(ch_bad_guy); if (FIGHTING(ch_hero)) stop_fighting(ch_hero); set_fighting(ch_hero, ch_bad_guy); set_fighting(ch_bad_guy, ch_hero); return TRUE; } return FALSE; }
void do_pshift( CHAR_DATA *ch, char *argument ) { ROOM_INDEX_DATA *to_room; EXIT_DATA *pexit; CHAR_DATA *victim; int door; if (!IS_CLASS(ch, CLASS_WIZARD)) { stc("Huh?\n\r",ch); return; } if (ch->pcdata->stats[WL_SPELLS] < 5) { stc("#RYou do not yet have mastery of this spell.#n\n\r",ch); return; } if ( ( victim = ch->fighting ) == NULL ) { if ( ch->position == POS_FIGHTING ) ch->position = POS_STANDING; send_to_char( "You aren't fighting anyone.\n\r", ch ); return; } if(ch->mana < 750) { send_to_char("#RYou d not have the 750 required mana.\n\r",ch); return; } door = number_door( ); if ( ( pexit = ch->in_room->exit[door] ) == NULL || (to_room = pexit->to_room) == NULL) { act( "#y$n#R mutters some words and disappears!", ch, NULL, NULL, TO_ROOM ); send_to_char( "#RYou mutter some dark words and vanish from combat.\n\r", ch ); char_from_room( ch ); char_to_room( ch, get_room_index(ROOM_VNUM_ALTAR)); stop_fighting( ch, TRUE ); return; }; act( "#y$n#R mutters some words and disappears!", ch, NULL, NULL, TO_ROOM ); send_to_char( "#RYou mutter some dark words and vanish from combat.\n\r", ch ); char_from_room(ch); char_to_room( ch, to_room ); do_look(ch,"auto"); stop_fighting( ch, TRUE ); ch->mana -= 750; return; }
void update_target (CHAR_DATA *tch, int affect_type) { if ( affect_type == MAGIC_AFFECT_SLEEP ) { do_sleep (tch, "", 0); if ( tch->fighting ) { if ( tch->fighting == tch ) stop_fighting (tch->fighting); stop_fighting (tch); } } }
/** * @param char_data *ch The person who is rescuing... * @param char_data *vict The person in need of rescue. * @param char_data *from The attacker, who will now hit ch. */ void perform_rescue(char_data *ch, char_data *vict, char_data *from) { send_to_char("Banzai! To the rescue...\r\n", ch); act("You are rescued by $N!", FALSE, vict, 0, ch, TO_CHAR); act("$n heroically rescues $N!", FALSE, ch, 0, vict, TO_NOTVICT); if (FIGHTING(vict) == from) stop_fighting(vict); if (FIGHTING(from)) stop_fighting(from); if (FIGHTING(ch)) stop_fighting(ch); set_fighting(ch, from, FMODE_MELEE); set_fighting(from, ch, FMODE_MELEE); }
/* * Lets the mobile goto any location it wishes that is not private. * * Syntax: mob goto [location] */ void do_mpgoto( CHAR_DATA *ch, char *argument ) { char arg[ MAX_INPUT_LENGTH ]; ROOM_INDEX_DATA *location; one_argument( argument, arg ); if ( arg[0] == '\0' ) { bug( "Mpgoto - No argument from vnum %d.", IS_NPC(ch) ? ch->pIndexData->vnum : 0 ); return; } if ( ( location = find_location( ch, arg ) ) == NULL ) { bug( "Mpgoto - No such location from vnum %d.", IS_NPC(ch) ? ch->pIndexData->vnum : 0 ); return; } if ( ch->fighting != NULL ) stop_fighting( ch, TRUE ); char_from_room( ch ); char_to_room( ch, location ); return; }
void lightning( void ) { DESCRIPTOR_DATA *d; for ( d = descriptor_list; d != NULL; d = d->next ) { if ( d->connected == CON_PLAYING && IS_OUTDOORS( d->character ) && IS_AWAKE ( d->character ) && number_chance(10) && !IS_IMMORTAL(d->character) && d->character->level > 17 && weather_info.sky == SKY_LIGHTNING ) { send_to_char("{x{RYou see a brilliant flash come down from the sky and then black out!{x\n\r",d->character); act( "$n has been struck by lightning!", d->character, NULL, NULL,TO_ROOM); if(check_immune(d->character,DAM_LIGHTNING) != IS_IMMUNE) { if(d->character->fighting) { stop_fighting(d->character,TRUE); } if(check_immune(d->character,DAM_LIGHTNING) != IS_RESISTANT) if (d->character->level < LI1); d->character->hit -= d->character->hit/25; if (d->character->level < LI2); d->character->hit -= d->character->hit/20; if (d->character->level < LI3); d->character->hit -= d->character->hit/15; WAIT_STATE(d->character,40); } else { if(check_immune(d->character,DAM_LIGHTNING) == IS_VULNERABLE) { d->character->hit -= d->character->hit/10; WAIT_STATE(d->character,40); } } } } }
void do_recall (CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; ROOM_INDEX_DATA *location; if (IS_NPC (ch)) { send_to_char ("Only players can recall.\n\r", ch); return; } act ("$n prays for transportation!", ch, 0, 0, TO_ROOM); if ((location = get_room_index (100)) == NULL) { send_to_char ("You are completely lost.\n\r", ch); return; } if (ch->in_room == location) return; if (IS_SET (ch->in_room->room_flags, ROOM_NO_RECALL)) { send_to_char ("Mota has forsaken you.\n\r", ch); return; } if(ch->infight) { int lose, skill; skill = get_skill (ch, gsn_recall); if (number_percent () < 80 * skill / 100) { WAIT_STATE (ch, 4); sprintf (buf, "You failed!.\n\r"); send_to_char (buf, ch); return; } lose = (ch->desc != NULL) ? 25 : 50; gain_exp (ch, 0 - lose); sprintf (buf, "You recall from combat! You lose %d exps.\n\r", lose); send_to_char (buf, ch); stop_fighting (ch, TRUE); } ch->move /= 2; act ("$n disappears.", ch, NULL, NULL, TO_ROOM); char_from_room (ch); char_to_room (ch, location); act ("$n appears in the room.", ch, NULL, NULL, TO_ROOM); do_function (ch, &do_look, "auto"); return; }
void do_krecall(CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; CHAR_DATA *victim; CHAR_DATA *mount; ROOM_INDEX_DATA *location; KINGDOM_DATA *kingdom; if(IS_NPC(ch) || (kingdom = get_kingdom(ch->pcdata->kingdom)) == &kingdom_default) { send_to_char("You have no kingdom!\n\r", ch); return; } act("$n's body flickers with green energy.", ch, 0, 0, TO_ROOM); act("Your body flickers with green energy.", ch, 0, 0, TO_CHAR); if((location = get_room_index(kingdom->recall)) == 0) { send_to_char("Your kingdom has no recall set.\n\r", ch); return; } if(ch->in_room == location) return; if(IS_SET(ch->in_room->room_flags, ROOM_NO_RECALL) || IS_AFFECTED(ch, AFF_CURSE)) { send_to_char("You are unable to recall.\n\r", ch); return; } if((victim = ch->fighting) != 0) { if(number_bits(1) == 0) { WAIT_STATE(ch, 4); sprintf(buf, "You failed!\n\r"); send_to_char(buf, ch); return; } sprintf(buf, "You recall from combat!\n\r"); send_to_char(buf, ch); stop_fighting(ch, TRUE); } act("$n disappears.", ch, 0, 0, TO_ROOM); char_from_room(ch); char_to_room(ch, location); act("$n appears in the room.", ch, 0, 0, TO_ROOM); do_look(ch, "auto"); if((mount = ch->mount) == 0) return; char_from_room(mount); char_to_room(mount, ch->in_room); return; }
/* * Lets the mobile transfer people. The 'all' argument transfers * everyone in the current room to the specified location * * Syntax: mob transfer [target|'all'] [location] */ void do_mptransfer(CHAR_DATA * ch, char *argument) { char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH]; ROOM_INDEX_DATA *location; CHAR_DATA *victim; argument = one_argument(argument, arg1); argument = one_argument(argument, arg2); if (arg1[0] == '\0') { bug("Mptransfer - Bad syntax from vnum %d.", IS_NPC(ch) ? ch->pIndexData->vnum : 0); return; } if (!str_cmp(arg1, "all")) { CHAR_DATA *victim_next; for (victim = ch->in_room->people; victim != NULL; victim = victim_next) { victim_next = victim->next_in_room; if (!IS_NPC(victim)) { sprintf(buf, "%s %s", victim->name, arg2); do_mptransfer(ch, buf); } } return; } /* * Thanks to Grodyn for the optional location parameter. */ if (arg2[0] == '\0') { location = ch->in_room; } else { if ((location = find_location(ch, arg2)) == NULL) { bug("Mptransfer - No such location from vnum %d.", IS_NPC(ch) ? ch->pIndexData->vnum : 0); return; } if (room_is_private(location)) return; } if ((victim = get_char_world(ch, arg1)) == NULL) return; if (victim->in_room == NULL) return; if (victim->fighting != NULL) stop_fighting(victim, TRUE); char_from_room(victim); char_to_room(victim, location); do_look(victim, "auto"); return; }
void raw_kill(struct char_data *ch) { if (ch->specials.fighting) stop_fighting(ch); death_cry(ch); make_corpse(ch); affect_total(ch); extract_char(ch); }
void raw_kill(struct char_data *ch) { if (FIGHTING(ch)) stop_fighting(ch); while (ch->affected) affect_remove(ch, ch->affected); death_cry(ch); make_corpse(ch); extract_char(ch); }
void do_touchofgod(CHAR_DATA *ch, char *argument ) { CHAR_DATA *victim; char arg[MAX_INPUT_LENGTH]; int dam; argument = one_argument( argument, arg ); dam = number_range(100,200); if (IS_NPC(ch)) return; if (!IS_CLASS(ch, CLASS_ANGEL)) { send_to_char("Huh?\n\r",ch); return; } if (ch->pcdata->powers[ANGEL_JUSTICE] < 4) { send_to_char("You cannot channel the will of God yet.\n\r",ch); return; } if ((victim = get_char_room(ch, arg)) == NULL) { send_to_char("They are not here.\n\r", ch); return; } if (IS_NPC(victim)) { send_to_char("Not on mobiles.\n\r",ch); return; } if (is_safe(ch,victim)) return; if (victim == ch) { send_to_char("That doesn't seem like a good idea.\n\r",ch); return; } WAIT_STATE(ch, 18); hurt_person(ch, victim, dam); act("You grab $N by the forehead and channel God's justice into $S body.",ch,NULL,victim,TO_CHAR); act("$n grabs you by your forehead and sends a prayer to God, DAMN THAT HURT.",ch,NULL,victim,TO_VICT); act("$n grabs $N by the forehead and sends a prayer to God.",ch,NULL,victim,TO_NOTVICT); if (number_range(1,3) == 1) { if (victim->position == POS_FIGHTING) stop_fighting(victim,TRUE); act("$N screams in pain and drops to the ground as God's justice wrecks $S body.",ch,NULL,victim,TO_CHAR); act("AARGH!!! The pain is to much, you drop to the ground.",ch,NULL,victim,TO_VICT); act("$N screams in agony and falls to the ground.",ch,NULL,victim,TO_NOTVICT); victim->position = POS_STUNNED; } return; }
void check_idling(struct char_data * ch) { if (++(ch->char_specials.timer) > idle_void) { if (GET_WAS_IN(ch) == NOWHERE && IN_ROOM(ch) != NOWHERE) { GET_WAS_IN(ch) = IN_ROOM(ch); if (FIGHTING(ch)) { stop_fighting(FIGHTING(ch)); stop_fighting(ch); } act("$n disappears into the void.", TRUE, ch, 0, 0, TO_ROOM); send_to_char("You have been idle, and are pulled into a void.\r\n", ch); save_char(ch, NOWHERE); Crash_crashsave(ch); char_from_room(ch); char_to_room(ch, 1); } else if (ch->char_specials.timer > idle_rent_time) { if (IN_ROOM(ch) != NOWHERE) char_from_room(ch); char_to_room(ch, 3); if (ch->desc) { STATE(ch->desc) = CON_DISCONNECT; /* * For the 'if (d->character)' test in close_socket(). * -gg 3/1/98 (Happy anniversary.) */ ch->desc->character = NULL; ch->desc = NULL; } if (free_rent) Crash_rentsave(ch, 0); else Crash_idlesave(ch); sprintf(buf, "%s force-rented and extracted (idle).", GET_NAME(ch)); mudlog(buf, CMP, LVL_GOD, TRUE); extract_char(ch); } } }
void do_delete( CHAR_DATA * ch, char * argument ) { DESCRIPTOR_DATA * d; if ( !ch->desc ) { return; } if ( str_cmp( ch->desc->incomm, "delete yes" ) ) { send_to_char( C_DEFAULT, "If you want to DELETE yourself, type 'delete yes'\n\r", ch ); return; } if ( ch->desc->original || IS_NPC( ch ) ) { send_to_char( C_DEFAULT, "You may not delete a switched character.\n\r", ch ); return; } stop_fighting( ch, TRUE ); send_to_char( C_DEFAULT, "You are no more.\n\r", ch ); act( AT_BLOOD, "$n is no more.", ch, NULL, NULL, TO_ROOM ); info( "%s is no more.", (int)( ch->name ), 0 ); sprintf( log_buf, "$N has DELETED in room vnum %d.", ch->in_room->vnum ); wiznet( log_buf, ch, NULL, WIZ_LOGINS, 0, 0 ); // delete player file sprintf( log_buf, "%s%c/%s", PLAYER_DIR, LOWER( ch->name[ 0 ] ), capitalize( ch->name ) ); remove( log_buf ); // delete finger file sprintf( log_buf, "%s%c/%s.fng", PLAYER_DIR, LOWER( ch->name[ 0 ] ), capitalize( ch->name ) ); remove( log_buf ); // delete corpses sprintf( log_buf, "%s%c/%s.cps", PLAYER_DIR, LOWER( ch->name[ 0 ] ), capitalize( ch->name ) ); remove( log_buf ); delete_playerlist( ch->name ); d = ch->desc; extract_char( ch, TRUE ); if ( d ) { close_socket( d ); } return; }
/***************************************************************************** Chiunque veda il Verme della Morte, viene addormentato dal suo sguardo ipnotico, a meno con non azzecchi un tiro salvezza contro paralisi. *****************************************************************************/ int VermeDellaMorte( struct char_data *pChar, int nCmd, const char *szArg, struct char_data *pMob, int nType ) { if( nType == EVENT_TICK && AWAKE( pMob ) ) { struct room_data *pRoom; if( ( pRoom = real_roomp( pMob->in_room ) ) != NULL ) { struct char_data *pNext, *pTar; for( pTar = pRoom->people; pTar; pTar = pNext ) { pNext = pTar->next_in_room; if( CAN_SEE( pTar, pMob ) && ( ( IS_PC( pTar ) && !IS_SET( pTar->specials.act, PLR_NOHASSLE ) ) || ( IS_NPC( pTar ) && ( ( pTar->specials.zone != pMob->specials.zone && !strchr( zone_table[ pTar->specials.zone ].races, GET_RACE( pTar ) ) ) || IS_SET( pTar->specials.act, ACT_ANNOYING ) ) ) ) && GET_POS( pTar ) > POSITION_SLEEPING && !IsImmune( pTar, IMM_SLEEP ) ) { if( IsSusc( pTar, IMM_SLEEP ) || ( !saves_spell( pTar, SAVING_PARA ) && ( !IsResist( pTar, IMM_SLEEP ) || !saves_spell( pTar, SAVING_PARA ) ) ) ) { act( "$N ti guarda fisso. La tua vista si sdoppia.", FALSE, pTar, 0, pMob, TO_CHAR ); act( "$n cade a terra addormentat$b.", TRUE, pTar, 0, 0, TO_ROOM ); if( pTar->specials.fighting ) stop_fighting( pTar ); GET_POS( pTar ) = POSITION_SLEEPING; } } } } else mudlog( LOG_SYSERR, "pMob in invalid room in VermeDellaMorte( carceri.c )" ); } return FALSE; }
void prepare_players(void) { DESCRIPTOR_DATA *d; for(d = descriptor_list; d; d = d->next) { if(d->connected != CON_PLAYING || !d->character) continue; stop_fighting(d->character, TRUE); d->character->position = POS_STANDING; do_restore(d->character, "self"); } do_forceauto(char_list, "call all"); do_autosave(char_list, ""); }
void raw_kill(struct char_data * ch, struct char_data * killer) { if (FIGHTING(ch)) stop_fighting(ch); while (ch->affected) affect_remove(ch, ch->affected); if (killer) { if (death_mtrigger(ch, killer)) death_cry(ch); } else death_cry(ch); make_corpse(ch); extract_char(ch); }
void do_booming(CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; char arg[MAX_INPUT_LENGTH]; argument = one_argument( argument, arg ); if (IS_NPC(ch)) return; if (!IS_CLASS(ch, CLASS_TANARRI)) { send_to_char("Huh?\n\r",ch); return; } if (!IS_SET(ch->pcdata->powers[TANARRI_POWER], TANARRI_BOOMING)) { send_to_char("You don't have that power yet.\n\r",ch); return; } if ((victim = get_char_room(ch, arg)) == NULL) { send_to_char("They are not here.\n\r", ch); return; } if (IS_NPC(victim)) one_hit(ch,victim, gsn_booming, 1); else { if (victim == ch) { send_to_char("That doesn't seem like a good idea.\n\r",ch); return; } one_hit(ch,victim, gsn_booming, 1); if (victim->position == POS_FIGHTING && number_range(1,4)==2) { send_to_char("Your booming voice stuns your opponent.\n\r",ch); send_to_char("The pain is to much, and you drop to the ground.\n\r",victim); stop_fighting(victim,TRUE); victim->position = POS_STUNNED; } } WAIT_STATE(ch,12); return; }
void do_mpgoto( CHAR_DATA *ch, char *argument ) { char arg[ MAX_INPUT_LENGTH ]; ROOM_INDEX_DATA *location; if ( !IS_NPC( ch ) ) { typo_message( ch ); return; } if ( IS_SET( ch->act , ACT_PET ) || IS_AFFECTED( ch, AFF_CHARM ) ) return; one_argument( argument, arg ); if ( arg[0] == '\0' ) { sprintf( log_buf, "Mpgoto - No argument: vnum %d name %s short %s.", ch->pIndexData->vnum, ch->name, ch->short_descr ); bug( log_buf, -1 ); return; } if ( ( location = find_location( ch, arg ) ) == NULL ) { sprintf( log_buf, "Mpgoto - No such location: vnum %d name %s short %s.", ch->pIndexData->vnum, ch->name, ch->short_descr ); bug( log_buf, -1 ); return; } if ( location == ch->in_room ) return; if ( ch->fighting != NULL ) stop_fighting( ch, TRUE ); char_from_room( ch ); char_to_room( ch, location ); return; }
void do_surrender( CHAR_DATA *ch, char *argument ) { CHAR_DATA *mob; if ( (mob = ch->fighting) == NULL ) { send_to_char( "But you're not fighting!\n\r", ch ); return; } act( "You surrender to $N!", ch, NULL, mob, TO_CHAR, 1 ); act( "$n surrenders to you!", ch, NULL, mob, TO_VICT, 1 ); act( "$n tries to surrender to $N!", ch, NULL, mob, TO_NOTVICT, 0 ); stop_fighting( ch, TRUE ); if ( !IS_NPC( ch ) && IS_NPC( mob ) && ( !HAS_TRIGGER( mob, TRIG_SURR ) || !mp_percent_trigger( mob, ch, NULL, NULL, TRIG_SURR ) ) ) { act( "$N seems to ignore your cowardly act!", ch, NULL, mob,TO_CHAR,1); multi_hit( mob, ch, TYPE_UNDEFINED ); } }
void do_mpgoto( CHAR_DATA *ch, char *argument ) { char arg[ MAX_INPUT_LENGTH ]; ROOM_INDEX_DATA *location; if ( !IS_NPC( ch ) ) { send_to_char( C_DEFAULT, "Huh?\n\r", ch ); return; } if ( IS_AFFECTED( ch, AFF_CHARM ) ) { return; } one_argument( argument, arg ); if ( arg[0] == '\0' ) { bug( "Mpgoto - No argument: vnum %d.", ch->pIndexData->vnum ); return; } if ( ( location = find_location( ch, arg ) ) == NULL ) { bug( "Mpgoto - No such location: vnum %d.", ch->pIndexData->vnum ); return; } if ( location == ch->in_room ) return; if ( ch->fighting != NULL ) stop_fighting( ch, TRUE ); char_from_room( ch ); char_to_room( ch, location ); return; }
/* move a player out of a room */ void char_from_room(struct char_data * ch) { struct char_data *temp; if (ch == NULL || ch->in_room == NOWHERE) { log("SYSERR: NULL or NOWHERE in handler.c, char_from_room"); exit(1); } if (FIGHTING(ch) != NULL) { stop_fighting(ch); } if ( affected_by_spell(ch, SPELL_LIGHT) ) { world[ch->in_room].light -= 10; } if ( affected_by_spell(ch, SPELL_DARKNESS) ) { world[ch->in_room].light += 10; } if (GET_EQ(ch, WEAR_LIGHT) != NULL) { if (GET_OBJ_TYPE(GET_EQ(ch, WEAR_LIGHT)) == ITEM_LIGHT) { if (GET_OBJ_VAL(GET_EQ(ch, WEAR_LIGHT), 2)) { /* Light is ON */ world[ch->in_room].light--; } } } /* if (affected_by_spell(ch, SPELL_ENTANGLE)) affect_from_char(ch, SPELL_ENTANGLE); if (affected_by_spell(ch, SPELL_MIRE)) affect_from_char(ch, SPELL_MIRE); */ REMOVE_FROM_LIST(ch, world[ch->in_room].people, next_in_room); ch->in_room = NOWHERE; ch->next_in_room = NULL; }
void raw_kill(struct char_data * ch, struct char_data * killer) { if (FIGHTING(ch)) stop_fighting(ch); while (ch->affected) affect_remove(ch, ch->affected); /* To make ordinary commands work in scripts. welcor*/ GET_POS(ch) = POS_STANDING; if (killer) { if (check_hooks(HOOK_CONT_DIED, ch_script_cont(ch), killer, SNull, SNull )) death_cry(ch); } else death_cry(ch); update_pos(ch); make_corpse(ch); extract_char(ch); }
/* control the fights going on. Called every 2 seconds from comm.c. */ void perform_violence(void) { struct char_data *ch; for (ch = combat_list; ch; ch = next_combat_list) { next_combat_list = ch->next_fighting; if (FIGHTING(ch) == NULL || IN_ROOM(ch) != IN_ROOM(FIGHTING(ch))) { stop_fighting(ch); continue; } if (IS_NPC(ch)) { if (GET_MOB_WAIT(ch) > 0) { GET_MOB_WAIT(ch) -= PULSE_VIOLENCE; continue; } GET_MOB_WAIT(ch) = 0; if (GET_POS(ch) < POS_FIGHTING) { GET_POS(ch) = POS_FIGHTING; act("$n scrambles to $s feet!", TRUE, ch, 0, 0, TO_ROOM); } } if (GET_POS(ch) < POS_FIGHTING) { send_to_char(ch, "You can't fight while sitting!!\r\n"); continue; } if (hit(ch, FIGHTING(ch), TYPE_UNDEFINED) < -1) { continue; } if (MOB_FLAGGED(ch, MOB_SPEC) && GET_MOB_SPEC(ch) && !MOB_FLAGGED(ch, MOB_NOTDEADYET)) { char actbuf[MAX_INPUT_LENGTH] = ""; (GET_MOB_SPEC(ch)) (ch, ch, 0, actbuf, 0); } } }
/* move a player out of a room */ void char_from_room(struct char_data *ch) { struct char_data *temp; if (ch == NULL || IN_ROOM(ch) == NOWHERE) { log("SYSERR: NULL character or NOWHERE in %s, char_from_room", __FILE__); exit(1); } if (FIGHTING(ch) != NULL) stop_fighting(ch); char_from_furniture(ch); if (GET_EQ(ch, WEAR_LIGHT) != NULL) if (GET_OBJ_TYPE(GET_EQ(ch, WEAR_LIGHT)) == ITEM_LIGHT) if (GET_OBJ_VAL(GET_EQ(ch, WEAR_LIGHT), 2)) /* Light is ON */ world[IN_ROOM(ch)].light--; REMOVE_FROM_LIST(ch, world[IN_ROOM(ch)].people, next_in_room); IN_ROOM(ch) = NOWHERE; ch->next_in_room = NULL; }
/* control the fights going on. Called every 2 seconds from comm.c. */ void perform_violence(void) { struct char_data *ch; for (ch = combat_list; ch; ch = next_combat_list) { next_combat_list = ch->next_fighting; if (FIGHTING(ch) == NULL || (IN_ROOM(ch) != IN_ROOM(FIGHTING(ch))) || \ (!char_within_range_of_vict(ch, FIGHTING(ch)))) { stop_fighting(ch); continue; } if (IS_NPC(ch)) { if (GET_MOB_WAIT(ch) > 0) { GET_MOB_WAIT(ch) -= PULSE_VIOLENCE; continue; } GET_MOB_WAIT(ch) = 0; if (GET_POS(ch) < POS_FIGHTING) { GET_POS(ch) = POS_FIGHTING; act("$n scrambles to $s feet!", TRUE, ch, 0, 0, TO_ROOM); } } if (GET_POS(ch) < POS_FIGHTING) { send_to_char("You can't fight while sitting!!\r\n", ch); continue; } hit(ch, FIGHTING(ch), TYPE_UNDEFINED); /* XXX: Need to see if they can handle "" instead of NULL. */ if (MOB_FLAGGED(ch, MOB_SPEC) && mob_index[GET_MOB_RNUM(ch)].func != NULL) (mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, ""); } }
void do_mienaku( CHAR_DATA *ch, char *argument ) { ROOM_INDEX_DATA *was_in; ROOM_INDEX_DATA *now_in; CHAR_DATA *victim; int attempt; if (IS_CLASS(ch, CLASS_NINJA) && ch->pcdata->powers[NPOWER_NINGENNO] < 3 ) { send_to_char("You have not learned the Ningenno principle to 3.\n\r", ch); return; } else if (!IS_CLASS(ch, CLASS_NINJA) ) { send_to_char("Huh?\n\r", ch); return; } if ( IS_NPC(ch) ) return; if ( ( victim = ch->fighting ) == NULL ) { if ( ch->position == POS_FIGHTING ) ch->position = POS_STANDING; send_to_char( "You aren't fighting anyone.\n\r", ch ); return; } if (ch->move < 200) { send_to_char("You don't have enough movement points to flee.\n\r", ch); return; } if (IS_AFFECTED(ch, AFF_WEBBED)) { send_to_char("You are unable to move with all this sticky webbing on.\n\r",ch); return; } was_in = ch->in_room; { EXIT_DATA *pexit; int door; send_to_char("You move to vanish from combat!\n\r", ch ); for ( attempt = 0; attempt < 6; attempt++ ) { door = number_door( ); if ( ( pexit = was_in->exit[door] ) == 0 || pexit->to_room == NULL || IS_SET(pexit->exit_info, EX_CLOSED) || ( IS_NPC(ch) && IS_SET(pexit->to_room->room_flags, ROOM_NO_MOB) ) ) continue; move_char( ch, door ); if ( ( now_in = ch->in_room ) == was_in ) continue; /* Use escape instead of flee so people know it's the ninja power */ ch->in_room = was_in; act( "$n has escaped!", ch, NULL, NULL, TO_ROOM ); ch->in_room = now_in; if ( !IS_NPC(ch) ) send_to_char( "You escape from combat!\n\r", ch ); if (victim->in_room == ch->in_room) { SET_BIT(victim->extra,BLINDFOLDED); act("You start to move at super speeds and blind $N.",ch,NULL,victim,TO_CHAR); act("$n starts to move at super speeds and blinds $N.",ch,NULL,victim,TO_ROOM); act("$n starts to move at super speeds and blinds you.",ch,NULL,victim,TO_VICT); return; } ch->move -= 1000; stop_fighting( ch, TRUE ); WAIT_STATE(ch,1); return; } } return; }
void hit(struct char_data *ch, struct char_data *victim, int type) { struct obj_data *wielded = GET_EQ(ch, WEAR_WIELD); int w_type, victim_ac, calc_thaco, dam, diceroll; /* Do some sanity checking, in case someone flees, etc. */ if (IN_ROOM(ch) != IN_ROOM(victim)) { if (FIGHTING(ch) && FIGHTING(ch) == victim) stop_fighting(ch); return; } /* Find the weapon type (for display purposes only) */ if (wielded && GET_OBJ_TYPE(wielded) == ITEM_WEAPON) w_type = GET_OBJ_VAL(wielded, 3) + TYPE_HIT; else { if (IS_NPC(ch) && ch->mob_specials.attack_type != 0) w_type = ch->mob_specials.attack_type + TYPE_HIT; else w_type = TYPE_HIT; } /* Calculate chance of hit. Lower THAC0 is better for attacker. */ calc_thaco = compute_thaco(ch, victim); /* Calculate the raw armor including magic armor. Lower AC is better for defender. */ victim_ac = compute_armor_class(victim) / 10; /* roll the die and take your chances... */ diceroll = rand_number(1, 20); /* * Decide whether this is a hit or a miss. * * Victim asleep = hit, otherwise: * 1 = Automatic miss. * 2..19 = Checked vs. AC. * 20 = Automatic hit. */ if (diceroll == 20 || !AWAKE(victim)) dam = TRUE; else if (diceroll == 1) dam = FALSE; else dam = (calc_thaco - diceroll <= victim_ac); if (!dam) /* the attacker missed the victim */ damage(ch, victim, 0, type == SKILL_BACKSTAB ? SKILL_BACKSTAB : w_type); else { /* okay, we know the guy has been hit. now calculate damage. */ /* Start with the damage bonuses: the damroll and strength apply */ dam = str_app[STRENGTH_APPLY_INDEX(ch)].todam; dam += GET_DAMROLL(ch); /* Maybe holding arrow? */ if (wielded && GET_OBJ_TYPE(wielded) == ITEM_WEAPON) { /* Add weapon-based damage if a weapon is being wielded */ dam += dice(GET_OBJ_VAL(wielded, 1), GET_OBJ_VAL(wielded, 2)); } else { /* If no weapon, add bare hand damage instead */ if (IS_NPC(ch)) dam += dice(ch->mob_specials.damnodice, ch->mob_specials.damsizedice); else dam += rand_number(0, 2); /* Max 2 bare hand damage for players */ } /* * Include a damage multiplier if victim isn't ready to fight: * * Position sitting 1.33 x normal * Position resting 1.66 x normal * Position sleeping 2.00 x normal * Position stunned 2.33 x normal * Position incap 2.66 x normal * Position mortally 3.00 x normal * * Note, this is a hack because it depends on the particular * values of the POSITION_XXX constants. */ if (GET_POS(victim) < POS_FIGHTING) dam *= 1 + (POS_FIGHTING - GET_POS(victim)) / 3; /* at least 1 hp damage min per hit */ dam = MAX(1, dam); if (type == SKILL_BACKSTAB) damage(ch, victim, dam * backstab_mult(GET_LEVEL(ch)), SKILL_BACKSTAB); else damage(ch, victim, dam, w_type); } }