Welcome to the Builder Academy

Question Parry and Dodge Fix

More
23 Nov 2013 19:24 #4526 by Papaya Pete
I have to apologize ahead of time; I didn't test this before trying it out. Once I did, I found that Parry and Dodge were not working properly. Anyways, I put the skill checks in fight.c in the wrong spots; here is where they (hopefully) should go. I've tested this, and it seems to work just fine.
Code:
if (diceroll == 20 || !AWAKE(victim)) dam = TRUE; else if (diceroll == 1) dam = FALSE; else dam = (calc_thaco - diceroll <= victim_ac); + if (dam) { + if (!IS_NPC(victim) && GET_SKILL(victim, SKILL_PARRY) > 0) { + prob = rand_number(1, 101); + if (prob < GET_SKILL(victim, SKILL_PARRY)) { + chance = rand_number(1, 100); + if (chance <= 15) { + send_to_char(ch, "%s parries your blow!\r\n", GET_NAME(victim)); + send_to_char(victim, "You parry %s's attack!\r\n", GET_NAME(ch)); + dam = FALSE; + } + } + if (GET_SKILL(ch, SKILL_PARRY) > 0) chance = rand_number(1, 100); else chance = 0; + if ((chance <= 10) && (GET_SKILL(ch, SKILL_PARRY) < 80) && (GET_SKILL(ch, SKILL_PARRY) > 0)) { + send_to_char(ch, "\tGYour parrying skill has gone up!\tn\r\n"); + GET_SKILL(ch, SKILL_PARRY) += 1; + } + } + else if (!IS_NPC(victim) && GET_SKILL(victim, SKILL_DODGE) > 0) { + prob = rand_number(1, 101); + if (prob < GET_SKILL(victim, SKILL_DODGE)) { + chance = rand_number(1, 100); + if (chance <= 15) { + send_to_char(ch, "%s dodges your attack!\r\n", GET_NAME(victim)); + send_to_char(victim, "You dodge %s's attack!\r\n", GET_NAME(ch)); + dam = FALSE; + } + } + if (GET_SKILL(ch, SKILL_DODGE) > 0) chance = rand_number(1, 100); else chance = 0; + if ((chance <= 10) && (GET_SKILL(ch, SKILL_DODGE) < 80) && (GET_SKILL(ch, SKILL_DODGE) > 0)) { + send_to_char(ch, "\tGYour dodging skill has gone up!\tn\r\n"); + GET_SKILL(ch, SKILL_DODGE) += 1; + } + } + } if (!dam) /* the attacker missed the victim */ damage(ch, victim, 0, type == SKILL_BACKSTAB ? SKILL_BACKSTAB : w_type); else {

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

More
24 Jan 2014 22:05 #4665 by RussBrown
Replied by RussBrown on topic Parry and Dodge Fix
FYI. The above code actually improves the attacker's dodge and parry skills. You should be checking victim instead of ch in those sections.
The following user(s) said Thank You: Papaya Pete

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

More
02 Mar 2014 06:34 #4724 by Papaya Pete
Replied by Papaya Pete on topic Parry and Dodge Fix
I think I actually found that bug (and forgot to post it), but will definitely double-check. Thanks for the heads up!

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

More
11 Apr 2016 10:26 - 12 Apr 2016 09:58 #5749 by JTP
Replied by JTP on topic Parry and Dodge Fix
Hmm i tested this short code, one little snag

there is no message showing room that someone parried.
Last edit: 12 Apr 2016 09:58 by JTP.

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

More
12 Apr 2016 22:06 #5750 by thomas
Replied by thomas on topic Parry and Dodge Fix
That is correct. The code only sends that to the two engaged chars. I suggest you add an act() call near the send_to_char calls if you wish it to also send to others. Search the code for examples of such act() calls.

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

More
26 Nov 2017 00:44 #7161 by Sascha
Replied by Sascha on topic Parry and Dodge Fix
Question - With something like this, where a "fix" is posted, and then someone later in the thread posts a fix or correction to the fix, is the original post updated? And is the original post in a condition where it works, or are other steps missing? I would love to put in dodge and parry as skills in my game and this is the only reference that comes up in the search function. I'm a newbie coder and looking at this in pieces to ascertain if it's good to go as is (or not) is beyond my confidence level, so any assistance is appreciated. Thanks so much!

Will you stand against the coming Storm? After the Breaking: STORMRIDERS MUD - atbmud.dune.net port 4000

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

Time to create page: 0.265 seconds