cor_update.c
demise/src/cor_update.c · 40.1 KB
From the archive dodbackup-final.tar.gz
Download the archive « Back to the archive contents
/********************************
* *
* New Improved regen code *
* *
* Coded by Corim *
* aka Gunnar Trulsrud *
* *
********************************/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h> /* unlink() */
#include "merc.h"
void pc_update args ((void));
void
hp_regen (CHAR_DATA * ch, int speed)
{
int min = 5;
int max = 10;
int hit_gain = 0;
int regen = 0;
int regen_max = 0;
int regen_penal = 0;
if (IS_NPC (ch) && !IS_SET (ch->act, ACT_PANDDEMON))
return;
if (ch->agg < 0)
ch->agg = 0;
else if (ch->agg > 100)
ch->agg = 100;
if (ch->hit < 1)
{
ch->hit += number_range (1, 2);
update_pos (ch);
}
else
{
if (ch->position == POS_SLEEPING)
{
min += 400;
max += 800;
hit_gain += number_range (min, max);
}
else
{
min += 200;
max += 400;
hit_gain += number_range (min, max);
}
regen = ch->max_hit * 0.025;
if (ch->agg > 0)
{
regen_max = regen * ch->agg;
regen_max /= 100;
regen -= regen_max;
}
regen += hit_gain;
regen *= speed;
if (IS_AFFECTED (ch, AFF_POISON))
regen_penal += 25;
if (IS_AFFECTED (ch, AFF_ROT))
regen_penal += 25;
if (IS_AFFECTED (ch, AFF_FLAMING))
{
if (!IS_EFRETI (ch) && !IS_NYM (ch, NYM_NEPHFURY))
{
if (get_disc (ch, DISC_DAIMOINON) < 6)
regen_penal += 25;
else if (IS_MORE (ch, MORE_FLAMES))
regen_penal += 25;
}
if (IS_EFRETI (ch))
{
regen_penal -= 25;
if (IS_MORE (ch, MORE_FLAMES))
regen_penal -= 25;
}
}
if (regen_penal > 0)
{
regen = regen * regen_penal;
regen /= 100;
}
else if (regen_penal < 0)
{
if (regen_penal >= -25)
regen *= 1.25;
else if (regen_penal >= -50)
regen *= 1.50;
}
ch->hit += regen;
if (ch->hit >= ch->max_hit)
{
ch->hit = ch->max_hit;
act ("Your wounds have completely regenerated themself.\n\r", ch,
NULL, NULL, TO_CHAR);
}
}
return;
}
void
mana_regen (CHAR_DATA * ch, int speed)
{
int min = 5;
int max = 10;
int mana_gain = 0;
int regen = 0;
if (IS_NPC (ch) && !IS_SET (ch->act, ACT_PANDDEMON))
return;
if (ch->position == POS_SLEEPING)
{
min += 400;
max += 800;
mana_gain += number_range (min, max);
}
else
{
min += 200;
max += 400;
mana_gain += number_range (min, max);
}
regen = ch->max_mana * 0.025;
regen += mana_gain;
regen *= speed;
ch->mana += regen;
if (ch->mana >= ch->max_mana)
{
ch->mana = ch->max_mana;
act_brief ("Your #cMystical Power#n has completely regenerated.\n\r",
ch, NULL, NULL, TO_CHAR, PLR_BRIEF3);
}
return;
}
void
move_regen (CHAR_DATA * ch, int speed)
{
int min = 5;
int max = 10;
int move_gain = 0;
int regen = 0;
int regen_max = 0;
if (IS_NPC (ch) && !IS_SET (ch->act, ACT_PANDDEMON))
return;
if (IS_XX (ch, XX_FSTAND))
return;
if (ch->position == POS_SLEEPING)
{
min += 400;
max += 800;
move_gain += number_range (min, max);
}
else
{
min += 200;
max += 400;
move_gain += number_range (min, max);
}
regen = ch->max_move * 0.025;
if (ch->agg > 0)
{
regen_max = regen * ch->agg;
regen_max /= 100;
regen -= regen_max;
}
regen += move_gain;
regen *= speed;
ch->move += regen;
if (ch->move >= ch->max_move)
{
ch->move = ch->max_move;
act_brief ("Your vitality has completely regenerated itself.\n\r", ch,
NULL, NULL, TO_CHAR, PLR_BRIEF3);
}
return;
}
void
item_regen (CHAR_DATA * ch, OBJ_DATA * obj, int speed)
{
int aggh = 0;
int max_hp = 0;
int total_aggh = 0;
if (ch->agg < 0)
ch->agg = 0;
else if (ch->agg > 100)
ch->agg = 100;
if (ch->agg > 0)
{
aggh = ch->max_hit * 0.25;
total_aggh = aggh * ch->agg;
total_aggh /= 100;
max_hp = ch->max_hit - total_aggh;
}
else
{
max_hp = ch->max_hit;
}
if (ch->hit < max_hp)
{
hp_regen (ch, speed);
if (ch->hit >= max_hp && ch->agg > 0)
{
stc ("You have regenerated all non-aggravated wounds.\n\r", ch);
}
if (ch->hit > max_hp)
ch->hit = max_hp;
}
else if (ch->hit == max_hp)
{
if (ch->hit < ch->max_hit)
{
stc
("You have too many aggravated wounds to regenerate any further.\n\r",
ch);
}
}
if (ch->mana < ch->max_mana)
mana_regen (ch, speed);
if (ch->mana > ch->max_mana)
ch->mana = ch->max_mana;
if (ch->move < ch->max_move)
move_regen (ch, speed);
if (ch->move > ch->max_move)
ch->move = ch->max_move;
if (!IS_VAMPIRE (ch) && ch->embraced == ARE_NONE)
{
if (ch->blood[BLOOD_CURRENT] < ch->blood[BLOOD_POOL])
ch->blood[BLOOD_CURRENT] += number_range (20, 30);
if (ch->blood[BLOOD_CURRENT] > ch->blood[BLOOD_POOL])
ch->blood[BLOOD_CURRENT] = ch->blood[BLOOD_POOL];
}
if (ch->agg > 0)
{
if (ch->position == POS_RESTING || ch->position == POS_SLEEPING
|| ch->position == POS_MEDITATING)
{
if (number_range (1, 4) > 1)
{
ch->agg -= number_range (4, 6);
if (ch->agg < 1)
{
stc ("You have regenerated all aggravated wounds.\n\r", ch);
}
else
{
stc ("You regenerate some aggravated wounds.\n\r", ch);
}
}
}
}
return;
}
void
drac_regen (CHAR_DATA * ch, int speed)
{
int aggh = 0;
int max_hp = 0;
int total_aggh = 0;
if (ch->agg < 0)
ch->agg = 0;
else if (ch->agg > 100)
ch->agg = 100;
if (ch->agg > 0)
{
aggh = ch->max_hit * 0.25;
total_aggh = aggh * ch->agg;
total_aggh /= 100;
max_hp = ch->max_hit - total_aggh;
}
else
{
max_hp = ch->max_hit;
}
ch->pcdata->cpowers[DRAC_HEALING]--;
act ("$n's body hums with ancient magic as $s wounds seems to heal.", ch,
NULL, NULL, TO_ROOM);
act ("Your body hums with ancient magic as you defy your wounds.", ch, NULL,
NULL, TO_CHAR);
if (ch->hit < max_hp)
{
hp_regen (ch, speed);
if (ch->hit >= max_hp && ch->agg > 0)
{
stc ("You have regenerated all non-aggravated wounds.\n\r", ch);
}
if (ch->hit > max_hp)
ch->hit = max_hp;
}
else if (ch->hit == max_hp)
{
if (ch->hit < ch->max_hit)
{
stc
("You have too many aggravated wounds to regenerate any further.\n\r",
ch);
}
}
if (ch->mana < ch->max_mana)
{
if (ch->pcdata->npowers[NINJA_RAGE] < 1 || ch->position <= POS_RESTING)
{
mana_regen (ch, speed);
if (ch->mana > ch->max_mana)
ch->mana = ch->max_mana;
}
}
if (ch->mana > ch->max_mana)
ch->mana = ch->max_mana;
if (ch->move < ch->max_move)
{
if (!IS_DRACWEAP (ch, DRAC_INVIS))
{
move_regen (ch, speed);
if (ch->move > ch->max_move)
ch->move = ch->max_move;
}
}
if (!IS_VAMPIRE (ch) && ch->embraced == ARE_NONE)
{
if (ch->blood[BLOOD_CURRENT] < ch->blood[BLOOD_POOL])
ch->blood[BLOOD_CURRENT] += number_range (20, 30);
if (ch->blood[BLOOD_CURRENT] > ch->blood[BLOOD_POOL])
ch->blood[BLOOD_CURRENT] = ch->blood[BLOOD_POOL];
}
if (ch->agg > 0)
{
if (ch->position == POS_RESTING || ch->position == POS_SLEEPING
|| ch->position == POS_MEDITATING)
{
if (number_range (1, 4) > 1)
{
ch->agg -= number_range (4, 6);
if (ch->agg < 1)
{
stc ("You have regenerated all aggravated wounds.\n\r", ch);
}
else
{
stc ("You regenerate some aggravated wounds.\n\r", ch);
}
}
}
}
return;
}
void
cor_regen (CHAR_DATA * ch, int speed)
{
int aggh = 0;
int max_hp = 0;
int total_aggh = 0;
int paid = FALSE;
if (ch->agg < 0)
ch->agg = 0;
else if (ch->agg > 100)
ch->agg = 100;
if (ch->agg > 0)
{
aggh = ch->max_hit * 0.25;
total_aggh = aggh * ch->agg;
total_aggh /= 100;
max_hp = ch->max_hit - total_aggh;
}
else
{
max_hp = ch->max_hit;
}
if (IS_XX (ch, XX_ADVPOISON) && number_range (1, 100) < 50)
{
stc ("The Poison Prevents you from regenerating!\n\r", ch);
return;
}
if (ch->hit < max_hp)
{
if (IS_VAMPIRE (ch) && !IS_NYM (ch, NYM_DEAD)
&& !IS_SET (ch->in_room->added_flags, ROOM2_LICHCIRCLE)
&& !IS_WEREWOLF (ch))
{
if (ch->pcdata->vamprage > 1 || ch->pcdata->regenerate > 0)
{
if (ch->blood[BLOOD_CURRENT] < 5)
{
stc
("You have insufficient blood to regenerate any more wounds.\n\r",
ch);
ch->pcdata->regenerate = 0;
}
else
{
ch->blood[BLOOD_CURRENT] -= 5;
if (ch->blood[BLOOD_CURRENT] < 0)
ch->blood[BLOOD_CURRENT] = 0;
stc ("You burn some blood to regenerate your wounds.\n\r",
ch);
hp_regen (ch, speed);
paid = TRUE;
}
}
if (ch->hit > max_hp)
ch->hit = max_hp;
}
else
{
hp_regen (ch, speed);
if (ch->hit > max_hp)
ch->hit = max_hp;
}
if (ch->hit >= max_hp)
{
if (max_hp < ch->max_hit)
stc ("You have regenerated all non-aggravated wounds.\n\r", ch);
}
}
else if (ch->hit == max_hp)
{
if (ch->hit < ch->max_hit)
{
stc
("You have too many aggravated wounds to regenerate any further.\n\r",
ch);
}
}
if (ch->mana < ch->max_mana)
{
if (ch->pcdata->npowers[NINJA_RAGE] < 1 || ch->position <= POS_RESTING)
{
mana_regen (ch, speed);
if (ch->mana > ch->max_mana)
ch->mana = ch->max_mana;
}
}
if (ch->move < ch->max_move)
{
if (!IS_XBITS (ch, X_NINJA_HIDE))
{
if (!IS_WRAITH (ch))
move_regen (ch, speed);
if (IS_WRAITH (ch)
&& (IS_NYM (ch, NYM_DEATHPLANE) || ch->pcdata->shadow == 0))
move_regen (ch, speed);
if (ch->move > ch->max_move)
ch->move = ch->max_move;
}
}
if (!IS_VAMPIRE (ch) && ch->embraced == ARE_NONE)
{
if (ch->blood[BLOOD_CURRENT] < ch->blood[BLOOD_POOL])
ch->blood[BLOOD_CURRENT] += number_range (20, 30);
if (ch->blood[BLOOD_CURRENT] > ch->blood[BLOOD_POOL])
ch->blood[BLOOD_CURRENT] = ch->blood[BLOOD_POOL];
}
if (ch->agg > 0)
{
if (ch->position == POS_RESTING || ch->position == POS_SLEEPING
|| ch->position == POS_MEDITATING)
{
if (number_range (1, 4) > 1)
{
if (IS_VAMPIRE (ch) && !IS_NYM (ch, NYM_DEAD) && !paid)
{
if (ch->pcdata->vamprage > 1 || ch->pcdata->regenerate > 0)
{
if (ch->blood[BLOOD_CURRENT] < 5)
{
stc
("You have insufficient blood to regenerate any more aggravated wounds.\n\r",
ch);
ch->pcdata->regenerate = 0;
}
else
{
ch->blood[BLOOD_CURRENT] -= 5;
if (ch->blood[BLOOD_CURRENT] < 0)
ch->blood[BLOOD_CURRENT] = 0;
ch->agg -= number_range (4, 6);
stc
("You burn some blood to regenerate your aggravated wounds.\n\r",
ch);
if (ch->agg < 1)
{
stc
("You have regenerated all aggravated wounds.\n\r",
ch);
}
else
{
stc
("You regenerate some aggravated wounds.\n\r",
ch);
}
}
}
}
else
{
ch->agg -= number_range (4, 6);
if (ch->agg < 1)
{
stc ("You have regenerated all aggravated wounds.\n\r",
ch);
}
else
{
stc ("You regenerate some aggravated wounds.\n\r", ch);
}
}
}
}
}
if (IS_VAMPIRE (ch) && !IS_NYM (ch, NYM_DEAD))
{
if (ch->pcdata->vamprage < 1)
{
ch->pcdata->regenerate--;
if (ch->pcdata->regenerate < 0)
ch->pcdata->regenerate = 0;
}
}
return;
}
void
cor_monk (CHAR_DATA * ch, int speed)
{
int aggh = 0;
int max_hp = 0;
int total_aggh = 0;
if (ch->agg < 0)
ch->agg = 0;
else if (ch->agg > 100)
ch->agg = 100;
if (ch->agg > 0)
{
aggh = ch->max_hit * 0.25;
total_aggh = aggh * ch->agg;
total_aggh /= 100;
max_hp = ch->max_hit - total_aggh;
}
else
{
max_hp = ch->max_hit;
}
if (IS_VAMPIRE (ch) && ch->pcdata->vamprage < 1
&& ch->pcdata->regenerate <= 0 && !IS_NYM (ch, NYM_DEAD))
return;
if (IS_VAMPIRE (ch) && !IS_NYM (ch, NYM_DEAD))
{
if (ch->blood[BLOOD_CURRENT] < 5)
{
stc ("You have insufficient blood to regenerate any further.\n\r",
ch);
ch->pcdata->regenerate = 0;
return;
}
ch->blood[BLOOD_CURRENT] -= 5;
if (ch->blood[BLOOD_CURRENT] < 0)
ch->blood[BLOOD_CURRENT] = 0;
}
if (ch->hit < max_hp)
{
hp_regen (ch, speed);
if (ch->hit >= max_hp)
{
stc ("You have regenerated all non-aggravated wounds.\n\r", ch);
}
if (ch->hit > max_hp)
ch->hit = max_hp;
}
else if (ch->hit == max_hp)
{
if (ch->hit < ch->max_hit)
{
stc
("You have too many aggravated wounds to regenerate any further.\n\r",
ch);
}
}
if (ch->mana < ch->max_mana)
{
if (ch->pcdata->npowers[NINJA_RAGE] < 1 || ch->position <= POS_RESTING)
{
mana_regen (ch, speed);
if (ch->mana > ch->max_mana)
ch->mana = ch->max_mana;
}
}
if (!IS_VAMPIRE (ch) && ch->embraced == ARE_NONE)
{
if (ch->blood[BLOOD_CURRENT] < ch->blood[BLOOD_POOL])
ch->blood[BLOOD_CURRENT] += number_range (20, 30);
if (ch->blood[BLOOD_CURRENT] > ch->blood[BLOOD_POOL])
ch->blood[BLOOD_CURRENT] = ch->blood[BLOOD_POOL];
}
if (ch->agg > 0)
{
if (ch->position == POS_RESTING || ch->position == POS_SLEEPING
|| ch->position == POS_MEDITATING)
{
if (number_range (1, 4) > 1)
{
ch->agg -= number_range (4, 6);
if (ch->agg < 1)
{
stc ("You have regenerated all aggravated wounds.\n\r", ch);
}
else
{
stc ("You regenerate some aggravated wounds.\n\r", ch);
}
}
}
}
if (IS_VAMPIRE (ch) && !IS_NYM (ch, NYM_DEAD))
{
ch->pcdata->regenerate--;
if (ch->pcdata->regenerate < 0)
ch->pcdata->regenerate = 0;
}
return;
}
void
pc_update (void)
{
char buf[MSL];
CHAR_DATA *ch;
CHAR_DATA *ch_next;
for (ch = char_list; ch != NULL; ch = ch_next)
{
ch_next = ch->next;
if (ch->in_room == NULL)
continue;
if (IS_NPC (ch))
continue;
if (!IS_NPC (ch))
{
if (ch->position == POS_STUNNED && number_range (1, 8) == 1)
{
update_pos (ch);
}
else if (ch->position < POS_STUNNED || ch->hit < 1)
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 2);
update_pos (ch);
}
else
{
if (IS_ITEMAFF (ch, ITEMA_REGENERATE))
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
item_regen (ch, NULL, 2);
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch, ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] + ch->loc_hp[5]) !=
0)
reg_mend (ch);
}
}
if (ch->pcdata->cpowers[DRAC_CURSED] > 0
&& number_range (1, 2) == 1)
{
int min = ch->max_hit / 12;
int max = ch->max_hit / 6;
int dam = 0;
int cap = 0;
int cap2 = 0;
if (min < 400)
min = 400;
if (max < 800)
max = 800;
if (min > 10000)
min = 10000;
if (max > 18000)
max = 18000;
ch->pcdata->cpowers[DRAC_CURSED]--;
dam = number_range (min, max);
stc
("Your body is wracked with pain as the #rDrake#n Spirit surges through your veins.\n\r",
ch);
act
("$n screams in pain, as $s body seems to pulse with unnatural energyies.",
ch, NULL, NULL, TO_ROOM);
ch->hit -= dam;
update_pos (ch);
cap = ch->max_hit * 25;
cap /= 100;
cap2 = ch->max_hit - cap;
if (ch->hit < cap2)
ch->pcdata->cpowers[DRAC_CURSED] = 0;
if (ch->pcdata->cpowers[DRAC_CURSED] <= 0)
{
stc
("You are relieved as the #rDrake#n Spirit finally leaves your body.\n\r",
ch);
act
("$n seems relieved as a faint #rDrake#n Spirit leaves $s body.",
ch, NULL, NULL, TO_ROOM);
ch->pcdata->cpowers[DRAC_CURSED] = 0;
}
}
if (IS_NYM (ch, NYM_CHARGING) && IS_DEMON (ch) && !IS_NPC (ch)
&& number_range (1, 4) == 2)
{
int sphere = 1;
if (ch->max_mana >= 10000)
{
sphere += ch->max_mana / 10000;
if (sphere > 10)
sphere = 10;
}
stc
("The air around you crackles as you finish charging a Lightning Sphere and it starts floating around you.\n\r",
ch);
ch->pcdata->shockballs++;
if (ch->pcdata->shockballs >= sphere)
{
REMOVE_BIT (ch->nymbits, NYM_CHARGING);
ch->pcdata->shockballs = sphere;
stc
("Your body starts regenerating again as you have charged up as many Lightning Spheres as you can handle.\n\r",
ch);
ch->pcdata->shockballs = sphere;
}
}
if (ch->pcdata->cpowers[DRAC_HEALING] > 0)
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || (ch->agg > 0
&& (ch->position ==
POS_RESTING
|| ch->position ==
POS_SLEEPING
|| ch->position ==
POS_MEDITATING)))
drac_regen (ch, 3);
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch, ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] + ch->loc_hp[5]) !=
0)
reg_mend (ch);
}
}
if (ch->class == CLASS_NONE || IS_SOUL (ch) || IS_GHOST (ch))
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 1);
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch, ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] + ch->loc_hp[5]) !=
0)
reg_mend (ch);
}
}
else
{
switch (ch->class)
{
default:
stc
("No regen for you punk, since Corim has forgotten you.\n\r",
ch);
break;
case CLASS_NEWWW:
if (ch->position == POS_SLEEPING)
{
if (ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 8);
}
else if (ch->fighting == NULL)
{
if (ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 4);
}
else
{
if (ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 2);
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_ELF:
if ((ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
&& !IS_NYM (ch, NYM_CHARGING))
cor_regen (ch, 4);
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_PARAGON:
case CLASS_GRIMALKIN:
case CLASS_REVENANT:
case CLASS_BALEHOUND:
case CLASS_NECROMANCER:
case CLASS_WRAITH:
if (IS_NYM (ch, NYM_DEATHPLANE))
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 8);
}
else if (ch->pcdata->shadow < 1)
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 4);
}
else if (ch->fighting != NULL)
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 1);
}
else if (number_range (1, 4) == 1)
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 1);
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_SHINOBI:
if (ch->position == POS_MEDITATING)
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 4);
}
if (ch->pcdata->npowers[NINJA_RAGE] > 0
&& ch->chi[CURRENT] > 0)
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| (!IS_XBITS (ch, X_FAE_FORCEWALL)
&& !IS_XBITS (ch, X_YANG_MIGHT)
&& !IS_XBITS (ch, X_YING_SPEED)
&& ch->mana < ch->max_mana) || ch->agg > 0)
cor_monk (ch, 3);
}
else if (ch->pcdata->npowers[NINJA_RAGE] > 0)
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| (!IS_XBITS (ch, X_FAE_FORCEWALL)
&& !IS_XBITS (ch, X_YANG_MIGHT)
&& !IS_XBITS (ch, X_YING_SPEED)
&& ch->mana < ch->max_mana) || ch->agg > 0)
cor_monk (ch, 2);
}
else if (ch->chi[CURRENT] > 0)
{
if (ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->agg > 0)
{
cor_monk (ch, 2);
}
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_SHIDOSHI:
case CLASS_GYPSY:
case CLASS_PLANARSOHEI:
case CLASS_NINJA:
if (IS_DEMON (ch))
{
if (ch->in_room != NULL
&& ch->in_room->area->plane == PLANE_HELL
&& !IS_NYM (ch, NYM_CHARGING))
{
if (ch->hit < ch->max_hit
|| ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 4);
}
}
if (IS_ANGELW (ch))
{
if (ch->in_room != NULL
&& ch->in_room->area->plane == PLANE_HEAVEN)
{
if (ch->hit < ch->max_hit
|| ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 4);
}
}
if (IS_MAGE (ch))
{
if (ch->mana < ch->max_mana)
{
if (ch->position == POS_MEDITATING)
cor_regen (ch, 4);
else
cor_regen (ch, 3);
}
}
if (ch->pcdata->npowers[NINJA_RAGE] > 0
&& !IS_NYM (ch, NYM_CHARGING))
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| (!IS_XBITS (ch, X_FAE_FORCEWALL)
&& !IS_XBITS (ch, X_YANG_MIGHT)
&& !IS_XBITS (ch, X_YING_SPEED)
&& ch->mana < ch->max_mana) || ch->agg > 0)
cor_regen (ch, 4);
}
if (ch->position == POS_MEDITATING
&& !IS_NYM (ch, NYM_CHARGING))
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 4);
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_DEMON:
if (ch->in_room != NULL
&& ch->in_room->area->plane == PLANE_HELL
&& !IS_NYM (ch, NYM_CHARGING))
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 8);
}
else if ((ch->hit < ch->max_hit
|| ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
&& !IS_NYM (ch, NYM_CHARGING))
cor_regen (ch, 2);
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_ANGELW:
if (ch->in_room != NULL
&& ch->in_room->area->plane == PLANE_HEAVEN)
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 8);
}
else if (ch->hit < ch->max_hit
|| ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 2);
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_DEFYLER:
case CLASS_ABERRATION:
case CLASS_WISHENCHANT:
case CLASS_EFRETI:
case CLASS_DJINN:
if (IS_MAGE (ch))
{
if (ch->mana < ch->max_mana)
{
if (ch->position == POS_MEDITATING)
ch->mana += number_range (500, 1000);
else
ch->mana += number_range (100, 200);
}
}
if (IS_DEMON (ch) && !IS_NYM (ch, NYM_CHARGING))
{
if (ch->in_room != NULL
&& ch->in_room->area->plane == PLANE_HELL)
{
if (ch->hit < ch->max_hit
|| ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 4);
}
}
if (IS_SET
(ch->pcdata->powers[DJINNPOWERS], DJINN_REGEN)
&& !IS_NYM (ch, NYM_CHARGING))
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 2);
if (IS_WEREWOLF (ch) && !IS_NYM (ch, NYM_CHARGING))
{
if (ch->position == POS_SLEEPING)
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move
|| ch->agg > 0)
cor_regen (ch, 8);
}
else if (ch->fighting == NULL)
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move
|| ch->agg > 0)
cor_regen (ch, 4);
}
}
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_SHAAHOUL:
case CLASS_TAKARRA:
case CLASS_SAINT:
case CLASS_MONK:
if (ch->position == POS_MEDITATING)
{
if (ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 4);
}
else if (ch->chi[CURRENT] > 0)
{
if (ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->agg > 0)
{
cor_monk (ch, 2);
}
}
if (IS_SET
(ch->pcdata->powers[DJINNPOWERS], DJINN_REGEN))
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_monk (ch, 2);
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_TIGRASHA:
case CLASS_RAKSHASA:
case CLASS_KAHN:
if (IS_DEMON (ch) && !IS_NYM (ch, NYM_CHARGING))
{
if (ch->in_room != NULL
&& ch->in_room->area->plane == PLANE_HELL)
{
if (ch->hit < ch->max_hit
|| ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 4);
}
}
if (IS_ANGELW (ch))
{
if (ch->in_room != NULL
&& ch->in_room->area->plane == PLANE_HEAVEN)
{
if (ch->hit < ch->max_hit
|| ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 8);
}
}
if ((ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
&& !IS_NYM (ch, NYM_CHARGING))
cor_regen (ch, 2);
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_KRENSHAR:
//case CLASS_ABOMINATION:
case CLASS_LICH:
case CLASS_VAMPIRE:
case CLASS_GHOUL:
case CLASS_IKIRYU:
case CLASS_CEVOYIA:
case CLASS_NECRONOM:
if (IS_MAGE (ch))
{
if (ch->mana < ch->max_mana)
{
if (ch->position == POS_MEDITATING)
ch->mana += number_range (500, 1000);
else
ch->mana += number_range (100, 200);
}
}
if (ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 3);
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_NEPHANDI:
if (ch->in_room != NULL
&& ch->in_room->area->plane == PLANE_HELL
&& !IS_NYM (ch, NYM_CHARGING))
{
if (ch->hit < ch->max_hit || ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 4);
}
else if ((ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
&& !IS_NYM (ch, NYM_CHARGING))
cor_regen (ch, 2);
if (ch->mana < ch->max_mana)
{
if (ch->position == POS_MEDITATING)
ch->mana += number_range (500, 1000);
else
ch->mana += number_range (100, 200);
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_HIGHLANDER:
case CLASS_WEAPONMASTER:
if (IS_QUICK (ch, QUICKENING_REGEN))
{
if (ch->fighting == NULL
&& number_range (1, 8) <= 5)
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 4);
mana_regen (ch, 4);
}
else
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 2);
mana_regen (ch, 2);
}
}
else if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
{
cor_regen (ch, 2);
mana_regen (ch, 2);
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
if (IS_QUICK (ch, QUICKENING_LIMB))
{
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] +
ch->loc_hp[2] + ch->loc_hp[3] +
ch->loc_hp[4] + ch->loc_hp[5]) != 0)
reg_mend (ch);
}
}
break;
case CLASS_ABOMINATION:
case CLASS_SKINDANCER:
case CLASS_WEREWOLF:
if (IS_MAGE (ch))
{
if (ch->mana < ch->max_mana)
{
if (ch->position == POS_MEDITATING)
ch->mana += number_range (500, 1000);
else
ch->mana += number_range (100, 200);
}
}
if (ch->position == POS_SLEEPING)
{
if (ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 8);
}
else if (ch->fighting == NULL)
{
if (ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 4);
}
else
{
if (ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 2);
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_BLACK_SPIRAL_DANCER:
if (ch->in_room != NULL
&& ch->in_room->area->plane == PLANE_HELL
&& !IS_NYM (ch, NYM_CHARGING))
{
if (ch->position == POS_SLEEPING)
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 12);
}
else if (ch->fighting == NULL
&& !IS_NYM (ch, NYM_CHARGING))
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 6);
}
else
{
if ((ch->hit < ch->max_hit
|| ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
&& !IS_NYM (ch, NYM_CHARGING))
cor_regen (ch, 4);
}
}
else
{
if (ch->position == POS_SLEEPING
&& !IS_NYM (ch, NYM_CHARGING))
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 8);
}
else if (ch->fighting == NULL
&& !IS_NYM (ch, NYM_CHARGING))
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 4);
}
else
{
if ((ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
&& !IS_NYM (ch, NYM_CHARGING))
cor_regen (ch, 2);
}
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_BETRAYER:
if ((ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
&& !IS_NYM (ch, NYM_CHARGING)
&& ch->in_room->area->plane != PLANE_LIMBO)
cor_regen (ch, 2);
if ((ch->hit < ch->max_hit || ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
&& !IS_NYM (ch, NYM_CHARGING)
&& ch->in_room->area->plane == PLANE_LIMBO)
cor_regen (ch, 4);
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_GAIAINQ:
{
int stat = 0;
stat = ch->max_hit;
stat *= 65;
stat /= 100;
if (ch->in_room != NULL
&& ch->in_room->area->plane == PLANE_HEAVEN)
{
if (ch->position == POS_SLEEPING)
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 12);
}
else if (ch->fighting == NULL)
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 6);
}
else
{
if (ch->hit < ch->max_hit
|| ch->move < ch->max_move
|| ch->mana < ch->max_mana || ch->agg > 0)
cor_regen (ch, 4);
}
}
else
{
if (ch->position == POS_SLEEPING)
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 8);
}
else if (ch->fighting == NULL)
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 4);
}
else
{
if (ch->hit < ch->max_hit
|| ch->mana < ch->max_mana
|| ch->move < ch->max_move || ch->agg > 0)
cor_regen (ch, 2);
}
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] +
ch->loc_hp[2] + ch->loc_hp[3] +
ch->loc_hp[4] + ch->loc_hp[5]) != 0)
reg_mend (ch);
}
if (IS_XX (ch, XX_EARTHSHIELD)
&& IS_XX (ch, XX_BROKENSHIELD) && ch->hit > stat)
{
if (number_range (1, 6) < 2
&& ch->fighting == NULL)
{
stc
("Your broken #gEa#Gr#Gth#n Shield reforms, erasing any sign of it ever being cracked.\n\r",
ch);
act
("$n's broken #gEa#Gr#Gth#n Shield reforms, erasing any sign of it ever being cracked.",
ch, NULL, NULL, TO_ROOM);
REMOVE_BIT (ch->xxbits, XX_BROKENSHIELD);
}
}
break;
}
case CLASS_DRAGON:
case CLASS_DRACONIAN:
if (ch->position == POS_RESTING
|| ch->position == POS_SLEEPING
|| ch->position == POS_MEDITATING)
cor_regen (ch, 4);
if (IS_VAMPAFF (ch, VAM_EARTHMELDED))
{
if (ch->pcdata->cpowers[DRAC_DEFENSIVE] > 8)
cor_regen (ch, 12);
if (ch->agg > 0)
{
ch->agg -= number_range (10, 20);
if (ch->agg < 1)
{
stc
("You have regenerated all aggravated wounds.\n\r",
ch);
}
else
{
stc
("You regenerate some aggravated wounds.\n\r",
ch);
}
}
}
if (IS_DRAC_MAGE (ch))
{
if (ch->pcdata->cpowers[DRAC_MAGIC] > 3)
{
if (ch->mana < ch->max_mana)
{
if (ch->position == POS_MEDITATING)
mana_regen (ch, 4);
else
mana_regen (ch, 2);
}
}
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
case CLASS_MAGE:
if (ch->mana < ch->max_mana)
{
if (ch->position == POS_MEDITATING)
ch->mana += number_range (500, 1000);
else
ch->mana += number_range (100, 200);
}
if (ch->loc_hp[6] > 0)
{
int sn = skill_lookup ("clot");
(*skill_table[sn].spell_fun) (sn, ch->level, ch,
ch);
}
else
{
if ((ch->loc_hp[0] + ch->loc_hp[1] + ch->loc_hp[2] +
ch->loc_hp[3] + ch->loc_hp[4] +
ch->loc_hp[5]) != 0)
reg_mend (ch);
}
break;
}
}
}
}
}
return;
}