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

scrymud at wanfear.com scrymud at wanfear.com
Sat Jun 9 10:24:02 PDT 2007


Author: gingon
Date: 2007-06-09 10:24:02 -0700 (Sat, 09 Jun 2007)
New Revision: 928

Modified:
   trunk/mud/grrmud/server/weather.cc
Log:
Added messages indicating weather change on tick. added day/night temperature weights. Adjusted weather weights. Fixed weather event messages.

Modified: trunk/mud/grrmud/server/weather.cc
===================================================================
--- trunk/mud/grrmud/server/weather.cc	2007-06-09 05:15:03 UTC (rev 927)
+++ trunk/mud/grrmud/server/weather.cc	2007-06-09 17:24:02 UTC (rev 928)
@@ -45,20 +45,30 @@
 const int swamp_weights[] = { 400,150,150,85,75,68,32,20,10,16,8,4,0};
 const int tropical_weights[] = { 520,130,130,65,55,48,32,10,5,0,0,0,0};
 const int arctic_weights[] = { 540,130,110,3,2,1,1,0,0,80,60,40,0};
+/* original weights for referance
+const int temperate_weights[] = { 520,130,130,65,55,48,32,20,10,65,48,32,0};
+const int savanah_weights[] = { 520,100,90,32,28,24,16,10,5,5,0,0,0};
+const int mountain_weights[] =  { 520,130,130,65,51,44,40,20,10,80,60,40,0};
+const int snowymountain_weights[] = { 520,130,130,32,25,22,20,20,10,130,96,64,0};
+const int sandydesert_weights[] = { 540,40,30,3,2,1,1,0,0,0,0,0,80};
+const int dirtdesert_weights[] = { 600,40,30,3,2,1,1,0,0,0,0,0,0};
+const int swamp_weights[] = { 400,150,150,85,75,68,32,20,10,16,8,4,0};
+const int tropical_weights[] = { 520,130,130,65,55,48,32,10,5,0,0,0,0};
+const int arctic_weights[] = { 540,130,110,3,2,1,1,0,0,80,60,40,0};*/
 
