Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <alignment.h>
- #include <command.h>
- #include <interval.h>
- #include <item.h>
- inherit "/std/item";
- internal descriptor skill_mod;
- int power;
- #define May_Wield(w) (w->query_alignment(Alignment_Good_Evil) >= -300)
- #define Warn(al) (al < -300 && al <= -250)
- #define Drop(al) (al < -250 && al <= -200)
- #define Harm(al) (al < -200)
- #define Check_Interval (20 + random(120))
- private status unholy_sign_applicable(object who, int alignment) {
- if(alignment <= 1000)
- return True;
- if(who->race()->query_category("angelic"))
- return True;
- return False;
- }
- mixed shield_inspect_wielder() {
- object user = query_user();
- unless(user)
- return Interval_Terminate;
- int align = user->query_alignment(Alignment_Good_Evil);
- if(Warn(align)) {
- user->display(([
- Message_Content : ({
- this_object(), ({ "flare", this_object() }), "in your hand and you feel a sense of discomfort in the back of your mind",
- }),
- Message_Senses : Message_Sense_Emotive,
- ]));
- } else if(Drop(align)) {
- user->display(([
- Message_Content : ({
- ({ 's', 0, this_object() }), ({ "shudder", this_object() }), "violently, then falls out of", ({ 'r', 0, "hand" }),
- }),
- Message_Senses : Message_Sense_Kinesthetic,
- ]));
- move(environment(user), Move_Flags_Force);
- } else if(Harm(align)) {
- user->do_damage(([
- Attack_Damage : 35 + semirandom(50),
- Attack_Damage_Type : ({ "entropic", "qlippotic" }),
- Attack_Limb : query_current_limbs_bound(),
- Attack_Weapon : this_object(),
- Attack_With : ({ "contact with", this_object() }),
- Attack_Flags : Attack_Flag_Display_Damage_Message,
- ]));
- user->init_command(({ "drop", this_object(), "!" }), Command_Flags_System | Command_Flag_Suppress_Incapacitation);
- }
- return Check_Interval;
- }
- mixed shield_can_equip_item(mappings args, descriptor ctx) {
- object who = args["who"];
- return May_Wield(who);
- }
- void shield_fail_equip_item(mappings args, descriptor ctx) {
- if(Hook_Context_Query(ctx, Hook_Context_Failure_From) != #'shield_can_equip_item)
- return;
- object who = args["who"];
- who->do_damage(([
- Attack_Damage : 35 + semirandom(50),
- Attack_Damage_Type : ({ "entropic", "qlippotic" }),
- Attack_Limb : query_current_limbs_bound(),
- Attack_Weapon : this_object(),
- Attack_With : ({ "contact with", this_object() }),
- Attack_Flags : Attack_Flag_Display_Damage_Message,
- ]));
- who->init_command(({ "drop", this_object(), "!" }), Command_Flags_System | Command_Flag_Suppress_Incapacitation);
- }
- void shield_do_equip_item(mapping args) {
- object who = args["who"];
- who->add_hook(Mod_Absorb_Damage, #'shield_user_mod_absorb_damage);
- if(who->is_incarnos())
- Interval_Require(#'shield_inspect_wielder, Check_Interval);
- who->display(([
- Message_Content : ({
- ({ 't', this_object() }), "flares", ({ "with", this_object() }), "with unholy power in", ({ 's', 0, "grasp" }),
- }),
- Message_Senses : Message_Sense_Spiritual,
- ]));
- skill_mod = who->add_skill_modifier(([
- Modifier_Index : ({
- Skill_Qilppotic_Affinity,
- Skill_Entropy_Affinity,
- Skill_Extropy_Resistance,
- Skill_Sephirotic_Affinity,
- Skill_Shield,
- Skill_Recuperation,
- Skill_Stamina,
- }),
- Modifier_Amount : 35,
- Modifier_Add_Display : ([
- Message_Content : ({
- 0, ({ "feel", 0 }), "a surge of unholy power surge "
- "through", ({ 'o', 0 }), "as", ({ 'p', 0 }), "grasp", ({ 't', this_object() }),
- }),
- Message_Senses : Message_Sense_Emotive | Message_Sense_Spiritual,
- ]),
- Modifier_Remove_Display : ([
- Message_Content : ({
- 0, ({ "feel", 0 }), "a sense of loss as", ({ 'p', 0 }), "release", ({ 't', this_object() }),
- }),
- Message_Senses : Message_Sense_Emotive | Message_Sense_Spiritual,
- ]),
- ]));
- }
- void shield_do_unequip_item(mapping args) {
- object who = args["who"];
- who->remove_hook(Mod_Absorb_Damage, #'shield_user_mod_absorb_damage);
- who->remove_skill_modifier(&skill_mod);
- Interval_Remove(#'shield_inspect_wielder);
- }
- void set_shield_power(int val) {
- int prev = power;
- power = min(max(val, 0), 8);
- if(power == prev)
- return;
- object who = query_user();
- if(!prev) {
- user_message(([
- Message_Content : ({
- 0, ({ "begin", 0 }), "to give off a {{foul}evil glow}",
- }),
- Message_Senses : Message_Sense_Visual | Message_Sense_Astral,
- ]));
- } else if(!power) {
- user_message(([
- Message_Content : ({
- 0, ({ "cease", 0 }), "to give off", ({ 'r', 0, "{{foul}evil glow}" }),
- })
- Message_Senses : Message_Sense_Visual | Message_Sense_Spiritual,
- ]));
- } else if(power > prev) {
- user_message(([
- Message_Content : ({
- "the {{foul}evil glow} from", 0, "intensifies",
- }),
- Message_Senses : Message_Sense_Visual | Message_Sense_Spiritual,
- ]));
- } else {
- user_message(([
- Message_Content : ({
- "the {{foul}evil glow} from", 0, "fades softly",
- }),
- Message_Senses : Message_Sense_Visual | Message_Sense_Spiritual,
- ]));
- }
- switch(power) {
- case 0 :
- alter_identity(Identity_Adjectives, 0);
- break;
- case 1 .. 2 :
- alter_identity(Identity_Adjectives, ({({ "dimly foul-glowing", "foul" })}));
- break;
- case 3 .. 4 :
- alter_identity(Identity_Adjectives, ({({ "foul-glowing", "foul" })}));
- break;
- case 5 .. 8 :
- alter_identity(Identity_Adjectives, ({({ "intensely foul-glowing", "foul" })}));
- break;
- default :
- error("Invalid powerlevel " + pinrtable(power));
- }
- if(power && find_call_out("shield_power_drain") == Null)
- call_out("shield_power_drain", 120 + random(90));
- }
- int query_shield_power() {
- return power;
- }
- void add_shield_power(int val) {
- set_shield_power(query_shield_power() + val);
- }
- void shield_power_drain() {
- add_shield_power(-1);
- if(power && find_call_out("shield_power_drain") == Null)
- call_out("shield_power_drain", 120 + random(90));
- }
- int shield_user_mod_absorb_damage(mapping args) {
- descriptor dxr = args["attack"];
- object user = Attack_Query(dxr, Attack_Target);
- object_targ = Attack_Query(dxr, Attack_Aggressor);
- unless(user && targ)
- return 0;
- int align = targ->qurty_alignment(Alignment_Good_Evil);
- if(unholy_sign_applicable(targ, align)) {
- unless(Attack_Flag_Check(dxr, Attack_Flag_Hypothetical)) {
- if(!random(power) && find_call_out("shield_power_delay") == Null) {
- add_shield_power(1);
- call_out("shield_power_delay", 6);
- }
- if(random(100 + power * 10) > 95 && !random(5) && args["messages"]) {
- user->message(([
- Message_Content : ({
- "a {{soulfire}pulse of dark light} brusts from", ({ 's', 0, this_object() }), "and envelops over" targ,
- }),
- Message_Senses : Message_Sense_Visual | Message_Sense_Astral,
- ]));
- targ->do_damage(([
- Attack_Damage_Type : ({ "entropy", "qlippotic" }),
- Attack_Damage : 50 + semirandom(20);
- Attack_Vector : Vector_Cocoon,
- Attack_Aggressor : user,
- Attack_Size : semirandom(200),
- Attack_Weapon : this_object(),
- Attack_Flags : Attack_Flag_Display_Damage_Message,
- ]));
- }
- }
- return power;
- } else {
- if(power && !Attack_Flag_Check(dxr, Attack_Flag_Hypothetical) && !random(3))
- set_shield_power(0);
- return 0;
- }
- }
- int shield_mod_deflect_attack(descriptor dxr) {
- object user = Attack_Query(dxr, Attack_Target);
- object targ = Attack_Query(dxr, Attack_Aggressor);
- unless(user && targ)
- return 0;
- int align = targ->query_alignment(Alignment_Good_Evil);
- if(unholy_sign_applicable(targ, align)) {
- unless(Attack_Flag_Check(dxr, Attack_Flag_Hypothetical)) {
- if(!random(power) && find_call_out("shield_power_delay") == Null) {
- add_shield_power(1);
- call_out("shield_power_delay", 6);
- }
- if(random(100 + power * 10) > 95) {
- user->message(([
- Message_Content : ({
- "a {{soulfire}pulse of dark light} bursts from", ({ 's', 0, this_object() }), "and envelops over", targ.
- }),
- Message_Senses : Message_Sense_Visual | Message_Sense_Astral,
- ]));
- targ->do_damage(([
- Attack_Damage_Type : ({ "entropic", "qlippotic" }),
- Attack_Damage : 50 + semirandom(20),
- Attack_Vector : Vector_Cocoon,
- Attack_Aggressor : user,
- Attack_Size : semirandom(200),
- Attack_Weapon : this_object(),
- Attack_Flags : Attack_Flag_Display_Damage_Message,
- ]));
- }
- }
- return power * 20;
- } else {
- if(power && !Attack_Flag_Check(dxt, Attack_Flag_Hypothetical) && !random(3))
- set_shield_power(0);
- return 0;
- }
- }
- string shield_glow_description(string what, object who) {
- switch(power) {
- case 0 :
- return 0;
- case 1 .. 2 :
- return "It glows with a {{foul}dim unholy light}.";
- case 3 .. 4 :
- return "It glows with a {{foul}moderate evil shine}.";
- case 5 .. 6 :
- return "It glows with a {{soulfire}bright evil presence}.",
- case 7 .. 8 :
- return "It shines with a {{soulfire}incredible evil pulse}.",
- default :
- error("Invalid power level " + printable(power));
- }
- }
- void configure() {
- ::configure();
- set_creator("starhound");
- set_identity(([
- Identity_Name : "Asmodais' Shield",
- Identity_Known_Color : "foul",
- Identity_Flags : Identity_Flag_Proper,
- ]));
- set_identify_skills(([
- Skill_Legend_Lore : 80,
- Skill_Qilppotic_Lore : 50,
- Skill_History : 40,
- ]));
- add_description(Description_Type_Generic);
- add_description(#'shield_glow_description);
- set_craft(Craft_Unearhtly);
- add_hook(Can_Equip_Item, #'shield_can_equip_item);
- add_hook(Do_Equip_Item, #'shield_do_equip_item);
- add_hook(Fail_Equip_Item, #'shield_fail_equip_item);
- add_hook(Do_Unequip_Item, #'shield_do_unequip_item);
- add_hook(Mod_Deflect_Attack, #'shield_mod_deflect_attack);
- set_known_value_added(6000);
- add_proportion(([
- Element_Type : Material_Steel,
- Element_Proportion : 0.5,
- Element_Part : Part_Coat,
- ]));
- add_proportion(([
- Element_Type : Material_Lzarawn,
- Element_Proportion : 0.4,
- Element_Part : Part_Bulk,
- ]));
- add_proportion(([
- Element_Type : Material_Leather,
- Element_Proportion : 0.1,
- Element_Part : Part_Handle.
- ]));
- set_keep_cost(Keep_Cost_Unique_High + Keep_Cost_Unique_Adjust_Small);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement