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

scrymud at wanfear.com scrymud at wanfear.com
Sun Jul 9 03:54:11 PDT 2006


Author: eroper
Date: 2006-07-09 03:54:09 -0700 (Sun, 09 Jul 2006)
New Revision: 840

Modified:
   trunk/mud/grrmud/server/critter.cc
   trunk/mud/grrmud/server/critter.h
   trunk/mud/grrmud/server/dam_spll.cc
   trunk/mud/grrmud/server/ez_spll.cc
   trunk/mud/grrmud/server/pet_spll.cc
   trunk/mud/grrmud/server/skills.cc
   trunk/mud/grrmud/server/spells.cc
   trunk/mud/grrmud/server/spells2.cc
Log:
Fixed quite a few spells that were reversing the aggressor and the victim in
the did_spell_hit() checks. This was actually making it harder to hit lower
level critters than higher level ones with some spells.

Resists & AC are now longer used to calculate did_spell_hit(). (resists are
still used in exact_raw_damage()

Critters that can't move due to position or running out of move points can no
longer dodge spells. ( added critter::canMove() )

Old target was 25% chance to miss on same-level victims
Current target is 15% chance to miss on same-level victims
                  11% chance to miss on -5 level victims
                  22% chance to miss on +5 level victims
                  ~11% is the best we get 90% is the worst we'll get.
This may need to be tuned, I'll be keeping an eye on it.

Fixed some of the new OO spells that were being called with is_canned set to
true all the time. I'm now passing this->is_canned instead.

Removed unused variable "p_lrnd" from critter::getBHDC()


Modified: trunk/mud/grrmud/server/critter.cc
===================================================================
--- trunk/mud/grrmud/server/critter.cc	2006-07-06 00:28:56 UTC (rev 839)
+++ trunk/mud/grrmud/server/critter.cc	2006-07-09 10:54:09 UTC (rev 840)
@@ -2348,7 +2348,6 @@
 }
 
 int critter::getBHDC(bool include_modifiers=false) {
-   int p_lrnd;
    int modifier = 0;
 
    return BH_DICE_COUNT+modifier;

Modified: trunk/mud/grrmud/server/critter.h
===================================================================
--- trunk/mud/grrmud/server/critter.h	2006-07-06 00:28:56 UTC (rev 839)
+++ trunk/mud/grrmud/server/critter.h	2006-07-09 10:54:09 UTC (rev 840)
@@ -1062,6 +1062,9 @@
    int isPlayerShopKeeper();
    int isManagedBy(critter& pc);
    stat_spell_cell* isAffectedBy(int spell_num);
+
+   short canMove() const { return ( POS == POS_STAND && ( getMov() > 0 ) ); }
+
    // return current value of cur_in_game after operation
    int getCurInGame();
    int setCurInGame(int i);

Modified: trunk/mud/grrmud/server/dam_spll.cc
===================================================================
--- trunk/mud/grrmud/server/dam_spll.cc	2006-07-06 00:28:56 UTC (rev 839)
+++ trunk/mud/grrmud/server/dam_spll.cc	2006-07-09 10:54:09 UTC (rev 840)
@@ -51,7 +51,7 @@
     critter& victim = *(spellSpearOfDarkness.victim);
     critter& agg = *(spellSpearOfDarkness.agg);
 	
-    if (did_spell_hit(victim, NORMAL, agg, clvl, TRUE)){
+    if (did_spell_hit(agg, NORMAL, victim, clvl, this->canned)){
 
         float dmg = (float)(d(7, (10 + clvl/5 - agg.ALIGN/200)));
         if ((agg.ALIGN < -350) && (victim.ALIGN > 350)) dmg *= 1.5;
@@ -150,7 +150,7 @@
    critter& victim = *(spellOrbOfPower.victim);
    critter& agg = *(spellOrbOfPower.agg);
 
-   if (did_spell_hit(victim, NORMAL, agg, clvl, TRUE)){
+   if (did_spell_hit(agg, NORMAL, victim, clvl, this->canned)){
       int dmg = d(10, clvl + 10);
       exact_raw_damage(dmg, FIRE, victim, agg);
 
@@ -253,7 +253,7 @@
    critter& agg = *(spellHolyWord.agg);
 
    
-   if( did_spell_hit(vict, NORMAL, agg, clvl, TRUE)){
+   if( did_spell_hit(agg, NORMAL, vict, clvl, this->canned)){
 
       int dmg = d(7, clvl + 5);
 
@@ -366,7 +366,7 @@
    }
    
 
-   if( did_spell_hit(vict, NORMAL, agg, clvl, TRUE)){
+   if( did_spell_hit(agg, NORMAL, vict, clvl, this->canned)){
       int dmg = d(5, clvl + 5);
 
       exact_raw_damage(dmg, NORMAL, vict, agg);
@@ -669,7 +669,7 @@
 
    int lost_con = FALSE;
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, NORMAL, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, NORMAL, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, NORMAL, vict)))) {
 
@@ -825,7 +825,7 @@
 
    int lost_con = FALSE;
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, NORMAL, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, NORMAL, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, NORMAL, vict)))) {
 
@@ -977,7 +977,7 @@
 
    int lost_con = FALSE;
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, NORMAL, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, NORMAL, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, NORMAL, vict)))) {
 
@@ -1138,7 +1138,7 @@
 
    int lost_con = FALSE;
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, NORMAL, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, NORMAL, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, NORMAL, vict)))) {
 
@@ -1295,7 +1295,7 @@
 
    int lost_con = FALSE;
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, NORMAL, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, NORMAL, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, NORMAL, vict)))) {
 
@@ -1448,7 +1448,7 @@
 
    int lost_con = FALSE;
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, NORMAL, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, NORMAL, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, NORMAL, vict)))) {
 

Modified: trunk/mud/grrmud/server/ez_spll.cc
===================================================================
--- trunk/mud/grrmud/server/ez_spll.cc	2006-07-06 00:28:56 UTC (rev 839)
+++ trunk/mud/grrmud/server/ez_spll.cc	2006-07-09 10:54:09 UTC (rev 840)
@@ -73,7 +73,7 @@
    short lost_con = TRUE;
 
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, NORMAL, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, NORMAL, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, NORMAL, vict)))) {
 
@@ -180,7 +180,7 @@
    short lost_con = TRUE;
 
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, NORMAL, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, NORMAL, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, NORMAL, vict)))) {
 
@@ -2163,7 +2163,7 @@
    short lost_con = TRUE;
 
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, AGILITY, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, AGILITY, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, AGILITY, vict)))) {
 
@@ -2259,7 +2259,7 @@
    short lost_con = FALSE;
 
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, AGILITY, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, AGILITY, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, AGILITY, vict)))) {
 
@@ -2383,7 +2383,7 @@
    short lost_con = TRUE;
    short did_hit = TRUE;
 
-   if ((is_canned && (did_hit = did_spell_hit(vict, NORMAL, agg, lvl, TRUE))) ||
+   if ((is_canned && (did_hit = did_spell_hit(agg, NORMAL, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, NORMAL, vict)))) {
 

Modified: trunk/mud/grrmud/server/pet_spll.cc
===================================================================
--- trunk/mud/grrmud/server/pet_spll.cc	2006-07-06 00:28:56 UTC (rev 839)
+++ trunk/mud/grrmud/server/pet_spll.cc	2006-07-09 10:54:09 UTC (rev 840)
@@ -320,7 +320,7 @@
    }
 
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, COERCION, pc, lvl, TRUE))) ||
+                      did_spell_hit(pc, COERCION, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(pc, spell_num)) && 
          (did_hit = did_spell_hit(pc, COERCION, vict)))) {
       

Modified: trunk/mud/grrmud/server/skills.cc
===================================================================
--- trunk/mud/grrmud/server/skills.cc	2006-07-06 00:28:56 UTC (rev 839)
+++ trunk/mud/grrmud/server/skills.cc	2006-07-09 10:54:09 UTC (rev 840)
@@ -1469,18 +1469,10 @@
   int j = 100;
   switch (spell_type)
      {
-     case NORMAL:
-        j = vict.AC;
-        break;
-     case FIRE: case D_BREATH:
-        j =  vict.HEAT_RESIS;
-        break;
-     case ICE:
-        j = vict.COLD_RESIS;
-        break;
-     case ELECTRICITY:
-        j = vict.ELEC_RESIS;
-        break;
+     case NORMAL: case FIRE: case D_BREATH: case ICE: case ELECTRICITY:
+          // If they can't move.. they're screwed.
+          if ( ! vict.canMove() ) { return(TRUE); }
+          break;
      case SUMMON:
         if (vict.isImmort()) {
            if (agg.isImmort()) {
@@ -1514,22 +1506,21 @@
         }
         j = 100;
      }//switch   
-  
-  j += vict.SPEL_RESIS; //gen resistance to spells
       
   if (is_canned) {
-    j -= (vict.LEVEL - lvl) * 10;
+    j -= (vict.LEVEL - lvl) * 20;
   }//if
   else {
-    j -= (vict.LEVEL - agg.LEVEL) * 10;
+    j -= (vict.LEVEL - agg.LEVEL) * 20;
   }//else
 
   j += 200; 
 
-  if (j < 0)
-    j = 0;
-  else if (j > 400)
-    j = 400;
+  if (j < 0) {
+      j = 0;
+  } else if (j > 400) {
+      j = 400;
+  }
 
   if ((spell_type == COERCION) || (spell_type == CHARM)) {
      if (vict.getLevel() > agg.getLevel()) {
@@ -1537,7 +1528,22 @@
      }
   }
 
-  return (d(1, 75) < d(1, j));
+  /* spells were missing a lot of the time, in fact some cases made it
+   * impossible to hit a mob just a few levels above you with magic at all.
+   * The new miss-rates should be roughly as follows:
+   *  Same level target: 15% miss
+   *  -5 level target:   11% miss
+   *  +5 level target:   22% miss
+   *  at best you'll miss 11% of the time, at worst 90%
+   *
+   *  Math example of a same-level encounter.
+   *  j = 100; j -= no level_bonus; j += 200
+   *  j = 300; 45 is 15% of 300. That's a 15% chance to miss.
+   */
+
+  // Attacker is seriously out-classed, 90% chance to miss.
+  if ( j == 0 ) { j = 50; }
+  return (d(1, 45) < d(1, j));
 }//did_spell_hit
 
 

Modified: trunk/mud/grrmud/server/spells.cc
===================================================================
--- trunk/mud/grrmud/server/spells.cc	2006-07-06 00:28:56 UTC (rev 839)
+++ trunk/mud/grrmud/server/spells.cc	2006-07-09 10:54:09 UTC (rev 840)
@@ -643,7 +643,7 @@
    }//if
 
    if (is_canned) {
-      if (did_spell_hit(vict, FIRE, agg, lvl, TRUE)) {
+      if (did_spell_hit(agg, FIRE, vict, lvl, TRUE)) {
          vict.HP -= d(4, 20) + 
                 lvl - (int)((100.0 / (vict.HEAT_RESIS + 100)) * 20);
          agg.PAUSE += 1;   // increment pause_count
@@ -1408,7 +1408,7 @@
       lvl = agg.LEVEL;
 
    if (is_canned) {
-      if (did_spell_hit(vict, CRONIC, agg, lvl, TRUE)) {
+      if (did_spell_hit(agg, CRONIC, vict, lvl, TRUE)) {
          do_effects = TRUE;
 
          if (&vict == &agg) {

Modified: trunk/mud/grrmud/server/spells2.cc
===================================================================
--- trunk/mud/grrmud/server/spells2.cc	2006-07-06 00:28:56 UTC (rev 839)
+++ trunk/mud/grrmud/server/spells2.cc	2006-07-09 10:54:09 UTC (rev 840)
@@ -691,7 +691,7 @@
      lvl = agg.LEVEL;
 
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, CRONIC, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, CRONIC, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, CRONIC, vict)))) {
 
@@ -809,7 +809,7 @@
      lvl = agg.LEVEL;
 
    if ((vict.getLevel() <= agg.getLevel()) && ((is_canned && (did_hit = 
-                      did_spell_hit(vict, CRONIC, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, CRONIC, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, CRONIC, vict))))) {
 
@@ -1200,7 +1200,7 @@
      lvl = agg.LEVEL;
 
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, CRONIC, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, CRONIC, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, CRONIC, vict)))) {
 
@@ -1314,7 +1314,7 @@
      lvl = agg.LEVEL;
 
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, CRONIC, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, CRONIC, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, CRONIC, vict)))) {
 
@@ -1407,7 +1407,7 @@
      lvl = agg.LEVEL;
 
    if ((is_canned && (did_hit = 
-                      did_spell_hit(vict, CRONIC, agg, lvl, TRUE))) ||
+                      did_spell_hit(agg, CRONIC, vict, lvl, TRUE))) ||
        (!is_canned && !(lost_con = lost_concentration(agg, spell_num)) && 
          (did_hit = did_spell_hit(agg, CRONIC, vict)))) {
 




More information about the ScryMUD mailing list