-//current weather weights
-const float clear_weights[]        = { 1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00};
-const float cloudy_weights[]       = { 1.00,3.00,2.00,1.50,1.25,1.12,1.00,1.00,1.00,1.50,1.25,1.12,1.00};
-const float overcast_weights[]     = { 1.00,2.00,3.00,2.00,1.50,1.25,1.12,1.00,1.00,2.00,1.50,1.25,1.00};
-const float drizzle_weights[]      = { 1.00,1.50,2.00,3.00,1.50,1.25,1.12,1.10,1.10,1.00,1.00,1.00,0.00};
-const float rain_weights[]         = { 0.80,1.25,1.50,2.00,3.00,2.00,1.50,1.25,1.10,0.80,0.80,0.70,0.00};
-const float heavyrain_weights[]    = { 0.60,1.00,1.25,1.50,2.00,3.00,1.60,1.00,1.00,0.60,0.60,0.50,0.00};
-const float thunderstorm_weights[] = { 0.40,0.80,1.00,1.25,1.50,2.00,3.00,1.20,1.20,0.50,0.50,0.50,0.00};
-const float hail_weights[]         = { 0.60,1.00,1.25,1.50,2.00,3.00,2.00,1.50,1.50,0.50,0.50,0.50,0.00};
-const float hailstorm_weights[]    = { 0.40,0.80,1.50,2.00,2.50,2.50,1.50,1.50,0.35,0.35,0.35,0.35,0.00};
-const float lightsnow_weights[]    = { 1.00,1.60,2.00,1.20,1.10,1.00,0.80,0.00,0.00,3.00,0.00,1.25,0.00};
-const float heavysnow_weights[]    = { 0.60,1.40,1.60,1.00,0.70,0.50,0.40,0.00,0.00,2.00,3.00,1.50,0.00};
-const float blizzard_weights[]     = { 0.60,1.40,1.60,0.60,0.50,0.30,0.20,0.00,0.00,1.50,2.00,2.50,0.00};
+//current weather weights               Cl    C    O    D    Lr  Hr    T    h    H   Ls    S   B    SS 
+const float clear_weights[]        = { 3.00,0.80,0.60,0.30,0.20,0.20,0.10,0.20,0.10,0.20,0.10,0.10,1.00};
+const float cloudy_weights[]       = { 0.80,3.00,0.80,0.60,0.50,0.50,0.40,0.50,0.40,0.50,0.50,0.25,1.00};
+const float overcast_weights[]     = { 0.75,2.00,3.00,2.00,0.75,0.50,0.40,0.50,0.50,2.00,0.50,0.25,1.00};
+const float drizzle_weights[]      = { 1.00,1.50,2.50,4.00,2.50,1.50,1.15,1.15,1.15,1.00,1.00,1.00,0.00};
+const float rain_weights[]         = { 0.80,1.25,1.50,2.00,3.00,2.00,1.30,1.25,1.20,0.50,0.50,0.50,0.00};
+const float heavyrain_weights[]    = { 0.60,1.00,1.50,1.50,2.00,4.00,1.60,1.00,1.00,0.30,0.30,0.30,0.00};
+const float thunderstorm_weights[] = { 0.40,0.80,1.250,1.25,1.50,2.00,4.00,1.50,1.35,0.20,0.20,0.20,0.00};
+const float hail_weights[]         = { 0.50,0.60,0.70,1.50,1.00,1.00,1.50,3.00,1.40,0.20,0.20,0.20,0.00};
+const float hailstorm_weights[]    = { 0.30,0.40,1.50,1.75,2.25,2.25,1.50,1.50,3.35,0.35,0.35,0.35,0.00};
+const float lightsnow_weights[]    = { 0.60,1.40,2.00,0.50,0.50,0.50,0.40,0.00,0.00,3.00,2.00,1.25,0.00};
+const float heavysnow_weights[]    = { 0.30,1.40,1.60,0.40,0.40,0.40,0.40,0.00,0.00,2.00,3.00,1.50,0.00};
+const float blizzard_weights[]     = { 0.20,1.30,1.50,0.25,0.25,0.25,0.25,0.00,0.00,1.75,2.25,2.50,0.00};
 const float sandstorm_weights[]    = { 0.50,1.00,1.00,1.00,1.00,1.00,1.00,0.00,0.00,0.00,0.00,0.00,2.00};
 const float* weather_weights[]= { clear_weights, cloudy_weights,
    overcast_weights,drizzle_weights,rain_weights,heavyrain_weights,
@@ -66,11 +76,11 @@
    heavysnow_weights,blizzard_weights,sandstorm_weights};
 
 //weather season weights
