~habnabit/tunnelhack/master

« back to all changes in this revision

Viewing changes to th/data/Items.dat

  • Committer: Aaron Gallagher
  • Date: 2013-07-08 03:48:45 UTC
  • Revision ID: habnabit@gmail.com-20130708034845-tajsarg7079fyngt
pyflakes fixes; trailing whitespace; typos.

Show diffs side-by-side

added added

removed removed

Lines of Context:
490
490
    soda, cookie, chocolate, flask, cookie, gum
491
491
*)
492
492
(*Postlist*slave_driver_items*
493
 
    chocolate, whip, whip, t_shirt, 
 
493
    chocolate, whip, whip, t_shirt,
494
494
    vest, whip
495
495
*)
496
496
(*Postlist*gnome_items*
535
535
    chocolate, soda, cookie,
536
536
    mcookie
537
537
*)
538
 
    
 
538
 
539
539
(*Postlist*programmer_items*
540
540
    sack,
541
541
    flask, lab_coat,
542
542
    cloak, conical_hat,
543
543
    textbook
544
544
*)
545
 
    
 
545
 
546
546
(*Postlist*skunk_items*
547
547
    lightsaber
548
548
*)
642
642
*)
643
643
 
644
644
(*Postlist*cesspool_items*
645
 
    human_corpse, pikachu_corpse, gnome_corpse, dwarf_corpse, 
 
645
    human_corpse, pikachu_corpse, gnome_corpse, dwarf_corpse,
646
646
    mcookie, flask, flask, glass, stick, tattered_rags,
647
647
    rock, filth
648
648
*)
664
664
    cloak, stick, flask, sack, mcookie, cloak, wand
