Welcome to the Builder Academy

Question Player special problem

More
01 Feb 2018 06:00 - 01 Feb 2018 06:01 #7495 by JTP
Player special problem was created by JTP
Ok added this:

Code:
if(affected_by_spell(ch, SPELL_BONE_ARMOR)) { bone_armor_rem = ch->player_specials->saved.bone_armor_hp - dam; // BONE ARMOR ADJUSTMENT HERE if(bone_armor_rem > 0) { // bone armor takes all of the damage and is still valid ch->player_specials->saved.bone_armor_hp = bone_armor_rem; dam = 0; send_to_char(ch, "Bone Armor At: %d\r\n", ch->player_specials->saved.bone_armor_hp); } else { ch->player_specials->saved.bone_armor_hp = 0; dam = -bone_armor_rem; affect_from_char(ch, SPELL_BONE_ARMOR); send_to_char(ch, "Your bone armor has worn out.\r\n"); } // END BONE ARMOR ADJUSTMENT }

But as you Can see on attached pic, the first 2 hits mob makes on me, is absorbed, but bone armor goes from 154 Down to 100. But the mob only damaged me 28 and 24 = 52 and not 54 ?

Then i miss it 3 times, and the bone armor is reduced each time. Bone armor should only drop, when someone hit me. Not when i hit it.

So something is wrong, i just cant see what.

Any ideas ?
Attachments:
Last edit: 01 Feb 2018 06:01 by JTP.

Please Log in or Create an account to join the conversation.

More
01 Feb 2018 06:56 - 01 Feb 2018 07:03 #7496 by Fizban
Replied by Fizban on topic Player special problem
Bone armor isn't preventing you from taking damage at all.

Your life went from 5000 to 4948.

Without more context and just looking at the above code and the screenshot, I think you can't do damage when you have bone armor, and any damage you would do is removing it from yourself.

You seem to have missed on every attack till it said your bone armor expired and then you started actually landing hits.

Without more context about where you inserted that chunk of code I'm guessing dam = damage you're doing, and not damage you're taking though as that seems to better fit what is going on in the screenshot.
Last edit: 01 Feb 2018 07:03 by Fizban.

Please Log in or Create an account to join the conversation.

More
01 Feb 2018 07:09 #7497 by WhiskyTest
Replied by WhiskyTest on topic Player special problem
dam = -bone_armor_rem;

do you mean :
dam -= bone_armor_rem;

Please Log in or Create an account to join the conversation.

More
01 Feb 2018 07:12 #7498 by JTP
Replied by JTP on topic Player special problem
Its added in fight.c

Between the Stock Line:

dam = MAX(MIN(dam, 100), 0);

And

GET_HIT(victim) -= dam;

Please Log in or Create an account to join the conversation.

More
01 Feb 2018 07:13 #7499 by Fizban
Replied by Fizban on topic Player special problem
That'd make more sense.

Otherwise if you would have taken 100 damage, but had 30 bone armor remaining, you'd get healed by 30 rather than taking 70.

But that seems like it'd only impact the attack that fully removed the bone armor, whereas he was clearly taking damage before it said it'd expired.

Please Log in or Create an account to join the conversation.

More
01 Feb 2018 07:17 #7500 by Fizban
Replied by Fizban on topic Player special problem
Yeah, notice that.

GET_HIT(victim) -= dam;

is taking dam, and reducing victims life by it.

if(affected_by_spell(ch, SPELL_BONE_ARMOR)) {

is checking whether ch has it, not vict. It's preventing you from doing damage while affected by it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.220 seconds