/***************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. In particular, you may not remove either of *
* these copyright notices. *
* *
* Much time and thought has gone into this software and you are *
* benefitting. We hope that you share your changes too. What goes *
* around, comes around. *
***************************************************************************/
/****************************************************************************
* ROM 2.4 is copyright 1993-1998 Russ Taylor *
* ROM has been brought to you by the ROM consortium *
* Russ Taylor (rtaylor@hypercube.org) *
* Gabrielle Taylor (gtaylor@hypercube.org) *
* Brian Moore (zump@rom.org) *
* By using this code, you have agreed to follow the terms of the *
* ROM license, in the file Rom24/doc/rom.license *
*****************************************************************************/
/****************************************************************************
* I got tired of the stock surrender command that, while in PK, always *
* ended in a successful stop of the fight. This was easy to abuse as a *
* sure fire way to get around having to flee in PK. What this code does *
* is change surrender to a system of needing acceptance in order for the *
* fight to stop. This code was originally written by Joseph, aka Diablos *
* of End of Time at eotmud.com:4000. In order to use this code, you must *
* abide by the Diku, Merc, and Rom licenses, and may not be used in any *
* MUD that may be considered commercial, pay-to-play, or pay-for-perks. *
* No credit is required, but is certainly appreciated if my name was *
* added as credit in a snippet or surrender helpfile. All code comments *
* MUST remain within the do_surrender and do_accept commands. Please *
* note that on End of Time, we have a "defend" command that enters the *
* character into a defensive stance where all of their defensive skills *
* are increased, and they stop attacking during normal combat. Going into*
* surrender mode on EoT automatically puts the character into defend, and *
* any instance of surrender being removed will bring the character out *
* of defend. Likewise, coming out of defend will remove the character *
* from surrender if they are in surrender mode. Since defend isn't a *
* stock feature, I haven't included any references to that in the actual *
* code, however, any similar systems in your game ought to work well with *
* this and I would recommend doing something similar if you don't already *
* have anything like this. Also noted within the code is the value you *
* change that determines how many rounds surrender will remain active. *
* The value I have it set at may not be appropriate for your game. One *
* final note, I have this written with mobprogf unctionality; if your game*
* doesn't have these, you will need to remove some code but I will point *
* out where. This code was originally released on Mudbytes at *
* http://www.mudbytes.net/ *
****************************************************************************/
/* In Merc.h look for:
struct char_data
Scroll near the bottom of the struct and add: */
sh_int surrender; //Timer
/* This is the timer value that will handle how long a character remains in surrender */
/* Go into interp.c and make sure you have a do_surrender function. If not then add: */
{"surrender", do_surrender, POS_FIGHTING, 0, LOG_NORMAL, 1},
/* Also add: */
{"accept", do_accept, POS_FIGHTING, 0, LOG_NORMAL, 1},
/* Go into interp.h and add this if you don't have the surrender command already: */
DECLARE_DO_FUN( do_surrender );
/* Also in interp.h add: */
DECLARE_DO_FUN( do_accept );
/* In Fight.c look for near the top:
void violence_update (void)
Find the part of the code that says:
if ((victim = ch->fighting) == NULL)
continue;
And add this after it: */
if(ch->surrender > 0)
{
if(--ch->surrender <= 0)
{
send_to_char("Your attempts at surrender have been ignored.\r\n",ch);
//If you have anything similar to the defend mentioned before, this is
//the place you would put removing it.
}
}
/*Also in fight.c find:
void stop_fighting (CHAR_DATA * ch, bool fBoth)
and just before this line:
fch->fighting = NULL;
add: */
if(fch->surrender > 0)
fch->surrender = 0;
/* Now find do_surrender in (probably) fight.c
I would recommend putting comment codes around the entire function rather than deleting it...
just incase. Paste this after it: */
void do_surrender (CHAR_DATA * ch, char * argument)
{
/* Surrender/Accept commands written by Joseph, aka Diablos, of End of Time eotmud.com:4000 */
CHAR_DATA *mob;
if ( (mob = ch->fighting) == NULL )
{
send_to_char( "But you're not fighting!\r\n", ch );
return;
}
//You may consider adding in restrictions to surrender if under the effect of things
//like berserk, frenzy, etc. (you may remove this comment)
WAIT_STATE( ch, 2 * PULSE_VIOLENCE );
if(ch->surrender > 0)
{
act( "You revoke your attempt to surrender!", ch, NULL, mob, TO_CHAR );
act( "$n revokes $s attempt to surrender!", ch, NULL, mob, TO_VICT );
act( "$n revokes $s attempt to surrender!", ch, NULL, mob, TO_NOTVICT );
ch->surrender = 0;
//This is where you would remove 'defend' or similar effect. (you may remove this comment)
return;
}
act( "You try to surrender to $N!", ch, NULL, mob, TO_CHAR );
act( "$n tries to surrenders to you!", ch, NULL, mob, TO_VICT );
act( "$n tries to surrender to $N!", ch, NULL, mob, TO_NOTVICT );
/* This is where you would remove some code to remove the mobprog functionality. If you
don't have mobprogs, the if check should read:
if ( !IS_NPC( ch ) && IS_NPC( mob ))
(you may remove this commend) */
if ( !IS_NPC( ch ) && IS_NPC( mob )
&& ( !HAS_TRIGGER_MOB( mob, TRIG_SURR )
|| !p_percent_trigger( mob,NULL, NULL, ch, NULL, NULL, TRIG_SURR ) ) )
{
act( "$N seems to ignore your cowardly act!", ch, NULL, mob, TO_CHAR );
multi_hit( mob, ch, TYPE_UNDEFINED );
return;
}
//Change this value to determine how many passes of violence_update it will take for
//the surrender to be considered ignored.
ch->surrender = 8;
//This is where you add any 'defend' like effect (you may remove this comment)
return;
}
void do_accept (CHAR_DATA * ch, char * argument)
{
/* Surrender/Accept commands written by Joseph, aka Diablos, of End of Time eotmud.com:4000 */
CHAR_DATA *mob;
int exploss;
char buf[MSL];
if ( (mob = ch->fighting) == NULL )
{
send_to_char( "But you're not fighting!\r\n", ch );
return;
}
//You may consider adding in restrictions to surrender if under the effect of things
//like berserk, frenzy, etc. (you may remove this comment)
if(mob->surrender <= 0)
{
send_to_char("They haven't offered to surrender!\r\n",ch);
return;
}
act( "You accept $N's surrender.", ch, NULL, mob, TO_CHAR );
act( "$n accepts your surrender.", ch, NULL, mob, TO_VICT );
act( "$n accepts $N's surrender.", ch, NULL, mob, TO_NOTVICT );
stop_fighting( mob, TRUE );
//default exp penalty:
exploss = mob->level * number_range(25,50);
mob->exp -= exploss;
sprintf( buf, "You lose %d exp.\r\n", exploss);
send_to_char(buf,mob);
return;
}