generic weapon #109

Parent #108Owner #36Flags read, fertileSource QuestCore.db

Aliases: generic weapon, weapon

12 verbs · 38 properties · 3 children

Verbs

VerbSpecFlagsDefinerLines
valuethis none thisrxd#1091
d*rop th*rowthis none nonerxd#1094
titlethis none thisrxd#1095
load reloadthis none nonerd#10924
find_ammothis none thisrxd#1097
unwieldthis none nonerd#1095
_unwieldthis none thisrxd#1097
do_shootthis none thisrxd#10925
fire shootany any anyrxd#10921
movetothis none thisrxd#1095
init_for_corethis none thisrxd#10934
look_selfthis none thisrxd#10914

Properties

PropertyDefinerFlagsOwnerValue
weapon#109r#361
shoots#109r#360
can_stun#109r#361
can_paralyse#109r#360
usage_verbage#109rc#36" %<swings> %d at "
shoot_verbage#109rc#36" %<fires> %d at "
projectile_dam#109r#362.0
ammo_type#109rc#36#-1
max_load#109rc#360
help_msg#109rc#36{"You may 'wield' a weapon to equip it."}
dig_level#109rc#360
learn#109rc#36{}
enchant_level#109rc#360
returning#108rc#36<clear>
how_long#108rc#36<clear>
been_told#108rc#36<clear>
home#108rc#36<clear>
child_limit#108rc#3640
recycle_at_death#108rc#36<clear>
drop_failed_msg#5rc#36<clear>
drop_succeeded_msg#5rc#36<clear>
odrop_failed_msg#5rc#36<clear>
odrop_succeeded_msg#5rc#36<clear>
otake_succeeded_msg#5rc#36<clear>
otake_failed_msg#5rc#36<clear>
take_succeeded_msg#5rc#36<clear>
take_failed_msg#5rc#36<clear>
value_base#102r#2<clear>
damage_base#102r#21.0
x_loc#102r#36<clear>
y_loc#102r#36<clear>
ansi_title#102r#36<clear>
obvious#102r#36<clear>
build_help#102rc#36
list of 25{"PROPERTIES", "==========", "MUST BE SET BY A WIZARD (sorry, no twinkers):", "weapon - 1 or 0", "shoots - 1 or 0", "can_stun - 1 or 0", "can_paralyse - 1 or 0", "damage_base - is defined on $subthing", "projectile_dam - set here and not on the ammo. default = 2.0", "value_base - The weapon value is calculated by the :value() verb,", " and is based on the features of the weapon. If you", " feel the weapon cost is too steep or cheap, ask a", " wizard to change this prop accordingly.", "==========", "@SET BY OWNER:", "usage_verbage - for non-projectile use. default = \" %<swings> %d at \"", "shoot_verbage - if it shoots. default = \" %<swings> %d at \"", "ammo_type - parent object of the projectile ammunition", "max_load - how many ammo rounds it will hold. default = 0", "help_msg - for the player", "dig_level: 0 => teeth, most weapons", " 1 => hands", " 2 => claws, daggers", " 3 => shovels, swords", " 4 => picks, axes"}
key#1c#360
aliases#1rc#36{"generic weapon", "weapon"}
description#1rc#36"When employed properly, an object that can create more damage than standard objects."
object_size#1r#36{10679, -1090650497}

Ancestry

Ancestors (nearest first): #108 generic replicating & returning thing#5 generic thing#102 subthing#1 Root Class

Children: #182 hand, #183 claw, #184 teeth

Call graph

calls n109_1 #109:d*rop n52_0 #52:has_property n109_1->n52_0 n5_1 #5:dr*op n109_1->n5_1 n109_3 #109:load n6_18 #6:tell n109_3->n6_18 n27_0 #27:union n109_3->n27_0 n109_4 #109:find_ammo n109_3->n109_4 n35_1 #35:say_action n109_3->n35_1 n109_2 #109:title n109_3->n109_2 n109_5 #109:unwield n109_5->n35_1 n109_5->n109_2 n109_6 #109:_unwield n109_5->n109_6 n6_10 #6:notify n109_5->n6_10 n52_3 #52:has_callable_verb n109_6->n52_3 n109_7 #109:do_shoot n109_7->n6_18 n1_4 #1:titlec n109_7->n1_4 n52_5 #52:isa n109_7->n52_5 n52_2 #52:has_verb n109_7->n52_2 n109_8 #109:fire n109_8->n52_0 n109_8->n6_18 n109_8->n6_10 n109_8->n109_7 n109_9 #109:moveto n109_9->n109_6 n1_17 #1:is_unlocked_for n109_9->n1_17 n5_2 #5:moveto n109_9->n5_2 n109_10 #109:init_for_core n108_4 #108:init_for_core n109_10->n108_4 n109_11 #109:look_self n109_11->n6_18 n1_9 #1:description n109_11->n1_9 n6_79 #6:tell_lines n109_11->n6_79

Source

value

Spec this none thisFlags rxdOwner #2Definer #109

Referenced by

none

Source

1return tofloat(this.value_base);

d*rop th*row

Spec this none noneFlags rxdOwner #2Definer #109

Referenced by

none

Source

1if ($object_utils:has_property(player, "wielded"))
2player.wielded = (player.wielded == this) ? $hand | player.wielded;
3endif
4pass(@args);

title

Spec this none thisFlags rxdOwner #2Definer #109

Referenced by

Source

1if (this.enchant_level > 0)
2return tostr("[purple]Enchanted ", this.name, " [+", tostr(this.enchant_level), "][normal]");
3else
4return this.name;
5endif

load reload

Spec this none noneFlags rdOwner #2Definer #109

Referenced by

none

Source

1"NEEDS WIZ PERMS";
2if (`player.stats_current[2][3] < 4.5 ! E_PROPNF => 1')
3return player:tell("You don't understand how load it.");
4endif
5ammopool = $set_utils:union(player.contents, player.location:contents());
6ammopool = $set_utils:union(player.contents, player.location:contents());
7found = 0;
8ammo = this:find_ammo(ammopool);
9if (valid(ammo))
10n = this.max_load - this.shoots;
11if (n)
12for z in [1..n]
13if (ammo.rounds > 0)
14this.shoots = this.shoots + 1;
15ammo.rounds = ammo.rounds - 1;
16endif
17endfor
18$you:say_action("%N %<loads> %d.");
19else
20player:tell("Already loaded.");
21endif
22else
23player:tell("You can't find anything that will load into ", this:title(), ".");
24endif

find_ammo

Spec this none thisFlags rxdOwner #2Definer #109

Referenced by

Source

1"USAGE: find_ammo(LIST of OBJs) => first matching object found or $nothing";
2for x in (args[1])
3if (parent(x) == this.ammo_type)
4return x;
5endif
6endfor
7return $nothing;

unwield

Spec this none noneFlags rdOwner #2Definer #109

Referenced by

none

Source

1if (this:_unwield())
2$you:say_action(tostr("%N %<puts> away ", this:title(), "."));
3else
4player:notify("You're not wielding that.");
5endif

_unwield

Spec this none thisFlags rxdOwner #2Definer #109

Referenced by

Source

1if ($object_utils:has_callable_verb(this.location, "_wield"))
2if (this.location.wielded == this)
3this.location:_wield($hand);
4return 1;
5endif
6endif
7return 0;

do_shoot

Spec this none thisFlags rxdOwner #2Definer #109

Referenced by

Source

1"do attack, stun if this.can_stun, subtract 1 from this.shoots";
2this.shoots = (this.shoots < 1) ? 0 | this.shoots;
3if (!this.shoots)
4return player.location:announce_all("*Click* ", this:titlec(), " is empty.");
5endif
6victim = player.location:match(args[1]);
7fork (7)
8if (valid(victim) && `victim.alive ! E_PROPNF => 0')
9if ($object_utils:isa(player.location, $terrain))
10shot = player.location:match_loc(player, victim) ? 1 | 0;
11else
12shot = (victim in player.location:contents()) ? 1 | 0;
13endif
14this.shoots = shot ? this.shoots - 1 | this.shoots;
15endif
16endfork
17x = (this.can_stun || this.can_paralyse) ? 1 | 0;
18if ($object_utils:has_verb(player.location, "queue_attack"))
19if (player == victim)
20return player.location:mooicide();
21endif
22player.location:queue_attack(player.name, args[1], player:damage(), x);
23else
24player:tell("This is a non-combat area.");
25endif

fire shoot

Spec any any anyFlags rxdOwner #2Definer #109

Referenced by

none

Source

1if (prepstr == "at")
2dobj = iobj;
3dobjstr = iobjstr;
4endif
5if ($object_utils:has_property(player, "wielded") && this.shoots)
6player.wielded = this;
7if (valid(dobj))
8melee = `player.location:valid_attack(player.name, dobjstr) ! E_VERBNF => 0';
9if (melee)
10if (player.location.sanctuary)
11return player.location:attack_bypass(verb, @args);
12elseif (!melee[1])
13if (!`melee[3].alive ! E_PROPNF')
14return player:tell("You cannot fight ", dobjstr, ".");
15endif
16endif
17return this:do_shoot(dobjstr);
18endif
19endif
20endif
21player:notify("You can't shoot that.");

moveto

Spec this none thisFlags rxdOwner #2Definer #109

Referenced by

none

Source

1where = args[1];
2if ((this:is_unlocked_for(where) && where:acceptable(this)) && (this.location != where))
3this:_unwield();
4pass(where);
5endif

init_for_core

Spec this none thisFlags rxdOwner #2Definer #109

Referenced by

none

Source

1if (caller_perms().wizard)
2if (this == $weapon)
3this.weapon = 1;
4this.shoots = 0;
5this.can_stun = 1;
6this.can_paralyse = 0;
7this.usage_verbage = " %<swings> %d at ";
8this.shoot_verbage = " %<fires> %d at ";
9this.projectile_dam = 2.0;
10this.ammo_type = $nothing;
11this.max_load = 0;
12this.damage_base = 1.0;
13this.dig_level = 0;
14else
15for p in (properties($weapon))
16clear_property(this, p);
17endfor
18endif
19if (this == $teeth)
20this.damage_base = 0.55;
21this.can_stun = 0;
22this.usage_verbage = " %<snaps> at ";
23elseif (this == $claw)
24this.damage_base = 0.55;
25this.can_stun = 0;
26this.usage_verbage = " %<claws> at ";
27this.dig_level = 2;
28elseif (this == $hand)
29this.damage_base = 0.5;
30this.usage_verbage = " %<swings> at ";
31this.dig_level = 1;
32endif
33return pass(@args);
34endif

look_self

Spec this none thisFlags rxdOwner #2Definer #109

Referenced by

none

Source

1desc = this:description();
2if (desc)
3player:tell_lines(desc);
4if (this.enchant_level)
5player:tell("");
6player:tell("Enchantment Level ", tostr(this.enchant_level));
7endif
8else
9player:tell("You see nothing special.");
10if (this.enchant_level)
11player:tell("");
12player:tell("Enchantment Level ", tostr(this.enchant_level));
13endif
14endif