[ScryMUD] SVN Commit Info r909 - trunk/mud/grrmud/server

scrymud at wanfear.com scrymud at wanfear.com
Sat Mar 3 16:37:24 PST 2007


Author: eroper
Date: 2007-03-03 16:37:24 -0800 (Sat, 03 Mar 2007)
New Revision: 909

Modified:
   trunk/mud/grrmud/server/command2.cc
   trunk/mud/grrmud/server/critter.cc
   trunk/mud/grrmud/server/critter.h
Log:
Reorganized the "score" output a bit, trying to condense it some. Added
main-hand and off-hand damage ranges to the output.

Added critter::getWeapRange() to facilitate the minimum and maximum damage
ranges, taking into account +DAM, weapon skill, etc.


Modified: trunk/mud/grrmud/server/command2.cc
===================================================================
--- trunk/mud/grrmud/server/command2.cc	2007-03-03 22:11:02 UTC (rev 908)
+++ trunk/mud/grrmud/server/command2.cc	2007-03-04 00:37:24 UTC (rev 909)
@@ -155,7 +155,7 @@
 
 int score(const String* str2, critter& pc) {
    std::stringstream buf;
-   std::string sep_line = "^N------------------------------------------------------------------------------";
+   const char* sep_line = "^N------------------------------------------------------------------------------";
 
 
    if ( ! pc.isPc() ) {
@@ -168,14 +168,14 @@
       return 0;
    }//if
 
-   buf.imbue( locale("") );
+   buf.imbue( std::locale("") );
 
    buf << sep_line << endl;
 
-   buf << "^M" << (const char*)(*(pc.getName()))
+   buf << "^C" << (const char*)(*(pc.getName()))
        << pc.short_desc << endl;
-   buf << "^m" << "You are a "
-       << "^M" <<  pc.getAge() << "^m" << " year old "; 
+   buf << "^c" << "You are a "
+       << "^C" <<  pc.getAge() << "^c" << " year old "; 
    switch ( pc.SEX ) {
       case 0:
          buf << cstr(CS_FEMALE, pc);
@@ -189,8 +189,8 @@
    }
    buf << get_race_name( pc.getRace() )
        << " " << get_class_name( pc.getClass() )
-       << " of level " << "^M" << pc.getLevel()
-       << "^m" << "." << endl;
+       << " of level " << "^C" << pc.getLevel()
+       << "^c" << "." << endl;
 
    buf << endl
        << "^c" << "You are carrying "
@@ -199,15 +199,16 @@
        << "^c" << "You are carrying "
        << "^C" << pc.GOLD << "^c" << " gold, which weighs "
        << "^C" << ( pc.GOLD / config.goldPerLb ) << "^c" << "lbs." << endl;
-   
-   buf << sep_line << endl;
 
-   buf << "^c" << left << setw(21) << "Distance from level:"
-       << "^C" << right << setw(15) << pc.getXpToNextLevel() << endl
-       << "^c" << left << setw(21) << "Total experience:"
-       << "^C" << right << setw(15) << pc.EXP << endl
-       << "^c" << left << setw(21) << "Practices to spend:"
-       << "^C" << right << setw(15) << pc.PRACS << endl;
+   buf << "^c" << left << setw(17) << "Needed to level:"
+       << "^C" << right << setw(12) << pc.getXpToNextLevel()
+       << endl
+       << "^c" << left << setw(17) << "Total experience:"
+       << "^C" << right << setw(12) << pc.EXP << endl
+       << "^c" << "You have "
+       << "^C" <<  pc.PRACS
+       << "^c" << " practices to spend."
+       << endl;
 
    buf << sep_line << endl;
 
@@ -238,7 +239,10 @@
        << "^C" << right << setw(6) << pc.getHP_MAX()
        << "^c" << " (" << right << setw(3) << pc.HP_REGEN 
        << "% regeneration)"
+       << "^c" << " Wimpy: " << "^C" << pc.getWimpy()
+       << "^c" << "hp"
        << endl
+
        << "^c" << left << setw(10) << "Mana:"
        << "^C" << right << setw(6) << pc.getMana()
        << "^c" << " of " 
@@ -246,6 +250,7 @@
        << "^c" << " (" << right << setw(3) << pc.MA_REGEN 
        << "% regeneration)"
        << endl
+
        << "^c" << left << setw(10) << "Movement:"
        << "^C" << right << setw(6) << pc.getMov()
        << "^c" << " of " 
@@ -256,28 +261,44 @@
 
    buf << sep_line << endl;
 
-   buf << "^c" << left << setw(33) << "Your armor class:"
-       << "^C" << right << setw(4) << pc.AC << endl
-       << "^c" << left << setw(34) << "Physical damage received:"
-       << "^C" << right << setw(3) << pc.getDamRecMod() << "%" << endl
-       << "^c" << left << setw(34) << "Damage received from heat:"
-       << "^C" << right << setw(3) << pc.HEAT_RESIS << "%" << endl
-       << "^c" << left << setw(34) << "Damage received from cold:"
-       << "^C" << right << setw(3) << pc.COLD_RESIS << "%" << endl
-       << "^c" << left << setw(34) << "Damage received from magic:"
-       << "^C" << right << setw(3) << pc.SPEL_RESIS << "%" << endl
-       << "^c" << left << setw(34) << "Damage received from electricity:"
-       << "^C" << right << setw(3) << pc.ELEC_RESIS << "%" << endl;
+   buf << "^c" << "Your armor class is "
+       << "^C" << pc.AC
+       << "^c" << "."<< endl
 
-   buf << sep_line << endl;
+       << "^c" << "You receive " 
+       << "^C" << pc.getDamRecMod() << "%"
+       << "^c" << " damage. "
+       << "^c" << "You deal " 
+       << "^C" << pc.DAM_GIV_MOD << "%"
+       << "^c" << " damage."
+       << endl
 
-   buf << "^c" << "You deal " << "^C" << pc.DAM_GIV_MOD << "% "
-       << "^c" << "damage" << endl;
+       << "^c" << "Damage received from "
+       << "heat: "
+       << "^C" << ( (pc.HEAT_RESIS + 100) / 2.0 ) << "%"
+       << "  "
+       << "^c" << "cold: "
+       << "^C" << ( (pc.COLD_RESIS + 100) / 2.0 ) << "%"
+       << "  "
+       << "^c" << "magic: "
+       << "^C" << ( (pc.SPEL_RESIS + 100) / 2.0 ) << "%"
+       << "  "
+       << "^c" << "electricity: "
+       << "^C" << ( (pc.ELEC_RESIS + 100) / 2.0 ) << "%"
+       << endl;
 
-   buf << "^c" << "Your wimpy is set to: "
-       << "^C" << pc.getWimpy()
-       << "^c" << "hp" << endl;
+   buf << "^c" << "Main-hand damage: "
+       << "^C" << pc.getWeapRange(0,9,true) << "^c" << "-"
+       << "^C" << pc.getWeapRange(1,9,true) << " ";
 
+   buf << "^c" << "Off-hand damage: "
+       << "^C" << pc.getWeapRange(0,10,true) << "^c" << "-"
+       << "^C" << pc.getWeapRange(1,10,true) << " ";
+
+   buf << endl;
+
+   buf << sep_line << endl;
+
    if (pc.HUNGER == 0) {
       buf << cstr(CS_YOU_HUNGRY, pc);
    }

Modified: trunk/mud/grrmud/server/critter.cc
===================================================================
--- trunk/mud/grrmud/server/critter.cc	2007-03-03 22:11:02 UTC (rev 908)
+++ trunk/mud/grrmud/server/critter.cc	2007-03-04 00:37:24 UTC (rev 909)
@@ -2489,6 +2489,54 @@
       return HIT+modifier;
 }//critter::getHIT
 
