ARENA.C
LIB3/D/HOME/CITY/ARENA/ARENA.C · 3.0 KB
From the archive nm4dos.zip
Download the archive « Back to the archive contents
#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();
}