-const float spring_weights[]  = { 1.00,2.00,2.00,2.00,2.00,2.00,2.00,1.50,1.50,0.25,0.10,0.00,1.00};
-const float summer_weights[]  = { 1.00,1.00,1.00,1.00,1.20,1.25,2.00,1.00,1.00,0.00,0.00,0.00,1.00};
-const float fall_weights[]    = { 1.00,1.00,1.00,1.00,1.00,1.00,1.00,0.50,0.50,1.00,1.00,1.00,1.00};
-const float winter_weights[]  = { 1.30,1.00,1.00,0.75,0.75,0.75,0.75,1.00,1.00,2.00,2.00,2.00,1.00};
-const float* season_weights[] = { spring_weights,summer_weights, fall_weights,
+const float spring_weights[]       = { 1.00,1.20,1.20,1.20,1.20,1.20,1.20,1.10,1.10,0.75,0.75,0.10,1.00};
+const float summer_weights[]       = { 1.10,1.10,1.10,1.20,1.10,1.10,1.30,1.10,1.10,0.50,0.50,0.50,1.00};
+const float fall_weights[]         = { 1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,0.60,0.60,0.60,1.00};
+const float winter_weights[]       = { 1.30,1.00,1.00,0.65,0.65,0.65,0.65,0.30,0.30,2.00,2.00,2.00,1.00};
+const float* season_weights[]      = { spring_weights,summer_weights, fall_weights,
       winter_weights};
 
 //climate temperature weights
@@ -124,6 +134,9 @@
 const float* temp_temp_weights[] = { freezing_temp_weights, vcold_temp_weights, cold_temp_weights,
 	chilly_temp_weights, pleas_temp_weights, warm_temp_weights, hot_temp_weights, vhot_temp_weights,
 	burning_temp_weights };
+// weights for nighttime
+const float night_temp_weights[] = { 1.5,1.5,1.5,1.5,1.0,1.0,1.0,1.0,1.0 };
+
 //wind range
 const int wind_min[] = {0,0,0,0,5,16,0,16,0,5,12,16,30};
 const int wind_max[] = {30,30,30,30,30,35,65,30,65,30,35,65,70};
@@ -139,6 +152,85 @@
 const char* temperature_strings[] = {"freezing","very cold","cold","chilly",
    "pleasant","warm","hot","very hot","burning hot"};
 
+// strings for changing weather
+const char* clear_change_strings[] = { "shouldn't see this", "A few clouds pass over head.\n", 
+    "The sky is blocked from view by thick clouds.\n", "It starts to drizzle.\n", "It starts to rain.\n", 
+	"It starts to pour.\n", "It begins to rain heavily.\n", "Hail starts falling from the sky.\n",
+	"Large peices of hail begin to rain down.\n", "It begins to snow lightly.\n", "It begins to snow heavily.\n", 
+	"The intensity of the snow increases to become a blizzard.\n", "A fierce wind begins to stir sand into the air.\n" };
+const char* cloudy_change_strings[] = { "The clouds drift away.\n", "shouldn't see this", "It becomes cloudier.\n", 
+    "It starts to drizzle.\n", "It starts to rain.\n", "It starts to pour.\n", "The rain stops.\n", 
+	"Hail starts falling from the sky.\n", "Large peices of hail begin to rain down.\n", 
+	"It begins to snow lightly.\n", "It begins to snow heavily.\n",	
+	"The intensity of the snow increases to become a blizzard.\n", "A fierce wind begins to stir sand into the air.\n" };
+const char* overcast_change_strings[] = { "The skies clear.\n", "The sky becomes vissible as the clouds part.\n", 
+    "shouldn't see this.\n", "It starts to drizzle.\n",	"It starts to rain.\n", "It starts to pour.\n", 
+	"It begins to rain heavily.\n", "Hail starts falling from the sky.\n",
+	"Large peices of hail begin to rain down.\n", "It begins to snow lightly.\n", "It begins to snow heavily.\n", 
+	"The intensity of the snow increases to become a blizzard.\n", "A fierce wind begins stir sand into the air.\n" };
+const char* drizzle_change_strings[] = { "The skies clear.\n", "The drizzle stops and the clouds begin to dissipate.\n", 
+    "The drizzle stops.\n", "shouldn't see this", "It starts to rain harder.\n", "It starts to pour.\n", 
+	"It begins to rain heavily.\n", "Hail starts falling from the sky.\n",	"Large peices of hail begin to rain down.\n", 
+	"It begins to snow lightly.\n", "It begins to snow heavily.\n", 
+	"The intensity of the snow increases to become a blizzard.\n", "A fierce wind begins to stir sand into the air.\n"};
+const char* rain_change_strings[] = { "The skies clear as the rain stops.\n", 
+    "The rain stops and the sky becomes vissible through the parting clouds.\n", 
+	"It stops raining.\n", "The rain lessens.\n", "shouldn't see this", "It starts to pour.\n", "It starts to rain harder.\n", 
+	"The falling rain is replaced by hail.\n", "Large peices of hail begin to rain down.\n", 
+	"The rain stops and light snow takes it's place.\n", "It begins to snow heavily.\n", 
+	"The intensity of the snow increases to become a blizzard.\n", "A fierce wind begins to stir sand into the air.\n" };
+const char* heavyrain_change_strings[] = { "The skies clear as the rain stops.\n", 
+    "The rain stops and the sky becomes vissible through the parting clouds.\n", "It stops raining.\n", 
+	"The rain lessens.", "The rain slows down.\n", "shouldn't this see", "The rain continues.\n", 
+	"The falling rain is replaced by hail.\n",	"Large peices of hail begin to rain down.\n", 
+	"The rain stops and light snow takes it's place.\n", "It begins to snow heavily.\n", 
+	"The intensity of the snow increases to become a blizzard.\n", "A fierce wind begins to stir sand into the air.\n"};
+const char* thunder_change_strings[] = { "The skies clear as the rain stops.\n", 
+    "The rain stops and the sky becomes vissible through the parting clouds.\n", "It stops raining.\n", 
+	"The rain lessens.\n", 	"The rain slows down.\n", "The thunder stops.\n", "shouldn't see this", 
+	"The falling rain is replaced by hail.\n",	"Large peices of hail begin to rain down.\n", 
+	"The rain stops and light snow takes it's place.\n", "It begins to snow heavily.\n", 
+	"The intensity of the snow increases to become a blizzard.\n", "A fierce wind begins to stir sand into the air.\n"};
+const char* hail_change_strings[] = { "The skies clear as the hail stops.\n", 
+    "The hail stops and the sky becomes vissible through the parting clouds.\n", 
+	"The hail stops", "The hail stops and a light rain begins.\n", "The hail stops but the rain continues.\n", 
+	"The hail is replaced by heavy rain.\n", "It stops hailing but the rain continues.\n", 
+	"shouldn't see this", "Even Larger peices of hail begin to rain down.\n", 
+	"The hail stops and light snow takes it's place.\n", "It begins to snow heavily.\n", 
+	"The intensity of the storm increases to become a blizzard.\n", "A fierce wind begins to stir sand into the air.\n" };
+const char* hailstorm_change_strings[] = { "The skies clear as the hail stops.\n", 
+    "The hail stops and the sky becomes vissible through the parting clouds.\n", 
+	"The hail stops", "The hail stops and a light rain begins.\n", "The hail stops but the rain continues.\n", 
+	"The hail is replaced by heavy rain.\n", "The hail stops and the rains continue.\n", 
+	"The intensity of the hail lessens.\n", "shouldn't see me", 
+	"The hail stops and light snow takes it's place.\n", "It begins to snow heavily.\n", 
+	"The intensity of the storm increases to become a blizzard.\n", "A fierce wind begins to stir sand into the air.\n" };
+const char* lightsnow_change_strings[] = { "The skies clear as the snow stops.\n", 
+    "The snow stops and the sky becomes vissible through the parting clouds.\n", "It stops snowing.\n", 
+	"The snow turns to light rain.", "The light snow becomes rain.", "The snow stops and is replaced by heavy rain.\n", 
+	"The snow turns to rain.\n", "The snow turns to hail.\n", "Large peices of hail begin to rain down.\n", "shouldn't see me", 
+	"It begins to snow even harder.\n", "The light snow becomes a blizzard!.\n", "A fierce wind begins to stir sand into the air.\n" };
+const char* heavysnow_change_strings[] = { "The skies clear as the snow stops.\n", 
+    "The snow stops and the sky becomes vissible through the parting clouds.\n", "It stops snowing.\n", 
+	"The snow turns to light rain.", "The snow becomes rain.", "The snow stops and is replaced by heavy rain.\n", 
+	"The snow turns to rain.\n", "The snow turns to hail.\n", "Large peices of hail begin to rain down.\n", 
+	"The snow becomes thinner.\n", "shouldn't see me", "The snow thickens and becomes a blizzard!.\n", 
+	"A fierce wind begins stir to sand into the air.\n" };
+const char* blizzard_change_strings[] = { "The skies clear as the snow stops.\n", 
+   "The snow stops and the sky becomes vissible through the parting clouds.\n", 
+   "It stops snowing.\n", "The snow turns to light rain.",	"The snow becomes rain.", 
+   "The snow stops and is replaced by heavy rain.\n", "The blizzard stops and a storm begins!", "The snow turns to hail.\n",
+	"Large peices of hail begin to rain down.\n", "The snow becomes thinner.\n", "shouldn't see me", 
+	"The snow thickens and becomes a blizzard!.\n", "A fierce wind begins to stir sand into the air.\n"};
+const char* sandstorm_change_strings[] = { "The skies clear as the sand settles.\n", 
+    "The sand stops blowing and the sky becomes vissible again.\n", "The sands settle.\n", 
+	"The sand is settled by the gentle rain.\n", "The falling rain turns the sandtorm to mud.\n", 
+	"The sandtorm turns to mud as a down pour begins!.\n", "The sand is turned to mud as the rains begin.\n", "not possible",
+	"not possible", "not possible", "not possible", "not possible", "shouldn't see me" };
+const char** weather_change_strings[] = { clear_change_strings, cloudy_change_strings, 
+	overcast_change_strings, drizzle_change_strings, rain_change_strings, heavyrain_change_strings,
+	thunder_change_strings, hail_change_strings, hailstorm_change_strings, lightsnow_change_strings,
+	heavysnow_change_strings, blizzard_change_strings, sandstorm_change_strings };
 //regen and mv usage mods
 const float weather_regen_mods[] = {1,1,1,1,0.95,0.9,0.8,0.9,0.8,0.95,0.9,0.8};
 const float temperature_regen_mods[] = {0.6,0.75,0.9,0.95,1,0.95,0.9,0.7,0.6};
@@ -367,7 +459,8 @@
    DistProbMatrix<WeatherType> weather_prob;
    DistProbMatrix<TemperatureType> temp_prob;
    int tweights[MAX_TEMP];
-
+   TemperatureType old_temp = climates[i].temperature;
+   WeatherType old_weather = climates[i].weather;
    //grab base weights for weather and temp
    memcpy(weights,climates[i].weather_base,MAX_WEATHER*sizeof(int)); 
    //combine current weather weights with base weather
@@ -387,7 +480,23 @@
    }else climates[i].weather = tw;
    //we have our new weather, so we can combine base, weather, season and temp weights
 
