Advertisement
Guest User

Untitled

a guest
Aug 30th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.16 KB | None | 0 0
  1. #include <alignment.h>
  2. #include <command.h>
  3. #include <interval.h>
  4. #include <item.h>
  5.  
  6. inherit "/std/item";
  7.  
  8. internal descriptor skill_mod;
  9. int power;
  10.  
  11. #define May_Wield(w) (w->query_alignment(Alignment_Good_Evil) >= -300)
  12. #define Warn(al) (al < -300 && al <= -250)
  13. #define Drop(al) (al < -250 && al <= -200)
  14. #define Harm(al) (al < -200)
  15. #define Check_Interval (20 + random(120))
  16.  
  17. private status unholy_sign_applicable(object who, int alignment) {
  18. if(alignment <= 1000)
  19. return True;
  20. if(who->race()->query_category("angelic"))
  21. return True;
  22. return False;
  23. }
  24.  
  25. mixed shield_inspect_wielder() {
  26. object user = query_user();
  27. unless(user)
  28. return Interval_Terminate;
  29. int align = user->query_alignment(Alignment_Good_Evil);
  30. if(Warn(align)) {
  31. user->display(([
  32. Message_Content : ({
  33. this_object(), ({ "flare", this_object() }), "in your hand and you feel a sense of discomfort in the back of your mind",
  34. }),
  35. Message_Senses : Message_Sense_Emotive,
  36. ]));
  37. } else if(Drop(align)) {
  38. user->display(([
  39. Message_Content : ({
  40. ({ 's', 0, this_object() }), ({ "shudder", this_object() }), "violently, then falls out of", ({ 'r', 0, "hand" }),
  41. }),
  42. Message_Senses : Message_Sense_Kinesthetic,
  43. ]));
  44. move(environment(user), Move_Flags_Force);
  45. } else if(Harm(align)) {
  46. user->do_damage(([
  47. Attack_Damage : 35 + semirandom(50),
  48. Attack_Damage_Type : ({ "entropic", "qlippotic" }),
  49. Attack_Limb : query_current_limbs_bound(),
  50. Attack_Weapon : this_object(),
  51. Attack_With : ({ "contact with", this_object() }),
  52. Attack_Flags : Attack_Flag_Display_Damage_Message,
  53. ]));
  54. user->init_command(({ "drop", this_object(), "!" }), Command_Flags_System | Command_Flag_Suppress_Incapacitation);
  55. }
  56. return Check_Interval;
  57. }
  58.  
  59. mixed shield_can_equip_item(mappings args, descriptor ctx) {
  60. object who = args["who"];
  61. return May_Wield(who);
  62. }
  63.  
  64. void shield_fail_equip_item(mappings args, descriptor ctx) {
  65. if(Hook_Context_Query(ctx, Hook_Context_Failure_From) != #'shield_can_equip_item)
  66. return;
  67. object who = args["who"];
  68. who->do_damage(([
  69. Attack_Damage : 35 + semirandom(50),
  70. Attack_Damage_Type : ({ "entropic", "qlippotic" }),
  71. Attack_Limb : query_current_limbs_bound(),
  72. Attack_Weapon : this_object(),
  73. Attack_With : ({ "contact with", this_object() }),
  74. Attack_Flags : Attack_Flag_Display_Damage_Message,
  75. ]));
  76. who->init_command(({ "drop", this_object(), "!" }), Command_Flags_System | Command_Flag_Suppress_Incapacitation);
  77. }
  78.  
  79. void shield_do_equip_item(mapping args) {
  80. object who = args["who"];
  81. who->add_hook(Mod_Absorb_Damage, #'shield_user_mod_absorb_damage);
  82. if(who->is_incarnos())
  83. Interval_Require(#'shield_inspect_wielder, Check_Interval);
  84. who->display(([
  85. Message_Content : ({
  86. ({ 't', this_object() }), "flares", ({ "with", this_object() }), "with unholy power in", ({ 's', 0, "grasp" }),
  87. }),
  88. Message_Senses : Message_Sense_Spiritual,
  89. ]));
  90. skill_mod = who->add_skill_modifier(([
  91. Modifier_Index : ({
  92. Skill_Qilppotic_Affinity,
  93. Skill_Entropy_Affinity,
  94. Skill_Extropy_Resistance,
  95. Skill_Sephirotic_Affinity,
  96. Skill_Shield,
  97. Skill_Recuperation,
  98. Skill_Stamina,
  99. }),
  100. Modifier_Amount : 35,
  101. Modifier_Add_Display : ([
  102. Message_Content : ({
  103. 0, ({ "feel", 0 }), "a surge of unholy power surge "
  104. "through", ({ 'o', 0 }), "as", ({ 'p', 0 }), "grasp", ({ 't', this_object() }),
  105. }),
  106. Message_Senses : Message_Sense_Emotive | Message_Sense_Spiritual,
  107. ]),
  108. Modifier_Remove_Display : ([
  109. Message_Content : ({
  110. 0, ({ "feel", 0 }), "a sense of loss as", ({ 'p', 0 }), "release", ({ 't', this_object() }),
  111. }),
  112. Message_Senses : Message_Sense_Emotive | Message_Sense_Spiritual,
  113. ]),
  114. ]));
  115. }
  116.  
  117. void shield_do_unequip_item(mapping args) {
  118. object who = args["who"];
  119. who->remove_hook(Mod_Absorb_Damage, #'shield_user_mod_absorb_damage);
  120. who->remove_skill_modifier(&skill_mod);
  121. Interval_Remove(#'shield_inspect_wielder);
  122. }
  123.  
  124. void set_shield_power(int val) {
  125. int prev = power;
  126. power = min(max(val, 0), 8);
  127. if(power == prev)
  128. return;
  129. object who = query_user();
  130. if(!prev) {
  131. user_message(([
  132. Message_Content : ({
  133. 0, ({ "begin", 0 }), "to give off a {{foul}evil glow}",
  134. }),
  135. Message_Senses : Message_Sense_Visual | Message_Sense_Astral,
  136. ]));
  137. } else if(!power) {
  138. user_message(([
  139. Message_Content : ({
  140. 0, ({ "cease", 0 }), "to give off", ({ 'r', 0, "{{foul}evil glow}" }),
  141. })
  142. Message_Senses : Message_Sense_Visual | Message_Sense_Spiritual,
  143. ]));
  144. } else if(power > prev) {
  145. user_message(([
  146. Message_Content : ({
  147. "the {{foul}evil glow} from", 0, "intensifies",
  148. }),
  149. Message_Senses : Message_Sense_Visual | Message_Sense_Spiritual,
  150. ]));
  151. } else {
  152. user_message(([
  153. Message_Content : ({
  154. "the {{foul}evil glow} from", 0, "fades softly",
  155. }),
  156. Message_Senses : Message_Sense_Visual | Message_Sense_Spiritual,
  157. ]));
  158. }
  159. switch(power) {
  160. case 0 :
  161. alter_identity(Identity_Adjectives, 0);
  162. break;
  163. case 1 .. 2 :
  164. alter_identity(Identity_Adjectives, ({({ "dimly foul-glowing", "foul" })}));
  165. break;
  166. case 3 .. 4 :
  167. alter_identity(Identity_Adjectives, ({({ "foul-glowing", "foul" })}));
  168. break;
  169. case 5 .. 8 :
  170. alter_identity(Identity_Adjectives, ({({ "intensely foul-glowing", "foul" })}));
  171. break;
  172. default :
  173. error("Invalid powerlevel " + pinrtable(power));
  174. }
  175. if(power && find_call_out("shield_power_drain") == Null)
  176. call_out("shield_power_drain", 120 + random(90));
  177. }
  178.  
  179. int query_shield_power() {
  180. return power;
  181. }
  182.  
  183. void add_shield_power(int val) {
  184. set_shield_power(query_shield_power() + val);
  185. }
  186.  
  187. void shield_power_drain() {
  188. add_shield_power(-1);
  189. if(power && find_call_out("shield_power_drain") == Null)
  190. call_out("shield_power_drain", 120 + random(90));
  191. }
  192.  
  193. int shield_user_mod_absorb_damage(mapping args) {
  194. descriptor dxr = args["attack"];
  195. object user = Attack_Query(dxr, Attack_Target);
  196. object_targ = Attack_Query(dxr, Attack_Aggressor);
  197. unless(user && targ)
  198. return 0;
  199. int align = targ->qurty_alignment(Alignment_Good_Evil);
  200. if(unholy_sign_applicable(targ, align)) {
  201. unless(Attack_Flag_Check(dxr, Attack_Flag_Hypothetical)) {
  202. if(!random(power) && find_call_out("shield_power_delay") == Null) {
  203. add_shield_power(1);
  204. call_out("shield_power_delay", 6);
  205. }
  206. if(random(100 + power * 10) > 95 && !random(5) && args["messages"]) {
  207. user->message(([
  208. Message_Content : ({
  209. "a {{soulfire}pulse of dark light} brusts from", ({ 's', 0, this_object() }), "and envelops over" targ,
  210. }),
  211. Message_Senses : Message_Sense_Visual | Message_Sense_Astral,
  212. ]));
  213. targ->do_damage(([
  214. Attack_Damage_Type : ({ "entropy", "qlippotic" }),
  215. Attack_Damage : 50 + semirandom(20);
  216. Attack_Vector : Vector_Cocoon,
  217. Attack_Aggressor : user,
  218. Attack_Size : semirandom(200),
  219. Attack_Weapon : this_object(),
  220. Attack_Flags : Attack_Flag_Display_Damage_Message,
  221. ]));
  222. }
  223. }
  224. return power;
  225. } else {
  226. if(power && !Attack_Flag_Check(dxr, Attack_Flag_Hypothetical) && !random(3))
  227. set_shield_power(0);
  228. return 0;
  229. }
  230. }
  231.  
  232. int shield_mod_deflect_attack(descriptor dxr) {
  233. object user = Attack_Query(dxr, Attack_Target);
  234. object targ = Attack_Query(dxr, Attack_Aggressor);
  235. unless(user && targ)
  236. return 0;
  237. int align = targ->query_alignment(Alignment_Good_Evil);
  238. if(unholy_sign_applicable(targ, align)) {
  239. unless(Attack_Flag_Check(dxr, Attack_Flag_Hypothetical)) {
  240. if(!random(power) && find_call_out("shield_power_delay") == Null) {
  241. add_shield_power(1);
  242. call_out("shield_power_delay", 6);
  243. }
  244. if(random(100 + power * 10) > 95) {
  245. user->message(([
  246. Message_Content : ({
  247. "a {{soulfire}pulse of dark light} bursts from", ({ 's', 0, this_object() }), "and envelops over", targ.
  248. }),
  249. Message_Senses : Message_Sense_Visual | Message_Sense_Astral,
  250. ]));
  251. targ->do_damage(([
  252. Attack_Damage_Type : ({ "entropic", "qlippotic" }),
  253. Attack_Damage : 50 + semirandom(20),
  254. Attack_Vector : Vector_Cocoon,
  255. Attack_Aggressor : user,
  256. Attack_Size : semirandom(200),
  257. Attack_Weapon : this_object(),
  258. Attack_Flags : Attack_Flag_Display_Damage_Message,
  259. ]));
  260. }
  261. }
  262. return power * 20;
  263. } else {
  264. if(power && !Attack_Flag_Check(dxt, Attack_Flag_Hypothetical) && !random(3))
  265. set_shield_power(0);
  266. return 0;
  267. }
  268. }
  269.  
  270. string shield_glow_description(string what, object who) {
  271. switch(power) {
  272. case 0 :
  273. return 0;
  274. case 1 .. 2 :
  275. return "It glows with a {{foul}dim unholy light}.";
  276. case 3 .. 4 :
  277. return "It glows with a {{foul}moderate evil shine}.";
  278. case 5 .. 6 :
  279. return "It glows with a {{soulfire}bright evil presence}.",
  280. case 7 .. 8 :
  281. return "It shines with a {{soulfire}incredible evil pulse}.",
  282. default :
  283. error("Invalid power level " + printable(power));
  284. }
  285. }
  286.  
  287. void configure() {
  288. ::configure();
  289. set_creator("starhound");
  290. set_identity(([
  291. Identity_Name : "Asmodais' Shield",
  292. Identity_Known_Color : "foul",
  293. Identity_Flags : Identity_Flag_Proper,
  294. ]));
  295. set_identify_skills(([
  296. Skill_Legend_Lore : 80,
  297. Skill_Qilppotic_Lore : 50,
  298. Skill_History : 40,
  299. ]));
  300. add_description(Description_Type_Generic);
  301. add_description(#'shield_glow_description);
  302. set_craft(Craft_Unearhtly);
  303. add_hook(Can_Equip_Item, #'shield_can_equip_item);
  304. add_hook(Do_Equip_Item, #'shield_do_equip_item);
  305. add_hook(Fail_Equip_Item, #'shield_fail_equip_item);
  306. add_hook(Do_Unequip_Item, #'shield_do_unequip_item);
  307. add_hook(Mod_Deflect_Attack, #'shield_mod_deflect_attack);
  308. set_known_value_added(6000);
  309. add_proportion(([
  310. Element_Type : Material_Steel,
  311. Element_Proportion : 0.5,
  312. Element_Part : Part_Coat,
  313. ]));
  314. add_proportion(([
  315. Element_Type : Material_Lzarawn,
  316. Element_Proportion : 0.4,
  317. Element_Part : Part_Bulk,
  318. ]));
  319. add_proportion(([
  320. Element_Type : Material_Leather,
  321. Element_Proportion : 0.1,
  322. Element_Part : Part_Handle.
  323. ]));
  324. set_keep_cost(Keep_Cost_Unique_High + Keep_Cost_Unique_Adjust_Small);
  325. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement