/* 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; }
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; }
/* syntax : discharge * (drops all elementalshields in one BIG blast) */ void do_discharge (CHAR_DATA *ch, char *argument) { CHAR_DATA *vch; CHAR_DATA *vch_next; CHAR_DATA *mount; char buf1[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH]; char buf3[MAX_STRING_LENGTH]; int magic_power = ch->spl[RED_MAGIC] + ch->spl[BLUE_MAGIC] + ch->spl[GREEN_MAGIC] + ch->spl[PURPLE_MAGIC] + ch->spl[YELLOW_MAGIC]; int dam; if (IS_NPC(ch)) return; if (!IS_CLASS(ch, CLASS_MAGE)) { send_to_char("Huh?\n\r",ch); return; } if (ch->pcdata->powers[PINVOKE] < 4) /* 4 is just a test */ { send_to_char("You don't have that invoke yet.\n\r",ch); return; } if (IS_ITEMAFF(ch, ITEMA_AFFENTROPY)) magic_power +=100; if (IS_ITEMAFF(ch, ITEMA_MAGESHIELD)) { REMOVE_BIT(ch->itemaffect, ITEMA_MAGESHIELD); for (vch = ch->in_room->people; vch != NULL; vch = vch_next) { vch_next = vch->next_in_room; if (vch != ch) { if (is_safe(ch,vch)) continue; if ((mount = ch->mount) != NULL) if (mount == vch) continue; dam = number_range(magic_power*7/2, magic_power*9/2) + ch->damroll; if (IS_AFFECTED(vch, AFF_SANCTUARY)) dam *= 0.5; sprintf(buf1,"$n's mystical shields explodes in a shower of flames striking $N [#C%d#n]",dam); sprintf(buf2,"Your mystical shields explodes in a shower of flames striking $N [#C%d#n]",dam); sprintf(buf3,"$n's mystical shields explodes in a shower of flames striking you [#C%d#n]",dam); act(buf1,ch,NULL,vch, TO_NOTVICT); act(buf2,ch,NULL,vch, TO_CHAR); act(buf3,ch,NULL,vch, TO_VICT); hurt_person(ch,vch,dam); if (vch->position > POS_STUNNED) { if (vch->fighting == NULL) set_fighting(vch, ch); if (ch->fighting == NULL) set_fighting(ch, vch); } } } } return; }
/** * @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); }
void do_drowfire(CHAR_DATA * ch, char *argument) { AFFECT_DATA af; CHAR_DATA *victim; if (ch->race != RACE_DROW) { send_to_char(AT_GREY, "Drowfire by a non-drow?\n\r", ch); return; } if (argument[0] != '\0') { if (!(victim = get_char_room(ch, argument))) { send_to_char(C_DEFAULT, "They aren't here.\n\r", ch); return; } } else { if (!(victim = ch->fighting)) { send_to_char(C_DEFAULT, "You aren't fighting anyone.\n\r", ch); return; } } if (is_affected(victim, gsn_drowfire)) return; WAIT_STATE(ch, skill_table[gsn_drowfire].beats); af.type = gsn_drowfire; af.level = ch->level; af.duration = ch->level / 10; af.location = APPLY_AC; af.modifier = 5 * ch->level; af.bitvector = 0; affect_to_char(victim, &af); af.location = APPLY_HITROLL; af.modifier = 0 - ch->level / 5; af.bitvector = 0; affect_to_char(victim, &af); send_to_char(AT_PINK, "You are surrounded by a purple outline.\n\r", victim); act(AT_PINK, "$n is surrounded by a purple outline.", victim, NULL, NULL, TO_ROOM); if (!victim->fighting) set_fighting(victim, ch); return; }
void do_disarm(struct char_data *ch, char *argument, int cmd) { char name[30]; int percent; struct char_data *victim; struct obj_data *w; int chance; int cost; if (check_peaceful(ch,"You feel too peaceful to contemplate violence.\n\r")) return; only_argument(argument, name); if (!(victim = get_char_room_vis(ch, name))) { if (ch->specials.fighting) { victim = ch->specials.fighting; } else { send_to_char("Disarm who?\n\r", ch); return; } } if (victim == ch) { send_to_char("Aren't we funny today...\n\r", ch); return; } if(!CheckKill(ch,victim)) return; if(ch->attackers > 3) { send_to_char("There is no room to disarm!\n\r", ch); return; } if(victim->attackers > 3) { send_to_char("There is no room to disarm!\n\r",ch); return; } cost = 25 - (GET_LEVEL(ch,BestFightingClass(ch))/10); if(GET_MANA(ch)<cost) { send_to_char("You trip and fall while trying to disarm.\n\r",ch); return; } percent=number(1,101); /* 101% is a complete failure */ percent -= dex_app[GET_DEX(ch)].reaction; percent += dex_app[GET_DEX(victim)].reaction; if(!ch->equipment[WIELD] && !ch->equipment[WIELD_TWOH]) { percent -= 50; } if(percent > ch->skills[SKILL_DISARM].learned) { /* failure */ GET_MANA(ch) -= 10; act("You try to disarm $N, but fail miserably.",TRUE,ch,0,victim,TO_CHAR); if((ch->equipment[WIELD]) && (number(1,10) > 8)) { send_to_char("Your weapon flies from your hand while trying!\n\r",ch); w = unequip_char(ch,WIELD); obj_from_char(w); obj_to_room(w,ch->in_room); act("$n tries to disarm $N, but $n loses his weapon!",TRUE,ch,0,victim,TO_ROOM); } else if((ch->equipment[WIELD_TWOH]) && (number(1,10) > 9)) { send_to_char("Your weapon slips from your hands while trying!\n\r",ch); w = unequip_char(ch,WIELD_TWOH); obj_from_char(w); obj_to_room(w,ch->in_room); act("$n tries to disarm $N, but $n loses his weapon!",TRUE,ch,0,victim,TO_ROOM); } GET_POS(ch) = POSITION_SITTING; if((IS_NPC(victim)) && (GET_POS(victim) > POSITION_SLEEPING) && (!victim->specials.fighting)) { set_fighting(victim, ch); } WAIT_STATE(ch, PULSE_VIOLENCE*2); } else { if(victim->equipment[WIELD]) { GET_MANA(ch) -= 25; w = unequip_char(victim, WIELD); act("$n makes an impressive fighting move.",TRUE, ch, 0, 0, TO_ROOM); act("You send $p flying from $N's grasp.", TRUE, ch, w, victim, TO_CHAR); act("$p flies from your grasp.", TRUE, ch, w, victim, TO_VICT); obj_from_char(w); obj_to_room(w, victim->in_room); if(ch->skills[SKILL_DISARM].learned < 50) ch->skills[SKILL_DISARM].learned += 2; } else if(victim->equipment[WIELD_TWOH]) { GET_MANA(ch) -= cost; if(IS_NPC(victim)) chance = 70; else chance = victim->skills[SKILL_TWO_HANDED].learned; percent=number(1,101); /* 101% is a complete failure */ if(percent > chance) { w = unequip_char(victim, WIELD_TWOH); act("$n makes a very impressive fighting move.",TRUE, ch, 0, 0, TO_ROOM); act("You send $p flying from $N's grasp.", TRUE, ch, w, victim, TO_CHAR); act("$p flies from your grasp.", TRUE, ch, w, victim, TO_VICT); obj_from_char(w); obj_to_room(w, victim->in_room); if(ch->skills[SKILL_DISARM].learned < 50) ch->skills[SKILL_DISARM].learned += 4; } else { act("You try to disarm $N, but fail miserably.",TRUE,ch,0,victim,TO_CHAR); } } else { act("You try to disarm $N, but $E doesn't have a weapon.", TRUE, ch, 0, victim, TO_CHAR); act("$n makes an impressive fighting move, but does little more.", TRUE, ch, 0, 0, TO_ROOM); } if ((IS_NPC(victim)) && (GET_POS(victim) > POSITION_SLEEPING) && (!victim->specials.fighting)) { set_fighting(victim, ch); } WAIT_STATE(ch, PULSE_VIOLENCE*1); } }
void found_prey( CHAR_DATA * ch, CHAR_DATA * victim ) { char buf[MAX_STRING_LENGTH]; char victname[MAX_STRING_LENGTH]; if( victim == NULL ) { bug( "%s", "Found_prey: null victim" ); return; } if( victim->in_room == NULL ) { bug( "%s", "Found_prey: null victim->in_room" ); return; } mudstrlcpy( victname, IS_NPC( victim ) ? victim->short_descr : victim->name, MAX_STRING_LENGTH ); if( !can_see( ch, victim ) ) { if( number_percent( ) < 90 ) return; switch ( number_bits( 2 ) ) { case 0: snprintf( buf, MAX_STRING_LENGTH, "Don't make me find you, %s!", victname ); do_say( ch, buf ); break; case 1: act( AT_ACTION, "$n sniffs around the room for $N.", ch, NULL, victim, TO_NOTVICT ); act( AT_ACTION, "You sniff around the room for $N.", ch, NULL, victim, TO_CHAR ); act( AT_ACTION, "$n sniffs around the room for you.", ch, NULL, victim, TO_VICT ); do_say( ch, "I can smell your blood!" ); break; case 2: snprintf( buf, MAX_STRING_LENGTH, "I'm going to tear %s apart!", victname ); do_yell( ch, buf ); break; case 3: do_say( ch, "Just wait until I find you..." ); break; } return; } if( xIS_SET( ch->in_room->room_flags, ROOM_SAFE ) ) { if( number_percent( ) < 90 ) return; switch ( number_bits( 2 ) ) { case 0: do_say( ch, "C'mon out, you coward!" ); snprintf( buf, MAX_STRING_LENGTH, "%s is a bloody coward!", victname ); do_yell( ch, buf ); break; case 1: snprintf( buf, MAX_STRING_LENGTH, "Let's take this outside, %s", victname ); do_say( ch, buf ); break; case 2: snprintf( buf, MAX_STRING_LENGTH, "%s is a yellow-bellied wimp!", victname ); do_yell( ch, buf ); break; case 3: act( AT_ACTION, "$n takes a few swipes at $N.", ch, NULL, victim, TO_NOTVICT ); act( AT_ACTION, "You try to take a few swipes $N.", ch, NULL, victim, TO_CHAR ); act( AT_ACTION, "$n takes a few swipes at you.", ch, NULL, victim, TO_VICT ); break; } return; } switch ( number_bits( 2 ) ) { case 0: snprintf( buf, MAX_STRING_LENGTH, "Your blood is mine, %s!", victname ); do_yell( ch, buf ); break; case 1: snprintf( buf, MAX_STRING_LENGTH, "Alas, we meet again, %s!", victname ); do_say( ch, buf ); break; case 2: snprintf( buf, MAX_STRING_LENGTH, "What do you want on your tombstone, %s?", victname ); do_say( ch, buf ); break; case 3: act( AT_ACTION, "$n lunges at $N from out of nowhere!", ch, NULL, victim, TO_NOTVICT ); act( AT_ACTION, "You lunge at $N catching $M off guard!", ch, NULL, victim, TO_CHAR ); act( AT_ACTION, "$n lunges at you from out of nowhere!", ch, NULL, victim, TO_VICT ); } stop_hunting( ch ); set_fighting( ch, victim ); multi_hit( ch, victim, TYPE_UNDEFINED ); return; }
void do_gbanish( CHAR_DATA *ch, char *argument ) { CHAR_DATA *victim; CHAR_DATA *mount; char buf[MAX_STRING_LENGTH]; char arg[MAX_INPUT_LENGTH]; int dam; argument = one_argument( argument, arg ); if (IS_NPC(ch)) return; if (!IS_CLASS(ch, CLASS_ANGEL)) { send_to_char("Huh?\n\r",ch); return; } if (ch->pcdata->powers[ANGEL_HARMONY] < 3) { send_to_char("Your not in contact with your inner harmonies.\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; } if (victim->alignment > 500) { send_to_char("They are not evil, you cannot punish them.\n\r",ch); return; } if (victim->alignment > 0) dam = 500; else if (victim->alignment > - 500) dam = 1000; else dam = 1500; sprintf(buf,"Your call for God to banish $N and $S is hurt [%d]",dam); act(buf,ch,NULL,victim,TO_CHAR); sprintf(buf,"$n calls for God to banish you, and it hurts BAD! [%d]",dam); act(buf,ch,NULL,victim,TO_VICT); sprintf(buf,"$n calls for God to Banish $N."); act(buf,ch,NULL,victim,TO_NOTVICT); hurt_person(ch,victim,dam); if (number_range(1,10) > 7) { act( "$n is flung into a vortex and disappears.", victim, NULL, NULL, TO_ROOM ); char_from_room( victim ); char_to_room( victim, get_room_index(ROOM_VNUM_HELL)); act( "$n is flung out of a vortex.", victim, NULL, NULL, TO_ROOM ); do_look(victim, "auto"); if ((mount = victim->mount) == NULL) return; char_from_room( mount ); char_to_room(mount, victim->in_room); do_look(mount, "auto"); return; } if (victim->position > POS_STUNNED) { if (victim->fighting == NULL) set_fighting(victim, ch); if (ch->fighting == NULL) set_fighting(ch, victim); } WAIT_STATE(ch,18); return; }
void found_prey( CHAR_DATA *ch, CHAR_DATA *victim ) { char buf[MAX_STRING_LENGTH]; char victname[MAX_STRING_LENGTH]; if (victim == NULL) { bug("Found_prey: null victim", 0); return; } if ( victim->in_room == NULL ) { bug( "Found_prey: null victim->in_room", 0 ); return; } sprintf( victname, IS_NPC( victim ) ? victim->short_descr : victim->nwol ); if ( !can_see(ch, victim) ) { if ( number_percent( ) < 90 ) return; switch( number_bits( 2 ) ) { case 0: sprintf( buf, "Nie kaz mi Cie szukac, %s!", victname ); do_say( ch, buf ); break; case 1: act( AT_ACTION, "$n sniffs around the room for $N.", ch, NULL, victim, TO_NOTVICT ); act( AT_ACTION, "You sniff around the room for $N.", ch, NULL, victim, TO_CHAR ); act( AT_ACTION, "$n sniffs around the room for you.", ch, NULL, victim, TO_VICT ); sprintf( buf, "I can smell your blood!" ); do_say( ch, buf ); break; case 2: sprintf( buf, "I'm going to tear %s apart!", victname ); do_yell( ch, buf ); break; case 3: do_say( ch, "Just wait until I find you..."); break; } return; } if ( IS_SET( ch->in_room->room_flags, ROOM_SAFE ) ) { if ( number_percent( ) < 90 ) return; switch( number_bits( 2 ) ) { case 0: do_say( ch, "C'mon out, you coward!" ); sprintf( buf, "%s is a bloody coward!", victname ); do_yell( ch, buf ); break; case 1: sprintf( buf, "Let's take this outside, %s", victname ); do_say( ch, buf ); break; case 2: sprintf( buf, "%s is a yellow-bellied wimp!", victname ); do_yell( ch, buf ); break; case 3: act( AT_ACTION, "$n takes a few swipes at $N.", ch, NULL, victim, TO_NOTVICT ); act( AT_ACTION, "You try to take a few swipes $N.", ch, NULL, victim, TO_CHAR ); act( AT_ACTION, "$n takes a few swipes at you.", ch, NULL, victim, TO_VICT ); break; } return; } switch( number_bits( 2 ) ) { case 0: sprintf( buf, "Twoja krew jest moja, %s!", victname ); do_yell( ch, buf); break; case 1: sprintf( buf, "Ha, znow sie spotykamy, %s!", victname ); do_say( ch, buf ); break; case 2: sprintf( buf, "Co sobie zyczysz wypisac na nagrobku, %s?", victname ); do_say( ch, buf ); break; case 3: act( AT_ACTION, "$n lunges at $N from out of nowhere!", ch, NULL, victim, TO_NOTVICT ); act( AT_ACTION, "You lunge at $N catching $M off guard!", ch, NULL, victim, TO_CHAR ); act( AT_ACTION, "$n lunges at you from out of nowhere!", ch, NULL, victim, TO_VICT ); } stop_hunting( ch ); set_fighting( ch, victim ); multi_hit(ch, victim, TYPE_UNDEFINED); return; }
/* * Alert: As of bpl14, this function returns the following codes: * < 0 Victim died. * = 0 No damage. * > 0 How much damage done. */ int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype) { if (GET_POS(victim) <= POS_DEAD) { /* This is "normal"-ish now with delayed extraction. -gg 3/15/2001 */ if (PLR_FLAGGED(victim, PLR_NOTDEADYET) || MOB_FLAGGED(victim, MOB_NOTDEADYET)) return (-1); log("SYSERR: Attempt to damage corpse '%s' in room #%d by '%s'.", GET_NAME(victim), GET_ROOM_VNUM(IN_ROOM(victim)), GET_NAME(ch)); die(victim); return (-1); /* -je, 7/7/92 */ } /* peaceful rooms */ if (ch != victim && ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL)) { send_to_char(ch, "This room just has such a peaceful, easy feeling...\r\n"); return (0); } /* shopkeeper protection */ if (!ok_damage_shopkeeper(ch, victim)) return (0); /* You can't damage an immortal! */ if (!IS_NPC(victim) && (GET_LEVEL(victim) >= LVL_IMMORT)) dam = 0; if (victim != ch) { /* Start the attacker fighting the victim */ if (GET_POS(ch) > POS_STUNNED && (FIGHTING(ch) == NULL)) set_fighting(ch, victim); /* Start the victim fighting the attacker */ if (GET_POS(victim) > POS_STUNNED && (FIGHTING(victim) == NULL)) { set_fighting(victim, ch); if (MOB_FLAGGED(victim, MOB_MEMORY) && !IS_NPC(ch)) remember(victim, ch); } } /* If you attack a pet, it hates your guts */ if (victim->master == ch) stop_follower(victim); /* If the attacker is invisible, he becomes visible */ if (AFF_FLAGGED(ch, AFF_INVISIBLE | AFF_HIDE)) appear(ch); /* Cut damage in half if victim has sanct, to a minimum 1 */ if (AFF_FLAGGED(victim, AFF_SANCTUARY) && dam >= 2) dam /= 2; /* Check for PK if this is not a PK MUD */ if (!pk_allowed) { check_killer(ch, victim); if (PLR_FLAGGED(ch, PLR_KILLER) && (ch != victim)) dam = 0; } /* Set the maximum damage per round and subtract the hit points */ dam = MAX(MIN(dam, 100), 0); GET_HIT(victim) -= dam; /* Gain exp for the hit */ if (ch != victim) gain_exp(ch, GET_LEVEL(victim) * dam); update_pos(victim); /* * skill_message sends a message from the messages file in lib/misc. * dam_message just sends a generic "You hit $n extremely hard.". * skill_message is preferable to dam_message because it is more * descriptive. * * If we are _not_ attacking with a weapon (i.e. a spell), always use * skill_message. If we are attacking with a weapon: If this is a miss or a * death blow, send a skill_message if one exists; if not, default to a * dam_message. Otherwise, always send a dam_message. */ if (!IS_WEAPON(attacktype)) skill_message(dam, ch, victim, attacktype); else { if (GET_POS(victim) == POS_DEAD || dam == 0) { if (!skill_message(dam, ch, victim, attacktype)) dam_message(dam, ch, victim, attacktype); } else { dam_message(dam, ch, victim, attacktype); } } /* Use send_to_char -- act() doesn't send message if you are DEAD. */ switch (GET_POS(victim)) { case POS_MORTALLYW: act("$n is mortally wounded, and will die soon, if not aided.", TRUE, victim, 0, 0, CommTarget::TO_ROOM); send_to_char(victim, "You are mortally wounded, and will die soon, if not aided.\r\n"); break; case POS_INCAP: act("$n is incapacitated and will slowly die, if not aided.", TRUE, victim, 0, 0, CommTarget::TO_ROOM); send_to_char(victim, "You are incapacitated an will slowly die, if not aided.\r\n"); break; case POS_STUNNED: act("$n is stunned, but will probably regain consciousness again.", TRUE, victim, 0, 0, CommTarget::TO_ROOM); send_to_char(victim, "You're stunned, but will probably regain consciousness again.\r\n"); break; case POS_DEAD: act("$n is dead! R.I.P.", FALSE, victim, 0, 0, CommTarget::TO_ROOM); send_to_char(victim, "You are dead! Sorry...\r\n"); break; default: /* >= POSITION SLEEPING */ if (dam > (GET_MAX_HIT(victim) / 4)) send_to_char(victim, "That really did HURT!\r\n"); if (GET_HIT(victim) < (GET_MAX_HIT(victim) / 4)) { send_to_char(victim, "%sYou wish that your wounds would stop BLEEDING so much!%s\r\n", CCRED(victim, C_SPR), CCNRM(victim, C_SPR)); if (ch != victim && MOB_FLAGGED(victim, MOB_WIMPY)) do_flee(victim, NULL, 0, 0); } if (!IS_NPC(victim) && GET_WIMP_LEV(victim) && (victim != ch) && GET_HIT(victim) < GET_WIMP_LEV(victim) && GET_HIT(victim) > 0) { send_to_char(victim, "You wimp out, and attempt to flee!\r\n"); do_flee(victim, NULL, 0, 0); } break; } /* Help out poor linkless people who are attacked */ if (!IS_NPC(victim) && !(victim->desc) && GET_POS(victim) > POS_STUNNED) { do_flee(victim, NULL, 0, 0); if (!FIGHTING(victim)) { act("$n is rescued by divine forces.", FALSE, victim, 0, 0, CommTarget::TO_ROOM); GET_WAS_IN(victim) = IN_ROOM(victim); char_from_room(victim); char_to_room(victim, 0); } } /* stop someone from fighting if they're stunned or worse */ if (GET_POS(victim) <= POS_STUNNED && FIGHTING(victim) != NULL) stop_fighting(victim); /* Uh oh. Victim died. */ if (GET_POS(victim) == POS_DEAD) { if (ch != victim && (IS_NPC(victim) || victim->desc)) { if (AFF_FLAGGED(ch, AFF_GROUP)) group_gain(ch, victim); else solo_gain(ch, victim); } if (!IS_NPC(victim)) { mudlog(BRF, LVL_IMMORT, TRUE, "%s killed by %s at %s", GET_NAME(victim), GET_NAME(ch), world[IN_ROOM(victim)].name); if (MOB_FLAGGED(ch, MOB_MEMORY)) forget(ch, victim); } die(victim); return (-1); } return (dam); }
bool sp_damage( OBJ_DATA * obj, CHAR_DATA * ch, CHAR_DATA * victim, int dam, int type, int sn, bool show_msg ) { int ch_strong, ch_weak, ch_race, ch_suscept, ch_resist, vi_strong, vi_weak, vi_race, vi_suscept, vi_resist; float dam_modifier = 1.0; float tmp = 0; bool can_reflect = TRUE; bool can_absorb = TRUE; if ( victim == NULL ) return FALSE; /* * First, check caster's strengths and weaknesses. * */ if ( IS_SET( type, NO_REFLECT ) ) { REMOVE_BIT( type, NO_REFLECT ); can_reflect = FALSE; } if ( IS_SET( type, NO_ABSORB ) ) { REMOVE_BIT( type, NO_ABSORB ); can_absorb = FALSE; } if ( obj == NULL ) { if ( ( can_reflect ) && ( skill_table[sn].target == TAR_CHAR_OFFENSIVE ) && ( IS_AFFECTED( victim, AFF_CLOAK_REFLECTION ) ) && ( ch != victim ) && ( number_percent( ) < ( victim->get_level("psuedo") - 70 ) ) ) { act( "@@N$n's @@lc@@el@@ro@@ya@@ak@@N glows brightly as $Nn's spell hits it, and the spell is reflected@@N!!", ch, victim, NULL, TO_ROOM ); act( "@@N$N's @@lc@@el@@ro@@ya@@ak@@N glows brightly, and reflects your spell back on you@@N!!", ch, NULL, victim, TO_CHAR ); act( "@@NYour @@lc@@el@@ro@@ya@@ak@@N glows brightly, and reflects the spell back on $N@@N!!!", victim, NULL, ch, TO_CHAR ); ( *skill_table[sn].spell_fun ) ( sn, 60, ch, ( void * )ch, NULL ); return FALSE; } else if ( ( can_reflect ) && ( skill_table[sn].target == TAR_CHAR_OFFENSIVE ) && ( IS_AFFECTED( victim, AFF_CLOAK_ABSORPTION ) ) && ( ch != victim ) && ( number_percent( ) < ( victim->get_level("psuedo") - 55 ) ) ) { int mana; mana = mana_cost( ch, sn ); victim->mana = UMIN( victim->max_mana, victim->mana + mana ); act( "@@N$n's @@lcloak@@N glows brightly as $N's spell hits it, then fades@@N!!", victim, NULL, ch, TO_ROOM ); act( "@@N$N's @@lcloak@@N glows brightly, and absorbs your spell@@N!!", ch, NULL, victim, TO_CHAR ); act( "@@NYour @@lcloak@@N glows brightly, and absorbs $N's spell@@N!!!", victim, NULL, ch, TO_CHAR ); return FALSE; } ch_strong = ( IS_NPC( ch ) ? ( ( ( ch->race > 0 ) && ( ch->race < MAX_RACE ) ) ? race_table[ch->race].strong_realms : ch->npcdata->strong_magic ) : race_table[ch->race].strong_realms ); ch_resist = ( IS_NPC( ch ) ? ( ( ( ch->race > 0 ) && ( ch->race < MAX_RACE ) ) ? race_table[ch->race].resist_realms : ch->npcdata->resist ) : race_table[ch->race].resist_realms ); ch_weak = ( IS_NPC( ch ) ? ( ( ( ch->race > 0 ) && ( ch->race < MAX_RACE ) ) ? race_table[ch->race].weak_realms : ch->npcdata->weak_magic ) : race_table[ch->race].weak_realms ); ch_suscept = ( IS_NPC( ch ) ? ( ( ( ch->race > 0 ) && ( ch->race < MAX_RACE ) ) ? race_table[ch->race].suscept_realms : ch->npcdata->suscept ) : race_table[ch->race].suscept_realms ); ch_race = ( IS_NPC( ch ) ? ( ( ( ch->race > 0 ) && ( ch->race < MAX_RACE ) ) ? race_table[ch->race].race_flags : ch->race_mods ) : race_table[ch->race].race_flags ); if ( IS_SET( ch_strong, type ) ) { dam_modifier += .35; } else if ( IS_SET( ch_weak, type ) ) { dam_modifier -= .35; } if ( IS_SET( ch_race, RACE_MOD_STRONG_MAGIC ) ) { dam_modifier += .25; } else if ( IS_SET( ch_race, RACE_MOD_WEAK_MAGIC ) ) { dam_modifier -= .25; } else if ( IS_SET( ch_race, RACE_MOD_NO_MAGIC ) ) { dam_modifier -= .50; } if ( ch->stance == STANCE_CASTER ) dam_modifier += .10; else if ( ch->stance == STANCE_WIZARD ) dam_modifier += .25; else if ( ch->stance == STANCE_MAGI ) dam_modifier += .30; if ( ( !IS_NPC( ch ) ) && ( !IS_SET( type, REALM_MIND ) ) ) { if ( ch->pcdata->learned[gsn_potency] > 0 ) { dam_modifier += ( get_curr_int( ch ) * ch->pcdata->learned[gsn_potency] / 5000 ); } if ( ch->pcdata->learned[gsn_thaumatergy] > 0 ) { dam_modifier += ( get_curr_int( ch ) * ch->pcdata->learned[gsn_thaumatergy] / 2500 ); } } if ( is_affected( ch, skill_lookup( "mystical focus" ) ) ) { dam_modifier += .5; } } /* obj == NULL */ else if ( obj->carried_by != NULL ) { ch = obj->carried_by; } else { snprintf( log_buf, (2 * MIL), "Error, object %s casting spell, but not carried by anyone.", obj->short_descr ); monitor_chan( log_buf, MONITOR_DEBUG ); return FALSE; } /* * Next, the victim * */ vi_strong = ( IS_NPC( victim ) ? ( ( ( victim->race > 0 ) && ( victim->race < MAX_RACE ) ) ? race_table[victim->race].strong_realms : victim->npcdata->strong_magic ) : race_table[victim->race].strong_realms ); vi_resist = ( IS_NPC( victim ) ? ( ( ( victim->race > 0 ) && ( victim->race < MAX_RACE ) ) ? race_table[victim->race].resist_realms : victim->npcdata->resist ) : race_table[victim->race].resist_realms ); vi_weak = ( IS_NPC( victim ) ? ( ( ( victim->race > 0 ) && ( victim->race < MAX_RACE ) ) ? race_table[victim->race].weak_realms : victim->npcdata->weak_magic ) : race_table[victim->race].weak_realms ); vi_suscept = ( IS_NPC( victim ) ? ( ( ( victim->race > 0 ) && ( victim->race < MAX_RACE ) ) ? race_table[victim->race].suscept_realms : victim->npcdata->suscept ) : race_table[victim->race].suscept_realms ); vi_race = ( IS_NPC( victim ) ? ( ( ( victim->race > 0 ) && ( victim->race < MAX_RACE ) ) ? race_table[victim->race].race_flags : victim->race_mods ) : race_table[victim->race].race_flags ); if ( IS_SET( vi_suscept, type ) ) { dam_modifier += .45; } else if ( IS_SET( vi_resist, type ) ) { dam_modifier -= .45; } else if ( IS_SET( vi_race, RACE_MOD_NO_MAGIC ) ) { dam_modifier -= .25; } if ( MAGIC_STANCE( ch ) ) dam_modifier += .15; if ( ( IS_SET( type, REALM_MIND ) ) && ( !HAS_MIND( victim ) ) ) dam_modifier = 0.0; else if ( ( ( IS_SET( type, REALM_IMPACT ) ) || ( IS_SET( type, REALM_ACID ) ) || ( IS_SET( type, REALM_GAS ) ) ) && ( !HAS_BODY( victim ) ) ) dam_modifier = 0.0; if ( ( IS_SET( type, REALM_POISON ) ) && ( IS_SET( vi_race, RACE_MOD_IMMUNE_POISON ) ) ) dam_modifier = 0.0; if ( ( IS_SET( type, REALM_DRAIN ) ) && ( IS_UNDEAD( victim ) ) ) dam_modifier = 0.0; tmp = dam; tmp *= dam_modifier; if ( check_charm_aff(ch, CHARM_AFF_MAGE) ) tmp *= ((100 + get_charm_bonus(ch, CHARM_AFF_MAGE)) / 100); dam = static_cast<int>(tmp); dam += number_range(static_cast<int>((dam * -0.10)), static_cast<int>((dam * 0.10))); /* Lets add a little randomness to things. --Kline */ if ( victim != ch ) { /* * Certain attacks are forbidden. * Most other attacks are returned. */ if ( is_safe( ch, victim ) ) return FALSE; if ( victim != ch->fighting ) check_killer( ch, victim ); if ( victim->position > POS_STUNNED ) { if ( victim->fighting == NULL ) set_fighting( victim, ch, FALSE ); victim->position = POS_FIGHTING; } if ( victim->position > POS_STUNNED ) { if ( ch->fighting == NULL ) { set_fighting( ch, victim, TRUE ); } /* * If victim is charmed, ch might attack victim's master. */ if ( IS_NPC( ch ) && IS_NPC( victim ) && IS_AFFECTED( victim, AFF_CHARM ) && victim->master != NULL && victim->master->in_room == ch->in_room && number_bits( 3 ) == 0 ) { stop_fighting( ch ); one_hit( ch, victim->master, TYPE_UNDEFINED ); } } /* * More charm stuff. */ if ( victim->master == ch ) stop_follower( victim ); /* * Inviso attacks ... not. */ if ( IS_AFFECTED( ch, AFF_INVISIBLE ) ) { affect_strip( ch, gsn_invis ); affect_strip( ch, gsn_mass_invis ); REMOVE_BIT( ch->affected_by, AFF_INVISIBLE ); act( "$n shimmers into existence.", ch, NULL, NULL, TO_ROOM ); } /* * Damage modifiers. */ if ( dam < 0 ) dam = 0; /* * Stop up any residual loopholes. */ if ( dam > sysdata.damcap ) { char buf[MAX_STRING_LENGTH]; snprintf( buf, MSL, "Spell: %d damage by %s, spell %s", dam, ( obj == NULL ) ? ch->get_name() : obj->short_descr, skill_table[sn].name ); if ( ch->level < 82 ) monitor_chan( buf, MONITOR_MAGIC ); log_f( "%s", buf ); dam = sysdata.damcap; } if ( ( show_msg ) && ( dam >= 0 ) ) sp_dam_message( obj, ch, victim, dam, type, sn ); } /* * Hurt the victim. * Inform the victim of his new state. */ victim->hit -= dam; if ( !IS_NPC(ch) ) { if ( dam > ch->pcdata->records->mdam_amt ) { send_to_char("@@yYou've broken your magical damage record!@@N\r\n", ch); ch->pcdata->records->mdam_amt = dam; ch->pcdata->records->mdam_gsn = sn; } } if ( !IS_NPC( victim ) ) check_adrenaline( victim, dam ); if ( !IS_NPC( victim ) && IS_WOLF( victim ) && ( dam > 350 ) ) do_rage( victim, "FORCE" ); update_pos( victim ); if ( ( IS_NPC( victim ) || !IS_VAMP( victim ) ) && !( deathmatch ) ) { switch ( victim->position ) { case POS_MORTAL: act( "$n is mortally wounded, and will die soon, if not aided.", victim, NULL, NULL, TO_ROOM ); send_to_char( "You are mortally wounded, and will die soon, if not aided.\r\n", victim ); break; case POS_INCAP: act( "$n is incapacitated and will slowly die, if not aided.", victim, NULL, NULL, TO_ROOM ); send_to_char( "You are incapacitated and will slowly die, if not aided.\r\n", victim ); break; case POS_STUNNED: act( "$n is too stunned to do anything!", victim, NULL, NULL, TO_ROOM ); send_to_char( "You are too stunned to do anything!\r\n", victim ); break; case POS_DEAD: act( "$n is DEAD!!", victim, 0, 0, TO_ROOM ); send_to_char( "You have been KILLED!!\r\n\r\n", victim ); break; default: if ( dam > victim->max_hit / 4 ) send_to_char( "That really did HURT!\r\n", victim ); if ( victim->hit < victim->max_hit / 4 ) send_to_char( "You sure are BLEEDING!\r\n", victim ); break; } } /* end of if statement */ /* * Sleep spells and extremely wounded folks. */ if ( !IS_AWAKE( victim ) ) stop_fighting( victim ); /* * Payoff for killing things. */ if ( victim->position == POS_DEAD && ( IS_NPC( victim ) || !IS_VAMP( victim ) || ( deathmatch ) ) ) { group_gain( ch, victim ); /* * Sort out kill counts..... */ if ( !IS_NPC( ch ) ) { if ( !IS_NPC( victim ) ) ch->pcdata->records->pk++; else ch->pcdata->records->mk++; } if ( !IS_NPC( victim ) ) { if ( !IS_NPC( ch ) ) victim->pcdata->records->pd++; else victim->pcdata->records->md++; } if ( !IS_NPC( victim ) || victim->act.test(ACT_INTELLIGENT) ) { snprintf( log_buf, (2 * MIL), "%s killed by %s at %d", victim->get_name(), ch->get_name(), victim->in_room->vnum ); log_string( log_buf ); notify( log_buf, 82 ); /* * As level gain is no longer automatic, a dead char loses * * 1/2 their gained exp. -S- * * Fixed my bug here too, hehe! */ if ( victim->exp > 0 ) { int lose = (victim->exp / 2); lose *= -1; victim->gain_exp(lose); } } if ( IS_NPC( ch ) ) raw_kill( victim, "" ); else { char name_buf[MAX_STRING_LENGTH]; snprintf( name_buf, MSL, "%s", ch->name.c_str() ); raw_kill( victim, name_buf ); } if ( deathmatch && !IS_NPC( victim ) ) do_quit( victim, "" ); if ( IS_NPC( ch ) && IS_NPC( victim ) && ch->act.test(ACT_INTELLIGENT) ) { do_get( ch, "all corpse" ); do_sacrifice( ch, "corpse" ); } if ( !IS_NPC( ch ) && IS_NPC( victim ) ) { if ( ch->act.test(ACT_AUTOLOOT) ) do_get( ch, "all corpse" ); else do_look( ch, "in corpse" ); if ( ch->act.test(ACT_AUTOSAC) ) do_sacrifice( ch, "corpse" ); } return FALSE; } if ( victim == ch ) return TRUE; /* * Take care of link dead people. */ if ( !IS_NPC( victim ) && victim->desc == NULL ) { if ( number_range( 0, victim->wait ) == 0 ) { do_recall( victim, "" ); return TRUE; } } /* * Wimp out? */ if ( IS_NPC( victim ) && dam > 0 ) { if ( ( victim->act.test(ACT_WIMPY) && number_bits( 1 ) == 0 && victim->hit < victim->max_hit / 2 ) || ( IS_AFFECTED( victim, AFF_CHARM ) && victim->master != NULL && victim->master->in_room != victim->in_room ) ) do_flee( victim, "" ); } if ( !IS_NPC( victim ) && victim->hit > 0 && victim->hit <= victim->wimpy && victim->wait == 0 ) do_flee( victim, "" ); return TRUE; }
/* * Inflict damage from a hit. */ int damage(CHAR_DATA *ch,CHAR_DATA *victim,int dam,int dt,int dam_type, bool show, int agg, int combo) { /*OBJ_DATA *corpse;*/ bool immune; if ( victim->position == P_DEAD ) return P_DEAD; /* @@@@@ FIX TORPOR if ( victim->position == P_TORPOR ) return P_TORPOR; */ /* damage reduction */ if ( dam > 15) dam = (dam - 5)/2 + 5; if(IS_SET(ch->form, FORM_HORRID)) dam++; /* @@@@@ FIX BITE DAMAGE FOR SERPENTIS 3 if(is_affected(ch, skill_lookup("skin of the adder")) && dam_type == DAM_BITE) dam++; */ /* In case of -ve agg ratings */ if (agg < 0) agg = 0; /* soakage */ dam = do_soak(victim, dam, agg); if ( victim != ch ) { if ( victim->position > P_STUN ) { if ( victim->fighting == NULL ) { set_fighting( victim, ch ); if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_KILL ) ) mp_percent_trigger( victim, ch, NULL, NULL, TRIG_KILL ); } if (victim->timer <= 4) victim->position = P_FIGHT; } if ( victim->position > P_STUN ) { if ( ch->fighting == NULL ) set_fighting( ch, victim ); } /* * More charm stuff. */ if ( victim->master == ch ) stop_follower( victim ); } /* * Inviso attacks ... not. */ if ( IS_AFFECTED(ch, AFF_INVISIBLE) ) { affect_strip( ch, gsn_invis ); REMOVE_BIT( ch->affected_by, AFF_INVISIBLE ); act( "$n fades into existence.", ch, NULL, NULL, TO_ROOM, 0 ); } /* * Damage modifiers. */ if ( dam > 1 && !IS_NPC(victim) && victim->condition[COND_DRUNK] > 10 ) dam = 9 * dam / 10; if ( dam > 1 && !IS_NPC(victim) && victim->condition[COND_HIGH] > 10 ) dam = 9 * dam / 10; if ( dam > 1 && ((IS_AFFECTED(victim, AFF_PROTECT_EVIL) && !IS_NATURAL(ch) )) ) dam -= dam / 4; immune = FALSE; /* * Check for parry, and dodge. if ( dt >= TYPE_HIT && ch != victim) { if ( check_parry( ch, victim ) ) return -1; if ( check_dodge( ch, victim ) ) return -1; } */ switch(check_immune(victim,dam_type)) { case(IS_IMMUNE): immune = TRUE; dam = 0; break; case(IS_RESISTANT): dam -= dam/3; break; case(IS_VULNERABLE): dam += dam/2; break; } if (show) dam_message( ch, victim, dam, dt, immune, combo ); if(dam > (victim->health + victim->agghealth -7)) { victim->position = P_MORT; stop_fighting(ch, TRUE); } else if(dam == (victim->health + victim->agghealth -7)) { victim->position = P_INCAP; stop_fighting(ch, TRUE); } if (dam == 0) return -1; else if(IS_SET(ch->off_flags, BANDAGED)) REMOVE_BIT(ch->off_flags, BANDAGED); /* * Hurt the victim. * Inform the victim of his new state. */ if( (victim->race == race_lookup("vampire")) && (dt == DAM_FIRE) ) { victim->agghealth -= dam; update_pos( victim, UMAX(1, agg) ); if(agg <= 0) agg = 1; } else if( (victim->race == race_lookup("werewolf")) && (dt == DAM_SILVER) ) { victim->agghealth -= dam; update_pos( victim, UMAX(1, agg) ); if(agg <= 0) agg = 1; } else if( (victim->race == race_lookup("faerie")) && (dt == DAM_IRON) ) { victim->health -= dam; victim->GHB += dam/3; update_pos( victim, agg ); } else if(agg) { victim->agghealth -= dam; update_pos( victim, agg ); } else { victim->health -= dam; update_pos( victim, 0 ); } switch( victim->position ) { case P_MORT: act( "$n is mortally wounded, and will die soon, if not aided.", victim, NULL, NULL, TO_ROOM, 0 ); send_to_char("You are mortally wounded, and may die soon, if not aided.\n\r", victim ); break; case P_INCAP: act( "$n is incapacitated and will slowly die, if not aided.", victim, NULL, NULL, TO_ROOM, 0 ); send_to_char("You are incapacitated and will slowly die, if not aided.\n\r", victim ); break; case P_TORPOR: act( "$n is mortally wounded, and will slowly die if not aided.", victim, NULL, NULL, TO_ROOM, 0 ); send_to_char("You enter torpor.\n\r", victim ); break; case P_STUN: act( "$n is stunned, but will probably recover.", victim, NULL, NULL, TO_ROOM, 0 ); send_to_char("You are stunned, but will probably recover.\n\r", victim ); break; case P_DEAD: act( "$n is DEAD!!", victim, 0, 0, TO_ROOM, 0 ); send_to_char( "You have been KILLED!!\n\r\n\r", victim ); break; default: if ( dam > MAX_HEALTH / 4 ) send_to_char( "That really did HURT!\n\r", victim ); if ( (victim->health + victim->agghealth - 7) < MAX_HEALTH / 4 ) send_to_char( "You sure are BLEEDING!\n\r", victim ); break; } if(dam_type == DAM_FIRE) fire_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR); if(dam_type == DAM_COLD) cold_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR); if(dam_type == DAM_LIGHTNING) shock_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR); if(dam_type == DAM_ACID) acid_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR); if(dam_type == DAM_POISON) poison_effect((void *) victim, agg+dam/2, dam, TARGET_CHAR); /* * Sleep spells and extremely wounded folks. */ if ( !IS_AWAKE(victim) ) stop_fighting( victim, FALSE ); /* * Payoff for killing things. */ if ( (victim->position == P_INCAP && IS_NPC(victim)) || victim->position == P_DEAD || victim->position == P_TORPOR ) { if ( !IS_NPC(victim) ) { log_string( LOG_GAME, Format("%s killed by %s at %d", victim->name, (IS_NPC(ch) ? ch->short_descr : ch->name), ch->in_room->vnum) ); } snprintf( log_buf, 2*MIL, "\tY[WIZNET]\tn %s got toasted by %s at %s [room %d]", (IS_NPC(victim) ? victim->short_descr : victim->name), (IS_NPC(ch) ? ch->short_descr : ch->name), ch->in_room->name, ch->in_room->vnum); if (IS_NPC(victim)) wiznet(log_buf,NULL,NULL,WIZ_MOBDEATHS,0,0); else wiznet(log_buf,NULL,NULL,WIZ_DEATHS,0,0); /* * Death trigger */ if ( IS_NPC( victim ) && HAS_TRIGGER( victim, TRIG_DEATH) ) { victim->position = P_STAND; mp_percent_trigger( victim, ch, NULL, NULL, TRIG_DEATH ); } if((!str_cmp(ch->description, "") || strlen(ch->description) < 10) && ch->played > 10*60*60) { send_to_char("No experience without a description.\n\r", ch); } else { if(ch->ooc_xp_count < 2) { send_to_char("You learn from your encounter.\n\r", ch); ch->oocxp += 1; ch->ooc_xp_count++; } else if(IS_SET(victim->act2, ACT2_HUNTER) && ch->ooc_xp_count < 50) { send_to_char("You learn from your encounter.\n\r", ch); ch->exp += 1; ch->ooc_xp_count++; } } if(ch->quest) { if(ch->quest->quest_type == Q_HITMAN && ch->quest->victim == victim) (*quest_table[ch->quest->quest_type].q_fun) (ch, 2); if(victim->quest != NULL && victim->quest->quest_type == Q_HITMAN && victim->quest->victim == victim && victim->quest->questor != ch) (*quest_table[victim->quest->quest_type].q_fun) (victim->quest->questor, 3); if(victim->quest != NULL && (victim->quest->quest_type == Q_BODYGUARD || victim->quest->quest_type == Q_RESCUE) && victim->quest->victim == victim) (*quest_table[victim->quest->quest_type].q_fun) (victim->quest->questor, 3); } if(victim->position != P_TORPOR || agg) update_pos( victim, agg ); return victim->position; } if ( victim == ch ) return ch->position; /* Link dead salvation. */ if ( !IS_NPC(victim) && victim->desc == NULL ) { do_function(victim, &do_flee,""); } tail_chain( ); return victim->position; }
/* Syntax : chant <type> <color> <target> * ex. chant bless red self */ void do_chant (CHAR_DATA *ch, char *argument) { char arg1[MAX_STRING_LENGTH]; char arg2[MAX_STRING_LENGTH]; char buf1[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH]; char buf3[MAX_STRING_LENGTH]; CHAR_DATA *victim; AFFECT_DATA af; int i, dam, count, sn; int red_magic = ch->spl[RED_MAGIC]; int blue_magic = ch->spl[BLUE_MAGIC]; int green_magic = ch->spl[GREEN_MAGIC]; int purple_magic = ch->spl[PURPLE_MAGIC]; int yellow_magic = ch->spl[YELLOW_MAGIC]; int magic_power = ch->spl[RED_MAGIC] + ch->spl[BLUE_MAGIC] + ch->spl[GREEN_MAGIC] + ch->spl[PURPLE_MAGIC] + ch->spl[YELLOW_MAGIC]; argument=one_argument(argument,arg1); strcpy(arg2,argument); if (IS_NPC(ch)) return; if (!IS_CLASS(ch, CLASS_MAGE) && !IS_CLASS(ch, CLASS_LICH)) { send_to_char("Huh?\n\r",ch); return; } if (arg1[0] == '\0') { send_to_char("Syntax : chant <bless/curse/damage/heal> <target>.\n\r", ch); return; } if (IS_ITEMAFF(ch, ITEMA_AFFENTROPY)) { magic_power +=100; red_magic +=20; yellow_magic +=20; purple_magic +=20; green_magic +=20; blue_magic +=20; } if (!str_cmp(arg1, "heal")) { if (arg2[0] == '\0') victim = ch; else if ((victim = get_char_room(ch, arg2)) == NULL) { send_to_char("They are not here.\n\r", ch ); return; } if (ch->mana < 1500) { send_to_char("You need 1500 mana.\n\r",ch); return; } act("$n channels lifeforce from the five elements into $N.",ch,NULL,victim,TO_NOTVICT); act("You channel lifeforce from the five elements into $N.",ch,NULL,victim,TO_CHAR); act("$n channels lifeforce from the five elements into you.",ch,NULL,victim,TO_VICT); WAIT_STATE(ch,8); ch->mana -= 1500; victim->hit = UMIN(victim->hit + (magic_power * 1.5), victim->max_hit); return; } else if (!str_cmp(arg1, "damage")) { if (arg2[0] == '\0' && ch->fighting != NULL) victim = ch->fighting; else if ((victim = get_char_room(ch, arg2)) == NULL) { send_to_char("They are not here.\n\r", ch ); return; } if (ch->mana <1000) { send_to_char("You need 1000 mana.\n\r",ch); return; } if (victim == ch) { send_to_char("You really don't want to hurt yourself.\n\r", ch ); return; } if (is_safe(ch, victim)) return; if (victim->position == POS_DEAD || ch->in_room != victim->in_room) return; if (IS_AFFECTED(ch, AFF_PEACE)) REMOVE_BIT(ch->affected_by, AFF_PEACE); if (victim->position > POS_STUNNED) { if (victim->fighting == NULL) set_fighting(victim, ch); if (ch->fighting == NULL) set_fighting(ch, victim); } WAIT_STATE(ch,8); ch->mana -= 1000; dam = number_range(red_magic*4, red_magic*5); dam += char_damroll(ch); dam = cap_dam(ch,victim,dam); if (!IS_NPC(victim)) { // if (IS_CLASS(ch, CLASS_MAGE) && dam > 600) dam = number_range(580,620); if (dam > 1000) dam = number_range(950,1050); } sprintf(buf1,"$n calls for the forces of #Rhell#n to destroy $N [#C%d#n]" , dam); sprintf(buf2,"You call for the forces of #Rhell#n to destroy $N [#C%d#n]" , dam); sprintf(buf3,"$n calls for the forces of #Rhell#n to destroy you [#C%d#n]" , dam); act(buf1,ch,NULL,victim, TO_NOTVICT); act(buf2,ch,NULL,victim, TO_CHAR); act(buf3,ch,NULL,victim, TO_VICT); hurt_person(ch, victim, dam); if (victim->position == POS_DEAD || ch->in_room != victim->in_room) return; dam = number_range(blue_magic*4, blue_magic*5); dam += char_damroll(ch); dam = cap_dam(ch,victim,dam); if (!IS_NPC(victim)) { // if (IS_CLASS(ch, CLASS_MAGE) && dam > 600) dam = number_range(580,620); if (dam > 1000) dam = number_range(950,1050); } sprintf(buf1,"$n summons a supernatural #Lstorm#n to strike $N with lightning [#C%d#n]" , dam); sprintf(buf2,"You summon a supernatural #Lstorm#n to strike $N with lightning [#C%d#n]" , dam); sprintf(buf3,"$n summons a supernatural #Lstorm#n to strike you with lightning [#C%d#n]" , dam); act(buf1,ch,NULL,victim, TO_NOTVICT); act(buf2,ch,NULL,victim, TO_CHAR); act(buf3,ch,NULL,victim, TO_VICT); hurt_person(ch, victim, dam); if (victim->position == POS_DEAD || ch->in_room != victim->in_room) return; dam = number_range(green_magic*4, green_magic*5); dam += char_damroll(ch); dam = cap_dam(ch,victim,dam); if (!IS_NPC(victim)) { // if (IS_CLASS(ch, CLASS_MAGE) && dam > 600) dam = number_range(580,620); if (dam > 1000) dam = number_range(950,1050); } sprintf(buf1,"$n calls for #Gthorns#n to grow from the earth and pierce $N [#C%d#n]" , dam); sprintf(buf2,"You call for #Gthorns#n to grow from the earth and pierce $N [#C%d#n]" , dam); sprintf(buf3,"$n calls for #Gthorns#n to grow from the earth and pierce You [#C%d#n]" , dam); act(buf1,ch,NULL,victim, TO_NOTVICT); act(buf2,ch,NULL,victim, TO_CHAR); act(buf3,ch,NULL,victim, TO_VICT); hurt_person(ch, victim, dam); if (victim->position == POS_DEAD || ch->in_room != victim->in_room) return; dam = number_range(purple_magic*4, purple_magic*5); dam += char_damroll(ch); dam = cap_dam(ch,victim,dam); if (!IS_NPC(victim)) { // if (IS_CLASS(ch, CLASS_MAGE) && dam > 600) dam = number_range(580,620); if (dam > 1000) dam = number_range(950,1050); } sprintf(buf1,"$n calls on the powers of the #punderdark#n to shatter $N's bones [#C%d#n]" , dam); sprintf(buf2,"You call on the powers of the #punderdark#n to shatter $N's bones [#C%d#n]" , dam); sprintf(buf3,"$n calls on the powers of the #punderdark#n to shatter your bones [#C%d#n]" , dam); act(buf1,ch,NULL,victim, TO_NOTVICT); act(buf2,ch,NULL,victim, TO_CHAR); act(buf3,ch,NULL,victim, TO_VICT); hurt_person(ch, victim, dam); if (victim->position == POS_DEAD || ch->in_room != victim->in_room) return; dam = number_range(yellow_magic*4, yellow_magic*5); dam += char_damroll(ch); dam = cap_dam(ch,victim,dam); if (!IS_NPC(victim)) { // if (IS_CLASS(ch, CLASS_MAGE) && dam > 600) dam = number_range(580,620); if (dam > 1000) dam = number_range(950,1050); } sprintf(buf1,"$n spews forth a shower of #yacid#n striking $N [#C%d#n]" , dam); sprintf(buf2,"you spew forth a shower of #yacid#n striking $N [#C%d#n]" , dam); sprintf(buf3,"$n spews forth a shower of #yacid#n striking you [#C%d#n]" , dam); act(buf1,ch,NULL,victim, TO_NOTVICT); act(buf2,ch,NULL,victim, TO_CHAR); act(buf3,ch,NULL,victim, TO_VICT); hurt_person(ch, victim, dam); return; } else if (!str_cmp(arg1, "bless")) { if ((victim = get_char_room(ch, arg2)) == NULL) { send_to_char("They are not here.\n\r", ch ); return; } if (ch->mana <2500) { send_to_char("You need 2500 mana.\n\r",ch); return; } if (victim->position == POS_DEAD || ch->in_room != victim->in_room) return; count = 0; for (i = 0; i<5 ; i++) { if (i==0) {sn = skill_lookup("purple sorcery");dam=purple_magic;} if (i==1) {sn = skill_lookup("yellow sorcery");dam=yellow_magic;} if (i==2) {sn = skill_lookup("green sorcery");dam=green_magic;} if (i==3) {sn = skill_lookup("red sorcery");dam=red_magic;} if (i==4) {sn = skill_lookup("blue sorcery");dam=blue_magic;} if (is_affected(victim, sn)) continue; count++; af.type = sn; af.duration = dam/4; af.location = APPLY_HIT; af.modifier = dam*2; af.bitvector = 0; affect_to_char(victim, &af); af.type = sn; af.duration = dam/4; af.location = APPLY_AC; af.modifier = -dam/2; af.bitvector = 0; affect_to_char(victim, &af); af.type = sn; af.duration = dam/4; af.location = APPLY_MOVE; af.modifier = dam*2; af.bitvector = 0; affect_to_char(victim, &af); af.type = sn; af.duration = dam/4; af.location = APPLY_MANA; af.modifier = dam*2; af.bitvector = 0; affect_to_char(victim, &af); af.type = sn; af.duration = dam/4; af.location = APPLY_HITROLL; af.modifier = dam/3; af.bitvector = 0; affect_to_char(victim, &af); af.type = sn; af.duration = dam/4; af.location = APPLY_DAMROLL; af.modifier = dam/3; af.bitvector = 0; affect_to_char(victim, &af); } ch->mana -= count * 500; WAIT_STATE(ch,6); sprintf(buf1, "You bless $N with the power of the elements."); sprintf(buf2, "The power of the five elements fills your body."); act(buf1, ch, NULL, victim, TO_CHAR); act(buf2, ch, NULL, victim, TO_VICT); return; } else if (!str_cmp(arg1, "curse")) { if ((victim = get_char_room(ch, arg2)) == NULL) { send_to_char("They are not here.\n\r", ch ); return; } if (ch->mana <2500) { send_to_char("You need 2500 mana.\n\r",ch); return; } if (victim->level < 3) { send_to_char("Not on mortal, thier bodies cant handles the strain....poor little buggers.\n\r",ch); return; } if (victim->position == POS_DEAD || ch->in_room != victim->in_room) return; count = 0; for (i = 0;i<5;i++) { if (i==0) {sn = skill_lookup("purple sorcery");dam=purple_magic;} if (i==1) {sn = skill_lookup("yellow sorcery");dam=yellow_magic;} if (i==2) {sn = skill_lookup("green sorcery");dam=green_magic;} if (i==3) {sn = skill_lookup("red sorcery");dam=red_magic;} if (i==4) {sn = skill_lookup("blue sorcery");dam=blue_magic;} if (is_affected(victim, sn)) continue; count++; af.type = sn; af.duration = dam/4; af.location = APPLY_HIT; af.modifier = -dam*2; af.bitvector = 0; affect_to_char(victim, &af); af.type = sn; af.duration = dam/4; af.location = APPLY_AC; af.modifier = dam/2; af.bitvector = 0; affect_to_char(victim, &af); af.type = sn; af.duration = dam/4; af.location = APPLY_MOVE; af.modifier = -dam*2; af.bitvector = 0; affect_to_char(victim, &af); af.type = sn; af.duration = dam/4; af.location = APPLY_MANA; af.modifier = -dam*2; af.bitvector = 0; affect_to_char(victim, &af); af.type = sn; af.duration = dam/4; af.location = APPLY_HITROLL; af.modifier = -dam/3; af.bitvector = 0; affect_to_char(victim, &af); af.type = sn; af.duration = dam/4; af.location = APPLY_DAMROLL; af.modifier = -dam/3; af.bitvector = 0; affect_to_char(victim, &af); } ch->mana -= count * 500; WAIT_STATE(ch,6); sprintf(buf1, "You curse $N with the power of the elements."); sprintf(buf2, "The power of the five elements wrecks your body."); act(buf1, ch, NULL, victim, TO_CHAR); act(buf2, ch, NULL, victim, TO_VICT); return; } send_to_char("Syntax : chant <bless/curse/damage/heal> <target>.\n\r", ch); return; }
void damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype) { char buf[MAX_STRING_LENGTH]; struct message_type *messages; int i,j,nr,max_hit,exp; int hit_limit(struct char_data *ch); assert(GET_POS(victim) > POSITION_DEAD); if ((GET_LEVEL(victim)>20) && !IS_NPC(victim)) /* You can't damage an immortal! */ dam=0; if (victim != ch) { if (GET_POS(victim) > POSITION_STUNNED) { if (!(victim->specials.fighting)) set_fighting(victim, ch); GET_POS(victim) = POSITION_FIGHTING; } if (GET_POS(ch) > POSITION_STUNNED) { if (!(ch->specials.fighting)) set_fighting(ch, victim); if (IS_NPC(ch) && IS_NPC(victim) && victim->master && !number(0,10) && IS_AFFECTED(victim, AFF_CHARM) && (victim->master->in_room == ch->in_room)) { if (ch->specials.fighting) stop_fighting(ch); hit(ch, victim->master, TYPE_UNDEFINED); return; } } } if (victim->master == ch) stop_follower(victim); if (IS_AFFECTED(ch, AFF_INVISIBLE)) appear(ch); if (IS_AFFECTED(victim, AFF_SANCTUARY)) dam = MIN(dam, 18); /* Max 18 damage when sanctuary */ dam=MIN(dam,100); dam=MAX(dam,0); GET_HIT(victim)-=dam; if (ch != victim) gain_exp(ch,GET_LEVEL(victim)*dam); update_pos(victim); if ((attacktype >= TYPE_HIT) && (attacktype <= TYPE_SLASH)) { if (!ch->equipment[WIELD]) { dam_message(dam, ch, victim, TYPE_HIT); } else { dam_message(dam, ch, victim, attacktype); } } else { for(i = 0; i < MAX_MESSAGES; i++) { if (fight_messages[i].a_type == attacktype) { nr=dice(1,fight_messages[i].number_of_attacks); for(j=1,messages=fight_messages[i].msg;(j<nr)&&(messages);j++) messages=messages->next; if (!IS_NPC(victim) && (GET_LEVEL(victim) > 20)) { act(messages->god_msg.attacker_msg, FALSE, ch, ch->equipment[WIELD], victim, TO_CHAR); act(messages->god_msg.victim_msg, FALSE, ch, ch->equipment[WIELD], victim, TO_VICT); act(messages->god_msg.room_msg, FALSE, ch, ch->equipment[WIELD], victim, TO_NOTVICT); } else if (dam != 0) { if (GET_POS(victim) == POSITION_DEAD) { act(messages->die_msg.attacker_msg, FALSE, ch, ch->equipment[WIELD], victim, TO_CHAR); act(messages->die_msg.victim_msg, FALSE, ch, ch->equipment[WIELD], victim, TO_VICT); act(messages->die_msg.room_msg, FALSE, ch, ch->equipment[WIELD], victim, TO_NOTVICT); } else { act(messages->hit_msg.attacker_msg, FALSE, ch, ch->equipment[WIELD], victim, TO_CHAR); act(messages->hit_msg.victim_msg, FALSE, ch, ch->equipment[WIELD], victim, TO_VICT); act(messages->hit_msg.room_msg, FALSE, ch, ch->equipment[WIELD], victim, TO_NOTVICT); } } else { /* Dam == 0 */ act(messages->miss_msg.attacker_msg, FALSE, ch, ch->equipment[WIELD], victim, TO_CHAR); act(messages->miss_msg.victim_msg, FALSE, ch, ch->equipment[WIELD], victim, TO_VICT); act(messages->miss_msg.room_msg, FALSE, ch, ch->equipment[WIELD], victim, TO_NOTVICT); } } } } switch (GET_POS(victim)) { case POSITION_MORTALLYW: act("$n is mortally wounded, and will die soon, if not aided.", TRUE, victim, 0, 0, TO_ROOM); act("You are mortally wounded, and will die soon, if not aided.", FALSE, victim, 0, 0, TO_CHAR); break; case POSITION_INCAP: act("$n is incapacitated and will slowly die, if not aided.", TRUE, victim, 0, 0, TO_ROOM); act("You are incapacitated an will slowly die, if not aided.", FALSE, victim, 0, 0, TO_CHAR); break; case POSITION_STUNNED: act("$n is stunned, but will probably regain conscience again.", TRUE, victim, 0, 0, TO_ROOM); act("You're stunned, but will probably regain conscience again.", FALSE, victim, 0, 0, TO_CHAR); break; case POSITION_DEAD: act("$n is dead! R.I.P.", TRUE, victim, 0, 0, TO_ROOM); act("You are dead! Sorry...", FALSE, victim, 0, 0, TO_CHAR); break; default: /* >= POSITION SLEEPING */ max_hit=hit_limit(victim); if (dam > (max_hit/5)) act("That Really did HURT!",FALSE, victim, 0, 0, TO_CHAR); if (GET_HIT(victim) < (max_hit/5)) { act("You wish that your wounds would stop BLEEDING that much!",FALSE,victim,0,0,TO_CHAR); if (IS_NPC(victim)) if (IS_SET(victim->specials.act, ACT_WIMPY)) do_flee(victim, "", 0); } break; } if (!IS_NPC(victim) && !(victim->desc)) { do_flee(victim, "", 0); if (!victim->specials.fighting) { act("$n is rescued by divine forces.", FALSE, victim, 0, 0, TO_ROOM); victim->specials.was_in_room = victim->in_room; char_from_room(victim); char_to_room(victim, 0); } } if (GET_POS(victim) < POSITION_STUNNED) if (ch->specials.fighting == victim) stop_fighting(ch); if (!AWAKE(victim)) if (victim->specials.fighting) stop_fighting(victim); if (GET_POS(victim) == POSITION_DEAD) { if (IS_NPC(victim) || victim->desc) if (IS_AFFECTED(ch, AFF_GROUP)) { group_gain(ch, victim); } else { /* Calculate level-difference bonus */ exp = GET_EXP(victim)/3; if (IS_NPC(ch)) exp += (exp*MIN(4, (GET_LEVEL(victim) - GET_LEVEL(ch))))>>3; else exp += (exp*MIN(8, (GET_LEVEL(victim) - GET_LEVEL(ch))))>>3; exp = MAX(exp, 1); gain_exp(ch, exp); change_alignment(ch, victim); } if (!IS_NPC(victim)) { sprintf(buf, "%s killed by %s at %s", GET_NAME(victim), (IS_NPC(ch) ? ch->player.short_descr : GET_NAME(ch)), world[victim->in_room].name); log(buf); } die(victim); }
void do_swoop(CHAR_DATA *ch, char *argument) { char arg[MAX_INPUT_LENGTH]; CHAR_DATA *victim; int dam; argument = one_argument(argument, arg); if (IS_NPC(ch)) if (!IS_CLASS(ch, CLASS_ANGEL)) { send_to_char("Huh?",ch); return; } if (arg[0] == '\0') { send_to_char("Swoop down upon whom?\n\r",ch); return; } if (ch->pcdata->powers[ANGEL_JUSTICE] < 1) { send_to_char("You haven't learned to fly yet.\n\r",ch); return; } if (!IS_SET(ch->pcdata->powers[ANGEL_POWERS], ANGEL_WINGS)) { send_to_char("Where are your wings?\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_safe(ch,victim)) return; if (IS_CLASS(victim, CLASS_ANGEL)) { send_to_char("You cannot swoop down upon the other chosen of God..",ch); act("#G$n just tried to swoop down upon you",ch,NULL,victim, TO_VICT); return; } act("You soar down from the clouds and strike $N with a righteous fury.\n\r",ch,NULL,victim, TO_CHAR); act("$n soars down from the clouds and strikes you with a righteous fury.\n\r",ch,NULL,victim, TO_VICT); act("$n soars down from the clouds and strikes $N with a righteous fury.\n\r",ch,NULL,victim, TO_NOTVICT); dam = (ch->generation - 10) * 1500; // victim->hit -= dam; // hurt_person(ch, victim, dam); set_fighting(ch,victim); hurt_person(ch, victim, dam); WAIT_STATE(ch, 20); return; }