-   memcpy(tweights,climates[i].temperature_base,MAX_TEMP*sizeof(int)); 
+  
+
+
+   // note that because the temperature is designed to gradually change, we only need day/night, more detail would skew the result toO heavily
+   if(config.hour <6 || config.hour >=18){ //night
+	   if( i == dirtdesert || i == sandydesert ){
+		   // deserts are a special case because they cycle quickly from hot to cold in the day to night transition
+		   // we use the mountain weights here sine it tends to be accurate for night desert
+		   memcpy(tweights,mountain_temp_weights,MAX_TEMP*sizeof(int));
+		   if(config.hour == 18) climates[i].temperature = chilly; //need to set temperature or boom
+	   }else memcpy(tweights,climates[i].temperature_base,MAX_TEMP*sizeof(int)); // grab the base weights
+	   combine_weights(tweights,night_temp_weights,MAX_TEMP);	
+   } else {
+	   //day time
+	   memcpy(tweights,climates[i].temperature_base,MAX_TEMP*sizeof(int));
+   }
+
    combine_weights(tweights,weather_temp_weights[climates[i].weather],MAX_TEMP);
    combine_weights(tweights,season_temp_weights[get_season(config.day)],
             MAX_TEMP);
@@ -408,8 +517,54 @@
    climates[i].wind = int_to_wind_enum(climates[i].windamount);
 
 
