Advertisement
ThoraldGM

Sword of Omens (Mystic MUD 1999)

Oct 18th, 2017
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 7.85 KB | None | 0 0
  1.          
  2.  
  3. #include <class.h>
  4. #include <combat.h>
  5. #include <ansi.h>
  6.  
  7. inherit "obj/weapon";
  8.  
  9. #define TPS this_player()->query_possessive()
  10. #define TPN this_player()->query_name()
  11.  
  12. object tpqa;
  13. object xxxx;
  14. object blah;
  15. object checktarget;
  16.  
  17. string sighttarget;
  18. string temp;
  19. string clanname;
  20.  
  21. void init() {
  22.  
  23.   weapon::init();
  24.   if(environment(this_object())==this_player()) {
  25.   add_action("_store","store");
  26.   add_action("_summon","summon");
  27.   add_action("_sight","sight");
  28.  }
  29. }
  30.  
  31.  
  32. create() {
  33.   ::create();
  34.   seteuid("torvald");
  35.   set_id(({ "Sword of Omens", "sword of omens", "sword" }));
  36.   set_short("Sword of Omens");
  37.   set_long("The Sword of Omens has a spiraled metal hilt with a wickedly\n"+
  38.            "curved hand guard. At the base of its long blade rests a ruby\n"+
  39.            "cats eye gem that allows you to summon help or sight <player>.\n");
  40.   set_weight(6);
  41.   set_class(20);
  42.   set_value(15000);
  43.   set_two_handed(1);
  44.   set_type(PARRY);
  45.   set_no_dull(1);
  46.   set("magic", 1);
  47.   set_hit_func(this_object());
  48.   set_wield_func(this_object());
  49.   set_bonus_func(this_object());
  50. }
  51.  
  52. int check_bonus(object attacker) {
  53.   return (random(26));
  54. }
  55.  
  56. weapon_hit(object attacker_ob) {
  57.   int dam;
  58.   tpqa = this_player()->query_attack();
  59.   xxxx = tpqa->query_name();
  60.   dam = random(26);
  61.  
  62.   if (dam < 10) {
  63.     tell_object(environment(this_object()),
  64. "%^RED%^Your sword engulfs "+xxxx+" in a blinding crimson light.%^RESET%^\n");
  65. tell_object(attacker_ob,"%^RED%^"+TPN+"'s sword engulfs you in a blinding crimson light.%^RESET%^\n");
  66.   tell_room(environment(environment(this_object())),environment(this_object())->query_name()+"'s sword engulfs "+xxxx+" in a blinding crimson light.\n",   ({environment(this_object()),attacker_ob}));
  67.     }
  68.  
  69.   else if (dam < 20) {
  70.     tell_object(environment(this_object()),
  71. "%^RED%^You parry "+xxxx+"'s attack with a flurry of clanging blows.%^RESET%^\n");
  72. tell_object(attacker_ob,"%^RED%^"+TPN+" parries your attack with a flurry of clanging blows.%^RESET%^\n");
  73.   tell_room(environment(environment(this_object())),environment(this_object())->query_name()+" parries "+xxxx+"'s attack with a flurry of clanging blows.\n",   ({environment(this_object()),attacker_ob}));
  74.     }
  75.  
  76.   else if (dam < 25) {
  77.     tell_object(environment(this_object()),
  78. "%^RED%^You thrust your sword deep into "+xxxx+" and twist the blade sharply!%^RESET%^\n");
  79. tell_object(attacker_ob,"%^RED%^"+TPN+" thrusts "+TPS+" sword deep into your side with a sharp twist!%^RESET%^\n");
  80.   tell_room(environment(environment(this_object())),environment(this_object())->query_name()+" thrusts "+TPS+" sword deep into "+xxxx+" with a sharp twist!\n",   ({environment(this_object()),attacker_ob}));
  81.    }
  82. }
  83.  
  84. query_save_item()
  85. {
  86.   return 0;
  87. }
  88.  
  89. int dest_when_sold() {
  90.   return 1;
  91. }
  92.  
  93. wield_func() {
  94.  int lvlcheck;
  95.  int flag;
  96.  flag= 0;
  97.  lvlcheck=(int)this_player()->query_level();
  98.  
  99.  
  100.  
  101. // NOT USING SET_CLASSES_ALLOWED HERE BECAUSE I WANT THE DAMAGE EFFECT
  102. // WHEN OTHER CLASSES TRY TO WIELD THE SWORD- Torvald 09 June 2000
  103.  
  104.  
  105.  
  106. if ((member_array(this_player()->query_class(),({ FIGHTER,PALADIN,KNIGHT })) >= 0) && (lvlcheck > 19)) {
  107.  tell_object(this_player(),
  108. "%^RED%^You grasp the Sword of Omens and it extends to its full length.%^RESET%^\n");
  109.         flag=0;
  110.         return 1;
  111.       }
  112.  
  113. else {
  114. if(member_array(this_player()->query_class(),({ FIGHTER,PALADIN,KNIGHT })) < 0) {
  115. tell_object(environment(this_object()),"You are not a master of the sword!\n");
  116. flag= 1;
  117.   }
  118.  
  119. if (lvlcheck < 20) {
  120. tell_object(environment(this_object()),"You are too inexperienced to handle this powerful weapon.\n");
  121. flag= 1;
  122.   }
  123.  
  124. if (flag) {
  125. tell_object(environment(this_object()),"%^YELLOW%^%^BOLD%^The Eye of Thundera glows red hot and burns your hand!%^RESET%^\n");
  126.   tell_room(environment(environment(this_object())),
  127. environment(this_object())->query_name()+" tries to grasp "+TPS+" sword but the hilt glows red hot!\n",   ({environment(this_object())}));
  128. environment(this_object())->reduce_hit_point(20);
  129. }
  130.  
  131. // Discreetly trying to eliminate the What? msg while keeping the ansi in if(flag)- Torvald 26 Mar 00
  132.   notify_fail(" \n");
  133.   return 0;
  134.    }
  135. }
  136.  
  137.  
  138. // CODE BELOW WRITTEN BY TORVALD ON 20 NOV 1999
  139. // PREVENTS STORING OF ITEM IN ALL CLAN HALLS, GUILDS, NIRVANA, & INN ROOMS
  140. // GREAT FOR KEEPING THOSE BOOT ITEMS EXPOSED & VULNERABLE
  141.  
  142.  
  143.  
  144. int _store(string str) {
  145.   if((str && (str=="sword" || str=="sword of omens" || str=="Sword of Omens")) && present("locker",environment(environment(this_object())))) {
  146.  environment(this_object())->force_us("drop Sword of Omens");
  147.    return 1;
  148. }
  149.     else notify_fail("What?\n");
  150.     return 0;
  151.   }
  152.  
  153.  
  154. int drop() {
  155.     temp = explode(file_name(environment(this_player())), "/");
  156.     if ((temp[2] == "inn" || temp[2] == "Daemon" || temp[2] == "nirvana" || temp[1] == "clans" || temp[2] == "store" || temp[2] == "storage" || temp[2] == "armory" || temp[2] == "backroom" || temp[2] == "rooms")) {
  157.   notify_fail(
  158. "This weapon cannot enforce justice when locked away in storage.\n"+
  159. "The sword evaporates into the ground in a puddle of molten metal!\n");
  160.   call_out("remove", 0);
  161.  
  162.   tell_room(environment(environment(this_object())),
  163. environment(this_object())->query_name()+" tries to store "+TPS+" sword here but fails.\n",   ({environment(this_object())}));
  164.   tell_room(environment(environment(this_object())),
  165. environment(this_object())->query_name()+"'s sword suddenly evaporates in a puddle of molten metal!\n",   ({environment(this_object())}));
  166.   return 2;
  167. }
  168.   else weapon::un_wield(this_object());
  169.   return 0;
  170. }
  171.  
  172.  
  173. int _summon(string str) {
  174. clanname = "/clan/obj/clan_daemon"->query_clan(""+this_player()->query_real_name()+"");
  175.   if(str && (str=="help")) {
  176. write("You thrust the Sword of Omens above your head.\n");
  177. say(TPN+" thrusts the Sword of Omens above "+TPS+" head.\n");
  178. this_player()->force_us("say thunder, thunder, THUNDER, THUNDERCATS... HO!\n");
  179. tell_room(environment(environment(this_object())),"%^RED%^A crimson beacon bursts forth from the Eye of the sword and pierces the sky.%^RESET%^\n");
  180. if(present("headband",this_player())) {
  181.    tell_object(filter(map("/clan/obj/clan_daemon"->query_clan_data()[""+clanname+""]["members"],(: find_player :)),(: $1 :)),"%^RED%^You see a beacon of crimson light pierce the sky!%^RESET%^\n",   ({environment(this_object())}));
  182.    tell_object(filter(map("/clan/obj/clan_daemon"->query_clan_data()[""+clanname+""]["members"],(: find_player :)),(: $1 :)),TPN+" needs help at "+environment(this_player())->query_short()+"!\n",   ({environment(this_object())}));
  183.    write("You summon the aid of your clan members.\n");
  184.    }
  185.  
  186. if(!present("headband",this_player())) {
  187.    write("You are not in a clan so your efforts to summon help are futile.\n");
  188.    }
  189.  
  190.    return 1;
  191. }
  192.     else notify_fail("What?\n");
  193.     return 0;
  194.   }
  195.  
  196.  
  197.  
  198. int _sight(string str) {
  199.  
  200.   if(!str) {
  201.     notify_fail("Syntax: sight <player>.\n");
  202.     return 0;
  203.    }
  204.  
  205. write("You raise the Sword of Omens and gaze into the Eye of Thundera.\n");
  206. say(TPN+" raises the Sword of Omens and gazes into the Eye of Thundera.\n");
  207. this_player()->force_us("say Sword of Omens, give me sight beyond sight!\n");
  208. tell_room(environment(environment(this_object())),"%^RED%^The ruby eye on the sword opens with a crimson light.%^RESET%^\n");
  209.  
  210.  
  211.   if(!find_player(""+lower_case(str)+"")) { call_out("do_close",3); notify_fail(" \n"); return 0; }
  212.  
  213.   if(wizardp(find_player(""+lower_case(str)+""))) {
  214.     call_out("do_obscure",3);
  215.     notify_fail(" \n");
  216.     return 0;
  217.    }
  218.  
  219.   sighttarget=str;
  220.   checktarget=find_living(""+sighttarget+"");
  221.   if(!checktarget) {
  222.     call_out("do_close",3);
  223.     notify_fail(" \n");
  224.     return 0;
  225.    }
  226.  
  227.   else tell_object(this_player(),"The Eye of Thundera reveals an image of "+capitalize(str)+" at "+environment(find_player(""+lower_case(str)+""))->query_short()+".\n");
  228.     return 1;
  229. }
  230.  
  231.  
  232. void do_close() {
  233.   tell_object(this_player(),"The Eye of Thundera shimmers briefly, then closes.\n");
  234.   return;
  235. }
  236.  
  237. void do_obscure() {
  238.   tell_object(this_player(),"The Eye of Thundera is obscured by powerful magic.\n");
  239.   return;
  240. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement