02 Jul, 2009, triskaledia wrote in the 1st comment:
Votes: 0
I've been working on a 'Mana Shield' for Wizard that would allow them to split their damage taken between their hitpoints and mana pool.
For some reason though, the following statement is restoring the victim's hp and mana:
if(IS_AFFECTED2(victim, AFF2_MANA_SHIELD))
{
stc("The mana shield absorbs some of the damage to your mana pool..\n\r", victim);
victim->hit -= dam - (dam * 45); //Damage is reduced by 45%
victim->mana -= dam - (dam * 55); //Mana takes 55% of the blow.
}
else
{
victim->hit -= dam;
}
*Needs some balancing for the damage taken, but got to get it working first*
Before this code bit:
//Randomize the damage.
dam += number_range(((dam / 10) * -1), (dam / 10));
//End randomization.

if (show)
dam_message (ch, victim, dam, dt, immune);

if (dam == 0)
return FALSE;

/*
* Hurt the victim.
* Inform the victim of his new state.
*/
After the code:
I have damage to equipment.
if((victim->pet != NULL) && (IS_AFFECTED2(victim->pet, AFF2_DARK_BOND)))
{
stc("Your undead takes most of the damage.\n\r",victim);
victim->hit += dam - (dam * .25);
//ch has sanctuary and pet doesn't, pet damage * 2.
//ch doesn't have sanctuary and pet does, pet damage / 2.
//ch doesn't have sanctuary and pet doesn't also, pet damage - dam.
//ch has sanctuary and pet has sanctuary, pet damamge - dam.
if((IS_AFFECTED(victim, AFF_SANCTUARY)) && (!IS_AFFECTED(victim->pet, AFF_SANCTUARY)))
victim->pet->hit -= (dam - (dam * .25)) * 2;
else if((!IS_AFFECTED(victim, AFF_SANCTUARY)) && (IS_AFFECTED(victim->pet, AFF_SANCTUARY)))
victim->pet->hit -= (dam - (dam * .25)) / 2;
else if((!IS_AFFECTED(victim, AFF_SANCTUARY)) && (!IS_AFFECTED(victim->pet, AFF_SANCTUARY)))
victim->pet->hit -= (dam - (dam * .25));
else if((IS_AFFECTED(victim, AFF_SANCTUARY)) && (IS_AFFECTED(victim->pet, AFF_SANCTUARY)))
victim->pet->hit -= (dam - (dam * .25));

if(victim->pet->hit < 1)
{
extract_char (victim->pet, TRUE);
act ("$n {cThe undead has been sent into the {Rf{Yi{Re{Yr{Ry {Yf{Rl{Ya{Rm{Ye{Rs{c.", victim->pet, NULL, NULL, TO_ROOM);
}
}

Dark Bond appears to work accurately for the necromantic undead.

Been scrolling up and down the code trying to figure out why I'm returning a restoration value to the victim instead of splitting out the damage,
and not finding why it's not working properly.
–Silence Tyire, the Sober (now)
02 Jul, 2009, Runter wrote in the 2nd comment:
Votes: 0
victim->hit  -= dam - (dam * 45);  //Damage is reduced by 45%
victim->mana -= dam - (dam * 55); //Mana takes 55% of the blow.


Should be
victim->hit  -=  dam - (dam * 45) / 100;  //Damage is reduced by 45%
victim->mana -= dam - (dam * 55) / 100; //Mana takes 55% of the blow.


or dam * .45 I guess.
02 Jul, 2009, triskaledia wrote in the 3rd comment:
Votes: 0
Me and my damn oversights… Thanks.
–Silence Tyire
0.0/3