-	
-   //if it's hailing, let's smack some people
+	//TODO move these into seperate functions
+
+   if(old_weather != climates[i].weather){
+	   Cell<critter*> cll(pc_list);
+	   critter* pc;
+	   room* rm;
+	   while((pc = cll.next())){
+		   rm = pc->getCurRoom();
+		   if(rm->getClimate() == i){
+			   if(!pc->isUnaware()) pc->show(weather_change_strings[old_weather][climates[i].weather]);
+		   }
+	   }
+   }
+
+   // let's blow out some lights
+ /*  if(climates[i].wind > lightwind){
+	   Cell<critter*> cll(pc_list);
+	   critter* pc;
+	   room* rm;
+	   unsigned int p;
+	   while((pc = cll.next())){
+		   rm = pc->getCurRoom();
+		   if(rm->getClimate() == i){
+			   switch(climates[i].wind){
+				   case lightwind:
+						p = 5;
+						break;
+				   case windy:
+					   p = 8;
+					   break;
+				   case verywindy:
+					    p = 10;
+						break;
+				   case gale:
+					   p 14;
+					   break;
+						p = 0;
+			   }
+			   if(rand()%100 >= p){
+					//gave up trying to add a is_lit flag, jsut going to remove it from eq and drop it into inv
+
+			   }
+		   }
+	   }*/
+		
+
+
+	   //if it's hailing, let's smack some people
    if(climates[i].weather == hail || climates[i].weather == hailstorm){
       Cell<critter*> cll(pc_list);
       critter* pc;
@@ -423,115 +578,125 @@
          prob = 5;
       }
 
