X-Git-Url: https://jfr.im/git/irc/gameservirc.git/blobdiff_plain/8a5cec4fe1859f7c5b1c818cf1cd7a5369e284aa..1781f48acb7a88a79ef85708ad4afe88ce35b7b1:/gameserv/do_attack.cpp diff --git a/gameserv/do_attack.cpp b/gameserv/do_attack.cpp index 222ebf0..053e1c7 100644 --- a/gameserv/do_attack.cpp +++ b/gameserv/do_attack.cpp @@ -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->wea]) / 2) + - (rand() % ((ni->stats->strength + webonus[ni->stats->wea]) / 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->arm])); + 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->wea]) / 2) + - (rand() % ((battle->stats->strength + webonus[battle->stats->wea])) / 2) - - (ni->stats->defense + arbonus[ni->stats->arm])); + mhit = (((battle->stats->strength) / 2) + + (rand() % ((battle->stats->strength)) / 2) - + (ni->stats->defense)); // Player's Hit - 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])); + 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 %s for %d points!", fight->name.c_str(), hit); + notice(s_GameServ, u, "You attack %s for %d hp!", fight->name.c_str(), hit); else notice(s_GameServ, u, "You miss %s 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->wea]; - dragon.strength = ni->stats->strength + webonus[ni->stats->wea]; - dragon.defense = ni->stats->defense + arbonus[ni->stats->arm]; + 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(); @@ -222,7 +233,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->wea], hit); + (ni->stats->getWeapon() ? ni->stats->getWeapon()->getName().c_str() : "Fists"), hit); } else {