/*************************************************************************** * Mud20 1.0 by Todd H. Johnson (Kregor) a derivative of the Open Gaming * * License by Wizards of the Coast. All comments referring to D20, OGL, * * and SRD refer to the System Reference Document for the Open Gaming * * system. Any inclusion of these derivatives must include credit to the * * Mud20 system, the full and complete Open Gaming LIcense, and credit to * * the respective authors. See ../doc/srd.txt for more information. * * * * Emud 2.2 by Igor van den Hoven, Michiel Lange, and Martin Bethlehem. * * * * MrMud 1.4 by David Bills, Dug Michael and Martin Gallwey * * * * Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael * * Chastain, Michael Quan, and Mitchell Tse. * * * * Original Diku Mud copyright (C) 1990 1991 by Sebastian Hammer, * * Michael Seifert, Hans Henrik St{rfeld, Tom Madsen, and Katje Nyboe. * ***************************************************************************/ /*************************************************************************** * mount.c: Functions for mounts and pets * ***************************************************************************/ #include "mud.h" bool is_mounting( CHAR_DATA *ch ) { bool mounting; push_call("is_mounting(%p)", ch); mounting = (ch->mounting && ch->mounting->in_room == ch->in_room); pop_call(); return mounting; } bool is_mounted( CHAR_DATA *ch ) { bool mounted; push_call("is_mounted(%p)", ch); mounted = (ch->master && ch->master->mounting == ch && ch->master->in_room == ch->in_room); pop_call(); return mounted; } void do_mount( CHAR_DATA *ch, char *argument ) { CHAR_DATA *victim; push_call("do_mount(%p,%p)",ch,argument); if (is_mounting(ch)) { send_to_char("You are already mounted.\n\r", ch); pop_call(); return; } if (*argument == 0) { send_to_char("Mount whom?\n\r", ch); pop_call(); return; } if ((victim = get_char_room(ch, argument)) == NULL) { send_to_char("They aren't here.\n\r", ch); pop_call(); return; } if (ch->furniture) { act( "You might want to get off of $p first.", ch, ch->furniture, NULL, TO_CHAR); pop_call(); return; } if (ch->hitched) { act( "You might want to unhitch $p first.", ch, ch->hitched, NULL, TO_CHAR); pop_call(); return; } if (is_mounted(victim)) { send_to_char("They are already mounted.\n\r", ch); pop_call(); return; } if (!IS_NPC(victim) || victim->master != ch) { send_to_char("You can only mount pets.\n\r", ch); pop_call(); return; } if (!quadruped(victim) && many_legged(victim)) { act( "$N cannot be mounted.", ch, NULL, victim, TO_CHAR); pop_call(); return; } if (victim->position != POS_STANDING) { act( "$N must be standing to be mounted.", ch, NULL, victim, TO_CHAR); pop_call(); return; } if (get_size(victim) <= get_size(ch)) { act( "$N is too small to be mounted by you!", ch, NULL, victim, TO_CHAR); act( "$n tries to mount you, but $e is too large!", ch, NULL, victim, TO_VICT); act( "$n tries to mount $M, but is too large!", ch, NULL, victim, TO_NOTVICT); pop_call(); return; } if (get_size(victim) > get_size(ch) + 1 || !mount_check(ch, victim, mount_roll(ch), 20)) { wait_state(ch, skill_table[gsn_mount].beats); act( "You mount $N.", ch, NULL, victim, TO_CHAR); act( "$n mounts you.", ch, NULL, victim, TO_VICT); act( "$n mounts $M.", ch, NULL, victim, TO_NOTVICT); TAKE_ACTION(ch, ACTION_MOVE); } else { act( "You mount $N quickly.", ch, NULL, victim, TO_CHAR); act( "$n mounts you quickly.", ch, NULL, victim, TO_VICT); act( "$n mounts $M quickly.", ch, NULL, victim, TO_NOTVICT); } ch->mounting = victim; pop_call(); return; } void do_dismount( CHAR_DATA *ch, char *argument ) { push_call("do_dismount(%p,%p)",ch,argument); if (!is_mounting(ch)) { send_to_char("You are not mounted.\n\r", ch); pop_call(); return; } act( "You dismount $N.", ch, NULL, ch->mounting, TO_CHAR); act( "$n dismounts you.", ch, NULL, ch->mounting, TO_VICT); act( "$n dismounts $N.", ch, NULL, ch->mounting, TO_NOTVICT); ch->mounting = NULL; pop_call(); return; } /* * returns FALSE if you mess up on riding to * spoil other actions in a round - Kregor */ bool mounted_combat_check( CHAR_DATA *ch ) { push_call("mounted_combat_check(%p)",ch); if (!is_mounting(ch)) { pop_call(); return TRUE; } int roll = mount_roll(ch); if (learned(ch, gsn_mounted_combat)) roll += 3; if (combat_mount(ch->mounting)) { if (IS_SET(ch->mounting->attack, ATTACK_MELEE) && !mount_check(ch, ch->mounting, roll, 10)) { act( "You forego other actions to control your mount.", ch, NULL, NULL, TO_CHAR); pop_call(); return FALSE; } } else { if (!mount_check(ch, ch->mounting, roll, 20)) { act( "You forego other actions to control your mount.", ch, NULL, NULL, TO_CHAR); pop_call(); return FALSE; } } pop_call(); return TRUE; } /* * Discharge command - for companions and paladin warhorse, this * transports the pet to the holding room for later summoning. * For other bought and charmed pets, this releases them * from your control - Kregor 06/12 */ void do_discharge(CHAR_DATA *ch, char *argument) { CHAR_DATA *victim; push_call("do_discharge(%p,%p)",ch,argument); if (argument[0] == '\0') { send_to_char("Discharge whom?\n\r", ch); pop_call(); return; } if ((victim = get_char_room(ch, argument)) == NULL) { send_to_char("The one you wish to discharge isn't here.\n\r", ch); pop_call(); return; } if (!victim->master || victim->master != ch) { act( "$N is not yours to discharge.", ch, NULL, victim, TO_CHAR); pop_call(); return; } if (IS_ACT(victim, ACT_WARHORSE)) { act("You discharge $N to $S $t refuge.", ch, IS_GOOD(ch) ? "celestial" : "fiendish", victim, TO_CHAR); act("$n discharges $N to $S $t refuge.", ch, IS_GOOD(ch) ? "celestial" : "fiendish", victim, TO_ROOM); char_from_room(victim); char_to_room(victim, ROOM_VNUM_HOLDING, TRUE); } else if (IS_ACT(victim, ACT_COMPANION) && victim->pIndexData->vnum == MOB_VNUM_SHADOW_BEAST) { act("{108}$n leaps into a shadowy portal and vanishes!", victim, NULL, NULL, TO_ROOM); char_from_room(victim); char_to_room(victim, ROOM_VNUM_HOLDING, TRUE); } else if (IS_ACT(victim, ACT_COMPANION)) { if (!IS_OUTSIDE(ch)) { act("You can only discharge your companion into the wilds.", ch, NULL, victim, TO_CHAR); pop_call(); return; } act("You send $N to its refuge.", ch, NULL, victim, TO_CHAR); act("$N retreats into the wilds.", ch, NULL, victim, TO_ROOM); char_from_room(victim); char_to_room(victim, ROOM_VNUM_HOLDING, TRUE); } else { stop_follower(victim); act( "You discharge $N from your service.", ch, NULL, victim, TO_CHAR); act( "$n discharge $N from $s service.", ch, NULL, victim, TO_ROOM); } pop_call(); return; }