-      while((pc = cll.next())){
-         if(!pc->isImmort() || !pc->isNoHassle()){
-            rm = pc->getCurRoom();
-            if(rm->getClimate() == i){
-               if((rand()%20 + 1)>prob){
-                  if(d(1,pc->DEX) > d(1,20)){
-                     Cell<critter*> rcll(rm->getCrits()); //holds mob        s in room
-                     dam = d(1,5);
-                     pc->takeDamage(dam,NORMAL);
-                     switch(dam){
-                        case 1:
-                        case 2:
-                        case 3:
-                           if(pc->isSleeping()){
-                              pc->setPosn(POS_REST);
-                              pc->show("You are awakened by a piece of hail hitting you!\n");                          
-                              while((crit_ptr = rcll.next())){
-                                 if(crit_ptr != pc){
-                                     Sprintf(buf, "%S is woken up by being hit with a piece of hail!\n",
-                                     pc->getName(crit_ptr->SEE_BIT));
-                                     crit_ptr->show(buf);
-                                  }
-                              }
-                           }else if(pc->isMeditating()){
-                              pc->setPosn(POS_REST);
-                              pc->show("Your meditation is broken by a stinging sensation!\n"); 
-                              while((crit_ptr = rcll.next())){
-                                 if(crit_ptr != pc){
-                                    Sprintf(buf, "%S's meditation is broken by a small piece of hail!!\n",
-                                    pc->getName(crit_ptr->SEE_BIT));
-                                    crit_ptr->show(buf);
-                                 }
-                              }
-                           }else{
-                              pc->show("A small piece of hail hits you!\n");
-                              while((crit_ptr = rcll.next())){
-                                 if(crit_ptr != pc){
-                                    Sprintf(buf, "A small piece of hails hits %S!\n",
-                                       pc->getName(crit_ptr->SEE_BIT));
-                                       crit_ptr->show(buf);
-                                    }
-                                 }
-                              }
-                           break;
-                        case 4:
-                        case 5:
-                           if(pc->isSleeping()){
-                              pc->setPosn(POS_REST);
-                              pc->show("You are awakened by a stringing sensation!\n");
-                              while((crit_ptr = rcll.next())){
-                              if(crit_ptr != pc){
-                                    Sprintf(buf, "%S is woken up by being hit with a large piece of hail!\n",
-                                    pc->getName(crit_ptr->SEE_BIT));
-                                    crit_ptr->show(buf);
-                                 }
-                              }
-                           }else if(pc->isMeditating()){
-                              pc->setPosn(POS_REST);
-                              pc->show("A stinging sensation breaks your meditation\n");
-                              while((crit_ptr = rcll.next())){
-                                 if(crit_ptr != pc){
-                                       Sprintf(buf, "%S's meditation is disrupted by a large peice of hail !\n",
-                                       pc->getName(crit_ptr->SEE_BIT));
-                                     crit_ptr->show(buf);
-                                 }
-                              }
-                           }else{
-                              pc->show("A large piece of hail hits you!\n");
-                              while((crit_ptr = rcll.next())){
-                                 if(crit_ptr != pc){
-                                    Sprintf(buf, "A large piece of hails hits %S!\n",
-                                          pc->getName(crit_ptr->SEE_BIT));
-                                    crit_ptr->show(buf);
-                                 }
-                              }
-                           }
-                          break;
-                     }
-                  } else {
-                     Cell<critter*> rcll(rm->getCrits()); //holds mobs in room
-                     if(pc->isSleeping() || pc->isMeditating()){
-                       while((crit_ptr = rcll.next())){
-                          if(crit_ptr != pc){
-                             if(crit_ptr->canSee(*pc)){
-                                Sprintf(buf,
-                                    "%S is nearly hit hit by a piece of hail!\n",
-                                    pc->getName());
-                                crit_ptr->show(buf);
-                             }
-                          }
-                       }
-                     }else{
-                        pc->show("You barely avoid being hit by a piece of hail!\n");
-                        while((crit_ptr = rcll.next())){
-                           if(crit_ptr != pc){
-                              if(crit_ptr->canSee(*pc)){
-                                 Sprintf(buf,
-                                    "%S barely avoids being hit by a piece of hail!\n",
-                                    pc->getName());
-                                 crit_ptr->show(buf);
-                              }
-                           }  
-                        }
-                     }
-                  }
-               }
-            }
-         }
-      }   
+	  while((pc = cll.next())){
+		  if(!pc->isImmort() || !pc->isNoHassle()){
+			  rm = pc->getCurRoom();
+			  if(rm->getClimate() == i){
+				  if((rand()%20 + 1)>prob){
+					  if(d(1,pc->DEX) > d(1,20)){
+						  Cell<critter*> rcll(rm->getCrits()); //holds mob        s in room
+						  dam = d(1,5);
+						  pc->takeDamage(dam,NORMAL);
+						  switch(dam){
+						case 1:
+						case 2:
+						case 3:
+							if(pc->isSleeping()){
+								pc->setPosn(POS_REST);
+								pc->show("You are awakened by a piece of hail hitting you!\n");                          
+								while((crit_ptr = rcll.next())){
+									if(crit_ptr != pc){
+										if(crit_ptr->canSee(*pc) && !crit_ptr->isUnaware()){
+											Sprintf(buf, "%S is woken up by being hit with a piece of hail!\n",
+												pc->getName(crit_ptr->SEE_BIT));
+											crit_ptr->show(buf);
+										}
+									}
+								}
+							}else if(pc->isMeditating()){
+								pc->setPosn(POS_REST);
+								pc->show("Your meditation is broken by a stinging sensation!\n"); 
+								while((crit_ptr = rcll.next())){
+									if(crit_ptr != pc){
+										if(crit_ptr->canSee(*pc) && !crit_ptr->isUnaware()){
+											Sprintf(buf, "%S's meditation is broken by a small piece of hail!!\n",
+												pc->getName(crit_ptr->SEE_BIT));
+											crit_ptr->show(buf);
+										}
+									}
+								}
+							}else{
+								pc->show("A small piece of hail hits you!\n");
+								while((crit_ptr = rcll.next())){
+									if(crit_ptr != pc){
+										Sprintf(buf, "A small piece of hails hits %S!\n",
+											pc->getName(crit_ptr->SEE_BIT));
+										crit_ptr->show(buf);
+									}
+								}
+							}
+							break;
+						case 4:
+						case 5:
+							if(pc->isSleeping()){
+								pc->setPosn(POS_REST);
+								pc->show("You are awakened by a stringing sensation!\n");
+								while((crit_ptr = rcll.next())){
+									if(crit_ptr != pc){
+										if(crit_ptr->canSee(*pc) && !crit_ptr->isUnaware()){
+											Sprintf(buf, "%S is woken up by being hit with a large piece of hail!\n",
+												pc->getName(crit_ptr->SEE_BIT));
+											crit_ptr->show(buf);
+										}
+									}
+								}
+							}else if(pc->isMeditating()){
+								pc->setPosn(POS_REST);
+								pc->show("A stinging sensation breaks your meditation\n");
+								while((crit_ptr = rcll.next())){
+									if(crit_ptr != pc){
+										if(crit_ptr->canSee(*pc) && !crit_ptr->isUnaware()){
+											Sprintf(buf, "%S's meditation is disrupted by a large peice of hail !\n",
+												pc->getName(crit_ptr->SEE_BIT));
+											crit_ptr->show(buf);
+										}
+									}
+								}
+							}else{
+								pc->show("A large piece of hail hits you!\n");
+								while((crit_ptr = rcll.next())){
+									if(crit_ptr != pc){
+										if(crit_ptr->canSee(*pc) && !crit_ptr->isUnaware()){
+											Sprintf(buf, "A large piece of hails hits %S!\n",
+												pc->getName(crit_ptr->SEE_BIT));
+											crit_ptr->show(buf);
+										}
+									}
+								}
+							}
+							break;
+						  }
+					  } else {
+						  Cell<critter*> rcll(rm->getCrits()); //holds mobs in room
+						  if(pc->isSleeping() || pc->isMeditating()){
+							  while((crit_ptr = rcll.next())){
+								  if(crit_ptr != pc){
+									  if(crit_ptr->canSee(*pc) && !crit_ptr->isUnaware()){
+										  Sprintf(buf,
+											  "%S is nearly hit hit by a piece of hail!\n",
+											  pc->getName());
+										  crit_ptr->show(buf);
+									  }
+								  }
+							  }
+						  }else{
+							  pc->show("You barely avoid being hit by a piece of hail!\n");
+							  while((crit_ptr = rcll.next())){
+								  if(crit_ptr != pc){
+									  if(crit_ptr->canSee(*pc) && !crit_ptr->isUnaware()){
+										  Sprintf(buf,
+											  "%S barely avoids being hit by a piece of hail!\n",
+											  pc->getName());
+										  crit_ptr->show(buf);
+									  }
+								  }  
+							  }
+						  }
+					  }
+				  }
+			  }
+		  }
+	  }   
    }
 
    if(climates[i].weather == thunderstorm){
@@ -558,11 +723,15 @@
 
 						   while((crit_ptr = rcll.next())){
 							   if(crit_ptr != pc){
-								   if(crit_ptr->canSee(*pc)){
+								   if(crit_ptr->canSee(*pc) && !crit_ptr->isUnaware()){
 									   Sprintf(buf,
 										   "%S is struck by lightning!!\n",
 										   pc->getName());
 									   crit_ptr->show(buf);
+								   }else {
+									   if(!crit_ptr->isUnaware()){
+										   crit_ptr->show("The lightning strike briefly illuminates a vague shape!");
+									   }
 								   }
 							   }
 						   }     
@@ -571,11 +740,15 @@
 						   pc->show("You meditation is broken by a bolt of lightning striking you!\n");
 						   while((crit_ptr = rcll.next())){
 							   if(crit_ptr != pc){
-								   if(crit_ptr->canSee(*pc)){
+								   if(crit_ptr->canSee(*pc) && !crit_ptr->isUnaware()){
 									   Sprintf(buf,
 										   "%S is struck by lightning!!\n",
 										   pc->getName());
 									   crit_ptr->show(buf);
+								   } else {
+									   if(!crit_ptr->isUnaware()){
+										   crit_ptr->show("The lightning strike briefly illuminates a vague shape!");
+									   }
 								   }
 							   }
 						   }                                 
@@ -583,11 +756,15 @@
 						   pc->show("You've been struck by lightning!\n");
 						   while((crit_ptr = rcll.next())){
 							   if(crit_ptr != pc){
-								   if(crit_ptr->canSee(*pc)){
+								   if(crit_ptr->canSee(*pc) && !crit_ptr->isUnaware()){
 									   Sprintf(buf,
 										   "%S is struck by lightning!!\n",
 										   pc->getName());
 									   crit_ptr->show(buf);
+								   } else {
+									   if(!crit_ptr->isUnaware()){
+										   crit_ptr->show("The lightning strike briefly illuminates a vague shape!");
+									   }
 								   }
 							   }
 						   }                  
@@ -605,7 +782,11 @@
 							   pc->show("A loud crash of thunder breaks your meditation!\n");
 						   }
 					   } else{
-						   pc->show("A brief flash of lightning is followed a crash of thunder!\n");
+						   if(!pc->isUnaware()){
+							   int chance = d(1,2);
+							   if(chance == 1 ) pc->show("A brief flash of lightning is followed a crash of thunder!\n");
+							   if(chance ==  2) pc->show("Lightning flashes on the horizon and thunder rumbles in the distance.\n");
+						   }
 					   }
 				   }
 			   }




More information about the ScryMUD mailing list