Welcome to the Builder Academy

Question Parry and Dodge Fix

More
26 Nov 2017 02:02 - 26 Nov 2017 02:03 #7164 by WhiskyTest
Replied by WhiskyTest on topic Parry and Dodge Fix
Papaya Pete hasn't edited the original post so I would say it hasn't been updated.

With the fixes that were discussed it would look like this:
Code:
/* Decide whether this is a hit or a miss. * Victim asleep = hit, otherwise: * 1 = Automatic miss. * 2..19 = Checked vs. AC. * 20 = Automatic hit. */ if (diceroll == 20 || !AWAKE(victim)) dam = TRUE; else if (diceroll == 1) dam = FALSE; else dam = (calc_thaco - diceroll <= victim_ac); + /* Dodge and Parry Snippet */ + 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) { + act("$N parries your attack!", FALSE, ch, NULL, victim, TO_CHAR); + act("You parry $n's attack!", FALSE, ch, NULL, victim, TO_VICT); + act("$N parries $n's attack!", FALSE, ch, NULL, victim, TO_NOTVICT); + dam = FALSE; + } + } + + if (GET_SKILL(victim, SKILL_PARRY) > 0) + chance = rand_number(1, 100); + else + chance = 0; + + if ((chance <= 10) && (GET_SKILL(victim, SKILL_PARRY) < 80) && (GET_SKILL(victim, SKILL_PARRY) > 0)) { + send_to_char(victim, "\tGYour parrying skill has gone up!\tn\r\n"); + GET_SKILL(victim, 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 ) { + act("$N dodges your attack!", FALSE, ch, NULL, victim, TO_CHAR); + act("You dodge $n's attack!", FALSE, ch, NULL, victim, TO_VICT); + act("$N dodges $n's attack!", FALSE, ch, NULL, victim, TO_NOTVICT); + dam = FALSE; + } + } + + if (GET_SKILL(victim, SKILL_DODGE) > 0) + chance = rand_number(1, 100); + else + chance = 0; + + if ((chance <= 10) && (GET_SKILL(victim, SKILL_DODGE) < 80) && (GET_SKILL(victim, SKILL_DODGE) > 0)) { + send_to_char(victim, "\tGYour dodging skill has gone up!\tn\r\n"); + GET_SKILL(victim, SKILL_DODGE) += 1; + } + } + } + /* End Dodge and Parry */ if (!dam) /* the attacker missed the victim */ damage(ch, victim, 0, type == SKILL_BACKSTAB ? SKILL_BACKSTAB : w_type); else {

This code also assumes you have added the two new skills SKILL_DODGE and SKILL_PARRY.

Other things:
You'd want to test the balance for the frequency of parry and dodge proccing - currently it has a 15% chance to proc provided the character makes their skill check.

Also doesn't check whether you need a weapon to parry.
Dodge will be tested even if parry was successful earlier.

But a great starting point I think.
Last edit: 26 Nov 2017 02:03 by WhiskyTest. Reason: spelling

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

Time to create page: 0.167 seconds