-
#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
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 \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());
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();
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->wea], hit);
+ "\ 2%d\ 2 damage!", ni->stats->name.c_str(),
+ (ni->stats->getWeapon() ? ni->stats->getWeapon()->getName().c_str() : "Fists"), hit);
}
else
{
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!",