[ScryMUD] SVN Commit Info r958 - trunk/mud/grrmud/server
svn-log at scrymud.net
svn-log at scrymud.net
Thu Jun 28 00:46:44 PDT 2007
Author: eroper
Date: 2007-06-28 00:46:44 -0700 (Thu, 28 Jun 2007)
New Revision: 958
Modified:
trunk/mud/grrmud/server/battle.cc
trunk/mud/grrmud/server/critter.cc
trunk/mud/grrmud/server/critter.h
Log:
Battle alignment changes now happen through the newly added
short critter::adjAlignment(short adjAmount) which caps at +/- 1000 and
returns the value of the modification which was actually applied to the stat.
i.e. if the critter is already -999 and is adjAlignment() is passed -10, the
critters alignment will be set to -1000 and -1 will be returned.
critter::getAlignment() now returns a short, consistent with the actual
storage data-type.
Modified: trunk/mud/grrmud/server/battle.cc
===================================================================
--- trunk/mud/grrmud/server/battle.cc 2007-06-24 23:26:13 UTC (rev 957)
+++ trunk/mud/grrmud/server/battle.cc 2007-06-28 07:46:44 UTC (rev 958)
@@ -778,11 +778,8 @@
val *= 1.0/pow(10, fabs(agg->ALIGN/1000.0));
}
- if ((agg->ALIGN < -1000) || (agg->ALIGN > 1000))
- val = 0;
+ agg->adjAlignment(-((short)(val)));
- agg->ALIGN -= (int)(val);
-
}
if (vict.pc && agg && agg->pc) {
Modified: trunk/mud/grrmud/server/critter.cc
===================================================================
--- trunk/mud/grrmud/server/critter.cc 2007-06-24 23:26:13 UTC (rev 957)
+++ trunk/mud/grrmud/server/critter.cc 2007-06-28 07:46:44 UTC (rev 958)
@@ -6147,12 +6147,32 @@
return ret_val;
}//critter::getMovRegen()
-int critter::getAlignment() const {
- int ret_val = short_cur_stats[18];
+short critter::getAlignment() const {
+ short ret_val = short_cur_stats[18];
if ( ret_val < -1000 ) {
ret_val = -1000;
} else if ( ret_val > 1000 ) {
ret_val = 1000;
}
return ret_val;
-}
+}//critter::getAlignment
+
+short critter::adjAlignment(short adjAmount) {
+
+ // When passed an adjustment value, it will adjust the players alignment by
+ // the adjAmount. This will cap the critters alignment at +/- 1000 and
+ // returns the amount the critters alignment was really modified by.
+
+ short ret_val = adjAmount;
+ int tmp_val = getAlignment() + adjAmount;
+
+ if (tmp_val > 1000) {
+ ret_val = adjAmount - (tmp_val -1000);
+ } else if (tmp_val < -1000) {
+ ret_val = adjAmount - (tmp_val +1000);
+ }
+
+ short_cur_stats[18] += ret_val;
+
+ return ret_val;
+}//critter::adjAlignment()
Modified: trunk/mud/grrmud/server/critter.h
===================================================================
--- trunk/mud/grrmud/server/critter.h 2007-06-24 23:26:13 UTC (rev 957)
+++ trunk/mud/grrmud/server/critter.h 2007-06-28 07:46:44 UTC (rev 958)
@@ -894,7 +894,8 @@
int getManaMax() const { return short_cur_stats[24]; }
int getMov() const { return short_cur_stats[17]; }
int getMovMax() const { return short_cur_stats[25]; }
- int getAlignment() const;
+ short getAlignment() const;
+ short adjAlignment(short adjAmount);
LanguageE getLanguageChoice() const ;
int getWimpy() const { return short_cur_stats[21]; }
More information about the ScryMUD
mailing list