+//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 ret_val, count, sides, weapon_skill, p_lrnd;
+   object *weapon = EQ[position];
+
+   ret_val = count = sides = weapon_skill = p_lrnd = 0;
+
+   if ( weapon && weapon->isWeapon() )  {
+
+      count = weapon->getDiceCnt();
+      sides = weapon->getDiceSides();
+
+      if ( weapon->isSlash() ) {
+         weapon_skill = SWORD_SKILL_NUM;
+      } else if ( weapon->isPierce() ) {
+         weapon_skill = DAGGER_SKILL_NUM;
+      } else if ( weapon->isSmash() ) {
+         weapon_skill = MACE_SKILL_NUM;
+      } else if ( weapon->isWhip() ) {
+         weapon_skill = WHIP_SKILL_NUM;
+      } else if ( weapon->isBow() ) {
+         weapon_skill = BOW_SKILL_NUM;
+      }
+
+      p_lrnd = get_percent_lrnd(weapon_skill, *this);
+      if ( p_lrnd > 0 ) {
+         count += p_lrnd/50;
+         sides += p_lrnd/33;
+      }
+
+   } else {//we're bare handed
+      count = getBHDC(true);
+      sides = getBHDS(true);
+   }
+
+   if ( min_max == 0 ) {// minimum
+      ret_val += count;
+   } else {//maximum
+      ret_val += count * sides;
+   }
+
+   ret_val += getDAM(TRUE);
+   return ret_val;
+}//critter::getWeapRange
+
 int critter::getWeapDAM(int position, bool include_modifiers=false) {
    int count = 0;
    int sides = 0;

Modified: trunk/mud/grrmud/server/critter.h
===================================================================
--- trunk/mud/grrmud/server/critter.h	2007-03-03 22:11:02 UTC (rev 908)
+++ trunk/mud/grrmud/server/critter.h	2007-03-04 00:37:24 UTC (rev 909)
@@ -887,6 +887,7 @@
    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);
    int getWeapDAM(int position, bool include_modifiers);
    int getMana() const { return short_cur_stats[16]; }
    int getManaMax() const { return short_cur_stats[24]; }




More information about the ScryMUD mailing list