- if (master_fight(ni))
- {
- notice(s_GameServ, u, "You have bested %s!", fight->name);
- addNews(todaysnews, "%s has bested %s and moved "\
- "to level %d", ni->stats->name, fight->name,
- (ni->stats->level + 1));
- }
- else
- notice(s_GameServ, u, "You have killed \ 2%s\ 2!", fight->name);
-
- notice(s_GameServ, u, "%s", fight->death);
- notice(s_GameServ, u, "You recieve \ 2%d\ 2 experience and \ 2%d\ 2 gold!",
- fight->exp, fight->gold);
-
- // If your new experience (or gold) will be greater than 2 billion,
- // then set your exp to 2bil. (2 billion max)... otherwise add them.
- // This could be a problem with overflowing out of the sign bit.
- // Unsigned long int maybe? Leave it for now.
- ni->stats->exp = ( (ni->stats->exp + fight->exp) > 2000000000 ? 2000000000 :
- ni->stats->exp + fight->exp);
-
- ni->stats->gold = (ni->stats->gold + fight->gold > 2000000000 ? 2000000000 :
- ni->stats->gold + fight->gold);
-
-
- if (master_fight(ni))
- {
- notice(s_GameServ, u, "You are now level %d!", ni->stats->level + 1);
- notice(s_GameServ, u, "You gain %d Strength, and %d Defense points!",
- strbonus[ni->stats->level - 1], defbonus[ni->stats->level - 1]);
-
- // Increase your level
-
- // Increase your maximum hit points
- ni->stats->maxhp += hpbonus[ni->stats->level - 1];
-
- // Heal the player by setting hp to their max
- ni->stats->hp = ni->stats->maxhp;
-
- // Add to your strength
- ni->stats->strength += strbonus[ni->stats->level - 1];
-
- // Add to your defensive power
- ni->stats->defense += defbonus[ni->stats->level - 1];
-
- ni->stats->level++;
-
- // Clear the pointer for your master
- ni->stats->master = NULL;
- }
-
- // They're dead so remove the pointer
- delete ni->stats->fight;
- ni->stats->fight = NULL;
- ni->stats->master = NULL;
-
- return;
- }
- else
- {
- if (hit > 0)
- fight->hp -= hit;
- if (mhit > 0)
- {
- notice(s_GameServ, u, "\1f%s\1f attacks with their \1f%s\1f for \ 2%d\ 2 damage!",
- fight->name, fight->weapon, mhit);
- }
- else if (mhit <= 0)
- notice(s_GameServ, u, "%s completely misses you!", fight->name);
-
- if (mhit >= ni->stats->hp)
- {
- if (!master_fight(ni))
- {
- notice(s_GameServ, u, "You have been \ 2\1fkilled\1f\ 2 by %s!", fight->name);
- notice(s_GameServ, u, "You lose all gold on hand and lose 10 percent "\
- "of your experience!");
- addNews(todaysnews, "%s has been killed by %s!",
- ni->stats->name, fight->name);
- ni->stats->gold = 0;
- ni->stats->exp -= (long int)(ni->stats->exp * .10);
- ni->stats->hp = 0;
- ni->stats->fight = NULL;
- clearAlive(ni->stats);
- return;
- }
- else
- {
- notice(s_GameServ, u, "%s has bested you! You will have to wait "\
- "until tomorrow to try again", ni->stats->master->name);
- addNews(todaysnews, "%s tried to best %s and failed!",
- ni->stats->name, fight->name);
- ni->stats->fight = NULL;
- ni->stats->master = NULL;
- return;
- }
- }
- else
- {
- if (mhit > 0)
- ni->stats->hp -= mhit;
- display_monster(u);
- return;
- }
- }
- }
- else if (player_fight(ni))
- {
-/* Offline fighting not available yet
- if (!(online = finduser(ni->stats->battle->nick)) || !nick_identified(online))
- {
- if (hit > 0)
- notice(s_GameServ, u, "You attack \1f%s\1f for \ 2%d\ 2 points!", battle->nick, hit);
- else
- notice(s_GameServ, u, "You miss \1f%s\1f completely!", battle->nick);
- if (hit >= battle->stats->hp)
- {
- notice(s_GameServ, u, "You have killed \ 2%s\ 2!", battle->nick);
-* notice(s_GameServ, u, "You recieve \ 2%d\ 2 experience and \ 2%ld\ 2 gold!",
- (long int)(battle->stats->exp * .10), battle->stats->gold);
- if (2000000000 - ni->stats->exp > (long int)(battle->stats->exp * .10))
- {
- ni->stats->exp += (long int)(battle->stats->exp * .10);
- battle->stats->exp -= (long int)(battle->stats->exp * .10);
- }
-* else
- {
- battle->stats->exp -= (long int)(battle->stats->exp * .10);
- ni->stats->exp = 2000000000;
- }
-
- if (2000000000 - ni->stats->gold > battle->stats->gold)
- {
-* ni->stats->gold += battle->stats->gold;
- battle->stats->gold = 0;
- }
- else
- {
- battle->stats->gold = 2000000000 - ni->stats->gold;
- ni->stats->gold = 2000000000;
- }
-* ni->stats->battle->stats->alive = 0;
- ni->stats->battle->battle = NULL;
- ni->stats->battle = NULL;
- return;
- }
- else
- {
- if (hit > 0)
-* battle->stats->hp -= hit;
- if (mhit > 0)
- {
- notice(s_GameServ, u, "\1f%s\1f hits you with their \1f%s\1f for \ 2%d\ 2 damage!",
- battle->nick, weapons[battle->stats->weapon], mhit);
- }
- else if (mhit <= 0)
- notice(s_GameServ, u, "%s completely misses you!", battle->nick);
-*
- if (mhit >= ni->stats->hp)
- {
- notice(s_GameServ, u, "You have been \ 2\1fkilled\1f\ 2 by %s!", battle->nick);
- if (2000000000 - battle->stats->gold > ni->stats->gold)
- {
- notice(s_GameServ, u, "%s took all your gold!", battle->nick);
- battle->stats->gold += ni->stats->gold;
-* ni->stats->gold = 0;
- }
- else
- {
- notice(s_GameServ, u, "You're lucky, %s couldn't carry all your gold.",
- battle->nick);
- ni->stats->gold -= (2000000000 - battle->stats->gold);
- notice(s_GameServ, u, "You were left dead with %d gold.",
-* (long int)ni->stats->gold);
- battle->stats->gold = 2000000000;
- }
- ni->stats->battle->battle = NULL;
- ni->stats->battle = NULL;
- ni->stats->alive = 0;
- return;
- }
-* else
- {
- if (mhit > 0)
- ni->stats->hp -= mhit;
- display_players(u);
- return;
- }
- }
- }
-* end offline fighting */
-
- if (is_playing(battle))
- {
- if (!isYourTurn(ni->stats))
- {
- notice(s_GameServ, u, "Please wait until %s decides what to do!",
- battle->stats->name);
- return;
- }
- if (hit > 0)
- {
- notice(s_GameServ, u, "You attack \1f%s\1f for \ 2%d\ 2 points!", battle->stats->name, hit);
-
- notice(s_GameServ, battle->getNick(), "%s has hit you with their %s for "\
- "\ 2%d\ 2 damage!", ni->stats->name,
- weapons[ni->stats->weapon], hit);
- }
- else
- {
- notice(s_GameServ, u, "You miss \1f%s\1f completely!", battle->stats->name);
- notice(s_GameServ, battle->getNick(), "%s misses you completely!", ni->stats->name);
- }
-
- if (hit >= battle->stats->hp)
- {
- notice(s_GameServ, u, "You have killed \ 2%s\ 2!", battle->stats->name);
- 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!",
- ni->stats->name);
- battle->stats->hp = 0;
- clearAlive(battle->stats);
-
- if (2000000000 - ni->stats->exp > (long int)(battle->stats->exp * .10))
- {
- ni->stats->exp += (long int)(battle->stats->exp * .10);
- battle->stats->exp -= (long int)(battle->stats->exp * .10);
- }
- else
- {
- battle->stats->exp -= (long int)(battle->stats->exp * .10);
- ni->stats->exp = 2000000000;
- }
-
- if (2000000000 - ni->stats->gold > battle->stats->gold)
- {
- notice(s_GameServ, battle->getNick(), "You lose ten percent of experience and "\
- "all gold on hand!");
- ni->stats->gold += battle->stats->gold;
- battle->stats->gold = 0;
- }
- else
- {
- battle->stats->gold = 2000000000 - ni->stats->gold;
- notice(s_GameServ, battle->getNick(), "You lose ten percent of your experience!");
-
- notice(s_GameServ, battle->getNick(), "However, %s could not carry all of your "\
- "gold.", ni->stats->name);
-
- notice(s_GameServ, battle->getNick(), "Luckily, you still have \ 2%ld\ 2 gold "\
- "left. All is not lost!", battle->stats->gold);
-
- ni->stats->gold = 2000000000;
- }
- clearYourTurn(ni->stats);
- clearYourTurn(battle->stats);
- battle->stats->battle = NULL;
- ni->stats->battle = NULL;
- return;
- }
- else
- {
- if (hit > 0)
- battle->stats->hp -= hit;
- clearYourTurn(ni->stats);
- setYourTurn(battle->stats);
- display_players(battle);
- notice(s_GameServ, u, "Please wait while %s decides what to do!",
- battle->stats->name);
- return;
- }
- }
- }
-}
-
-void do_heal(char *u)
-{
- aClient *ni;
- char *amount = strtok(NULL, " ");
- int price, num;
-
- if (!amount)
- {
- notice(s_GameServ, u, "SYNTAX: /msg %S HEAL {ALL | #}");
- return;
- }
- else if (!(ni = find(u)))
- {
- notice(s_GameServ, u, "Fatal error. Contact a(n) %S admin. buf: %s", strtok(NULL, ""));
- return;
- }
- else if (isIgnore(ni))
- {
- #ifdef DEBUGMODE
- log("Ignoring %s.", ni->getNick());
- #endif
- return;
- }
- else if (!is_playing(ni))
- {
- notice(s_GameServ, u, "You aren't playing!");
- return;
- }
- else if (!isAlive(ni->stats))
- {
- notice(s_GameServ, u, "You are dead. Wait until tomorrow for healing.");
- return;
- }
- else if (is_fighting(ni))
- {
- notice(s_GameServ, u, "You can't heal in battle!");
- return;
- }
- else if (ni->stats->hp >= ni->stats->maxhp)
- {
- notice(s_GameServ, u, "You don't need healing!");
- return;
- }
-
- updateTS(ni->stats);
- if (stricmp(amount, "ALL") == 0)
- {
- price = ni->stats->level * 3;
- if (ni->stats->gold < (ni->stats->maxhp - ni->stats->hp) * price)
- {
- notice(s_GameServ, u, "Healing \ 2%d\ 2 points for \ 2%d\ 2 gold per point.",
- (long int)ni->stats->gold/price, price);
- ni->stats->hp += ni->stats->gold / price;
- ni->stats->gold %= price;
- }