]> jfr.im git - irc/gameservirc.git/commitdiff
added fair fights and fixed some bugs
authorkainazzzo <redacted>
Wed, 8 Mar 2006 04:26:57 +0000 (04:26 +0000)
committerkainazzzo <redacted>
Wed, 8 Mar 2006 04:26:57 +0000 (04:26 +0000)
git-svn-id: https://svn.code.sf.net/p/gameservirc/code/trunk@407 bc333340-6410-0410-a689-9d09f3c113fa

gameserv/Changes
gameserv/config.cpp
gameserv/data/levels/level9.dat
gameserv/do_attack.cpp
gameserv/flags.h
gameserv/gameserv.cpp
gameserv/gameserv.example.conf

index 3c074ca3171d1f3ec3474e863fb3f57ca19f44b4..9bb65341d3d377925c6a2d886b0ee4e9522bba06 100644 (file)
@@ -1,4 +1,6 @@
 Version 1.3.3
+* Added a fair fight checker which won't allow people who can kill others with one hit
+    to even challenge other players - Kain (thanks Mauritz)
 * Fixed a bug that would delete a user upon reset or defeating the dragon - Kain
 * Fixed a compile bug for some operating systems in c_forest.cpp - Kain (thanks Mauritz)
 * Fixed a bug that occured when a player defeated another player and gameserv /noticed the channel
index 81dfa43f4ab3118b66e2a743cff2a61a20bd003f..348aaa444f4de65dc14e76cdebe6b739be1c6999 100644 (file)
@@ -116,7 +116,7 @@ int load_config_file(char *config)
 {
   char *buf, *directive, *value;
   
-#define numdirectives 39
+#define numdirectives 40
   
   unload_config_file();
   
@@ -182,6 +182,7 @@ int load_config_file(char *config)
   directives[36].desc = "MAXFORESTFIGHTS - Maximum amount of forest fights to roll over";
   directives[37].desc = "ROLLOVERPERIOD - Period (in seconds) to rollover forest fights";
   directives[38].desc = "NUMROLLOVERFIGHTS - Number of forest fights to roll over";
+  directives[39].desc = "FAIRFIGHTS - True/False as to whether or not to check for fair fights";
   
   configflags = 0;
   
@@ -493,6 +494,13 @@ int load_config_file(char *config)
                  numrolloverfights = stringtoint(value);
                  directives[38].done = true;
                }
+         else if (stricmp(directive, "FAIRFIGHTS") == 0)
+               {
+                 value = strtok(NULL, "");
+                 if (stricmp(value, "TRUE") == 0)
+                       setFairFights();
+                 directives[39].done = true;
+               }
          else if (stricmp(directive, "WELCOMEMSG") == 0)
                {
                  // This directive is optional
index 20be7559327d2e4799eb91cdb8dcefcec24fd571..5a5c7fe9c075314751dacbce793987838eacaabe 100644 (file)
@@ -1,5 +1,5 @@
 535~690
-10351~30000
+10351~75000
 21231~24032
 1958~3000
 ^
index df1e07d62b07e1f8de5773bd1d6dca79375ad207..70aa62b5c4bf22eb740157ff01e90d5a131a62a2 100644 (file)
@@ -110,7 +110,7 @@ void do_attack(char *u)
                                          " %s is now watching over the Dragon's lair!",
                                          ni->stats->getName().c_str(), ni->stats->getName().c_str(),
                                          ni->stats->getMonster()->name.c_str(), ni->stats->getName().c_str());
-                         dragon.name = "DRAGON-" + ni->stats->getName();
+                         dragon.name = "Dragon " + ni->stats->getName();
                          dragon.weapon = "Breath of Fire";
                          dragon.strength = ni->stats->getStrength();
                          dragon.defense = ni->stats->getDefense();
index 83f41409f4d4ace3f9784ab787c496e18ed9670f..dd66c4558d266795e05b3bcac55c7063256dd4c7 100644 (file)
 #define CFLAG_SAVEDNOTICE              0x00000010
 #define CFLAG_USENICKSERV              0x00000020
 #define CFLAG_ROLLOVERFORESTFIGHTS      0x00000040
+#define CFLAG_FAIRFIGHTS               0x00000080
+
+#define setFairFights()                        (configflags |= CFLAG_FAIRFIGHTS)
+#define clearFairFights()              (configflags &= ~CFLAG_FAIRFIGHTS)
+#define isFairFights()                 (configflags & CFLAG_FAIRFIGHTS)
 
 #define setRolloverForestFights()       (configflags |= CFLAG_ROLLOVERFORESTFIGHTS)
 #define clearRolloverForestFights()     (configflags &= ~CFLAG_ROLLOVERFORESTFIGHTS)
index 8d6c5af101f95b2f042f910e1e283aa531002c3e..2d77c800090f5a4d6d746c2a2803a9ace9607f6b 100644 (file)
@@ -1596,6 +1596,10 @@ void do_fight(char *u)
     {
          notice(s_GameServ, u, "%s is fighting %s already!", battle->stats->getName().c_str(), battle->stats->getMonster()->name.c_str());
     }
+  else if (isFairFights() && (ni->stats->getStrength()/2 - battle->stats->getDefense()) > 0)
+    {
+         notice(s_GameServ, u, "Fair fighting is enabled, and you're too strong for %s!", battle->stats->getName().c_str());
+    } 
   else if (ni->stats->getLevel() - battle->stats->getLevel() > maxbfightdistance)
     {
          // You can't fight someone below you by more than X level(s)
index 99187627c7e95198616a9b2c5fa5b3bbd1e37474..99744495cd1ec0e1ff5b8f1618dad6898462b2b6 100644 (file)
@@ -184,6 +184,12 @@ maxafightdistance 2
 #      player fights only
 maxbfightdistance 1
 
+# Leave this as is if you want to enable fair fight checking
+# This will not let a player fight another player if they will
+# Kill the other player with 1 hit... useful for those pesky Level 1 players
+# That have the best armor and weapons because they play way too much!
+fairfights true
+
 # This is the maximum time (in seconds) that a player may remain idle
 # before something naughty happens to them :)
 maxidletime 300