665
665
*)
666
666
(*Postlist*lab_items*
667
 
    scalpel, textbook, textbook, textbook, lab_coat, lab_coat, 
 
667
    scalpel, textbook, textbook, textbook, lab_coat, lab_coat,
668
668
    flask, flask, pencil, pencil, flask, textbook, magnifying_glass
669
669
*)
670
670
(*Postlist*cavern_items*
697
697
(*Functions*scalpel, spork, pocket_knife, knife*
698
698
def use(self, itm, user, here):
699
699
    which = Ifc.choice('What do you want to dissect? ', user.inventory)
700
 
    if not which: 
 
700
    if not which:
701
701
        return Item.RETURN_FALSE
702
702
    elif which.kind.heal == 0:
703
703
        Ifc.you("shouldn't bother dissecting that.")
714
714
        elif user.hp < user.mhp / 2: cache += "It looks fresh and tasty."
715
715
        else: cache += "It appears to be edible."
716
716
        Ifc.you(cache)
717
 
    
718
 
    if which.tainted: 
 
717
 
 
718
    if which.tainted:
719
719
        return Item.HANDLED_NONE
720
720
    if which.kind is gnome_corpse:
721
721
        Ifc.you('convince yourself that gnomes are essentially a species of chicken.')
806
806
    itm.destroy()
807
807
    Ifc.you('discard the empty shell.')
808
808
    return Item.HANDLED_NONE
809
 
*** 
 
809
***
810
810
def supercharge(self, itm, owner, taint):
811
811
    if taint:
812
812
        Ifc.you("don't think that did anything useful. Maybe the egg was bad.")
889
889
def eat(self, itm, eater, here):
890
890
    if eater is not g.player and (itm.type in (0, 1, 5) and not eater.species.smart) or (itm.type == 3 and eater.hp < eater.mhp/3):
891
891
        return Item.RETURN_FALSE
892
 
    
 
892
 
893
893
    Ifc.you('sip|s| from |your| flask.', eater)
894
894
    itm.uses -= 1
895
895
    if itm.type == 0:
969
969
    "The CRC Handbook of Chemistry and Physics"
970
970
*)
971
971
(*List*textbook_difficulty*
972
 
    5, 11, 
973
 
    11, 12, 
 
972
    5, 11,
 
973
    11, 12,
974
974
    8, 9, 5,
975
975
    30, 8,
976
976
    11,
998
998
    if not hit: return
999
999
    if itm.topic == 18:
1000
1000
        Ifc.you('smash|es| the massive tome into %s!' % Ifc.the_mon(target), wielder)
1001
 
        if target.damage(Utl.d(2, 6), wielder, msg='a rubber bible concussion'): 
 
1001
        if target.damage(Utl.d(2, 6), wielder, msg='a rubber bible concussion'):
1002
1002
            return
1003
1003
    elif (itm.topic == 2 or itm.topic == 7) and target.species.alignment < 0:
1004
1004
        Ifc.your('flesh is burned by the powerfully nerd-aligned tome!', target)
1005
 
        if target.damage(Utl.d(1, 8), wielder, usearmor=0, msg=textbook_topics[itm.topic]): 
 
1005
        if target.damage(Utl.d(1, 8), wielder, usearmor=0, msg=textbook_topics[itm.topic]):
1006
1006
            return
1007
 
    
 
1007
 
1008
1008
    index = target.int - textbook_difficulty[itm.topic]
1009
1009
    if index < -3 and target.species.smart:
1010
1010
        Ifc.you('|are| rendered stupified by the awesome power of %s!' % textbook_topics[itm.topic], target)
1021
1021
    inscore = (user.int + Utl.rn(2)) - textbook_difficulty[itm.topic]
1022
1022
    Ifc.you('examine|s| the textbook "%s"...' % textbook_topics[itm.topic], user)
1023
1023
    itm.uses += 1
1024
 
    if user is g.player and user.int > 4 and not Ifc.yn('Do you want to read it? '): 
 
1024
    if user is g.player and user.int > 4 and not Ifc.yn('Do you want to read it? '):
1025
1025
        return Item.RETURN_FALSE
1026
1026
    if user.species.alignment < 0 and (itm.topic == 2 or itm.topic == 7):
1027
1027
        tmp = Utl.rn(4)
1060
1060
            user.hp = user.mhp * 2
1061
1061
    else:
1062
1062
        Ifc.you("can't really get any benefit from something this low-level.", user)
1063
 
    
 
1063
 
1064
1064
    if not user.dead and Utl.rn(itm.uses) > 0:
1065
1065
        Ifc.you('watch|es| the textbook crumble into dust.', user)
1066
1066
        itm.destroy()
1078
1078
def use(self, itm, user, here):
1079
1079
    if user is g.player:
1080
1080
        which = Ifc.choice('Rub what with the fur? ', user.inventory)
1081
 
        if not which: 
 
1081
        if not which:
1082
1082
            return Item.RETURN_FALSE
1083
1083
        if which.kind is wand:
1084
1084
            which.charges += 1
1125
1125
    if Utl.rn(itm.charges) - 3 > 0:
1126
1126
        Ifc.your('overcharged wand discharges into |your|self instead!', user)
1127
1127
        user.damage(
1128
 
            max(Utl.d(itm.charges - 3, (50 - (user.int / (4 if itm.blessed else 1)))), 1), 
 
1128
            max(Utl.d(itm.charges - 3, (50 - (user.int / (4 if itm.blessed else 1)))), 1),
1129
1129
            usearmor=0, msg='an unfortunate wand-related accident')
1130
1130
        return Item.HANDLED_NONE
1131
1131
    if user is g.player:
1144
1144
            return Item.RETURN_FALSE
1145
1145
    else:
1146
1146
        who = user.get_wand_target()
1147
 
        if not who: 
 
1147
        if not who:
1148
1148
            return Item.RETURN_FALSE
1149
1149
    Ifc.you('|are| struck by a %s!' % (
1150
1150
        'miniature lightning bolt' if itm.charges > 5 else Utl.rn_seq(charge_adjective) + ' electric arc'), who)
1151
1151
    if user is g.player:
1152
1152
        g.used_wand += 1
1153
1153
    who.damage(
1154
 
        Utl.d(itm.charges, 20 + (10 if itm.blessed else 0)), 
 
1154
        Utl.d(itm.charges, 20 + (10 if itm.blessed else 0)),
1155
1155
        msg='a bolt of blazing electric death, administered by %s' % (
1156
 
            user.species.adesc), 
 
1156
            user.species.adesc),
1157
1157
        dodie=False)
1158
1158
    itm.charges -= 1
1159
1159
    if who.hp <= -(Utl.rn(25) + 10):
1345
1345
def eat(self, itm, eater, here, wielder=None):
1346
1346
    if eater is not g.player and not eater.rabid:
1347
1347
        return Item.RETURN_FALSE
1348
 
    
 
1348
 
1349
1349
    if here or eater.species.resist_polymorph:
1350
1350
        Ifc.you('swallow|s| the gum.', eater)
1351
1351
    if eater.species.resist_polymorph:
1367
1367
(*Functions*magnifying_glass*
1368
1368
def use(self, itm, user, here):
1369
1369
    which = Ifc.choice('Examine what? ', user.inventory)
1370
 
    if not which: 
 
1370
    if not which:
1371
1371
        return Item.RETURN_FALSE
1372
1372
    if user.int < 8:
1373
1373
        Ifc.you("don't see anything interesting.")
1397
1397
***
1398
1398
def use(self, itm, user, here):
1399
1399
    mode = Ifc.choice_str('Do what with the sack? ', (
1400
 
        'Take something out.', 
1401
 
        'Put something in.', 
 
1400
        'Take something out.',
 
1401
        'Put something in.',
1402
1402
        'Look in the sack.'
1403
1403
    ), cancel=1)
1404
1404
    if mode == -1:
1411
1411
            Ifc.msg('The sack is empty.')
1412
1412
            return Item.RETURN_FALSE
1413
1413
        which = Ifc.choice('Remove what from the sack? ', itm.contents)
1414
 
        if not which: 
 
1414
        if not which:
1415
1415
            return Item.RETURN_FALSE
1416
1416
        itm.contents.remove(which)
1417
1417
        user.add(which)
1421
1421
            Ifc.you("don't think you can fit anything else in the sack.")
1422
1422
            return Item.RETURN_FALSE
1423
1423
        which = Ifc.choice('Put what in the sack? ', user.inventory)
1424
 
        if not which: 
 
1424
        if not which:
1425
1425
            return Item.RETURN_FALSE
1426
1426
        if which.wielded and not user._try_unwield(which):
1427
1427
            return Item.RETURN_FALSE
1458
1458
def use(self, itm, user, here):
1459
1459
    tmp = Ifc.choice_str('Do what with the cage? ', (
1460
1460
        'Remove a creature.',
1461
 
        'Put in a creature.', 
 
1461
        'Put in a creature.',
1462
1462
        'Look inside'
1463
1463
    ), cancel=1)
1464
1464
    if tmp == -1:
1468
1468
            Ifc.you('look in and realize the cage is empty.')
1469
1469
            return Item.RETURN_FALSE
1470
1470
        who = Ifc.choice('Let out who? ', itm.contents)
1471
 
        if not who: 
 
1471
        if not who:
1472
1472
            return Item.RETURN_FALSE
1473
1473
        itm.contents.remove(who)
1474
1474
        here.add(who)
1476
1476
        Ifc.you('let out %s.' % Ifc.the_mon(who))
1477
1477
    elif tmp == 1:
1478
1478
        who = Ifc.choice('Put in who? ', here.mons)
1479
 
        if not who: 
 
1479
        if not who:
1480
1480
            return Item.RETURN_FALSE
1481
1481
        if user is who:
1482
1482
            Ifc.you("can't be in the cage and carry it at the same time.")
1483
1483
            return Item.RETURN_FALSE
1484
1484
        if itm.used_space + who.species.size > itm.capacity:
1485
1485
            Ifc.you("can't fit this creature into the cage.")
1486
 
            if who.species.size > capacity:
 
1486
            if who.species.size > itm.capacity:
1487
1487
                Ifc.msg("It's simply too large.")
1488
1488
            else:
1489
1489
                Ifc.msg("It's already too crowded in the cage.")
1517
1517
***
1518
1518
def use(self, itm, user, here):
1519
1519
    Ifc.you('blow|s| the whistle.', user)
1520
 
    if itm.tainted: 
 
1520
    if itm.tainted:
1521
1521
        Ifc.your('whistle produces an unpleasant buzzing squawk.', user)
1522
1522
    for m in here.mons:
1523
1523
        if m is user or m.owner is user: continue
1638
1638
        "Treat the fox's injuries.",
1639
1639
        'Euthanize the fox.'
1640
1640
    ))
