/
LIB3/
LIB3/D/ADMIN/
LIB3/D/ADMIN/OBJ/
LIB3/D/ADMIN/ROOM/W/
LIB3/D/HOME/
LIB3/D/HOME/CITY/ARENA/
LIB3/D/HOME/CITY/ITEMS/
LIB3/D/HOME/CITY/POSTOFFI/
LIB3/DOC/
LIB3/GLOBAL/SPECIAL/
LIB3/GLOBAL/VIRTUAL/
LIB3/NET/
LIB3/NET/CONFIG/
LIB3/NET/DAEMON/CHARS/
LIB3/NET/GOPHER/
LIB3/NET/INHERIT/
LIB3/NET/OBJ/
LIB3/NET/SAVE/
LIB3/NET/VIRTUAL/
LIB3/OBJ/B_DAY/
LIB3/OBJ/HANDLERS/TERM_TYP/
LIB3/PLAYERS/B/
LIB3/PLAYERS/N/
LIB3/ROOM/
LIB3/SAVE/
LIB3/SAVE/BOARDS/
LIB3/SAVE/ENVIRON/
LIB3/SAVE/POST/
LIB3/STD/COMMANDS/SHADOWS/
LIB3/STD/CREATOR/
LIB3/STD/DOM/
LIB3/STD/EFFECTS/
LIB3/STD/EFFECTS/HEALING/
LIB3/STD/EFFECTS/OTHER/
LIB3/STD/EFFECTS/POISONS/
LIB3/STD/ENVIRON/
LIB3/STD/GUILDS/
LIB3/STD/LIQUIDS/
LIB3/STD/ROOM/
LIB3/STD/TRIGGER/SHADOW/
LIB3/W/
LIB3/W/BANNOR/
LIB3/W/NEWSTYLE/
#include "arena.h"
#include "library.h"
inherit "/std/room";

object ob;

setup()
{
   set_short("The arena");
   set_long("This is where the citizens of "+CITYNAME
      +" can come to pit their strength against a number"
      +" of opponents.\n");
   set_light(100);
   add_exit("south", "arena_lobby", "gate");
   modify_exit("south", ({"function", "do_leave"}) );
}

int do_leave()
{
   if(ob)
      write("Hah, you wimped out, and failed to defeat "
      + NAMES[(int)this_player()->query_property("arena")]
      +".\n");
   call_other(PATH+"arena_lobby", "do_remove");
   if (ob) ob->dest_me();
   return 1;
}

void welcome()
{
   write("Welcome to the arena.\n");
   write("One of the champions will be along shortly to "
      +"try and beat the living daylight out of you. Why "
      +"not take this opportunity to set your wimpy to "
      +"a safe value?\n");
   ob = clone_object("/obj/monster");
   call_out("next_champion", 8);
}

void next_champion()
{
   int l;
   string str, tmp;
   
if (!ob) return;
   l = (int)this_player()->query_property("arena");
   sscanf(NAMES[l], "%s the %s", str, tmp);
   
ob->set_name(capitalize(str));
ob->add_alias(str);
ob->set_short(capitalize(NAMES[l]));
   ob->set_long(NAMES[l] +".\nHe is the "+
      ({"first","second","third","fourth","fifth","sixth","penultimate","final"})[l]
+" champion of the arena.\n");
   ob->set_guild_ob("/d/home/guilds/fighters/guild_object");
   
   if(l>4) ob->set_race_ob("/std/races/troll");
   else ob->set_race_ob("/std/races/human");
   
   ob->adjust_xp(500+800*l);
   ob->set_level(5+10*l);
   ob->set_new_level(5+10*l);
   ob->set_max_hp(400+250*l);
   
   /*
   ob->add_attack("punch", 0, 100, ({ l, l, l}), ({ }), ({ }), "blunt");
   ob->add_attack("kick", 0, 100, ({ l*4, l, l}), ({ }), ({ }), "blunt");
   */
   write(ob->query_short()+" enters the arena.\n");
   ob->move(this_object());
   ob->init_command(":eyes you speculatively.");
   
   call_out("begin_attack", 5);
}

void begin_attack()
{
   if (ob) ob->attack_ob(this_player());
}

void event_death()
{
if(this_player()->query_property("dead") )
      {
      write("Seeing you defeated, " + ob->query_short()
         +" leaves the arena.\n");
      ob->dest_me();
      return;
   }
   write("Congratulations!\n You have defeated "+
      NAMES[(int)this_player()->query_property("arena")]
      +".\n");
   this_player()->add_property("arena",
      (int)this_player()->query_property("arena")+1);
   if((int)this_player()->query_property("arena") == sizeof(NAMES))
      {
      write("You have defeated the final champion of the "
         +"arena, and earned the title 'master of the "
         +"arena'. Well done.\n");
      
      LIBRARY->set_quest(this_player()->query_name(), "arena");
      this_player()->adjust_xp(20000);
      return;
   }
   write("The next champion of the arena you will face is "+
      NAMES[(int)this_player()->query_property("arena")] +".\n");
   write("For now, please leave the arena, rest, and "
      +"recuperate.\n");
}

void dest_me()
{
   if (ob) ob->dest_me();
}