]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/do_attack.cpp
added items to the tavern.dat, added the filename option to the config file
[irc/gameservirc.git] / gameserv / do_attack.cpp
index 1f53b24bac46eae7b84c4782626e601faed04d50..222ebf01ea19a015977b6da3a976edc59602e302 100644 (file)
@@ -51,25 +51,26 @@ void do_attack(char *u)
   if (!player_fight(ni))
     {
       // Player's Hit
-      hit = ((ni->stats->strength + webonus[ni->stats->weapon]) / 2) +
-       (rand() % ((ni->stats->strength + webonus[ni->stats->weapon]) / 2));
+      hit = ((ni->stats->strength + webonus[ni->stats->wea]) / 2) +
+       (rand() % ((ni->stats->strength + webonus[ni->stats->wea]) / 2)) - 
+       fight->defense;
 
       // Opponent's Hit
       mhit = (fight->strength / 2) +
        (rand() % (fight->strength / 2) - (ni->stats->defense +
-                                          arbonus[ni->stats->armor]));
+                                          arbonus[ni->stats->arm]));
     }
   else
     {
       // Opponent's Hit
-      mhit = (((battle->stats->strength + webonus[battle->stats->weapon]) / 2) +
-             (rand() % ((battle->stats->strength + webonus[battle->stats->weapon])) / 2) -
-             (ni->stats->defense + arbonus[ni->stats->armor]));
+      mhit = (((battle->stats->strength + webonus[battle->stats->wea]) / 2) +
+             (rand() % ((battle->stats->strength + webonus[battle->stats->wea])) / 2) -
+             (ni->stats->defense + arbonus[ni->stats->arm]));
 
       // Player's Hit
-      hit = (((ni->stats->strength + webonus[ni->stats->weapon]) / 2) +
-            (rand() % ((ni->stats->strength + webonus[ni->stats->weapon])) / 2) -
-            (battle->stats->defense + arbonus[battle->stats->armor]));
+      hit = (((ni->stats->strength + webonus[ni->stats->wea]) / 2) +
+            (rand() % ((ni->stats->strength + webonus[ni->stats->wea])) / 2) -
+            (battle->stats->defense + arbonus[battle->stats->arm]));
     }
 
   if (!player_fight(ni))
@@ -95,13 +96,22 @@ void do_attack(char *u)
          notice(s_GameServ, u, "You recieve \ 2%d\ 2 experience and \ 2%d\ 2 gold!",
                  fight->exp, fight->gold);
 
-         if (dragon_fight(ni))
-           {
-             addNews(todaysnews, "%s is a true warrior! %s has beaten %s!!",
-                     ni->stats->name.c_str(), ni->stats->name.c_str(),
-                     ni->stats->master->name.c_str());
-             ni->stats->master = NULL; // Don't progress in levels
-           }
+       if (dragon_fight(ni))
+       {
+           addNews(todaysnews, "%s is a true warrior! %s has beaten %s!!"\
+                       " %s is now watching over the Dragon's lair!",
+           ni->stats->name.c_str(), ni->stats->name.c_str(),
+           ni->stats->fight->name.c_str(), ni->stats->name.c_str());
+           dragon.name = "DRAGON-" + ni->stats->name;
+           dragon.weapon = weapons[ni->stats->wea];
+           dragon.strength = ni->stats->strength + webonus[ni->stats->wea];
+           dragon.defense = ni->stats->defense + arbonus[ni->stats->arm];
+           dragon.hp = ni->stats->maxhp;
+           dragon.maxhp = ni->stats->maxhp;
+           save_dragon();
+           clearDragonFight(ni->stats);
+           reset(ni->stats);
+       }
 
          // If your new experience (or gold) will be greater than 2 billion,
          // then set your exp to 2bil. (2 billion max)... otherwise add them.
@@ -212,7 +222,7 @@ void do_attack(char *u)
 
              notice(s_GameServ, battle->getNick(), "%s has hit you with their %s for "\
                     "^B%d^B damage!", ni->stats->name.c_str(),
-                    weapons[ni->stats->weapon], hit);
+                    weapons[ni->stats->wea], hit);
            }
          else
            {