generic weapon #109
Aliases: generic weapon, weapon
12 verbs · 38 properties · 3 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
value | this none this | rxd | #109 | 1 |
d*rop th*row | this none none | rxd | #109 | 4 |
title | this none this | rxd | #109 | 5 |
load reload | this none none | rd | #109 | 24 |
find_ammo | this none this | rxd | #109 | 7 |
unwield | this none none | rd | #109 | 5 |
_unwield | this none this | rxd | #109 | 7 |
do_shoot | this none this | rxd | #109 | 25 |
fire shoot | any any any | rxd | #109 | 21 |
moveto | this none this | rxd | #109 | 5 |
init_for_core | this none this | rxd | #109 | 34 |
look_self | this none this | rxd | #109 | 14 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
weapon | #109 | r | #36 | 1 |
shoots | #109 | r | #36 | 0 |
can_stun | #109 | r | #36 | 1 |
can_paralyse | #109 | r | #36 | 0 |
usage_verbage | #109 | rc | #36 | " %<swings> %d at " |
shoot_verbage | #109 | rc | #36 | " %<fires> %d at " |
projectile_dam | #109 | r | #36 | 2.0 |
ammo_type | #109 | rc | #36 | #-1 |
max_load | #109 | rc | #36 | 0 |
help_msg | #109 | rc | #36 | {"You may 'wield' a weapon to equip it."} |
dig_level | #109 | rc | #36 | 0 |
learn | #109 | rc | #36 | {} |
enchant_level | #109 | rc | #36 | 0 |
returning | #108 | rc | #36 | <clear> |
how_long | #108 | rc | #36 | <clear> |
been_told | #108 | rc | #36 | <clear> |
home | #108 | rc | #36 | <clear> |
child_limit | #108 | rc | #36 | 40 |
recycle_at_death | #108 | rc | #36 | <clear> |
drop_failed_msg | #5 | rc | #36 | <clear> |
drop_succeeded_msg | #5 | rc | #36 | <clear> |
odrop_failed_msg | #5 | rc | #36 | <clear> |
odrop_succeeded_msg | #5 | rc | #36 | <clear> |
otake_succeeded_msg | #5 | rc | #36 | <clear> |
otake_failed_msg | #5 | rc | #36 | <clear> |
take_succeeded_msg | #5 | rc | #36 | <clear> |
take_failed_msg | #5 | rc | #36 | <clear> |
value_base | #102 | r | #2 | <clear> |
damage_base | #102 | r | #2 | 1.0 |
x_loc | #102 | r | #36 | <clear> |
y_loc | #102 | r | #36 | <clear> |
ansi_title | #102 | r | #36 | <clear> |
obvious | #102 | r | #36 | <clear> |
build_help | #102 | rc | #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 | #1 | c | #36 | 0 |
aliases | #1 | rc | #36 | {"generic weapon", "weapon"} |
description | #1 | rc | #36 | "When employed properly, an object that can create more damage than standard objects." |
object_size | #1 | r | #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
Source
value
Referenced by
none
Source
1return tofloat(this.value_base);
d*rop th*row
Referenced by
none
Source
1if ($object_utils:has_property(player, "wielded")) 2player.wielded = (player.wielded == this) ? $hand | player.wielded; 3endif 4pass(@args);
title
Referenced by
- #109:load line 23:
this:title - #109:unwield line 2:
this:title
Source
1if (this.enchant_level > 0) 2return tostr("[purple]Enchanted ", this.name, " [+", tostr(this.enchant_level), "][normal]"); 3else 4return this.name; 5endif
load reload
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
Referenced by
- #109:load line 8:
this:find_ammo
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
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
Referenced by
- #109:unwield line 1:
this:_unwield - #109:moveto line 3:
this:_unwield
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
Referenced by
- #109:fire line 17:
this:do_shoot
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
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
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
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
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