1641
 
    
 
1641
 
1642
1642
    if tmp == 0:
1643
1643
        Ifc.msg('You leave the fox to die.')
1644
1644
        itm.fox.hp = 0
1762
1762
        Ifc.your('Zaurus sends out a call for help!')
1763
1763
        here.add(th.data.Species.debugger.make(target=g.player, ai=th.Monster.ATTACKING))
1764
1764
        return Item.HANDLED_NONE
1765
 
    
 
1765
 
1766
1766
    tmp = Ifc.choice_str('What would you like to do? ', (
1767
1767
        'View map.',
1768
1768
        'Scan for life-forms.',
1776
1776
        Ifc.pk()
1777
1777
    elif tmp == 1:
1778
1778
        where = Ifc.gnsew('Aim it in which direction?', here)
1779
 
        if not where: 
 
1779
        if not where:
1780
1780
            return Item.RETURN_FALSE
1781
1781
        if not where.mons:
1782
1782
            Ifc.your('Zaurus reports no life in the next room.')
1832
1832
 
1833
1833
(*Functions*conical_hat*
1834
1834
def monUse(self, itm, user, here):
1835
 
    if user.species.boss: 
 
1835
    if user.species.boss:
1836
1836
        return False
1837
1837
    return True
1838
1838
***
1881
1881
(*Functions*mirror*
1882
1882
def use(self, itm, user, here):
1883
1883
    who = Ifc.choice('Aim the mirror at whom? ', here.mons)
1884
 
    if not who: 
 
1884
    if not who:
1885
1885
        return Item.RETURN_FALSE
1886
1886
    Ifc.you('gaze|s| into the mirror...', who)
1887
1887
    Ifc.msg('%s -<%% The Most Awesome %s-kind in the Land %%>-%s' % (Ifc.color(Ifc.CYAN), who.species.name, Ifc.color()))
1888
 
    
 
1888
 
1889
1889
    mons = []
1890
1890
    equals = superiors = 0
1891
1891
    for m in g.monsters:
1902
1902
            Ifc.msg('    Weapon: %s' % m.wielded.kind.adesc)
1903
1903
        Ifc.msg('    %s' % m.describe())
1904
1904
        Ifc.msg('')
1905
 
    
 
1905
 
1906
1906
    if len(mons) == 1:
1907
1907
        Ifc.you('|are| unique among all beings.', who)
1908
1908
    elif superiors == 0 and equals == 0:
1912
1912
    else:
1913
1913
        Ifc.you("|are|n't that impressive, really.", who)
1914
1914
    return Item.HANDLED_NONE
1915
 
*** *)    
 
1915
*** *)
1916
1916
 
1917
1917
(*Functions*scythe*
1918
1918
def used_as_weapon(self, itm, wielder, here, target, hit):