]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/do_attack.cpp
Added everything necessary to save overtop of the old dragon when someone beats the...
[irc/gameservirc.git] / gameserv / do_attack.cpp
index 1f53b24bac46eae7b84c4782626e601faed04d50..4f1ce64a2884bcc0885cec1d4810f8404d485641 100644 (file)
@@ -52,7 +52,8 @@ void do_attack(char *u)
     {
       // Player's Hit
       hit = ((ni->stats->strength + webonus[ni->stats->weapon]) / 2) +
-       (rand() % ((ni->stats->strength + webonus[ni->stats->weapon]) / 2));
+       (rand() % ((ni->stats->strength + webonus[ni->stats->weapon]) / 2)) - 
+       fight->defense;
 
       // Opponent's Hit
       mhit = (fight->strength / 2) +
@@ -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->weapon];
+           dragon.strength = ni->stats->strength + webonus[ni->stats->weapon];
+           dragon.defense = ni->stats->defense + arbonus[ni->stats->armor];
+           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.