-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathItem.pm
More file actions
884 lines (667 loc) · 23.7 KB
/
Item.pm
File metadata and controls
884 lines (667 loc) · 23.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
package NetHack::Item;
use 5.008001;
use Moose -traits => 'NetHack::Item::Meta::Trait::InstallsSpoilers';
use NetHack::ItemPool;
use NetHack::Item::Meta::Trait::IncorporatesUndef;
use NetHack::Item::Meta::Types;
with 'NetHack::ItemPool::Role::HasPool';
has tracker => (
is => 'ro',
writer => '_set_tracker',
isa => 'NetHack::ItemPool::Tracker',
predicate => 'has_tracker',
);
has raw => (
is => 'ro',
isa => 'Str',
required => 1,
);
has identity => (
is => 'rw',
isa => 'Str',
predicate => 'has_identity',
);
has appearance => (
is => 'rw',
isa => 'Str',
predicate => 'has_appearance',
);
has artifact => (
is => 'rw',
isa => 'Str',
);
has slot => (
traits => [qw/IncorporatesUndef/],
is => 'rw',
isa => 'Maybe[Str]',
);
has quantity => (
is => 'rw',
isa => 'Int',
default => 1,
);
has cost_each => (
is => 'rw',
isa => 'Int',
default => 0,
);
has specific_name => (
is => 'rw',
isa => 'Str',
predicate => 'has_specific_name',
trigger => sub {
# recalculate whether this item is an artifact or not (e.g. Sting)
my $self = shift;
$self->pool->incorporate_artifact($self)
if $self->is_artifact && $self->has_pool;
},
);
has generic_name => (
is => 'rw',
isa => 'Str',
predicate => 'has_generic_name',
);
has container => (
is => 'rw',
isa => 'NetHack::Item',
clearer => 'clear_container',
predicate => 'is_in_container',
weak_ref => 1,
);
for my $type (qw/wield quiver grease offhand/) {
my $is = "is_$type";
unless ($type =~ /offhand/) {
$is .= 'e' unless $is =~ /e$/; # avoid "greaseed"
$is .= 'd';
}
has $is => (
traits => [qw/Bool IncorporatesUndef/],
is => 'rw',
isa => 'Bool',
default => 0,
handles => {
"$type" => 'set',
"un$type" => 'unset',
},
)
}
for my $buc (qw/is_blessed is_uncursed is_cursed/) {
my %others = map { $_ => 1 } qw/is_blessed is_uncursed is_cursed/;
delete $others{$buc};
my @others = keys %others;
has $buc => (
is => 'rw',
isa => 'Bool',
trigger => sub {
my $self = shift;
my $set = shift;
# if this is true, the others must be false
if ($set) {
$self->$_(0) for @others;
}
# if this is false, then see if only one can be true
elsif (defined($set)) {
my %other_vals = map { $_ => $self->$_ } @others;
my $unknown = 0;
for (values %other_vals) {
return if $_; # we already have a true value
++$unknown if !defined;
}
# multiple items are unknown, we can't narrow it down
return if $unknown > 1;
# if only one item is unknown, find it and set it to true
my @must_be_true = grep { !defined($other_vals{$_}) }
@others;
# no unknowns, we're good
return if @must_be_true == 0;
my ($must_be_true) = @must_be_true;
$self->$must_be_true(1);
}
},
);
}
sub is_holy { shift->is_blessed(@_) }
sub is_unholy { shift->is_cursed(@_) }
sub buc {
my $self = shift;
if (@_) {
my $new_buc = shift;
my $is_new_buc = "is_$new_buc";
return $self->$is_new_buc(1);
}
for my $buc (qw/blessed uncursed cursed/) {
my $is_buc = "is_$buc";
return $buc if $self->$is_buc;
}
return undef;
}
around BUILDARGS => sub {
my $orig = shift;
my $class = shift;
my $args;
if (@_ == 1 && !ref($_[0])) {
$args = { raw => $_[0] };
}
else {
$args = $orig->($class, @_);
}
if ($args->{buc}) {
$args->{"is_$args->{buc}"} = 1;
}
$args->{is_blessed} = delete $args->{is_holy}
if exists $args->{is_holy};
$args->{is_cursed} = delete $args->{is_unholy}
if exists $args->{is_unholy};
return $args;
};
sub BUILD {
my $self = shift;
my $args = shift;
$self->_rebless_into($args->{type}) if $args->{type};
$self->parse_raw;
}
sub choose_item_class {
my $self = shift;
my $type = shift;
my $subtype = shift;
my $class = "NetHack::Item::" . ucfirst lc $type;
$class .= '::' . ucfirst lc $subtype
if $subtype;
return $class;
}
sub spoiler_class {
my $self = shift;
my $type = shift;
$type ||= $self->type if $self->can('type');
my $class = $type
? "NetHack::Item::Spoiler::" . ucfirst lc $type
: "NetHack::Item::Spoiler";
Class::MOP::load_class($class);
return $class;
}
sub _rebless_into {
my $self = shift;
my $type = shift;
my $subtype = shift;
return if !blessed($self);
my $class = $self->choose_item_class($type, $subtype);
Class::MOP::load_class($class);
$class->meta->rebless_instance($self);
}
sub extract_stats {
my $self = shift;
my $raw = shift || $self->raw;
my %stats;
my @fields = qw/slot quantity buc greased poisoned erosion1 erosion2 proofed
used eaten diluted enchantment item generic specific
recharges charges candles lit_candelabrum lit laid chained
quivered offhand offhand_wielded wielded worn cost cost2 cost3/;
# the \b in front of "item name" forbids "Amulet of Yendor" being parsed as
# "A mulet of Yendor"
@stats{@fields} = $raw =~ m{
^ # anchor
(?:([\w\#\$])\s[+-]\s)? \s* # slot
([Aa]n?|[Tt]he|\d+)? \s* # quantity
(blessed|(?:un)?cursed|(?:un)?holy)? \s* # buc
(greased)? \s* # grease
(poisoned)? \s* # poison
((?:(?:very|thoroughly)\ )?(?:burnt|rusty))? \s* # erosion 1
((?:(?:very|thoroughly)\ )?(?:rotted|corroded))? \s* # erosion 2
(fixed|(?:fire|rust|corrode)proof)? \s* # proofed
(partly\ used)? \s* # candles
(partly\ eaten)? \s* # food
(diluted)? \s* # potions
([+-]\d+)? \s* # enchantment
(?:(?:pair|set)\ of)? \s* # gloves boots
\b(.*?) \s* # item name
(?:called\ (.*?))? \s* # generic name
(?:named\ (.*?))? \s* # specific name
(?:\((\d+):(-?\d+)\))? \s* # charges
(?:\((no|[1-7])\ candles?(,\ lit|\ attached)\))? \s* # candelabrum
(\(lit\))? \s* # lit
(\(laid\ by\ you\))? \s* # eggs
(\(chained\ to\ you\))? \s* # iron balls
(\(in\ quiver\))? \s* # quivered
(\(alternate\ weapon;\ not\ wielded\))? \s* # offhand
(\(wielded\ in\ other.*?\))? \s* # offhand wield
(\((?:weapon|wielded).*?\))? \s* # wielding
(\((?:being|embedded|on).*?\))? \s* # worn
# shop cost! there are multiple forms, with an optional quality comment
(?:
\( unpaid, \ (\d+) \ zorkmids? \)
|
\( (\d+) \ zorkmids? \)
|
,\ no\ charge (?:,\ .*)?
|
,\ (?:price\ )? (\d+) \ zorkmids (\ each)? (?:,\ .*)?
)? \s*
$ # anchor
}x;
confess "Couldn't parse $raw"
unless defined($stats{item}) && length($stats{item});
# this canonicalization must come early
if ($stats{item} =~ /^potions? of ((?:un)?holy) water$/) {
$stats{item} = 'potion of water';
$stats{buc} = $1;
}
# go from japanese to english if possible
my $spoiler = $self->spoiler_class;
$stats{item} = $spoiler->japanese_to_english->{$stats{item}}
|| $stats{item};
# singularize the item if possible
$stats{item} = $spoiler->singularize($stats{item})
|| $stats{item};
$stats{type} = $spoiler->name_to_type($stats{item});
if ($self->has_pool && ($stats{item} eq $self->pool->fruit_name || $stats{item} eq $self->pool->fruit_plural)) {
$stats{item} = $self->pool->fruit_name; # singularize
$stats{type} = 'food';
}
elsif ($self->has_pool && $self->pool->allow_other_fruit_names) {
$stats{type} = 'food';
}
confess "Unknown item type for '$stats{item}' from $raw"
if !$stats{type};
# canonicalize the rest of the stats
$stats{quantity} = 1 if !defined($stats{quantity})
|| $stats{quantity} =~ /\D/;
$stats{lit_candelabrum} = ($stats{lit_candelabrum}||'') =~ /lit/;
$stats{lit} = delete($stats{lit_candelabrum}) || $stats{lit};
$stats{candles} = 0 if ($stats{candles}||'') eq 'no';
$stats{worn} = !defined($stats{worn}) ? 0
: $stats{worn} =~ /\(on (left|right) / ? $1
: 1;
# item damage
for (qw/burnt rusty rotted corroded/) {
my $match = ($stats{erosion1}||'') =~ $_ ? $stats{erosion1}
: ($stats{erosion2}||'') =~ $_ ? $stats{erosion2}
: 0;
$stats{$_} = $match ? $match =~ /thoroughly/ ? 3
: $match =~ /very/ ? 2
: 1
: 0;
}
delete @stats{qw/erosion1 erosion2/};
# boolean stats
for (qw/greased poisoned used eaten diluted lit laid chained quivered offhand offhand_wielded wielded/) {
$stats{$_} = defined($stats{$_}) ? 1 : 0;
}
# maybe-boolean stats
for (qw/proofed/) {
$stats{$_} = defined($stats{$_}) ? 1 : undef;
}
my $cost2 = delete $stats{cost2};
$stats{cost} ||= $cost2;
my $cost3 = delete $stats{cost3};
$stats{cost} ||= $cost3;
# numeric, undef = 0 stats
for (qw/candles cost/) {
$stats{$_} = 0 if !defined($stats{$_});
}
# strings
for (qw/generic specific/) {
$stats{$_} = '' if !defined($stats{$_});
}
$stats{is_custom_fruit} = 0;
return \%stats;
}
sub parse_raw {
my $self = shift;
my $raw = shift || $self->raw;
my $stats = $self->extract_stats($raw);
# exploit the fact that appearances don't show up in the spoiler table as
# keys
$self->_set_appearance_and_identity($stats);
$self->_rebless_into($stats->{type}, $self->subtype);
$self->incorporate_stats($stats);
}
sub incorporate_stats {
my $self = shift;
my $stats = shift;
$self->slot($stats->{slot}) if defined $stats->{slot};
$self->buc($stats->{buc}) if $stats->{buc};
$self->quantity($stats->{quantity});
$self->is_wielded($stats->{wielded});
$self->is_greased($stats->{greased});
$self->is_quivered($stats->{quivered});
$self->is_offhand($stats->{offhand});
$self->generic_name($stats->{generic}) if defined $stats->{generic};
$self->specific_name($stats->{specific}) if defined $stats->{specific};
$self->cost_each($stats->{cost});
}
sub is_artifact {
my $self = shift;
my $is_artifact = sub {
return 1 if $self->artifact;
my $name = $self->specific_name
or return 0;
my $spoiler = $self->spoiler_class->artifact_spoiler($name);
# is there even an artifact with this name?
return 0 unless $spoiler;
# is it the same type as us?
return 0 unless $spoiler->{type} eq $self->type;
# is it the EXACT name? (e.g. "gray stone named heart of ahriman" fails
# because it's not properly capitalized and doesn't have "The"
my $arti_name = $spoiler->{fullname}
|| $spoiler->{name};
return 0 unless $arti_name eq $name;
# if we know our appearance, is it a possible appearance for the
# artifact?
if (my $appearance = $self->appearance) {
return 0 unless grep { $appearance eq ($_||'') }
$spoiler->{appearance},
@{ $spoiler->{appearances} };
}
# if we know our identity, is the artifact's identity the same as ours?
# if so, then we can know definitively whether this is the artifact
# or not (see below)
if (my $identity = $self->identity) {
if ($identity eq $spoiler->{base}) {
$self->artifact($spoiler->{name});
return 1;
}
else {
return 0;
}
}
# otherwise, the best we can say is "maybe". consider the artifact
# naming bug. we may have a pyramidal amulet that is named The Eye of
# the Aethiopica. the naming bug exploits the fact that if pyramidal is
# NOT ESP, then it will correctly name the amulet. if pyramidal IS ESP
# then we cannot name it correctly -- the only pyramidal amulet that
# can have the name is the real Eye
return undef;
}->();
return $is_artifact;
}
sub _set_appearance_and_identity {
my $self = shift;
my $stats = shift;
my $best_match = $stats->{item};
if ($self->has_pool && $best_match eq $self->pool->fruit_name) {
$self->identity("slime mold");
$self->appearance($best_match);
$stats->{is_custom_fruit} = 1;
}
elsif (my $spoiler = $self->spoiler_class->spoiler_for($best_match)) {
if ($spoiler->{artifact}) {
$self->artifact($spoiler->{name});
$spoiler = $self->spoiler_class->spoiler_for($spoiler->{base})
if $spoiler->{base};
}
$self->identity($spoiler->{name});
if (defined(my $appearance = $spoiler->{appearance})) {
$self->appearance($appearance);
}
}
else {
$self->appearance($best_match);
my @possibilities = $self->possibilities;
if (@possibilities == 1 && $best_match ne $possibilities[0]) {
$stats->{item} = $possibilities[0];
$self->_set_appearance_and_identity($stats);
}
if ($self->identity && $self->identity eq 'slime mold') {
$stats->{is_custom_fruit} = 1;
}
}
}
sub possibilities {
my $self = shift;
if ($self->has_identity) {
return $self->identity if wantarray;
return 1;
}
return $self->tracker->possibilities if $self->has_tracker;
my @possibilities = @{ $self->spoiler_class->possibilities_for_appearance($self->appearance) || [] };
if (@possibilities == 0 && $self->has_pool && $self->pool->allow_other_fruit_names) {
$self->identity('slime mold');
@possibilities = ($self->appearance);
}
return sort @possibilities;
}
sub spoiler {
my $self = shift;
return unless $self->has_identity;
return $self->spoiler_class->spoiler_for($self->identity);
}
sub spoiler_values {
my $self = shift;
my $key = shift;
return map { $self->spoiler_class->spoiler_for($_)->{$key} }
$self->possibilities;
}
sub collapse_spoiler_value {
my $self = shift;
my $key = shift;
return $self->spoiler_class->collapse_value($key, $self->possibilities);
}
sub can_drop { 1 }
sub is_evolution_of {
my $new = shift;
my $old = shift;
return 0 if $new->type ne $old->type;
return 0 if $new->has_identity
&& $old->has_identity
&& $new->identity ne $old->identity;
return 0 if $new->has_appearance
&& $old->has_appearance
&& $new->appearance ne $old->appearance;
# items can become artifacts but they cannot unbecome artifacts
return 0 if $old->is_artifact
&& !$new->is_artifact;
return 1;
}
sub evolve_from {
my $self = shift;
my $new = shift;
my $args = shift || {};
return 0 unless $new->is_evolution_of($self);
my $old_quantity = $self->quantity;
$self->incorporate_stats_from($new);
$self->slot($new->slot);
$self->quantity($old_quantity + $new->quantity)
if $args->{add} && $self->stackable;
return 1;
}
sub maybe_is {
my $self = shift;
my $other = shift;
return $self->is_evolution_of($other) || $other->is_evolution_of($self);
}
sub incorporate_stats_from {
my $self = shift;
my $other = shift;
$other = NetHack::Item->new($other)
if !ref($other);
confess "New item (" . $other->raw . ") does not appear to be an evolution of the old item (" . $self->raw . ")" unless $other->is_evolution_of($self);
my @stats = (qw/slot quantity cost_each specific_name generic_name
is_wielded is_quivered is_greased is_offhand is_blessed
is_uncursed is_cursed artifact identity appearance/);
for my $stat (@stats) {
$self->incorporate_stat($other => $stat);
}
}
sub incorporate_stat {
my $self = shift;
my $other = shift;
my $stat = shift;
$other = NetHack::Item->new($other)
if !ref($other);
my ($old_attr, $new_attr) = map {
$_->meta->find_attribute_by_name($stat)
or confess "No attribute named ($stat)";
} $self, $other;
my $old_value = $old_attr->get_value($self);
my $new_value = $new_attr->get_value($other);
if (!defined($new_value)) {
# if the stat incorporates undef, then incorporate it!
return unless $old_attr->does('IncorporatesUndef');
}
return if defined($old_value)
&& defined($new_value)
&& $old_value eq $new_value;
$old_attr->set_value($self, $new_value);
}
sub fork_quantity {
my $self = shift;
my $quantity = shift;
confess "Unable to fork more ($quantity) than the entire quantity (" . $self->quantity . ") of item ($self)"
if $quantity > $self->quantity;
confess "Unable to fork the entire quantity ($quantity) of item ($self)"
if $quantity == $self->quantity;
my $new_item = $self->meta->clone_object($self);
$new_item->quantity($quantity);
$self->quantity($self->quantity - $quantity);
return $new_item;
}
# if we have only one possibility, then that is our identity
before 'identity', 'has_identity' => sub {
my $self = shift;
return if @_;
return unless $self->has_tracker;
return if $self->tracker->possibilities > 1;
$self->identity($self->tracker->possibilities);
};
sub cost {
my $self = shift;
confess "Set cost_each instead." if @_;
return $self->cost_each * $self->quantity;
}
sub throw_range {
my $self = shift;
my %args = @_;
my $range = int($args{strength} / 2);
if (($self->identity||'') eq 'heavy iron ball') {
$range -= int($self->weight / 100);
}
else {
$range -= int($self->weight / 40);
}
$range = 1 if $range < 1;
if ($self->type eq 'gem' || ($self->identity||'') =~ /\b(?:arrow|crossbow bolt)\b/) {
if (0 && "Wielding a bow for arrows or crossbow for bolts or sling for gems") {
++$range;
}
elsif ($self->type ne 'gem') {
$range = int($range / 2);
}
}
# are we on Air? are we levitating?
if (($self->identity||'') eq 'boulder') {
$range = 20;
}
elsif (($self->identity||'') eq 'Mjollnir') {
$range = int(($range + 1) / 2);
}
# are we underwater?
return $range;
}
sub name {
my $self = shift;
$self->artifact || $self->identity || $self->appearance
}
# Anything can be wielded; subclasses may provide more options
sub specific_slots { [] }
sub fits_in_slot {
my ($self, $slot) = @_;
return 1 if $slot eq "weapon" || $slot eq "offhand";
grep { $_ eq $slot } @{ $self->specific_slots };
}
sub did_polymorph { }
sub did_polymorph_from {
my $self = shift;
my $older = shift;
$self->did_polymorph;
$self->is_blessed($older->is_blessed);
$self->is_uncursed($older->is_uncursed);
$self->is_cursed($older->is_cursed);
}
__PACKAGE__->meta->install_spoilers(qw/subtype stackable material weight price
plural glyph/);
# anything can be used as a weapon
__PACKAGE__->meta->install_spoilers(qw/sdam ldam tohit hands/);
around weight => sub {
my $orig = shift;
my $self = shift;
my $weight = $orig->($self, @_);
return $weight if !defined($weight);
return $weight * $self->quantity;
};
__PACKAGE__->meta->make_immutable;
no Moose;
1;
__END__
=head1 NAME
NetHack::Item - parse and interact with a NetHack item
=head1 SYNOPSIS
use NetHack::Item;
my $item = NetHack::Item->new("f - a wand of wishing named SWEET (0:3)" );
$item->slot # f
$item->type # wand
$item->specific_name # SWEET
$item->charges # 3
$item->spend_charge;
$item->wield;
$item->buc("blessed");
$item->charges # 2
$item->is_wielded # 1
$item->is_blessed # 1
$item->is_cursed # 0
=head1 DESCRIPTION
NetHack's items are complex beasts. This library attempts to control that
complexity.
=head1 ATTRIBUTES
These are the attributes common to every NetHack item. Subclasses (e.g. Wand)
may have additional attributes.
=over 4
=item raw
The raw string passed in to L</new>, to be parsed. This is the only required
attribute.
=item identity
The identity of the item (a string). For example, "clear potion" will be
"potion of water". For artifacts, the base item is used for identity, so for
"the Eye of the Aethiopica" you'll have "amulet of ESP".
=item appearance
The appearance of the item (a string). For example, "potion of water" will be
"clear potion". For artifacts, the base item is used for appearance, so for
"the Eye of the Aethiopica" you'll have "pyramidal amulet" (or any of the
random appearances for amulets of ESP).
=item artifact
The name of the artifact, if applicable. The leading "The" is stripped (so
you'll have "Eye of the Aethiopica").
=item slot
The inventory or container slot in which this item resides. Obviously not
applicable to items on the ground.
=item quantity
The item stack's quantity. Usually 1.
=item cost
The amount of zorkmids that a shopkeeper is demanding for this item.
=item specific_name
A name for this specific item, as opposed to a name for all items of this
class. Artifacts use specific name.
=item generic_name
A name for all items of this class, as opposed to a name for a specific item.
Identification uses generic name.
=item is_wielded, is_quivered, is_greased, is_offhand
Interesting boolean states of an item.
=item is_blessed, is_cursed, is_uncursed
Boolean states about the BUC status of an item. If one returns true, the others
will return false.
=item buc
Returns "blessed", "cursed", "uncursed", or C<undef>.
=item is_holy, is_unholy
Synonyms for L</is_blessed> and L</is_cursed>.
=back
=head1 AUTHORS
Shawn M Moore, C<sartak@bestpractical.com>
Jesse Luehrs, C<doy@tozt.net>
Sean Kelly, C<cpan@katron.org>
Stefan O'Rear, C<stefanor@cox.net>
=head1 SEE ALSO
L<http://sartak.org/code/TAEB/>
=head1 COPYRIGHT AND LICENSE
Copyright 2009-2011 Shawn M Moore.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut