/* * This is the simulator suit - it is a shadow, so you have to make sure all * the functions in this file are allowed shadows. * * See sim.c and README.sim for information */ static object owner; static int kill_flag; int hit_point; object attacker_ob; object arena; int exp_start; start(me) { owner=me; arena=environment(owner); hit_point=owner->query_hp(); attacker_ob=owner->query_attack(); /* query_attack returns attacker_ob */ exp_start=owner->query_exp(); shadow (owner,1); set_heart_beat(1); add_action("test","test"); } test() { write("Simfight suit on.\n"); hp(); return 1; } /* query_real_name(){ return "The Gladiator "+owner->query_real_name(); } */ query_hp() { return hit_point; } query_exp() { return exp_start; } query_attack() { return attacker_ob; } heart_beat() { kill_flag=0; owner->heartbeat(); } short(){ return "The Gladiator " + owner->short(); } realshort(){ return owner->short(); } suit() { return this_object(); } owner(){ return owner; } fix_exp() { owner->add_exp(exp_start-owner->query_exp()); } leaving() { owner->stop_fight(); if (attacker_ob) { attacker_ob->stop_fight(); tell_object(attacker_ob,owner->query_name()+" gives up.\n"); } fix_exp(); } stop_fight() { owner->stop_fight(); attacker_ob=0; } hit_player(dam) { if (environment(owner)!=arena) { write("Your simulator suit falls off you.\n"); fix_exp(); owner->hit_player(dam); dest_me(); return 1; } if (!attacker_ob) set_heart_beat(1); if (!attacker_ob && this_player() != owner) attacker_ob = this_player(); dam -= random(owner->query_ac() + 1); if (dam <= 0) return 0; if (dam > hit_point+1) dam = hit_point+1; hit_point = hit_point - dam; if (hit_point<0) { /* We died ! */ if (!owner->query_npc() && !query_ip_number(owner)) { /* This player is linkdead. */ write(owner->query_name() + " is not here. You cannot kill a player who is not logged in.\n"); } arena->defeat(this_player(),owner); return 0; } return dam; } kill(arg) { string str; object ob; if (environment(owner)!=arena) { tell_object(owner,"Your simulator suit falls off you.\n"); dest_me(); return 1; } if(!this_player()) ::kill(str); if(attacker_ob) { write("You cannot attack that fast.\n"); return 1; } if ((!arg) || (sscanf(arg,"%s",str)!=1)) { write("Kill what ?\n"); return 1; } ob=find_player(str); if ((!ob) || (!ob->suit())) { write("That person is not suited up.\n"); return 1; } if (ob->query_attack()) { write("That person is already fighting "+ob->query_attack()->query_name()+".\n"); return 1; } this_player()->attack_object(ob); attacker_ob=ob; return 1; } hp() { write("hp: " + hit_point +"/"+ owner->query_max_hp() +" "); write("sp: "+owner->query_spell_points()+"/"+owner->query_max_sp()+"\n"); return 1; } score(arg) { string tmp; write("You are "+owner->short()+".\n"); write("You are currently in a simulated fight.\n"); write("Level: "+owner->query_level()); write(" Alignment: "+owner->query_al_title()+"\n"); write("Hit points: "+hit_point+"("+owner->query_max_hp()+") "); write("Spell points: "+owner->query_spell_points()+"("+owner->query_max_sp()+")\n"); write("\n"); write("Your stats are:\n"); write("Strength "+owner->query_str()+"/25 "); write("You have "+query_exp()+" experience points.\n"); write("Intelligence "+owner->query_int()+"/25 "); write("You belong to "+owner->guild_string()+" guild.\n"); write("Wisdom "+owner->query_wis()+"/25 "); write("You have "+owner->query_savings()+" coins in the bank.\n"); write("Dexterity "+owner->query_dex()+"/25 "); write("You are carrying "+owner->query_money()+" coins.\n"); write("Constitution "+owner->query_con()+"/25 "); write("You have "+owner->query_quest_points()+" quest points.\n"); if (owner->query_level_drained()) write("\nYou have been level drained "+owner->query_level_drained() +" times.\n"); write("\nYour level in lesser magic is "+owner->query_lesser_magic()+".\n"); return 1; } dest_me() { destruct(this_object()); return 1; }