]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/do_attack.cpp
updated the TODO
[irc/gameservirc.git] / gameserv / do_attack.cpp
index 4f1ce64a2884bcc0885cec1d4810f8404d485641..a45e9f1e9c6883122d8a0209280468d08cd51533 100644 (file)
@@ -1,14 +1,14 @@
-
 #include "aClient.h"
 #include "extern.h"
 #include "flags.h"
 #include "level.h"
 #include "player.h"
+#include "item.h"
 
 
 void do_attack(char *u)
 {
-  int hit, mhit;
+  int hit = 0, mhit = 0;
   aClient *ni, *battle; // The player and perhaps the player they're fighting
   Monster *fight; // The monster they may be fighting
 
@@ -51,32 +51,43 @@ 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)) - 
-       fight->defense;
+      if ((ni->stats->strength / 2) == 0)
+       {
+         hit = 0;
+       }
+      else
+       {
+         hit = (ni->stats->strength / 2) +     (rand() % (ni->stats->strength / 2)) - fight->defense;
+       }
 
       // Opponent's Hit
-      mhit = (fight->strength / 2) +
-       (rand() % (fight->strength / 2) - (ni->stats->defense +
-                                          arbonus[ni->stats->armor]));
+      if ((fight->strength / 2) == 0)
+       {
+         mhit = 0;
+       }
+      else
+       {
+         mhit = (fight->strength / 2) +
+           (rand() % (fight->strength / 2) - (ni->stats->defense));
+       }
     }
   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) / 2) +
+             (rand() % ((battle->stats->strength)) / 2) -
+             (ni->stats->defense));
 
       // 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) / 2) +
+            (rand() % ((ni->stats->strength)) / 2) -
+            (battle->stats->defense));
     }
 
   if (!player_fight(ni))
     {
       if (hit > 0)
-        notice(s_GameServ, u, "You attack \1f%s\1f for \ 2%d\ 2 points!", fight->name.c_str(), hit);
+        notice(s_GameServ, u, "You attack \1f%s\1f for \ 2%d\ 2 hp!", fight->name.c_str(), hit);
       else
         notice(s_GameServ, u, "You miss \1f%s\1f completely!", fight->name.c_str());
 
@@ -103,9 +114,9 @@ void do_attack(char *u)
            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.weapon = "Breath of Fire";
+           dragon.strength = ni->stats->strength;
+           dragon.defense = ni->stats->defense;
            dragon.hp = ni->stats->maxhp;
            dragon.maxhp = ni->stats->maxhp;
            save_dragon();
@@ -221,8 +232,8 @@ void do_attack(char *u)
              notice(s_GameServ, u, "You attack \1f%s\1f for \ 2%d\ 2 points!", battle->stats->name.c_str(), hit);
 
              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);
+                    "\ 2%d\ 2 damage!", ni->stats->name.c_str(),
+                    (ni->stats->getWeapon() ? ni->stats->getWeapon()->getName().c_str() : "Fists"), hit);
            }
          else
            {
@@ -232,7 +243,7 @@ void do_attack(char *u)
 
          if (hit >= battle->stats->hp)
            {
-             notice(s_GameServ, u, "You have killed ^\ 2%s\ 2!", battle->stats->name.c_str());
+             notice(s_GameServ, u, "You have killed \ 2%s\ 2!", battle->stats->name.c_str());
              notice(s_GameServ, u, "You recieve \ 2%d\ 2 experience and \ 2%ld\ 2 gold!",
                     (long int)(battle->stats->exp * .10), battle->stats->gold);
              notice(s_GameServ, battle->getNick(), "You have been killed by \ 2%s\ 2!",