[ScryMUD] SVN Commit Info r922 - trunk/mud/grrmud/server
scrymud at wanfear.com
scrymud at wanfear.com
Tue Jun 5 23:21:19 PDT 2007
Author: eroper
Date: 2007-06-05 23:21:19 -0700 (Tue, 05 Jun 2007)
New Revision: 922
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
trunk/mud/grrmud/server/misc2.h
trunk/mud/grrmud/server/skills.cc
trunk/mud/grrmud/server/spells.cc
Log:
* Marked some accessors in critters as const.
* The logic skill no longer reduces charisma, and instead raises
intelligence.
* Modified several uses of raw stats to call the appropriate accessors with
the modifiers flag. One very noticeable result will be that max weight will
increase from skill granted strength bonuses.
Modified: trunk/mud/grrmud/server/battle.cc
===================================================================
--- trunk/mud/grrmud/server/battle.cc 2007-06-01 23:56:32 UTC (rev 921)
+++ trunk/mud/grrmud/server/battle.cc 2007-06-06 06:21:19 UTC (rev 922)
@@ -150,7 +150,7 @@
/* 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)) ) {
+ crit_ptr->LEVEL) * (int)((float)(crit_ptr->getDEX(true)) / 9.0))-(crit_ptr->PAUSE*60)) ) {
atks++;
}
@@ -1124,8 +1124,8 @@
return;
}//if
- int hp_gain = d(1, crit.CON/2);
- int mana_gain = d(1, crit.WIS/2);
+ int hp_gain = d(1, crit.getCON(true)/2);
+ int mana_gain = d(1, crit.getWIS(true)/2);
int _class = crit.getClass();
switch (_class)
@@ -1133,17 +1133,17 @@
case WARRIOR:
case RANGER:
case THIEF:
- hp_gain += d(2, crit.CON/2);
+ hp_gain += d(2, crit.getCON(true)/2);
break;
case BARD:
- hp_gain += d(3, crit.CON/2);
+ hp_gain += d(3, crit.getCON(true)/2);
break;
case SAGE:
case WIZARD:
case CLERIC:
case ALCHEMIST:
case NECROMANCER:
- mana_gain += d(2, crit.WIS/2);
+ mana_gain += d(2, crit.getWIS(true)/2);
break;
default:
if (mudlog.ofLevel(DBG)) {
@@ -1153,10 +1153,10 @@
}//switch
crit.LEVEL++;
- crit.PRACS += d(2, (int)((float)(crit.INT)/6.0)) + 1;
+ crit.PRACS += d(2, (int)((float)(crit.getINT(true))/6.0)) + 1;
crit.MA_MAX += mana_gain;
crit.setHP_MAX(crit.getHP_MAX() + hp_gain);
- crit.MV_MAX += d(1, crit.getDEX(TRUE));
+ crit.MV_MAX += d(1, crit.getDEX(true));
crit.show("You rise a level.\n");
if ( crit.isAvian() ) {
Modified: trunk/mud/grrmud/server/critter.cc
===================================================================
--- trunk/mud/grrmud/server/critter.cc 2007-06-01 23:56:32 UTC (rev 921)
+++ trunk/mud/grrmud/server/critter.cc 2007-06-06 06:21:19 UTC (rev 922)
@@ -1990,7 +1990,7 @@
/** NOTE: This may normalize the real value.
*/
-int critter::getDamRecMod() {
+int critter::getDamRecMod() const {
int min_val = 25;
if (is_affected_by(FLESH_TO_STONE_SKILL_NUM, *this)) {
min_val = 1;
@@ -2345,14 +2345,14 @@
} // cur_weight
int critter::getMaxWeight() {
- return (short_cur_stats[1] * 10 + getNakedWeight()); // 10 times their str
+ return (getSTR(true) * 10 + getNakedWeight()); // 10 times their str
}//max_weight
int critter::getCurRoomNum() {
return IN_ROOM;
}
-int critter::getSTR(bool include_modifiers=false) {
+int critter::getSTR(bool include_modifiers=false) const {
int p_lrnd;
int modifier = 0;
@@ -2366,7 +2366,7 @@
return STR+modifier;
}
-int critter::getDEX(bool include_modifiers=false) {
+int critter::getDEX(bool include_modifiers=false) const {
int p_lrnd;
int modifier = 0;
@@ -2380,7 +2380,7 @@
return DEX+modifier;
}
-int critter::getWIS(bool include_modifiers=false) {
+int critter::getWIS(bool include_modifiers=false) const {
int p_lrnd;
int modifier = 0;
@@ -2394,7 +2394,7 @@
return WIS+modifier;
}
-int critter::getCHA(bool include_modifiers=false) {
+int critter::getCHA(bool include_modifiers=false) const {
int p_lrnd;
int modifier = 0;
@@ -2403,31 +2403,36 @@
if ( p_lrnd > 0 ) {
modifier += p_lrnd/30;
}
-
- p_lrnd = get_percent_lrnd(LOGIC_SKILL_NUM, *this);
- if ( p_lrnd > 0 ) {
- modifier -= p_lrnd/30;
- }
}
return CHA+modifier;
}
-int critter::getCON(bool include_modifiers=false) {
+int critter::getCON(bool include_modifiers=false) const {
return CON;
}//critter::getCON()
-int critter::getINT(bool include_modifiers=false) {
- return INT;
-}//critter::getCON()
+int critter::getINT(bool include_modifiers=false) const {
+ int p_lrnd;
+ int modifier = 0;
-int critter::getBHDC(bool include_modifiers=false) {
+ if ( include_modifiers && pc ) {
+ p_lrnd = get_percent_lrnd(LOGIC_SKILL_NUM, *this);
+ if ( p_lrnd > 0 ) {
+ modifier += p_lrnd/30;
+ }
+ }
+
+ return INT+modifier;
+}//critter::getINT()
+
+int critter::getBHDC(bool include_modifiers=false) const {
int modifier = 0;
return BH_DICE_COUNT+modifier;
}
-int critter::getBHDS(bool include_modifiers=false) {
+int critter::getBHDS(bool include_modifiers=false) const {
int p_lrnd;
int modifier = 0;
@@ -2441,7 +2446,7 @@
return BH_DICE_SIDES+modifier;
}
-int critter::getDAM(bool include_modifiers=false) {
+int critter::getDAM(bool include_modifiers=false) const {
int p_lrnd;
int modifier = 0;
@@ -2455,7 +2460,7 @@
return DAM+modifier;
}
-int critter::getHIT(bool include_modifiers=false, object* weapon = NULL) {
+int critter::getHIT(bool include_modifiers=false, object* weapon = NULL) const {
int p_lrnd;
int modifier = 0;
int weapon_skill = 0;
@@ -2492,7 +2497,7 @@
//min_max is 0 or 1. If 0, the minimum damage done by that hand is returned,
//otherwise the maximum possible damage. This will handle both weapons and
//bare handed. Originally writter for use in the "score" output.
-int critter::getWeapRange(short min_max, int position, bool include_modifiers=false) {
+int critter::getWeapRange(short min_max, int position, bool include_modifiers=false) const {
int ret_val, count, sides, weapon_skill, p_lrnd;
object *weapon = EQ[position];
@@ -2546,7 +2551,7 @@
return ret_val;
}//critter::getWeapRange
-float critter::getWeapDAM(int position, bool include_modifiers=false) {
+float critter::getWeapDAM(int position, bool include_modifiers=false) const {
int count = 0;
int sides = 0;
int weapon_skill = 0;
Modified: trunk/mud/grrmud/server/critter.h
===================================================================
--- trunk/mud/grrmud/server/critter.h 2007-06-01 23:56:32 UTC (rev 921)
+++ trunk/mud/grrmud/server/critter.h 2007-06-06 06:21:19 UTC (rev 922)
@@ -754,7 +754,7 @@
/** NOTE: This may normalize the real value.
*/
- int getDamRecMod();
+ int getDamRecMod() const;
/** For scripts, the script_targ is always *this. The script_owner
* will be null (for non-script specific stuff) and should be specified
@@ -876,19 +876,19 @@
int getCharisma() const { return short_cur_stats[4]; }
int getHP() const { return short_cur_stats[15]; }
int getHP_MAX() const { return short_cur_stats[23]; }
- int getSTR(bool include_modifiers);
- int getDEX(bool include_modifiers);
- int getWIS(bool include_modifiers);
- int getCHA(bool include_modifiers);
- int getCON(bool include_modifiers);
- int getINT(bool include_modifiers);
- int getBHDC(bool include_modifiers);
- int getBHDS(bool include_modifiers);
- int getHIT(bool include_modifiers) { return getHIT(include_modifiers, NULL); }
- int getHIT(bool include_modifiers, object *weapon);
- int getDAM(bool include_modifiers);
- int getWeapRange(short min_max, int position, bool include_modifiers);
- float getWeapDAM(int position, bool include_modifiers);
+ int getSTR(bool include_modifiers) const;
+ int getDEX(bool include_modifiers) const;
+ int getWIS(bool include_modifiers) const;
+ int getCHA(bool include_modifiers) const;
+ int getCON(bool include_modifiers) const;
+ int getINT(bool include_modifiers) const;
+ int getBHDC(bool include_modifiers) const;
+ int getBHDS(bool include_modifiers) const;
+ int getHIT(bool include_modifiers) const { return getHIT(include_modifiers, NULL); }
+ int getHIT(bool include_modifiers, object *weapon) const;
+ int getDAM(bool include_modifiers) const;
+ int getWeapRange(short min_max, int position, bool include_modifiers) const;
+ float getWeapDAM(int position, bool include_modifiers) const;
int getMana() const { return short_cur_stats[16]; }
int getManaMax() const { return short_cur_stats[24]; }
int getMov() const { return short_cur_stats[17]; }
@@ -1065,9 +1065,9 @@
int isAnimal() { return RACE == ANIMAL; }
int isAvian() { return RACE == AVIAN; }
int isMonster() { return RACE == MONSTER; }
- int isCharmed() { return master != NULL; }
- int isWanderer() { return mob && MOB_FLAGS.get(2); }
- int isBanker() { return mob && MOB_FLAGS.get(6); }
+ int isCharmed() const { return master != NULL; }
+ int isWanderer() const { return mob && MOB_FLAGS.get(2); }
+ int isBanker() const { return mob && MOB_FLAGS.get(6); }
int isOpen(int cur_military_time, int do_msg, critter& pc) const;
int isTeacher();
Modified: trunk/mud/grrmud/server/misc2.cc
===================================================================
--- trunk/mud/grrmud/server/misc2.cc 2007-06-01 23:56:32 UTC (rev 921)
+++ trunk/mud/grrmud/server/misc2.cc 2007-06-06 06:21:19 UTC (rev 922)
@@ -712,7 +712,7 @@
}//check_for_diversions
-stat_spell_cell* is_affected_by(int spell_num, critter& pc) {
+stat_spell_cell* is_affected_by(int spell_num, const critter& pc) {
Cell<stat_spell_cell*> cll(pc.affected_by);
stat_spell_cell* ptr;
@@ -725,7 +725,7 @@
}//is_affected_by
-stat_spell_cell* is_affected_by(int spell_num, object& obj) {
+stat_spell_cell* is_affected_by(int spell_num, const object& obj) {
Cell<stat_spell_cell*> cll(obj.affected_by);
stat_spell_cell* ptr;
Modified: trunk/mud/grrmud/server/misc2.h
===================================================================
--- trunk/mud/grrmud/server/misc2.h 2007-06-01 23:56:32 UTC (rev 921)
+++ trunk/mud/grrmud/server/misc2.h 2007-06-06 06:21:19 UTC (rev 922)
@@ -58,8 +58,8 @@
critter& pc, room* aux_rm = NULL, critter* aux_crit = NULL,
int do_msg = TRUE);
-stat_spell_cell* is_affected_by(int spell_num, critter& pc);
-stat_spell_cell* is_affected_by(int spell_num, object& obj);
+stat_spell_cell* is_affected_by(int spell_num, const critter& pc);
+stat_spell_cell* is_affected_by(int spell_num, const object& obj);
stat_spell_cell* has_stat_affect(int affect_num, object& obj);
Modified: trunk/mud/grrmud/server/skills.cc
===================================================================
--- trunk/mud/grrmud/server/skills.cc 2007-06-01 23:56:32 UTC (rev 921)
+++ trunk/mud/grrmud/server/skills.cc 2007-06-06 06:21:19 UTC (rev 922)
@@ -419,7 +419,7 @@
if (skill_did_hit(pc, KICK_SKILL_NUM, vict)) {
pc.PAUSE = 1; //increment pause_count
- float d1 = (((float)(pc.STR)) * (float)(pc.getLevel()) + 5.0) / 60.0;
+ float d1 = (((float)(pc.getSTR(true))) * (float)(pc.getLevel()) + 5.0) / 60.0;
exact_raw_damage(d((int)d1, 5), NORMAL, vict, pc);
vict.PAUSE = 1;
@@ -588,7 +588,7 @@
wd = pc.DAM + d(pc.BH_DICE_COUNT, pc.BH_DICE_SIDES);
- exact_raw_damage( (d(pc.STR/2, 5) + pc.DEX/2)+(wd*2) + (int)(pc.LEVEL/5),
+ exact_raw_damage( (d(pc.getSTR(true)/2, 5) + pc.getDEX(true)/2)+(wd*2) + (int)(pc.getLevel()/5),
NORMAL, vict, pc);
pc.PAUSE = 1;
vict.PAUSE = 1;
@@ -826,7 +826,7 @@
did_blind = TRUE;
}
- exact_raw_damage((d(pc.STR/2, 5) + pc.LEVEL), NORMAL, vict);
+ exact_raw_damage((d(pc.getSTR(true)/2, 5) + pc.getLevel()), NORMAL, vict);
if (vict.HP < 0) {
Sprintf(buf, "rips %S's throat out with %s %s!!\n",
@@ -1496,18 +1496,18 @@
}
break;
case CRONIC:
- j = ((18 - vict.CON) * 5 + 25);
+ j = ((18 - vict.getCON(true)) * 5 + 25);
break;
case AGILITY:
- j = ((18 - vict.DEX) * 5 + 25);
+ j = ((18 - vict.getDEX(true)) * 5 + 25);
break;
case COERCION:
case CHARM:
- j = ((18 - vict.INT) * 5 + 25);
- if (agg.ALIGN < -850)
+ j = ((18 - vict.getINT(true)) * 5 + 25);
+ if (agg.getAlignment() < -850)
j += (int)((float)j * .25);
- else if (agg.ALIGN > 250)
- j += (int)((float)j * ((float)agg.ALIGN / 4000.0));
+ else if (agg.getAlignment() > 250)
+ j += (int)((float)j * ((float)agg.getAlignment() / 4000.0));
break;
default:
if (mudlog.ofLevel(ERROR)) {
@@ -1575,14 +1575,14 @@
if ((spell_num == CONSTRUCT_SKILL_NUM) || (spell_num == BREW_SKILL_NUM)) {
if ( agg.isSage() ) {
- return ( d(1, 75) < d(1, (percent_lrnd*2 + 2*(agg.getDEX(TRUE) + agg.INT))));
+ return ( d(1, 75) < d(1, (percent_lrnd*2 + 2*(agg.getDEX(TRUE) + agg.getINT(true)))));
} else {
- return (d(1, 100) < d(1, (percent_lrnd * 2 + 2 * (agg.getDEX(TRUE) + agg.INT))));
+ return (d(1, 100) < d(1, (percent_lrnd * 2 + 2 * (agg.getDEX(TRUE) + agg.getINT(true)))));
}
}
else if ((spell_num == BODYSLAM_SKILL_NUM) ||
(spell_num == HURL_SKILL_NUM))
- return (d(1, vict.CRIT_WT_CARRIED) < d(1, percent_lrnd + agg.STR * 10));
+ return (d(1, vict.CRIT_WT_CARRIED) < d(1, percent_lrnd + agg.getSTR(true) * 10));
else if ((spell_num == BACKSTAB_SKILL_NUM) ||
(spell_num == CIRCLE_SKILL_NUM)) {
@@ -1593,8 +1593,8 @@
if(agg.isHiding()) backstab_bonus += get_percent_lrnd(HIDE_SKILL_NUM, agg)/6; //harder to hit something if you can't move around
if(agg.isInvis()) backstab_bonus += 15;
- int rnd1 = d(1, (agg.HIT * 3 + agg.DEX * 5 + agg.LEVEL * 2));
- int rnd2 = d(1, (2 * vict.DEX + vict.LEVEL + max(-vict.AC / 2, 25)));
+ int rnd1 = d(1, (agg.HIT * 3 + agg.getDEX(true) * 5 + agg.getLevel() * 2));
+ int rnd2 = d(1, (2 * vict.getDEX(true) + vict.getLevel() + max(-vict.AC / 2, 25)));
return ( (((float)(rnd1) * (float)(percent_lrnd) / 100.0) + backstab_bonus) >
((float)(rnd2)));
}
Modified: trunk/mud/grrmud/server/spells.cc
===================================================================
--- trunk/mud/grrmud/server/spells.cc 2007-06-01 23:56:32 UTC (rev 921)
+++ trunk/mud/grrmud/server/spells.cc 2007-06-06 06:21:19 UTC (rev 922)
@@ -1673,7 +1673,7 @@
}// else
i = (int)(((float)percent_lrned / 50.0) *
- (float)(agg.WIS + agg.INT + agg.LEVEL + 130));
+ (float)(agg.getWIS(true) + agg.getINT(true) + agg.getLevel() + 130));
return (d(1, 100) >= d(1, i));
}//lost_concentration
More information about the ScryMUD
mailing list