fight3.c
src/fight3.c · 6.3 KB
From the archive cyhawk_mud.tar.gz
Download the archive « Back to the archive contents
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
#include "magic.h"
#include "recycle.h"
#include "tables.h"
#define ptc printf_to_char
/*
* random_kill_bonus()
*
* On a kill, players have a chance of a random bonus.
* This bonus can be pretty much anything, extra experience,
* questpoints, stat boosts, free spells/enhancement, rare
* items, etc.
*/
int random_kill_bonus(CHAR_DATA * ch, CHAR_DATA * mob, int experience)
{
int quest, stat;
switch(number_range(0, 75))
{ default:
break;
/* Case 1: Extra Experience 2x */
case 1:
ptc(ch, "{WThri has smiled apon you. You recive double experience!{x\n\r");
experience *= 2;
break;
/* Case 2: No Experience */
case 2:
ptc(ch, "{RMarduk laughs at you from above, and steals your experience!{x\n\r");
experience = 0;
break;
/* Case 3: 5-10 QPs */
case 3:
quest = number_range(5, 10);
ptc(ch, "{WKuan Yin smiles on you. You recive %d quest points!{x\n\r", quest);
ch->quest_curr += quest;
ch->quest_accum += quest;
experience = 0;
break;
/* Case 4: +1 Strength */
case 4:
stat = 1;
ptc(ch, "{wYou feel stronger!{x\n\r");
ch->perm_stat[STAT_STR] += stat;
ch->mod_stat[STAT_STR] += stat;
experience = 0;
break;
/* Case 5: +1 Intelligence */
case 5:
stat = 1;
ptc(ch, "{wYou feel smarter!{x\n\r");
ch->perm_stat[STAT_INT] += stat;
ch->mod_stat[STAT_INT] += stat;
experience = 0;
break;
/* Case 6: +1 Wisdom */
case 6:
stat = 1;
ptc(ch, "{wYou feel more wise!{x\n\r");
ch->perm_stat[STAT_WIS] += stat;
ch->mod_stat[STAT_WIS] += stat;
experience = 0;
break;
/* Case 7: +1 Constitution */
case 7:
stat = 1;
ptc(ch, "{wYou feel healthier!{x\n\r");
ch->perm_stat[STAT_CON] += stat;
ch->mod_stat[STAT_CON] += stat;
experience = 0;
break;
/* Case 8: +1 Charisma */
case 8:
stat = 1;
ptc(ch, "{wYou feel more charismatic!{x\n\r");
ch->perm_stat[STAT_CHA] += stat;
ch->mod_stat[STAT_CHA] += stat;
experience = 0;
break;
/* Case 9: +1 Force */
case 9:
stat = 1;
ptc(ch, "{GYou feel more powerful!{x\n\r");
ch->multis[0] += stat;
experience = 0;
break;
/* Case 10: +1 Intuition */
case 10:
stat = 1;
ptc(ch, "{GYou feel more insightful!{x\n\r");
ch->multis[1] += stat;
experience = 0;
break;
/* Case 11: +1 Luck */
case 11:
stat = 1;
ptc(ch, "{GYou feel more lucky!{x\n\r");
ch->multis[2] += stat;
experience = 0;
break;
/* Case 12: +1 Speed */
case 12:
stat = 1;
ptc(ch, "{GYou feel quicker!{x\n\r");
ch->multis[3] += stat;
experience = 0;
break;
/* Case 13: +1 Resilience */
case 13:
stat = 1;
ptc(ch, "{GYou feel more resilient!{x\n\r");
ch->multis[4] += stat;
experience = 0;
break;
/* Case 14: +1 Command */
case 14:
stat = 1;
ptc(ch, "{GYou feel more in command of the situation!{x\n\r");
ch->multis[5] += stat;
experience = 0;
break;
}
return experience;
}
/*
* heal_char()
*
* Function takes care of healing players. Anywhere a player
* ammounts health, it should go through here.
* kinda the opposite of damage()
*/
void heal_char (CHAR_DATA * ch, int ammount, bool magic)
{
/* Malady prevents all healing */
if (IS_AFFECTED2(ch, AFF2_MALADY))
{
stc("{MYour body doesn't seem to heal!{x\n", ch);
return;
}
/* Hungry? Non-magical healing of course*/
if (!magic)
{
if (ch->pcdata->condition[COND_HUNGER] == 0)
ammount /= 2;
if (ch->pcdata->condition[COND_THIRST] == 0)
ammount /= 2;
}
/* Sitting on something? */
if (!magic)
{
if (ch->on != NULL && ch->on->item_type == ITEM_FURNITURE)
ammount = ammount * ch->on->value[3] / 100;
}
if (magic)
{
if (ch->on != NULL && ch->on->item_type == ITEM_FURNITURE)
ammount = ammount * ch->on->value[4] / 100;
}
/* Take care of position */
switch (ch->position)
{ default:
break;
case POS_SLEEPING:
ammount *= 3;
break;
case POS_RESTING:
ammount *= 2;
break;
case POS_FIGHTING:
ammount /= 2;
break;
}
/* Take care of heal rate of the room
* Non-magical adds hp heal rate
* Magical adds mana regen rate
*/
if (!magic)
ammount = ammount * ch->in_room->heal_rate / 100;
if (magic)
ammount = ammount * ch->in_room->mana_rate / 100;
/* Rejuvination 5x heal rate IF its non-magic*/
if (!magic && (IS_AFFECTED2(ch, AFF2_REJUVINATION)))
ammount *= 5;
/* regeneration 2x heal rate */
if (IS_AFFECTED(ch, AFF_REGENERATION))
ammount *= 2;
/* Plague/poison/diease, reduces by 10x if non-magical */
if (!magic && (IS_AFFECTED(ch, AFF_PLAGUE)))
ammount = ammount / 10;
if (!magic && (IS_AFFECTED(ch, AFF_POISON)))
ammount = ammount / 10;
/* Add the health */
ch->hit += ammount;
/* Take care of going over max hp */
if (ch->hit > ch->max_hit)
ch->hit = ch->max_hit;
/* finally, update their position */
update_pos(ch);
return;
}