]> jfr.im git - irc/gameservirc.git/blob - gameserv/do_run.cpp
Consolidated monster data into a single .dat file
[irc/gameservirc.git] / gameserv / do_run.cpp
1 #include "extern.h"
2 #include "aClient.h"
3 #include "flags.h"
4 #include "options.h"
5 #include "player.h"
6
7 void do_run(char *u)
8 {
9 aClient *user;
10 Player *p, *p2 = NULL;
11
12 if (!(user = find(u)))
13 {
14 notice(s_GameServ, u, "Couldn't find you. Error. Contact a <S admin");
15 return;
16 }
17 else if (isIgnore(user))
18 {
19 #ifdef DEBUGMODE
20 log("Ignoring %s.", user->getNick());
21 #endif
22 return;
23 }
24 else if (!is_playing(user))
25 {
26 notice(s_GameServ, u, "You must be playing to run!");
27 return;
28 }
29
30 updateTS(user->stats);
31 p = user->stats;
32
33 if (p->getBattle())
34 p2 = p->getBattle()->stats;
35
36 if (!is_fighting(user))
37 notice(s_GameServ, u, "You run in place... try fighting next time.");
38 else if (!player_fight(user) && !master_fight(user) && !dragon_fight(user))
39 {
40 notice(s_GameServ, u, "You run away from \ 2%s\ 2 like a little baby!", p->getMonster()->name.c_str());
41 p->delMonster();
42 }
43 else if (player_fight(user) && isYourTurn(p))
44 {
45 notice(s_GameServ, u, "You run away from \ 2%s\ 2 like a little baby!", p2->getName().c_str());
46 notice(s_GameServ, p->getBattle()->getNick(), "\ 2%s\ 2 ran away from you like a little baby!", p->getName().c_str());
47 addNews(todaysnews, "%s ran away from %s like a little baby!!", p->getName().c_str(), p2->getName().c_str()); /* DrLnet - edited by Kain */
48 p2->delBattle();
49 p->delBattle();
50 }
51 else if (player_fight(user) && !isYourTurn(p))
52 {
53 notice(s_GameServ, u, "It is not your turn. Please wait until \ 2%s\ 2 decides what to do.", p2->getName().c_str());
54 }
55 else if (master_fight(user))
56 {
57 notice(s_GameServ, u, "You cannot run from \ 2%s\ 2! FIGHT!", p->getMaster()->name.c_str());
58 }
59 else if (dragon_fight(user))
60 {
61 notice(s_GameServ, u, "You cannot run from %s! FIGHT!", dragon.name.c_str());
62 }
63 }