[ScryMUD] SVN Commit Info r914 - trunk/mud/grrmud/server
scrymud at wanfear.com
scrymud at wanfear.com
Sun Mar 4 16:06:50 PST 2007
Author: eroper
Date: 2007-03-04 16:06:50 -0800 (Sun, 04 Mar 2007)
New Revision: 914
Modified:
trunk/mud/grrmud/server/battle.cc
trunk/mud/grrmud/server/critter.cc
trunk/mud/grrmud/server/critter.h
trunk/mud/grrmud/server/misc2.cc
Log:
Added critter::isUsingShield(), which should be quite self-explanatory.
Added critter::combatBonusVal()
Historically, combat went something like this.
1. The agressor rolled to hit, and maybe missed.
2. The defender rolled to dodge.
3. The defender rolled to parry/block.
This not only over-complicated things, but it meant that an agressor had to
roll against 3 saving rolls in order to hit something.
Dexterity was by and large the largest determining factor in all of these
rolls.
Today it's more like this:
Both the agressor and defender have bonuses returned from
critter::combatBonusVal(). This method takes into account passive skills that
are applied, some to the defender, some to the attacker, and some are commonly
applied to both. Additionally the critters levels, dexterity, and position are
taken into account by this method.
At present the list of modifying skills is as follows:
Common: Quickfoot, Martial Arts,
Aggressor: Weapon Mastery, Fencing (if it's a sword), Sword, Dagger, Mace,
Whip, Bow,
Defender: Dodge, Block, Parry
Block is now being treated as a shield skill. It is not considered if the
defender is not wearing a shield. Additionally, defenders who are both
dual-wielding and wearing a shield lose any off-hand parry bonus they may have
had. They still retain a parry bonus from their main-handed weapon (if they
have one)
The aggressors +HIT value and the defenders AC are taken into account in
battle.cc, not currently in critter::combatBonusVal(). They are both applied
once, when combatBonusBal() is called.
At this point a single roll is done.
If d(1,50+aggr_bonuses) > d(1,50+vict_bonuses) the aggressor has sucessfully
struck the defender.
If the defender suceeds in defending a weighted random roll (based on skill
%'s) determines which method was used to defend and the corresponding combat
messages are issued. This isn't terribly simulation-like, but it does make
things easier to keep track of, simplifies calculations and to be honest the
players can't really tell what's going on behind the scenes anyway.
This system should prevent players from seeing messages claiming they dodged
when they don't know the dodge skill.
Barehanded damage is now calculated with critter::getWeapDAM() just as weapon
damage is. This method takes into account player skills, +DAM bonuses and
penalizes the off-hand based on the callers dual wield proficiency.
Victim positional damage modifiers have reduced from 1.0, 1.5, 2.0, 3.0 and
4.0 to 1.0, 1.25, 1.50, 1.75 and 2.0 respectively.
battle.cc's exact_raw_damage no longer applies the aggressors Earthmeld skill
to the victim. The victims earthmeld skill is no properly consulted.
Additionally, dual wield will now fire every combat round. Off-hand damage is
severely reduced and can be increased (though not to 100% damage) by improving
ones knowledge of the "Dual wield" skill. The best you'll get is 70% of normal
damage with your off-hand.
Previously when get_percent_lrnd() was called on a MOB, 70 + the MOB's level
was returned. Since we have MOBs in the game > level 30, I've changed this to
return 2.5 * the MOB's level. I didn't bother _really_ fixing this (capping
it) as I've been working on allowing builders to "train" MOB's, allowing them
to custom design the MOB's proficiency levels.
Modified: trunk/mud/grrmud/server/battle.cc
===================================================================
--- trunk/mud/grrmud/server/battle.cc 2007-03-04 09:08:00 UTC (rev 913)
+++ trunk/mud/grrmud/server/battle.cc 2007-03-05 00:06:50 UTC (rev 914)
@@ -119,9 +119,9 @@
if (mudlog.ofLevel(DBG)) {
mudlog << "In large while, crit_ptr: " << crit_ptr << flush
- << " name: "
- << crit_ptr->getName() << " size of IS_FIGHTING: "
- << crit_ptr->IS_FIGHTING.size() << endl << endl;
+ << " name: "
+ << crit_ptr->getName() << " size of IS_FIGHTING: "
+ << crit_ptr->IS_FIGHTING.size() << endl << endl;
}//if
@@ -130,16 +130,16 @@
if (!crit_ptr->IS_FIGHTING.isEmpty()) {
is_embattled = TRUE;
-
+
if (crit_ptr->isUsingClient()) {
crit_ptr->show(CTAG_BATTLE(crit_ptr->whichClient() ));
}
-
+
/* KHAAVREN DELETE MARKER
- else if (crit_ptr->isUsingColor()) {
+ else if (crit_ptr->isUsingColor()) {
crit_ptr->show(*(crit_ptr->getBattleColor()));
- }
- */
+ }
+ */
int atks = crit_ptr->ATTACKS;
if (crit_ptr->ATTACKS > 4)
@@ -147,10 +147,10 @@
if (crit_ptr->ATTACKS < 1)
atks = 1;
- /* check for second attack */
+ /* check for second attack */
if ((crit_ptr->isPc())
- && (d(1,100) < d(1, (get_percent_lrnd(SECOND_ATTACK_SKILL_NUM, *(crit_ptr)) +
- crit_ptr->LEVEL) * (int)((float)(crit_ptr->getDEX(TRUE)) / 9.0))-(crit_ptr->PAUSE*60)) ) {
+ && (d(1,100) < d(1, (get_percent_lrnd(SECOND_ATTACK_SKILL_NUM, *(crit_ptr)) +
+ crit_ptr->LEVEL) * (int)((float)(crit_ptr->getDEX(TRUE)) / 9.0))-(crit_ptr->PAUSE*60)) ) {
atks++;
}
@@ -161,29 +161,29 @@
if (mudlog.ofLevel(DBG)) {
mudlog << "In do_battle, within for loop, i: "
- << i << " aggressor: "
- << *(name_of_crit(*crit_ptr, ~0)) << " addr: "
- << crit_ptr << flush << " victim addr: "
- << vict_ptr << " vict_name: "
- << *(name_of_crit(*vict_ptr, ~0)) << endl;
+ << i << " aggressor: "
+ << *(name_of_crit(*crit_ptr, ~0)) << " addr: "
+ << crit_ptr << flush << " victim addr: "
+ << vict_ptr << " vict_name: "
+ << *(name_of_crit(*vict_ptr, ~0)) << endl;
}
int show_vict_tags = TRUE;
if ((vict_ptr = check_for_diversions(*vict_ptr, "GM",
- *crit_ptr))) {
+ *crit_ptr))) {
if (vict_ptr->isUsingClient()) {
vict_ptr->show(CTAG_BATTLE(vict_ptr->whichClient()));
}
/* KHAAVREN DELETE MARKER
- else if (vict_ptr->isUsingColor()) {
+ else if (vict_ptr->isUsingColor()) {
show(*(vict_ptr->getBattleColor()), *vict_ptr);
- }
- */
+ }
+ */
//do reg attack
do_battle_round(*crit_ptr, *vict_ptr, 9, show_vict_tags);
-
+
if (crit_ptr->isNpc()) {
do_battle_proc(*crit_ptr);
}//if
@@ -196,56 +196,42 @@
vict_ptr->show(CTAG_END_BATTLE(vict_ptr->whichClient()));
}
/* KHAAVREN DELETE MARKER
- else if (vict_ptr->isUsingColor()) {
+ else if (vict_ptr->isUsingColor()) {
vict_ptr->show(*(vict_ptr->getDefaultColor()));
- }
- */
+ }
+ */
}//if
}//if
}//for /* now check for dual wield */
if (crit_ptr->isFighting() && crit_ptr->isDualWielding()) {
- int val = (int)(((float)(get_percent_lrnd(DUAL_WIELD_SKILL_NUM,
- *crit_ptr)) *
- (float)(crit_ptr->getDEX(TRUE)) / 10.0));
- if (d(1,100) < d(1, val)-(crit_ptr->PAUSE*50) ) {
- vict_ptr = crit_ptr->IS_FIGHTING.peekFront();
- if (vict_ptr->isUsingClient()) {
- vict_ptr->show(CTAG_BATTLE(vict_ptr->whichClient()));
- }
- /* KHAAVREN DELETE MARKER
- else if (vict_ptr->isUsingColor()) {
- vict_ptr->show(*(vict_ptr->getBattleColor()));
- }
- */
+ vict_ptr = crit_ptr->IS_FIGHTING.peekFront();
- int show_vict_tags = TRUE; //Show tags if needed.
- do_battle_round(*crit_ptr, *vict_ptr, 10, show_vict_tags);
+ if (vict_ptr->isUsingClient()) {
+ vict_ptr->show(CTAG_BATTLE(vict_ptr->whichClient()));
+ }
- // Tags will only be shown in do_battle_round if
- // the victim died.
- if (show_vict_tags) {
- if (vict_ptr->isUsingClient()) {
- vict_ptr->show(CTAG_END_BATTLE(vict_ptr->whichClient()));
- }
- /* KHAAVREN DELETE MARKER
- else if (vict_ptr->isUsingColor()) {
- vict_ptr->show(*(vict_ptr->getDefaultColor()));
- }
- */
- }//if
- }//if
+ int show_vict_tags = TRUE; //Show tags if needed.
+ do_battle_round(*crit_ptr, *vict_ptr, 10, show_vict_tags);
+
+ // Tags will only be shown in do_battle_round if
+ // the victim died.
+ if (show_vict_tags) {
+ if (vict_ptr->isUsingClient()) {
+ vict_ptr->show(CTAG_END_BATTLE(vict_ptr->whichClient()));
+ }
+ }//if
}//if
if (crit_ptr->isUsingClient()) {
crit_ptr->show(CTAG_END_BATTLE(crit_ptr->whichClient()));
}
/* KHAAVREN DELETE MARKER
- else if (crit_ptr->isUsingColor()) {
+ else if (crit_ptr->isUsingColor()) {
crit_ptr->show(*(crit_ptr->getDefaultColor()));
- }
- */
+ }
+ */
}//if
}//while
@@ -297,7 +283,6 @@
int& show_vict_tags) {
float damage, weapon_dam, pos_mult, xp_damage;
short is_wielding = FALSE;
- short tp, td;
String buf(81);
String aggbuf(25);
String victbuf(25);
@@ -306,7 +291,6 @@
String victendbuf(50);
String otherbuf(50);
char dam_str[50];
- int i;
if (mudlog.ofLevel(DBG)) {
mudlog << "In do_battle_round, agg addr: " << &agg << " name: "
@@ -369,136 +353,138 @@
return;
}//if
- //how hard am I to hit?
- int j = (
- (vict.getDEX(TRUE) * 3)
- - (vict.AC / 10)
- + vict.LEVEL
- + (agg.POS * 5)
- );
+ int j = (int)(vict.combatBonusVal(false) - ((vict.AC - 100)/10.0));
+ int i = (int)(agg.combatBonusVal(true) + agg.HIT);
- //how good am I at hitting you?
- i = (
- (agg.getDEX(TRUE) * 3)
- + (agg.getHIT(true, agg.eq[posn_of_weapon]) * 2)
- + agg.LEVEL + (vict.POS * 5)
- );
+ //if it was impossible to either hit or avoid getting hit, let us know.
+ if ( abs(j-i) > 50 ) {
+ cerr << "(vict)" << (const char*)(*vict.getName()) << ":" << j
+ << " (agg)" << (const char*)(*agg.getName()) << ":" << i << endl;
+ }
- if ((!vict.isStunned() && (d(1, j) > d(1, i))) ||
- (agg.POS == POS_STUN)) { //missed, stunned
- if (agg.POS == POS_STUN) {
- agg.show("You lie immobilized by the thought of imminent death.\n"
- );
- }//if
+ if ( (( ! vict.isStunned() ) && ( d(1,50+j) > d(1,50+i) ))
+ || ( agg.POS == POS_STUN ) ) {
+
+ if ( agg.POS == POS_STUN ) {
+ agg.show("You lie immobilized by the thought of imminent death.\n",
+ HL_BATTLE);
+ return;
+ }
else {
- // log("In the else, missed.\n");
- Sprintf(buf, "%S misses you.\n", name_of_crit(agg, vict.SEE_BIT));
- buf.Cap();
- vict.show(buf, HL_BATTLE);
+ int lower_bound = 1;
+ int miss_score = 50;
+ int dodge_score = 0
+ + get_percent_lrnd(DODGE_SKILL_NUM, vict)
+ + get_percent_lrnd(QUICKFOOT_SKILL_NUM, vict)
+ + get_percent_lrnd(MARTIAL_ARTS_SKILL_NUM, vict);
+ int block_score = 0;
+ int parry_score = 0;
- Sprintf(buf, "You miss %S.\n", name_of_crit(vict, agg.SEE_BIT));
- agg.show(buf, HL_BATTLE);
+ if ( vict.isUsingShield() ) {
+ block_score += get_percent_lrnd(BLOCK_SKILL_NUM, vict);
+ }
- Sprintf(buf, "misses %S.", name_of_crit(vict, ~0));
- emote(buf, agg, room_list[agg.getCurRoomNum()], TRUE, &vict);
- }//else
+ if ( vict.eq[9] ||
+ (vict.eq[10] && vict.isDualWielding() && (!vict.isUsingShield() )) ) {
+ parry_score += get_percent_lrnd(PARRY_SKILL_NUM, vict);
+ }
- return;
- }//if
+ int total_score = miss_score + dodge_score + block_score + parry_score;
+ int random_num = d(1,total_score);
- td = tp = FALSE;
- float chance = 0.0;
+ if ( (random_num >= lower_bound) && (random_num < (lower_bound + miss_score)) ) {
+ Sprintf(buf, "%S misses you.\n", name_of_crit(agg, vict.SEE_BIT));
+ buf.Cap();
+ vict.show(buf, HL_BATTLE);
- /* This used to check for battle stun, but in personal experience dodging
- is a natural reaction... even when you've got the wind knocked out of
- you or your world is spinning you can still manage to (instinctively)
- move the hell out of the way.
+ Sprintf(buf, "You miss %S.\n", name_of_crit(vict, agg.SEE_BIT));
+ agg.show(buf, HL_BATTLE);
- Also if you're asleep, meditating, or dying... fat chance dodging buddy
- */
- if ( (!vict.isParalyzed()) && ( vict.isStanding() || vict.isSitting() ) ) {
- // bigger means less likely to hit, should range from around 1-600
- if ( vict.isStunned() ) {
- chance = (float)(d(1, 300)) * (float)agg.getDEX(TRUE) / 18.0;
- } else {
- chance = (float)(d(1, 600)) * (float)agg.getDEX(TRUE) / 18.0;
- }
- if ((chance < 100.0) && vict.isStanding()) {
- td = (d(1, get_percent_lrnd(DODGE_SKILL_NUM, vict, TRUE) +
- vict.getDEX(TRUE) * 2) > d(4,25));
- }//if
+ Sprintf(buf, "misses %S.", name_of_crit(vict, ~0));
+ emote(buf, agg, room_list[agg.getCurRoomNum()], TRUE, &vict);
- // Don't parry & dodge at the same time...
- // 9 is wielded, 18 is shield... shields can parry a blow.
- if ((!td && (vict.EQ[9] || vict.EQ[18])) &&
- (vict.isStanding() || vict.isSitting())) {
- // bigger means less likely to hit, should range from around 1-600
- chance = (float)(d(1, 800)) * ((float)(agg.getDEX(TRUE))) / 18.0;
- if (chance < 100.0) {
- tp = (d(1, get_percent_lrnd(PARRY_SKILL_NUM, vict, TRUE) +
- vict.getDEX(TRUE) * 2) > d(4,25));
+ return;
}
- }//if
- }//if
- if (td) {
- Sprintf(buf, "dodges %S's blow.", name_of_crit(agg, ~0));
- emote(buf, vict, room_list[agg.getCurRoomNum()], TRUE, &agg);
-
- Sprintf(buf, "%S dodges your blow.\n", name_of_crit(vict, agg.SEE_BIT));
- buf.Cap();
- agg.show(buf, HL_BATTLE);
-
- Sprintf(buf, "You dodge %S's blow.\n", name_of_crit(agg, vict.SEE_BIT));
- vict.show(buf, HL_BATTLE);
-
- return;
- }//if td
+ lower_bound += miss_score;
- if (tp) {
- Sprintf(buf, "parries %S's blow.", name_of_crit(agg, ~0));
- emote(buf, vict, room_list[agg.getCurRoomNum()], TRUE, &agg);
-
- Sprintf(buf, "%S parries your blow.\n",
- name_of_crit(vict, agg.SEE_BIT));
- buf.Cap();
- agg.show(buf, HL_BATTLE);
-
- Sprintf(buf, "You parry %S's blow.\n",
- name_of_crit(agg, vict.SEE_BIT));
- vict.show(buf, HL_BATTLE);
-
- return;
- }//if tp
+ if ( (random_num >= lower_bound) && (random_num < (lower_bound + dodge_score)) ) {
+ Sprintf(buf, "dodges %S's blow.", name_of_crit(agg, ~0));
+ emote(buf, vict, room_list[agg.getCurRoomNum()], TRUE, &agg);
+ Sprintf(buf, "%S dodges your blow.\n", name_of_crit(vict, agg.SEE_BIT));
+ buf.Cap();
+ agg.show(buf, HL_BATTLE);
+
+ Sprintf(buf, "You dodge %S's blow.\n", name_of_crit(agg, vict.SEE_BIT));
+ vict.show(buf, HL_BATTLE);
+
+ return;
+ }
+
+ lower_bound += dodge_score;
+
+ if ( (random_num >= lower_bound) && (random_num < (lower_bound + parry_score)) ) {
+
+ Sprintf(buf, "parries %S's blow.", name_of_crit(agg, ~0));
+ emote(buf, vict, room_list[agg.getCurRoomNum()], TRUE, &agg);
+
+ Sprintf(buf, "%S parries your blow.\n",
+ name_of_crit(vict, agg.SEE_BIT));
+ buf.Cap();
+ agg.show(buf, HL_BATTLE);
+
+ Sprintf(buf, "You parry %S's blow.\n",
+ name_of_crit(agg, vict.SEE_BIT));
+ vict.show(buf, HL_BATTLE);
+
+ return;
+ }
+
+ lower_bound += parry_score;
+
+ if ( (random_num >= lower_bound) && (random_num < (lower_bound + block_score)) ) {
+
+ Sprintf(buf, "blocks %S's blow.", name_of_crit(agg, ~0));
+ emote(buf, vict, room_list[agg.getCurRoomNum()], TRUE, &agg);
+
+ Sprintf(buf, "%S blocks your blow.\n",
+ name_of_crit(vict, agg.SEE_BIT));
+ buf.Cap();
+ agg.show(buf, HL_BATTLE);
+
+ Sprintf(buf, "You block %S's blow.\n",
+ name_of_crit(agg, vict.SEE_BIT));
+ vict.show(buf, HL_BATTLE);
+
+ return;
+ }
+ }//agg isn't stunned.
+ }//missed,blocked,parried,dodged,whatever...
+
/* else, did hit */
// log("Did hit..going into messages.\n");
- if (is_wielding) { //wielded
- weapon_dam = agg.getWeapDAM(posn_of_weapon, true);
- }//if
- else {
- weapon_dam = d(agg.getBHDC(TRUE), agg.getBHDS(TRUE));
- //batlog << "no weapon, weapon_dam: " << weapon_dam << endl;
- }//else
-
+ //handles bhd too
+ weapon_dam = agg.getWeapDAM(posn_of_weapon, true);
+
// log("About to enter switch.\n");
switch (vict.POS) {
case POS_STAND:
pos_mult = 1.0;
break;
case POS_PRONE: case POS_REST: case POS_SIT:
- pos_mult = 1.5;
+ pos_mult = 1.25;
break;
case POS_SLEEP:
- pos_mult = 2.0;
+ pos_mult = 1.5;
break;
case POS_MED:
- pos_mult = 3.0;
+ pos_mult = 1.75;
break;
case POS_STUN:
- pos_mult = 4.0;
+ pos_mult = 2.0;
break;
default:
@@ -511,8 +497,7 @@
}//switch
/* no modifiers have been added yet, exact_raw... does that */
- damage = ((float)agg.STR/3.0 + (float)agg.getDAM(TRUE) + weapon_dam) *
- pos_mult;
+ damage = weapon_dam * pos_mult;
if (is_wielding) {
if (((agg.EQ[posn_of_weapon])->obj_flags).get(41))
@@ -931,7 +916,7 @@
}//if
if (is_affected_by(EARTHMELD_SKILL_NUM, vict)) {
- if ((pl = get_percent_lrnd(EARTHMELD_SKILL_NUM, agg)) > d(1,115)) {
+ if ((pl = get_percent_lrnd(EARTHMELD_SKILL_NUM, vict)) > d(1,115)) {
dam *= (100.0 - ((float)(pl))/7.0) / 100.0;
}//if
}//if
Modified: trunk/mud/grrmud/server/critter.cc
===================================================================
--- trunk/mud/grrmud/server/critter.cc 2007-03-04 09:08:00 UTC (rev 913)
+++ trunk/mud/grrmud/server/critter.cc 2007-03-05 00:06:50 UTC (rev 914)
@@ -2533,11 +2533,20 @@
ret_val += count * sides;
}
+ ret_val += getDAM(true);
+
+ ret_val += (int)( (getSTR(true) - 10) / 2.0 );
+
+ if ( position == 10 ) {//penalty for off-hand
+ p_lrnd = get_percent_lrnd(DUAL_WIELD_SKILL_NUM, *this);
+ ret_val = (int)( ret_val * ( 0.50 + p_lrnd/500.0 ) );
+ }
+
ret_val += getDAM(TRUE);
return ret_val;
}//critter::getWeapRange
-int critter::getWeapDAM(int position, bool include_modifiers=false) {
+float critter::getWeapDAM(int position, bool include_modifiers=false) {
int count = 0;
int sides = 0;
int weapon_skill = 0;
@@ -2558,17 +2567,32 @@
weapon_skill = BOW_SKILL_NUM;
}
- } else { //not weapon, technically we shouldn't have this happen.
- return 0;
+ p_lrnd = get_percent_lrnd(weapon_skill, *this);
+ if ( p_lrnd > 0 ) {
+ count = p_lrnd/50;
+ sides = p_lrnd/33;
+ }
+
+ count += weapon->getDiceCnt();
+ sides += weapon->getDiceSides();
+
+ } else {//we're bare handed
+ count = getBHDC(true);
+ sides = getBHDS(true);
}
- p_lrnd = get_percent_lrnd(weapon_skill, *this);
- if ( p_lrnd > 0 ) {
- count = p_lrnd/50;
- sides = p_lrnd/33;
+ float ret_val = d(count,sides);
+
+ ret_val += getDAM(true);
+
+ ret_val += (getSTR(true) - 10) / 2.0 ;
+
+ if ( position == 10 ) {//penalty for off-hand
+ p_lrnd = get_percent_lrnd(DUAL_WIELD_SKILL_NUM, *this);
+ ret_val = ret_val * ( 0.50 + p_lrnd/500.0 );
}
- return d(weapon->getDiceCnt()+count, weapon->getDiceSides()+sides);
+ return ret_val;
}//critter::getWeapDAM
void critter::checkForBattle(room& rm) {
@@ -5779,7 +5803,7 @@
}
HP -= (int)(dam);
- return (int)dam;
+ return abs((int)dam);
}//exact_raw_damage
@@ -5829,3 +5853,109 @@
HP -= (int)(dam);
return (int)dam;
}
+
+float critter::combatBonusVal(bool is_aggressor) {
+
+ int p_lrnd;
+ float ret_val = 0;
+
+ ret_val += getLevel()/1.35;
+
+ if ( getPosn() > 2 ) {
+ //sleeping or worse, no bonus for you
+ return 0;
+ }
+
+ if ( getPosn() > 1 ) {//if they're resting or worse
+ //return with just a level bonus
+ return ret_val;
+ }
+
+ ret_val += (getDEX(true)-10)/2.0;
+
+ if ( getPosn() > 0 ) {//less than standing, you get dex+level
+ return ret_val;
+ }
+
+ //currently defenders have a few additional helping skills
+ if ( !is_aggressor ) {
+
+ //TODO: heavy armor _should_ negatively impact this
+ ret_val += get_percent_lrnd(DODGE_SKILL_NUM, *this)/15.0;
+
+ if ( isUsingShield() ) {//can only block when using a shield
+ ret_val += get_percent_lrnd(BLOCK_SKILL_NUM, *this)/15.0;
+ }
+
+ //add in their ability to parry, but only if they have a weapon
+ p_lrnd = get_percent_lrnd(PARRY_SKILL_NUM, *this);
+ if ( eq[9] ) {
+ ret_val += p_lrnd/15.0;
+ }
+
+ //TODO: really you shouldn't be able to dual-wield _AND_ use a shield at
+ //all.
+ //
+ //if you're using a shield, you can't parry with your off-hand. there's
+ //also a sizeable penalty for the off-hand.
+ if ( eq[10] && isDualWielding() && ( ! isUsingShield() ) ) {
+ ret_val += p_lrnd/30.0;
+ }
+ }//defender-specific skills
+
+
+ //things that apply to anyone follow
+ //TODO: Again, heavy armor should negatively impact both of these
+ ret_val += get_percent_lrnd(QUICKFOOT_SKILL_NUM, *this)/15.0;
+ ret_val += get_percent_lrnd(MARTIAL_ARTS_SKILL_NUM, *this)/15.0;
+
+ //the following only give credit if they've got a weapon
+ if ( eq[9] || ( eq[10] && isDualWielding() && (! isUsingShield()) ) ) {
+
+ p_lrnd = get_percent_lrnd(WEAPON_MASTERY_SKILL_NUM, *this);
+
+ for ( int i = 9; i <= 10; i++ ) {
+
+ if ( ! eq[i] ) {//skip if there isn't a weapon in this slot.
+ continue;
+ }
+
+ //only check the off-hand if they're dual wielding and not using a
+ //shield.
+ if ( i == 10 && ( (! isDualWielding()) || (isUsingShield()) ) ) {
+ continue;
+ }
+
+ float bonus;
+ bonus = 0;
+
+ //apply weapon specific bonuses
+ if ( eq[i]->isSlash() ) {
+ bonus += get_percent_lrnd(SWORD_SKILL_NUM, *this)/15.0;
+ bonus += get_percent_lrnd(FENCING_SKILL_NUM, *this)/15.0;
+ }
+ else if ( eq[i]->isPierce() ) {
+ bonus += get_percent_lrnd(DAGGER_SKILL_NUM, *this)/15.0;
+ }
+ else if ( eq[i]->isSmash() ) {
+ bonus += get_percent_lrnd(MACE_SKILL_NUM, *this)/15.0;
+ }
+ else if ( eq[i]->isWhip() ) {
+ bonus += get_percent_lrnd(WHIP_SKILL_NUM, *this)/15.0;
+ }
+ else if ( eq[i]->isBow() ) {
+ bonus += get_percent_lrnd(BOW_SKILL_NUM, *this)/15.0;
+ }
+
+ if ( i == 10 ) {//penalize off-hand bonuses
+ bonus *= 0.50;
+ }
+
+ ret_val += bonus;
+
+ }//check both main-hand and off-hand
+
+ }//if they have at least one weapon
+
+ return ret_val;
+}//critter::combatBonusVal()
Modified: trunk/mud/grrmud/server/critter.h
===================================================================
--- trunk/mud/grrmud/server/critter.h 2007-03-04 09:08:00 UTC (rev 913)
+++ trunk/mud/grrmud/server/critter.h 2007-03-05 00:06:50 UTC (rev 914)
@@ -888,7 +888,7 @@
int getHIT(bool include_modifiers, object *weapon);
int getDAM(bool include_modifiers);
int getWeapRange(short min_max, int position, bool include_modifiers);
- int getWeapDAM(int position, bool include_modifiers);
+ float getWeapDAM(int position, bool include_modifiers);
int getMana() const { return short_cur_stats[16]; }
int getManaMax() const { return short_cur_stats[24]; }
int getMov() const { return short_cur_stats[17]; }
@@ -1020,6 +1020,7 @@
int isBlocked() { return CRIT_FLAGS.get(21); }
int isTailing() { return CRIT_FLAGS.get(23); }
int isDualWielding() { return crit_flags.get(16); }
+ bool isUsingShield() { return(eq[18] ? true : false); }
int canClimb();
int isParalyzed();
int isNotComplete() const ;
@@ -1160,6 +1161,7 @@
critter* makeSmob(int suppress_sub_fail_msg = 0);
int takeDamage(int adamage, int type, critter &agg);
int takeDamage(int damage, int type);
+ float combatBonusVal(bool is_aggressor);
};//class critter
Modified: trunk/mud/grrmud/server/misc2.cc
===================================================================
--- trunk/mud/grrmud/server/misc2.cc 2007-03-04 09:08:00 UTC (rev 913)
+++ trunk/mud/grrmud/server/misc2.cc 2007-03-05 00:06:50 UTC (rev 914)
@@ -1681,7 +1681,7 @@
return (70 + pc.LEVEL);
}//if
}//if automatic (ie should search)
- return (70 + pc.LEVEL);
+ return (int)(2.5*pc.LEVEL)
}//if not a pc
int retval;
More information about the ScryMUD
mailing list