i made a new spell for my mud called vitality. what it does is this: you cast it on yourself or another, you get a 33% increase in hp for a limited time. so far i have most of it figured out. i just can't get their hitpoints that they have to go up along with max hitpoints. example:
if someone has 1200/1200 hp, then casted vitality they would end up with 1200/1600 hp. i want their regular hitpoints to go up as well. here's my code so far.
if someone has 1200/1200 hp, then casted vitality they would end up with 1200/1600 hp. i want their regular hitpoints to go up as well. here's my code so far.
ch_ret spell_vitality( int sn, int level, CHAR_DATA *ch, void *vo )
{
CHAR_DATA *victim = (CHAR_DATA *) vo;
SKILLTYPE *skill = get_skilltype(sn);
AFFECT_DATA af;
int vch;
int vvh;
if (target_name[0] == '\0')
victim = ch;
else
victim = get_char_room(ch, target_name);
if ( IS_SET( victim->immune, RIS_MAGIC ) )
{
immune_casting( skill, ch, victim, NULL );
return rSPELL_FAILED;
}
if ( IS_AFFECTED(victim, AFF_VITALITY) )
{
failed_casting( skill, ch, victim, NULL );
return rSPELL_FAILED;
}
act( AT_MAGIC, "&WYou complete your spell", ch, NULL, NULL, TO_CHAR );
af.type = gsn_vitality;
af.duration = 120;
af.location = APPLY_HIT;
af.modifier = (victim->max_hit*.33);
af.bitvector = meb(AFF_VITALITY);
affect_to_char( victim, &af );
vch = (victim->max_hit*.33); <-- i tried these
vvh = victim->hit + vch; <-- but it doesn't work
victim->hit = vvh; <-- i get more regular hp than max
act( AT_MAGIC, "&WYou feel vitalized!", victim, NULL, NULL, TO_CHAR );
return rNONE;
}