(*Imports* from . import Kind from .. import Item, Utl, Ifc, g import th *) (*Definition*cloak* name = "Cloak"; armor = 3; *) (*Definition*chainmail* name = "Chainmail Bikini"; armor = 3; *) (*Definition*spork* name = "Plastic Spork"; damage = 1; *) (*Definition*wand* name = "Rubber Wand"; damage = 7; use_type = Item.TYPE_OFFENSE; *) (*Definition*nerf_sword* name = "Dread Sword of Nerfing"; adesc = "the Dread Sword of Nerfing"; damage = 15; pc_only = True; deadly_weapon = True; to_hit = 10; *) (*Definition*pikachu_egg* name = "Striped Yellow Egg"; heal = 20; veg_level = Item.VEGETARIAN; tasty = "It has a bit of a zing to it."; tainted_chance = 3; *) (*Definition*wonderful_egg* name = "Yellow Striped Egg"; heal = 60; veg_level = Item.VEGETARIAN; tasty = "Mmmmm, everyone loves a questionable egg."; tainted_chance = 5; *) (*Definition*mcookie* name = "Chromatic Cookie"; heal = 1000; using_does_not_destroy = False; veg_level = Item.VEGAN; tasty = "You are lifted to the heights of culinary wonder."; tainted_chance = 8; damage = 1; use_type = Item.TYPE_DEFENSE; *) (*Definition*dwarf_corpse* name = "Dwarf corpse"; heal = 10; tainted_chance = 10; tasty = "Wow, the beard is the most flavorful part!"; *) (*Definition*vest* name = "Black Vest"; armor = 2; *) (*Definition*textbook* name = "Textbook"; damage = 5; deadly_weapon = True; use_type = Item.TYPE_MISC; *) (*Definition*spider_corpse* name = "Spider corpse"; heal = 50; tainted_chance = 100; tasty = "This is a bug."; *) (*Definition*pocket_knife* name = "Pocket Knife"; damage = 5; *) (*Definition*fox_socks* name = "Fox Socks"; adesc = "a pair of Fox Socks"; armor = 1; *) (*Definition*carrot* name = "Carrot"; heal = 3; veg_level = Item.VEGAN; tasty = "You feel very hoppy to have such food."; tainted_chance = 3; *) (*Definition*peanut* name = "Peanut"; heal = 2; veg_level = Item.VEGAN; tasty = "Eh, it's unsalted."; *) (*Definition*mirror* name = "Magic Mirror"; *) (*Definition*cat_corpse* name = "Cat corpse"; heal = 5; tainted_chance = 5; tasty = "Hmm, tastes like rabbit."; *) (*Definition*fox_corpse* name = "Talking Fox corpse"; heal = 10; tasty = "It tastes like surrealists."; *) (*Definition*whip* name = "Bullwhip"; damage = 10; deadly_weapon = True; to_hit = 25; *) (*Definition*cage* name = "Animal Cage"; adesc = "an Animal Cage"; *) (*Definition*sack* name = "Sack"; *) (*Definition*red_shirt* name = "Red Star-Trek Uniform"; armor = -10; *) (*Definition*filth* name = "Pile of Filth"; tainted_chance = 100; heal = 100; *) (*Definition*fox_box* name = "Small Cage"; pc_only = True; *) (*Definition*dog_corpse* name = "Dog corpse"; heal = 8; tainted_chance = 5; tasty = "You find the dog very tasty."; *) (*Definition*flask* name = "Flask of Chemicals"; damage = 1; veg_level = Item.VEGAN; heal = 1; tainted_chance = 8; tasty = "It tastes funny..."; use_type = Item.TYPE_DEFENSE; *) (*Definition*ethernet_cable* name = "Networking cable"; damage = 2; *) (*Definition*giant_hamster_corpse* name = "Giant hamster corpse"; heal = 50; tainted_chance = 50; tasty = "The giant hamster is an ample meal."; *) (*Definition*frying_pan* name = "Frying Pan"; damage = 10; armor = 4; *) (*Definition*bulletproof_vest* name = "Bulletproof Vest"; armor = 8; *) (*Definition*pen* name = "Pen of the Propagandists"; adesc = "the Pen of the Propagandists"; damage = 25; pc_only = True; deadly_weapon = True; to_hit = 10; *) (*Definition*camera* name = "Camera"; damage = 5; deadly_weapon = True; use_type = Item.TYPE_MISC; *) (*Definition*top_hat* name = "Top Hat"; armor = 2; *) (*Definition*lightsaber* name = "Glowing Sword"; damage = 20; deadly_weapon = True; to_hit = 15; *) (*Definition*zergling_corpse* name = "Zergling corpse"; heal = 8; tainted_chance = 5; tasty = "Mmm, that's tasty parody!"; *) (*Definition*mind_flayer_corpse* name = "Mind flayer corpse"; heal = 12; tainted_chance = 20; tasty = "This is real brain food."; *) (*Definition*t_shirt* name = "T-Shirt"; armor = 2; *) (*Definition*hamster_corpse* name = "Hamster corpse"; heal = 2; tainted_chance = 5; tasty = "It tastes like wood shavings."; *) (*Definition*conical_hat* name = "Conical hat"; armor = 2; use_type = Item.TYPE_ESCAPE; *) (*Definition*knife* name = "Knife"; damage = 10; to_hit = 10; deadly_weapon = True; *) (*Definition*baseball_bat* name = "Baseball bat"; damage = 9; deadly_weapon = True; *) (*Definition*pencil* name = "Pencil"; damage = 1; *) (*Definition*coffee* name = "Cup of coffee"; heal = 7; veg_level = Item.VEGETARIAN; tasty = "You prefer yours black."; *) (*Definition*ball* name = "Sports Ball"; damage = 1; deadly_weapon = True; *) (*Definition*briefcase* name = "Briefcase"; damage = 9; pc_only = True; *) (*Definition*wonka_whistle* name = "Brass Whistle"; pc_only = True; *) (*Definition*toad_corpse* name = "Giant toad corpse"; heal = 50; tainted_chance = 100; tasty = "This is a bug."; *) (*Definition*soda* name = "Soda"; heal = 5; veg_level = Item.VEGAN; tasty = "This sugared water is very tasty."; *) (*Definition*meter_stick* name = "Meter stick"; damage = 4; *) (*Definition*pick_axe* name = "Pick-axe"; damage = 12; deadly_weapon = True; *) (*Definition*screwdriver* name = "Screwdriver"; damage = 3; deadly_weapon = True; *) (*Definition*whistle* name = "Ultrasonic Whistle"; adesc = "an Ultrasonic Whistle"; *) (*Definition*scythe* name = "Aetherial Scythe"; adesc = "an Aetherial Scythe"; damage = 50; deadly_weapon = True; to_hit = -5; *) (*Definition*cookie* name = "Cookie"; heal = 8; veg_level = Item.VEGETARIAN; tasty = "It tastes very good."; *) (*Definition*stick* name = "Stick"; damage = 1; *) (*Definition*key* name = "Key"; damage = 1; pc_only = True; *) (*Definition*metal_slab* armor = 4; name = "Slab of Metal"; damage = 9; deadly_weapon = True; *) (*Definition*zaurus* name = "Zaurus of Perspicacity"; adesc = "the Zaurus of Perspicacity"; pc_only = True; *) (*Definition*overalls* name = "Pair of Overalls"; armor = 5; *) (*Definition*chocolate* name = "Chunk of chocolate"; heal = 15; veg_level = Item.VEGAN; tasty = "It tastes wonderful!"; *) (*Definition*spock_ears* name = "Vulcan Ears"; adesc = "a pair of Vulcan Ears"; armor = 1; *) (*Definition*lab_coat* name = "Lab Coat"; armor = 4; *) (*Definition*scalpel* name = "Scalpel"; damage = 4; deadly_weapon = True; *) (*Definition*furry_costume* name = "Costume"; armor = 5; *) (*Definition*novel* name = "Novel"; damage = 3; deadly_weapon = True; use_type = Item.TYPE_MISC; *) (*Definition*crocodile_corpse* name = "Crocodile corpse"; heal = 12; tainted_chance = 25; tasty = "Mmm, savory!"; *) (*Definition*glass* name = "Shard of Glass"; damage = 5; deadly_weapon = True; *) (*Definition*fur_scrap* name = "Scrap of Fur"; use_type = Item.TYPE_OFFENSE; *) (*Definition*parrot_corpse* name = "Parrot corpse"; heal = 8; tainted_chance = 5; tasty = "It's not just pinin' for the fjords."; *) (*Definition*gnome_corpse* name = "Gnome corpse"; heal = 6; tainted_chance = 10; tasty = "Gnome, the other white meat!"; *) (*Definition*mask* name = "Gas Mask"; armor = 1; *) (*Definition*gum* name = "Blue Gum"; adesc = "some Blue Gum"; heal = 1; veg_level = Item.VEGAN; damage = 2; tainted_chance = 10; *) (*Definition*jacket* name = "Fasionable Jacket"; armor = 2; *) (*Definition*tribble_corpse* name = "Tribble corpse"; heal = 1; tainted_chance = 5; tasty = "Eww, there was a hair in this corpse!"; *) (*Definition*magnifying_glass* name = "Lens"; damage = 3; *) (*Definition*human_corpse* name = "Human corpse"; heal = 16; tainted_chance = 10; tasty = "Tastes like beef."; *) (*Definition*rock* name = "Rock"; damage = 5; *) (*Definition*tattered_rags* name = "Tattered clothing"; adesc = "some Tattered clothing"; armor = 1; *) (*Definition*pikachu_corpse* name = "Pikachu corpse"; heal = 12; tainted_chance = 50; tasty = "The pikachu corpse smells slightly of ozone, and tastes tangy."; *) (*Definition*squirrel_corpse* name = "Squirrel corpse"; heal = 10; tainted_chance = 0; tasty = "It is very meaty, and tastes good also!"; *) (*Definition*oompa_corpse* name = "Oompa-Loompa corpse"; adesc = "an Oompa-Loompa corpse"; heal = 20; tasty = "Mmm, prime-quality and chocolate fed!"; *) (*Definition*steroid_pill* name = "Steroid Pill"; heal = 5; tasty = "You note that the intravenous variety would be more effective."; *) (*Definition*dragon_fang* name = "Dragon Fang"; damage = 12; deadly_weapon = True; to_hit = 40; *) (*Postlist*trekie_items* spock_ears, red_shirt, cloak, chocolate, cookie, camera *) (*Postlist*champion_items* cloak, metal_slab, lightsaber, mcookie, flask, sack, wand *) (*Postlist*dwarf_items* pick_axe, sack, rock, rock *) (*Postlist*wonka_items* gum, gum, chocolate, cookie, chocolate, pikachu_egg *) (*Postlist*furvert_items* whip, wand, cloak, chainmail, t_shirt, whip, knife, novel, chocolate, stick, furry_costume *) (*Postlist*beatnik_items* cookie, coffee, coffee, t_shirt, knife, pocket_knife, pocket_knife, textbook, novel, novel, textbook, mirror, cloak, cloak, tattered_rags, mcookie *) (*Postlist*oompa_items* gum, gum, knife, mcookie, cookie, lab_coat, chocolate, chocolate, mask, soda, cookie, chocolate, flask *) (*Postlist*warrior_oompa_items* gum, gum, knife, knife, knife, lab_coat, lab_coat, chocolate, chocolate, gum, soda, cookie, chocolate, flask, cookie, gum *) (*Postlist*slave_driver_items* chocolate, whip, whip, t_shirt, vest, whip *) (*Postlist*gnome_items* knife, stick, stick, cookie, soda, cloak, conical_hat, conical_hat, mcookie, conical_hat,conical_hat,conical_hat, knife, stick, cloak, stick, whistle, wand *) (*Postlist*booth_babe_items* chainmail, cloak, conical_hat, chainmail, furry_costume, knife, vest, top_hat, chainmail *) (*Postlist*hobo_items* rock, stick, soda, tattered_rags, tattered_rags, pocket_knife, spork, chocolate, frying_pan, frying_pan, tattered_rags, sack *) (*Postlist*mole_person_items* rock, rock, rock, tattered_rags, tattered_rags, tattered_rags, stick, hamster_corpse, hamster_corpse, hamster_corpse *) (*Postlist*hobo_leader_items* knife, knife, pocket_knife, pocket_knife, tattered_rags, tattered_rags, cloak, cloak, stick, rock, chocolate, sack, sack, sack, chocolate, hamster_corpse, hamster_corpse, cookie, cookie, cookie *) (*Postlist*hamster_items* peanut, carrot *) (*Postlist*mind_flayer_items* knife, cloak, human_corpse, scalpel *) (*Postlist*care_bear_items* human_corpse, fur_scrap, wand, stick, chocolate, chocolate, soda, cookie, mcookie *) (*Postlist*programmer_items* sack, flask, lab_coat, cloak, conical_hat, textbook *) (*Postlist*skunk_items* lightsaber *) (*Postlist*vape_items* lightsaber *) (*Postlist*nerd_items* pencil, meter_stick, ethernet_cable, screwdriver, soda, cookie, t_shirt, pencil, pencil, pencil, t_shirt, meter_stick, textbook, textbook, spork, scalpel, chocolate *) (*Postlist*madsci_items* lab_coat, textbook, scalpel, flask, flask, bulletproof_vest, mask *) (*Postlist*artsie_items* pencil,soda, cookie, t_shirt, pencil, pencil, pocket_knife, textbook, novel, novel, novel, camera, soda, jacket, jacket, carrot *) (*Postlist*jock_items* baseball_bat, baseball_bat, t_shirt, t_shirt, knife, pocket_knife, jacket, soda, carrot, ball, *) (*Postlist*pyrex_elf_items* glass, glass, scalpel, glass, cloak, flask, flask *) (*Postlist*fox_items* overalls, top_hat, vest *) (*Postlist*crocodile_items* pikachu_corpse, human_corpse, hamster_corpse, gnome_corpse,pikachu_corpse, human_corpse, hamster_corpse, gnome_corpse, mcookie *) (*Postlist*reporter_items* camera, camera, cookie, cookie, pencil, t_shirt, t_shirt, coffee, jacket *) (*Postlist*secguard_items* baseball_bat, baseball_bat, knife, pocket_knife, cookie, coffee, jacket, bulletproof_vest, bulletproof_vest, t_shirt, pocket_knife *) (*Postlist*senator_items* knife, pocket_knife, pocket_knife, jacket, cookie, coffee, bulletproof_vest, bulletproof_vest, bulletproof_vest, peanut, peanut, cookie, coffee, mirror *) (*Postlist*intern_items* pencil, pencil, pocket_knife, cookie, coffee, coffee, coffee, jacket, t_shirt, t_shirt, top_hat, t_shirt *) (*Postlist*furry_items* furry_costume *) (*Postlist*coffee_items* mcookie, cookie, cookie, novel, novel, coffee, coffee, chocolate, chocolate, textbook *) (*Postlist*all_items* stick, scalpel, pencil, pocket_knife, spork, glass, meter_stick, ethernet_cable, screwdriver, knife, baseball_bat, rock, lightsaber, textbook, novel, ball, frying_pan, flask, cookie, mcookie, soda, squirrel_corpse, carrot, peanut, chocolate, gnome_corpse, human_corpse, hamster_corpse, cat_corpse, pikachu_corpse, tribble_corpse, spider_corpse, crocodile_corpse, conical_hat, tattered_rags, cloak, t_shirt, jacket, metal_slab, mask, lab_coat, sack, zergling_corpse, mind_flayer_corpse, steroid_pill, pick_axe, fur_scrap, wand, parrot_corpse, coffee, magnifying_glass, giant_hamster_corpse, fox_corpse, overalls, top_hat, vest, dragon_fang, filth, pikachu_egg, toad_corpse, whip, cage, whistle, gum, camera, bulletproof_vest, spock_ears, red_shirt, chainmail, furry_costume, mirror *) (*Postlist*corpses* hamster_corpse, gnome_corpse, human_corpse, cat_corpse, pikachu_corpse, tribble_corpse, spider_corpse, crocodile_corpse, zergling_corpse, mind_flayer_corpse, dwarf_corpse, parrot_corpse, giant_hamster_corpse, fox_corpse, toad_corpse, squirrel_corpse *) (*Postlist*cesspool_items* human_corpse, pikachu_corpse, gnome_corpse, dwarf_corpse, mcookie, flask, flask, glass, stick, tattered_rags, rock, filth *) (*Postlist*cafe_items* ethernet_cable, ethernet_cable, soda, cookie, chocolate, screwdriver, textbook, coffee *) (*Postlist*nest_items* carrot, peanut, hamster_corpse, tattered_rags, fur_scrap *) (*Postlist*locker_items* steroid_pill, steroid_pill, soda, jacket, t_shirt, t_shirt, baseball_bat, ball, ball, pocket_knife, steroid_pill, soda *) (*Postlist*hive_items* conical_hat, conical_hat, conical_hat, conical_hat, cloak, stick, flask, sack, mcookie, cloak, wand *) (*Postlist*lab_items* scalpel, textbook, textbook, textbook, lab_coat, lab_coat, flask, flask, pencil, pencil, flask, textbook, magnifying_glass *) (*Postlist*cavern_items* tattered_rags, tattered_rags, tattered_rags, stick, stick, filth, filth, overalls, rock, rock, rock, rock, sack, peanut, peanut, carrot, carrot, peanut, chocolate, soda, frying_pan, frying_pan, frying_pan, spork, spork *) (*Postlist*artifacts* zaurus, pen, nerf_sword *) (*Functions*coffee* def eat(self, itm, eater, here): if eater.species.level: bonus = Utl.d(1, 4) + 1 eater.mdx = min(eater.species.level.mdx, eater.mdx + bonus) eater.dex = min(eater.dex + bonus, eater.mdx) Ifc.you("feel|s| jittery.", eater) else: eater.dex = eater.mdx Ifc.you("feel|s| awake and ready to go.", eater) return Item.HANDLED_NONE *** *) (*Functions*scalpel, spork, pocket_knife, knife* def use(self, itm, user, here): which = Ifc.choice('What do you want to dissect? ', user.inventory) if not which: return Item.RETURN_FALSE elif which.kind.heal == 0: Ifc.you("shouldn't bother dissecting that.") return Item.RETURN_FALSE if which.kind is soda: Ifc.you("are now covered in soda.") which.destroy() elif Utl.rn(-3) + user.dex + (3 if self is scalpel else 0) < 8: Ifc.you("clumsily botch your dissection, destroying the %s." % which.kind.name) which.destroy() else: cache = "carefully pick apart the %s with your %s. " % (which.kind.name, self.name) if which.tainted: cache += "It's rotten! Yuck!" elif user.hp < user.mhp / 2: cache += "It looks fresh and tasty." else: cache += "It appears to be edible." Ifc.you(cache) if which.tainted: return Item.HANDLED_NONE if which.kind is gnome_corpse: Ifc.you('convince yourself that gnomes are essentially a species of chicken.') elif which.kind is hamster_corpse: Ifc.you('rationalize that a hamster is basically a small cow.') elif which.kind is user.species.corpse: Ifc.you('must be really hungry.') elif which.kind is pikachu_corpse: if Utl.rn(): Ifc.you('wonder if Pikachu are considered kosher.') else: Ifc.you('think that Pikachu are a kind of lamb.') return Item.HANDLED_NONE *** *) (*List*egg_colors* "chartreuse", "celadon", "lime-colored", "asparagus-colored", "yellow", "orpiment", "ochre", "cadmium-yellow" *) (*Functions*wonderful_egg* def use(self, itm, user, here): Ifc.you('crack open the egg.') Ifc.msg("Arcane energies surge forth from the wonderous egg!") if itm.tainted: Ifc.msg("Something goes horribly wrong! It burns!") user.damage(Utl.rn(2), msg='a very bad egg', setamt=1) else: for itm in user.inventory: if itm.tainted: Ifc.your("%s glows red, then yellow."%itm.kind.name, user) itm.tainted = False for mon in here.mons: if itm.blessed and mon.ai == th.Monster.ATTACKING: continue Ifc.you("|are| surrounded by a yellow aura.",mon) mon.hp = mon.mhp if itm.blessed: for mon in here.mons: if mon.ai == th.Monster.ATTACKING: Ifc.msg("The arcane energies ravage %s!",Ifc.the_mon(mon)) user.damage(2*Utl.rn(30), msg='an Egg of Eggs') itm.destroy() Ifc.you('discard the empty shell.') return Item.HANDLED_NONE *** def supercharge(self, itm, owner, taint): Ifc.you('anoint the egg with more yolk. It glows puce.') itm.blessed = True *** *) (*Functions*pikachu_egg* def use(self, itm, user, here): Ifc.you('crack open the egg.') which = Ifc.choice('Dip what in the yolk? ', user.inventory) if not which: Ifc.you('carefully put the egg back together.') return Item.RETURN_FALSE elif which is itm: Ifc.you("can't figure out how to turn the egg into a Klein bottle.") return Item.RETURN_FALSE elif which.kind in corpses: Ifc.you('watch the arcane energies of the egg surge through the %s...' % which.kind.name) if not which.living_form: Ifc.msg("But nothing else happens. It's beyond all mortal aid.") if which.kind is parrot_corpse: Ifc.msg('This is an ex-parrot!') elif not itm.tainted: if Utl.rn(): Ifc.you('see the %s rise from the dead and ally with you!' % which.living_form.species.name) which.living_form.ai = th.Monster.PET which.living_form.owner = user else: Ifc.you('see the %s rise from the dead!' % which.living_form.species.name) which.living_form.hp = 1 which.living_form.dead = False which.living_form.target = None here.add(which.living_form) which.destroy() else: Ifc.you('sense something is terribly, terribly wrong.') Ifc.you('watch as the corpse sublimates into a cloud of pungent smoke!') Ifc.you('feel very sick.') user.damage(Utl.rn(3), msg='a burning %s' % which.living_form.species.name, setamt=1) which.destroy() else: which.kind.supercharge(which, user, itm.tainted) itm.destroy() Ifc.you('discard the empty shell.') return Item.HANDLED_NONE *** def supercharge(self, itm, owner, taint): if taint: Ifc.you("don't think that did anything useful. Maybe the egg was bad.") return Ifc.you('anoint the egg with more yolk. It glows yellowish-cyan.') itm.blessed = True itm.tainted = False *** *) (*List*flask_types* 'Acid', 'Poison', 'Sticky Stuff', 'Toxic Waste', 'Tasty Juice', 'Oil' *) (*Functions*flask* def xmake(self, itm): itm.uses = Utl.d(1, 10) itm.type = Utl.rn(6) *** def use(self, itm, user, here): if user.int > 11: Ifc.you('have a flask of %s.' % flask_types[itm.type]) elif user.int < 5: Ifc.you('have a flask of funny liquid.') else: if Utl.rn(user.int) < 2 or itm.tainted: Ifc.you('think this is %s.' % Utl.rn_seq(flask_types)) else: Ifc.you('think this is %s.' % flask_types[itm.type]) return Item.HANDLED_NONE *** def used_as_weapon(self, itm, wielder, here, target, hit): itm.uses -= 1 Ifc.you('throw|s| liquid from |your| flask!', wielder) if itm.uses == 0: Ifc.you('run|s| out of %s.' % flask_types[itm.type], wielder) itm.destroy() if not hit: return if itm.type == 0: if target.resist_chemical: Ifc.you('|are| unaffected.', target) else: target.damage(Utl.d(1, 8) + (10 if itm.blessed else 0), wielder, 0, 'vitriol throwing') elif itm.type == 1: Ifc.you('|are| weakened by poison!', target) target.str -= Utl.rn(2) target.damage(Utl.d(2, 6) + (10 if itm.blessed else 0), wielder, 0, '%spoisonous liquid' % ('very ' if itm.blessed else '')) elif itm.type == 2: Ifc.you('|are| covered in sticky junk!', target) target.dex -= 2 elif itm.type == 3: if target.species.resist_polymorph: Ifc.you('shimmer|s| slightly.', target) return elif target.resist_polymorph: Ifc.you('|are| protected by |your| armor.', target) return if target is g.player: g.polymorphed += 1 Ifc.you('undergo|es| a strange transformation!', target) tmp = Utl.rn_seq(th.data.Species.all_creatures) while tmp.boss or not tmp.polymorphable: if Utl.rn(5) == 0: Ifc.you('feel|s| a horrible wrenching sensation!', target) Ifc.you('fall|s| to pieces!', target) target.damage(0, wielder, setamt=1, msg='a disagreement of internal organs') return tmp = Utl.rn_seq(th.data.Species.all_creatures) Ifc.you('turn|s| into %s.' % tmp.adesc, target) target.species = tmp target.reroll_stats() elif itm.type == 4: Ifc.you("do|es|n't seem to be affected.", target) elif itm.type == 5: Ifc.you("get|s| all slippery!", target) if Utl.rn(): for titem in Utl.gen_shuffle(target.inventory): if target._try_drop(titem): Ifc.you("lose|s| |your| grip on |your| %s!" % titem.kind.name, target) break *** def eat(self, itm, eater, here): 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): return Item.RETURN_FALSE Ifc.you('sip|s| from |your| flask.', eater) itm.uses -= 1 if itm.type == 0: Ifc.your('throat burns terribly!', eater) eater.damage(Utl.rn(2) - (3 if itm.tainted else 0), msg='using acid', setamt=1) elif itm.type == 1: Ifc.you('feel|s| very ill.', eater) eater.damage(Utl.rn(4) - (2 if itm.tainted else 0), msg='drinking poison', setamt=1) eater.str = Utl.d(1, 3) eater.dex = Utl.d(1, 3) elif itm.type == 2: Ifc.you('drink|s| viscous liquid.', eater) if itm.tainted: Ifc.you('feel|s| quite ill.', eater) eater.str /= 2 eater.dex /= 2 else: Ifc.you('feel|s| restored.', eater) eater.str, eater.dex, eater.int = eater.mst, eater.mdx, eater.min elif itm.type == 3: Ifc.you('drink|s| some chromatic fluid.', eater) if eater.species.resist_polymorph: Ifc.you('feel|s| like a new %s!' % eater.species.name, eater) eater.reroll_stats() else: if itm.tainted and not itm.blessed: tmp = th.data.Species.amorphous_blob Ifc.you('undergo|es| a hideous transformation!', eater) elif itm.blessed and not itm.tainted and eater is g.player: spe = Ifc.gstring('Become what sort of creature? ') Ifc.you('think %s-like thoughts and hope.' % spe) tmp = Ifc.get_spe(spe) if not tmp or tmp.boss or not tmp.polymorphable: Ifc.msg("Oh no, it didn't work!") if Utl.rn(3) == 0: tmp = Utl.rn_seq(th.data.Species.all_creatures) else: tmp = th.data.Species.amorphous_blob else: g.controlled_polymorph += 1 else: tmp = Utl.rn_seq(th.data.Species.all_creatures) if eater is g.player: g.polymorphed += 1 Ifc.you('turn|s| into %s!' % tmp.adesc, eater) eater.species = tmp eater.reroll_stats() elif itm.type == 4: eater.hp += Utl.d(2, 8) + 5 if eater.hp > eater.mhp: eater.str = eater.mst Ifc.you('feel|s| really good.', eater) eater.mhp = eater.hp = eater.mhp + (eater.hp - eater.mhp) / 3 elif itm.type == 5: Ifc.you('feel|s| slick.', eater) if itm.uses == 0: Ifc.you('drank all of |your| %s.' % flask_types[itm.type], eater) itm.destroy() return Item.HANDLED_TAINTED *** def supercharge(self, itm, owner, taint): Ifc.you('see the chemicals in the flask sparkle.') itm.blessed = True *** *) (*List*textbook_topics* "Adventuring For Dummies", "Linear Algebra", "The Art of Computer Programming", "Differential Equations", "Algebra", "Elementary Calculus", "The Book of Foo", "Java in a Nutshell", "Introductory Biology", "Essentials of Medicinal Chemistry", "Advanced Inorganic Chemistry", "Prealgebra", "English Orthography", "Elements of Style", "Gomer's World Of Outhouses", "My First Book of Tasty Animals", "Baby's First Book", "Physics for Scientists and Engineers", "The CRC Handbook of Chemistry and Physics" *) (*List*textbook_difficulty* 5, 11, 11, 12, 8, 9, 5, 30, 8, 11, 11, 6, 8, 8, 3, 2, 1, 10, 15 *) (*Functions*textbook* def xmake(self, itm): itm.topic = Utl.rn(len(textbook_topics)) itm.uses = Utl.d(1, 3) *** def monUse(self, itm, user, here): return user.species.smart *** def wield_action(self, itm, wielder, here): if wielder.alignment < 0 and (itm.topic == 2 or itm.topic == 7): Ifc.you('|are| zapped by the powerfully nerd-aligned tome!') wielder.damage(Utl.d(1, 8), usearmor=0, msg='really bad paper cuts') *** def used_as_weapon(self, itm, wielder, here, target, hit): if not hit: return if itm.topic == 18: Ifc.you('smash|es| the massive tome into %s!' % Ifc.the_mon(target), wielder) if target.damage(Utl.d(2, 6), wielder, msg='a rubber bible concussion'): return elif (itm.topic == 2 or itm.topic == 7) and target.species.alignment < 0: Ifc.your('flesh is burned by the powerfully nerd-aligned tome!', target) if target.damage(Utl.d(1, 8), wielder, usearmor=0, msg=textbook_topics[itm.topic]): return index = target.int - textbook_difficulty[itm.topic] if index < -3 and target.species.smart: Ifc.you('|are| rendered stupified by the awesome power of %s!' % textbook_topics[itm.topic], target) target.stun(Utl.d(1, textbook_difficulty[itm.topic] / 2 + 1), 'and morbidly dreading %s' % textbook_topics[itm.topic]) elif index < 3 and Utl.rn(): Ifc.you('recoil|s| in fear of %s!' % textbook_topics[itm.topic], target) if target is g.player: target.stun(1, 'terrorized of %s' % textbook_topics[itm.topic]) else: target.ai = th.Monster.FLEEING *** def use(self, itm, user, here): if user is g.player: g.illiterate += 1 inscore = (user.int + Utl.rn(2)) - textbook_difficulty[itm.topic] Ifc.you('examine|s| the textbook "%s"...' % textbook_topics[itm.topic], user) itm.uses += 1 if user is g.player and user.int > 4 and not Ifc.yn('Do you want to read it? '): return Item.RETURN_FALSE if user.species.alignment < 0 and (itm.topic == 2 or itm.topic == 7): tmp = Utl.rn(4) if tmp < 3: Ifc.you('|are| blasted by the powerfully nerd-aligned tome!', user) if tmp == 0: user.damage(0, msg='a computer science text', setamt=1) else: user.damage(Utl.rn(20), usearmor=0, msg='a computer science text') else: Ifc.you('feel|s| powerfully captivated by the contents.', user) Ifc.you('abandon|s| |your| former course and embrace|s| the Geek Way!', user) user.species = th.data.Species.nerd user.reroll_stats() return Item.HANDLED_NONE if inscore < -5: Ifc.your('brain is utterly overwhelmed by the contents!', user) if itm.topic == 7: Ifc.you('understand|s| everything momentarily, then die|s|!', user) else: Ifc.you('collapse|s| into a catatonic state.', user) user.damage(0, msg='the complicated wordplay of %s' % textbook_topics[itm.topic], setamt=1) elif inscore < 0 or itm.tainted: Ifc.you("don't understand the cryptic verbage.", user) if Utl.rn(): Ifc.you("|are| stunned by the book's power.", user) user.stun(Utl.d(1, textbook_difficulty[itm.topic]), 'confused by the wordplay of %s' % textbook_topics[itm.topic]) elif inscore < 7: Ifc.you('understand|s| the book, and feel|s| smarter!', user) user.int += 1 user.min += 1 if itm.topic == 7: Ifc.you('comprehend|s| the bizzare nature of the universe.', user) user.int += 1 user.min += 1 user.hp = user.mhp * 2 else: Ifc.you("can't really get any benefit from something this low-level.", user) if not user.dead and Utl.rn(itm.uses) > 0: Ifc.you('watch|es| the textbook crumble into dust.', user) itm.destroy() return Item.HANDLED_NONE *** *) (*Functions*fur_scrap* def monUse(self, itm, user, here): for i in user.inventory: if i.kind is wand and i.charges < 3: return True else: return False *** def use(self, itm, user, here): if user is g.player: which = Ifc.choice('Rub what with the fur? ', user.inventory) if not which: return Item.RETURN_FALSE if which.kind is wand: which.charges += 1 Ifc.msg('The hairs bristle with electricity.') else: Ifc.you("suspect that wouldn't do anything.") return Item.RETURN_FALSE else: for i in user.inventory: if i.kind is wand and i.charges < 3: i.charges += 1 Ifc.you('rub|s| |your| rubber wand with |your| scrap of fur.', user) Ifc.your('wand crackles with electricity.', user) break if Utl.rn(5) == 0 or itm.tainted: Ifc.your('fur scrap is worn out.', user) itm.destroy() return Item.HANDLED_NONE *** *) (*List*charge_adjective* "bright", "dazzling", "brilliant", "blazing", "stupendious", "magnificent" *) (*List*fried_msg* "|are| burnt to a crisp!", "|are| reduced to ashes!", "explode|s| into a cloud of smoke!", "|are| utterly annihilated!", "turn|s| to ashes!", "eat|s| blazing electric death!" *) (*Functions*wand* def xmake(self, itm): itm.charges = Utl.d(1, 4) *** def monUse(self, itm, user, here): return Utl.rn() and itm.charges > 0 *** def use(self, itm, user, here): if itm.charges == 0: Ifc.your('wand is totally discharged.', user) return Item.RETURN_FALSE if Utl.rn(itm.charges) - 3 > 0: Ifc.your('overcharged wand discharges into |your|self instead!', user) user.damage( max(Utl.d(itm.charges - 3, (50 - (user.int / (4 if itm.blessed else 1)))), 1), usearmor=0, msg='an unfortunate wand-related accident') return Item.HANDLED_NONE if user is g.player: if len(here.mons) > 1: who = Ifc.choice('Zap it at whom? ', here.mons) if not who or who is g.player: return Item.RETURN_FALSE elif who.owner is user: Ifc.you("wouldn't want to hurt your %s!" % ( 'friend' if who.species.smart else 'pet')) return Item.RETURN_FALSE if who.hp <= who.mhp / 2: who.ai = th.Monster.FLEEING else: Ifc.you("don't see any prospective targets here.") return Item.RETURN_FALSE else: who = user.get_wand_target() if not who: return Item.RETURN_FALSE Ifc.you('|are| struck by a %s!' % ( 'miniature lightning bolt' if itm.charges > 5 else Utl.rn_seq(charge_adjective) + ' electric arc'), who) if user is g.player: g.used_wand += 1 who.damage( Utl.d(itm.charges, 20 + (10 if itm.blessed else 0)), msg='a bolt of blazing electric death, administered by %s' % ( user.species.adesc), dodie=False) itm.charges -= 1 if who.hp <= -(Utl.rn(25) + 10): Ifc.you(Utl.rn_seq(fried_msg), who) who.die(user, docorpse=False) elif who.hp <= 0: who.die(user) elif itm.blessed and Utl.rn(): Ifc.you('|are| paralyzed by shock!', who) who.stun(itm.charges + 1, 'paralyzed by an electric shock') return Item.HANDLED_NONE *** def supercharge(self, itm, owner, taint): Ifc.your('wand glows a resplendent yellow.') itm.blessed = True *** *) (*Functions*whip* def used_as_weapon(self, itm, wielder, here, target, hit): if Utl.rn(wielder.dex) + (-2 if hit else 2) < Utl.rn(6): Ifc.you('|are| hit by recoil!', wielder) dmg = Utl.rn(wielder.str / 4 + 3) if wielder.hp - dmg <= 0: dmg = wielder.hp - 1 wielder.damage(dmg, msg='recoil from a bullwhip') *** *) (*Functions*mcookie* def monUse(self, itm, user, here): return True *** def eat(self, itm, eater, here): if itm.tainted: Ifc.your('mouth burns! The cookie was poisoned!', eater) eater.damage(Utl.rn(5), msg='eating a poisoned magic cookie', setamt=1) itm.destroy() return Item.RETURN_TRUE Ifc.you('find|s| the taste awe-inspiring!', eater) if Utl.rn(): Ifc.you('|are| stronger!', eater) eater.str = eater.mst = eater.mst + Utl.d(1, 3) if Utl.rn(): Ifc.you('|are| smarter!', eater) eater.int = eater.min = eater.min + Utl.d(1, 3) if Utl.rn(): Ifc.you('|are| more agile!', eater) eater.dex = eater.mdx = eater.mdx + Utl.d(1, 3) Ifc.you('|are| stronger!', eater) eater.hp = eater.mhp = eater.mhp + Utl.d(1, 20) return Item.HANDLED_NONE *** def used_as_weapon(self, itm, wielder, here, target, hit): if hit: self.use(itm, target, here, wielder) *** def use(self, itm, user, here, hitter=None): Ifc.you('gaze|s| into the cookie...', user) if user.int + Utl.rn(3) < 10: Ifc.you('|are| very hungry.', user) user.damage(Utl.rn(10), hitter, usearmor=0, msg='powerful cookie-induced hunger pains') else: tmp = Utl.rn(16) if tmp <= 3: where = Utl.rn_exit(here) if user is g.player: if where.mons: Ifc.you('gain|s| insight from the cookie: the room to the %s contains %s.' % (Utl.nsew(here, where), Utl.rn_seq(where.mons).species.adesc)) else: Ifc.you('gain|s| insight from the cookie: the room to the %s is empty.' % Utl.nsew(here, where)) else: Ifc.you('gain|s| insight from the cookie.', user) elif tmp > 3 and tmp <= 6: if user.species.boss: Ifc.you('twitch|es| involuntarily.', user) return Item.HANDLED_NONE Ifc.you('vanish|es| in a puff of chocolate smoke!', user) if user is g.player: g.teleported += 1 here.mons.remove(user) where = Utl.rn_node(False, 0) where.add(user) Ifc.you('suddenly appear|s| out of cookie-space.', user) if itm.tainted and Utl.rn() and not user.species.resist_polymorph: Ifc.you('|are| horrified to discover that |you| |are| partially turned to chocolate!', user) user.add(chocolate.make()) user.add(chocolate.make()) user.damage(0, hitter, msg='being turned to chocolate', setamt=1) return Item.HANDLED_NONE elif itm.tainted: Ifc.you('catch|es| a whiff of old chocolate.', user) elif tmp == 7: Ifc.you("|are| weakened by the cookie's power!", user) user.mhp -= 1 user.hp -= 1 elif tmp == 8: Ifc.you("find|s| new strength!", user) user.mhp += 1 user.hp += 1 else: Ifc.you('see|s| a glowing map projected from the cookie.', user) if user is g.player: th.Map.show_map(10, 40, 30, False, True) Ifc.pk() user.damage(10 - user.int, hitter, usearmor=0, msg='contemplating a quasi-magical cookie') user.hp = min(user.hp, user.mhp) return Item.HANDLED_NONE *** *) (*Functions*camera* def xmake(self, itm): itm.memory = Utl.d(3, 6) itm.pictures = [] *** def show_pics(self, itm): Ifc.you('view the pictures.') if not itm.pictures: Ifc.msg('There are none.') else: for s in itm.pictures: Ifc.msg('\t- %s.' % s) *** def monUse(self, itm, user, here): return user.species.smart and itm.memory > 2 and Utl.rn() *** def used_as_weapon(self, itm, wielder, here, target, hit): if not hit: return if Utl.rn(5) == 0: Ifc.you("trigger|s| the camera's flash!", wielder) Ifc.you('|are| temporarily blinded!', target) target.stun(Utl.d(1, 3), "blind from a camera's flash") *** def use(self, itm, user, here): if user is g.player and not Ifc.yn('Would you like to take a picture? ') and Ifc.yn('Would you like to view the pictures? '): self.show_pics(itm) return Item.HANDLED_NONE if itm.memory == 0: Ifc.your('camera is out of memory.', user) return Item.HANDLED_NONE if user is g.player and Utl.rn(user.dex) > 2: subject = Ifc.choice('Take a picture of whom? ', here.mons) else: if user is g.player: Ifc.your('hand slips!') subject = Utl.rn_seq(here.mons) if not subject: return Item.RETURN_FALSE itm.memory -= 1 photo = subject.photograph(user) itm.pictures.append(photo) Ifc.you('photograph|s| the %s.' % subject.species.name, user) Ifc.you('ha|ve| %s.' % photo, user) return Item.HANDLED_NONE *** *) (*Functions*steroid_pill* def eat(self, itm, eater, here): if eater.species.level: bonus = Utl.d(1, 4) + 1 eater.mst = min(eater.species.level.mst, eater.mst + bonus) eater.str = min(eater.str + bonus, eater.mst) Ifc.you('feel|s| tough.', eater) else: eater.str = eater.mst Ifc.you('feel|s| strange.', eater) if Utl.rn(6) == 0: Ifc.you('suddenly feel|s| very queasy!', eater) eater.mhp -= Utl.rn(10) eater.damage(min(eater.hp, eater.mhp), msg='steroid abuse', setamt=1) return Item.HANDLED_NONE *** def monUse(self, itm, user, here): return user.species.alignment < 0 *** def use(self, itm, user, here): Ifc.you('pull|s| the capsule apart and snort|s| the contents.', user) self.eat(itm, user, here) return Item.HANDLED_NONE *** *) (*Functions*gum* def use(self, itm, user, here): Ifc.msg('It smells of berries.') *** def used_as_weapon(self, itm, wielder, here, target, hit): Ifc.you('lunge|s| at %s with |your| gum in hand!' % Ifc.the_mon(target), wielder) if not hit: return if Utl.rn(wielder.dex) < Utl.rn(target.dex): self.eat(itm, target, None, wielder) itm.destroy() *** def eat(self, itm, eater, here, wielder=None): if eater is not g.player and not eater.rabid: return Item.RETURN_FALSE if here or eater.species.resist_polymorph: Ifc.you('swallow|s| the gum.', eater) if eater.species.resist_polymorph: Ifc.you("|are|n't affected.", eater) elif eater.resist_polymorph and not here: Ifc.your("watch|es| the gum land in |your| costume's fake mouth.", eater) else: Ifc.you("swell|s| up like a giant blueberry!", eater) if Utl.rn(): eater.species = th.data.Species.blueberry eater.reroll_stats() eater.stun(Utl.d(1, 6), 'stunned by an internal influx of blueberry juice') else: Ifc.you('burst|s| and die|s|!', eater) eater.damage(0, wielder, msg='exploding', setamt=1) return Item.RETURN_TRUE *** *) (*Functions*magnifying_glass* def use(self, itm, user, here): which = Ifc.choice('Examine what? ', user.inventory) if not which: return Item.RETURN_FALSE if user.int < 8: Ifc.you("don't see anything interesting.") else: if self._check_taint(user, which): Ifc.you('think everything is in good order.') else: Ifc.you('suspect that it may be defective.') return Item.HANDLED_NONE *** def _check_taint(self, user, which): if user.int < 14: if Utl.rn(3) == 0: return not which.tainted else: return which.tainted else: return which.tainted *** *) (*Functions*sack* def xmake(self, itm): itm.capacity = 9 itm.contents = [] while Utl.rn() and len(itm.contents) <= itm.capacity: itm.contents.append(Utl.rn_seq(all_items).make()) *** def use(self, itm, user, here): mode = Ifc.choice_str('Do what with the sack? ', ( 'Take something out.', 'Put something in.', 'Look in the sack.' ), cancel=1) if mode == -1: return Item.RETURN_FALSE elif mode == 0: if len(user.inventory) >= user.str: Ifc.you('are carrying too much stuff to take something out of the sack.') return Item.RETURN_FALSE elif not itm.contents: Ifc.msg('The sack is empty.') return Item.RETURN_FALSE which = Ifc.choice('Remove what from the sack? ', itm.contents) if not which: return Item.RETURN_FALSE itm.contents.remove(which) user.add(which) Ifc.you('remove the %s from the sack.' % which.kind.name) elif mode == 1: if len(itm.contents) >= itm.capacity: Ifc.you("don't think you can fit anything else in the sack.") return Item.RETURN_FALSE which = Ifc.choice('Put what in the sack? ', user.inventory) if not which: return Item.RETURN_FALSE if which.wielded and not user._try_unwield(which): return Item.RETURN_FALSE if which.worn and not user._try_unwear(which): return Item.RETURN_FALSE if itm is which: Ifc.you('watch the sack disappear in a poof of logic!') itm.destroy() if Utl.rn(): Ifc.you('attract some company from the management!') tmp = th.data.Species.garbage_collector.make(ai=th.Monster.WANDERING) here.add(tmp) Ifc.you('mutter|s| about circular references.', tmp) else: Ifc.you('put the %s in the sack.' % which.kind.name) user.inventory.remove(which) itm.contents.append(which) elif mode == 2: if not itm.contents: Ifc.msg('The sack is empty.') else: Ifc.you('see in the sack:') Ifc.msg(Ifc.show(itm.contents)) return Item.RETURN_FALSE return Item.HANDLED_NONE *** *) (*Functions*cage* def xmake(self, itm): itm.capacity = th.Monster.SMALL itm.used_space = 0 itm.contents = [] *** def use(self, itm, user, here): tmp = Ifc.choice_str('Do what with the cage? ', ( 'Remove a creature.', 'Put in a creature.', 'Look inside' ), cancel=1) if tmp == -1: return Item.RETURN_FALSE elif tmp == 0: if not itm.contents: Ifc.you('look in and realize the cage is empty.') return Item.RETURN_FALSE who = Ifc.choice('Let out who? ', itm.contents) if not who: return Item.RETURN_FALSE itm.contents.remove(who) here.add(who) itm.used_space -= who.species.size Ifc.you('let out %s.' % Ifc.the_mon(who)) elif tmp == 1: who = Ifc.choice('Put in who? ', here.mons) if not who: return Item.RETURN_FALSE if user is who: Ifc.you("can't be in the cage and carry it at the same time.") return Item.RETURN_FALSE if itm.used_space + who.species.size > itm.capacity: Ifc.you("can't fit this creature into the cage.") if who.species.size > capacity: Ifc.msg("It's simply too large.") else: Ifc.msg("It's already too crowded in the cage.") return Item.HANDLED_NONE if who.owner is not user and who.dex > user.dex + Utl.rn(-5): Ifc.you('evade|s| %s grasp!' % Ifc.the_mon(user, possessive=1), who) return Item.HANDLED_NONE elif who.owner is not user: Ifc.you("capture the %s!" % who.species.name) itm.contents.append(who) who.here.remove(who) who.here = None itm.used_space += who.species.size Ifc.you('put %s in the cage.' % Ifc.the_mon(who)) elif tmp == 2: if not itm.contents: Ifc.msg('The cage is empty.') else: Ifc.you('see in the cage:') Ifc.msg(Ifc.show(itm.contents)) return Item.RETURN_FALSE return Item.HANDLED_NONE *** *) (*Functions*whistle* def xmake(self, itm): itm.uses = Utl.d(3, 3) *** def monUse(self, itm, user, here): return user.species.smart and len(user.here.mons) > 1 and Utl.rn(4) == 0 *** def use(self, itm, user, here): Ifc.you('blow|s| the whistle.', user) if itm.tainted: Ifc.your('whistle produces an unpleasant buzzing squawk.', user) for m in here.mons: if m is user or m.owner is user: continue if not m is g.player and not m.species.boss and Utl.rn(m.int) + (3 if m.species.smart else 0) < 4 + (1 if user.int > 10 else -1): Ifc.you('|are| captivated by the aetherial sound!', m) m.ai = th.Monster.PET m.owner = user m.target = None elif m is not g.player and ((m.int > 10 and not m.species.peaceful) or itm.tainted or m.species.boss): Ifc.you('anger|s| %s with the sound!' % Ifc.the_mon(m), user) m.target = user else: Ifc.you('|are| irritated by the noise.', m) itm.uses -= 1 if itm.uses == 0: Ifc.your('whistle is starting to come apart.', user) itm.tainted = True elif itm.uses <= -4: Ifc.your('whistle falls apart.', user) itm.destroy() return Item.HANDLED_NONE *** *) (*Functions*novel* def monUse(self, itm, user, here): return user.species.smart *** def use(self, itm, user, here): if user is g.player: g.illiterate += 1 if user.int < 6: Ifc.you('|are| confused by the big words.', user) elif user.int < 10: Ifc.you('read|s| some of the turgid prose.', user) else: Ifc.you('wonder|s| aloud how this drivel got published.', user) *** *) (*Functions*wonka_whistle* def xmake(self, itm): itm.first_use = True itm.uses = Utl.d(2, 4) *** def use(self, itm, user, here): Ifc.you('blow|s| the brass whistle.', user) if itm.first_use: itm.first_use = False tmp = th.data.Species.oompa.make(name='Doompel Empa', ai=th.Monster.PET) here.add(tmp) Ifc.msg('You see an oompa-loompa enter the room, apparently summoned by the whistle.') Ifc.msg('He says: "Thank you for defeating the Dark One."') g.freed_oompas = Ifc.yn('"Will you now earn our eternal gratitude by setting us free?" ', True) if not g.freed_oompas: Ifc.msg("The oompa-loompa looks at you, his new master, with sadness in his eyes.") else: Ifc.msg(' "We oompa-loompas must now defeat our deluded brethren who are still') Ifc.msg('under the influence of the slavers, but we are eternally in your debt. Should') Ifc.msg('you ever need our aid on your righteous and noble quest, blow the whistle') Ifc.msg('and we shall come.') Ifc.msg(' "There is another thing, friend %s. Wonka trusted me' % g.player.species.name) Ifc.msg('with some secrets, and I wish to share them with you. The passageway in the') Ifc.msg('back of the ancient catacombs can be enlarged by pressing on a specific rock') Ifc.msg('outside it."') Ifc.msg('He goes on to explain where the rock is hidden.') for m in g.monsters: if m.species is th.data.Species.oompa: m.alignment = g.player.alignment m.target = None th.data.Species.oompa.alignment = tmp.alignment = g.player.alignment tmp.ai = th.Monster.WANDERING else: itm.uses -= 1 if g.freed_oompas: for x in xrange(Utl.d(1, 4)): here.add(th.data.Species.oompa.make()) else: here.add(th.data.Species.warrior_oompa.make(ai=th.Monster.PET, owner=user, name='Slave')) if itm.uses <= 0: Ifc.your('whistle unexpectedly falls apart!', user) itm.destroy() return Item.HANDLED_NONE *** *) (*Functions*fox_box* def xmake(self, itm): if Utl.rn(): params = dict( name='Millie', inventory=[overalls.make()], gender=2 ) else: params = dict( name='Ozy', inventory=[top_hat.make(), vest.make()], gender=1 ) fox = th.data.Species.fox.make(hp=1, **params) fox.setup_inventory() itm.fox = fox *** def use(self, itm, user, here): if not itm.fox: Ifc.msg('The tiny cage is empty and in unusably poor condition.') return Item.RETURN_FALSE fox_you, fox_your = Ifc.format('|you|', itm.fox), Ifc.format('|your|', itm.fox) if itm.fox.hp > 0: Ifc.msg("You open the cage and discover that it contains a Talking Fox.") Ifc.msg("Sadly, %s has been badly mistreated and appears to be only barely" % fox_you) Ifc.msg("clinging to life. You doubt %s will live much longer." % fox_you) else: Ifc.msg('You find a dead fox.') itm.fox = None here.add(fox_corpse.make()) return Item.HANDLED_NONE tmp = Ifc.choice_str('What will you do? ', ( 'Leave the fox in the box.', 'Remove the fox from the box.', "Treat the fox's injuries.", 'Euthanize the fox.' )) if tmp == 0: Ifc.msg('You leave the fox to die.') itm.fox.hp = 0 elif tmp == 1: if user.dex < Utl.rn(3, 6): Ifc.msg('Your clumsiness has cost this fox %s life. Whoops.' % fox_your) itm.fox.hp = 0 else: Ifc.msg('You carefully remove the fox from the box and as you set it down, it scampers away.') itm.fox = None g.incscore(50, 'You assisted in the escape of an abused fox.') elif tmp == 2: if user.int + user.dex < Utl.rn(2, 24): Ifc.msg("If you had expressed interest in becoming a doctor, this fox probably") Ifc.msg("would've advised you not to quit your day job. Unfortunately, that will") Ifc.msg("never happen as your incompetent work has finished off the fox for good.") g.incscore(-100, "Your attempt at surgery caused the painful death of a fox.") itm.fox.hp = 0 else: Ifc.msg('You manage to help the fox, earning %s eternal gratitude.' % fox_your) itm.fox.ai, itm.fox.hp, itm.fox.owner = th.Monster.PET, itm.fox.mhp / 2, user g.incscore(120, "You helped an injured fox regain %s strength." % fox_your) here.add(itm.fox) itm.fox = None elif tmp == 3: if user.wielded: if user.wielded.kind in (pencil, spork, magnifying_glass): Ifc.msg('Finishing off the fox with %s would not exactly be merciful.' % user.wielded.kind.adesc) elif user.wielded.kind in (stick, meter_stick): Ifc.msg("You don't think that a stick would provide painless euthanasia.") elif user.wielded.kind is screwdriver: Ifc.msg("You now know why Dr. Kevorkian did not use screwdrivers. That was messy.") itm.fox.hp = 0 g.incscore(-100, "You pointlessly maimed a helpless fluffy animal.") elif user.wielded.kind is novel: Ifc.msg("Even after reading the first three paragraphs, the novel fails to kill the fox.") elif user.wielded.kind is ball: Ifc.msg("You suspect that the ball you are wielding would not provide a swift death.") elif user.wielded.kind is textbook: Ifc.msg("Oh my. You don't think you'll ever get the stains out.") user.wielded.tainted = True itm.fox.hp = 0 g.incscore(-100, 'You pointlessly maimed a helpless fluffy animal.') elif user.wielded.kind in (mcookie, flask): Ifc.msg("You imagine overfeeding the fox would not be a painless death.") elif user.wielded.kind is gum: Ifc.msg("The fox won't open %s mouth enough for you to put the gum in." % fox_your) else: Ifc.msg("You swiftly kill the fox with your %s, ending %s suffering." % (user.wielded.kind.name, fox_your)) Ifc.msg("At least the poor creature is no longer in pain.") itm.fox.hp = 0 g.incscore(75, "You ended the suffering of a fox through euthanasia.") else: if user.str > 10: Ifc.msg("You quickly snap the fox's neck, ending %s suffering." % fox_your) Ifc.msg("At least the poor creature is no longer in pain.") itm.fox.hp = 0 g.incscore(75, "You ended the suffering of a fox through euthanasia.") else: Ifc.msg("You realize you aren't strong enough to kill the fox painlessly with your bare hands.") if itm.fox and itm.fox.hp <= 0: itm.fox.dead = True return Item.HANDLED_NONE *** *) (*Functions*nerf_sword* def used_as_weapon(self, itm, wielder, here, target, hit): if not hit or wielder.alignment >= 0: return tmp = Utl.rn(10) if tmp < 4: Ifc.your('foam-rubber blade shoots %s with noxious polymers!' % Ifc.the_mon(target), wielder) if not target.resist_chemical: target.dex -= 1 target.damage(10, wielder, msg='dangerous toys') elif tmp < 7: Ifc.your('foam-rubber blade nerfs %s!' % Ifc.the_mon(target), wielder) target.dex -= Utl.d(1, 6) target.str -= Utl.d(1, 6) target.int -= Utl.d(1, 6) elif tmp < 9: if target.wielded: Ifc.your('foam-rubber blade nerfs %s %s!' % (Ifc.the_mon(target, possessive=1), target.wielded.kind.name), wielder) if g.player.here is not here: Ifc.msg('A distant voice says: "Nerfed the %s!"' % target.wielded.kind.name) target.wielded.kind.damage /= 2 elif not (target.species.boss or target is g.player): Ifc.your('foam-rubber blade bisects %s!' % Ifc.the_mon(target), wielder) target.damage(0, wielder, msg='very dangerous toys', setamt=1) else: Ifc.your('foam-rubber blade nerfs all %ss!' % target.species.name, wielder) if g.player.here is not here: Ifc.msg('A distant voice says: "Nerfed the %s!"' % target.species.name) target.species.str -= Utl.rn(2) target.species.dex -= Utl.rn(2) target.species.int -= Utl.rn(2) target.species.hp -= Utl.rn(5) *** *) (*Functions*pen* def used_as_weapon(self, itm, wielder, here, target, hit): if not hit or wielder.alignment != 0: return if not target.species.boss and target.int < wielder.int + Utl.rn(-wielder.int / 2) and Utl.rn(3) == 0: Ifc.you('feel|s| drawn to %s!' % Ifc.the_mon(wielder), target) if not target.pc: target.ai, target.owner = th.Monster.PET, wielder if target.species.smart: Ifc.you('swear|s| loyalty to %s cause!' % Ifc.format('|your|', wielder), target) else: Ifc.you('|are| paralyzed by indecision!', target) target.stun(Utl.d(1, 3), 'mulling over a moral conflict') *** *) (*Functions*zaurus* def use(self, itm, user, here): if user.species.alignment <= 0: Ifc.you("|are| blasted by the PDA's power!", user) user.damage(Utl.d(2, 20), usearmor=0, msg='playing with a dangerous gadget') return Item.HANDLED_NONE if user.int + Utl.rn(6) < 12: Ifc.you('mess up really badly.') Ifc.your('Zaurus sends out a call for help!') here.add(th.data.Species.debugger.make(target=g.player, ai=th.Monster.ATTACKING)) return Item.HANDLED_NONE tmp = Ifc.choice_str('What would you like to do? ', ( 'View map.', 'Scan for life-forms.', 'Engage in introspection.', 'Fire an energy beam.' ), cancel=1) if tmp == -1: return Item.RETURN_FALSE elif tmp == 0: th.Map.show_map(20, 40, 0, False, True, True) Ifc.pk() elif tmp == 1: where = Ifc.gnsew('Aim it in which direction?', here) if not where: return Item.RETURN_FALSE if not where.mons: Ifc.your('Zaurus reports no life in the next room.') else: Ifc.your('Zaurus gives you a report:') Ifc.msg('\n### LIFEFORMS ###') for m in where.mons: Ifc.msg(' %s' % m.describe()) Ifc.msg('') Ifc.pk() elif tmp == 2: Ifc.your('Zaurus gives you a report:') Ifc.msg('\n### USER STATUS ###') Ifc.msg('Status of %s the %s level %d/%d %s:' % ( user.name, th.Monster.GENDER[user.gender], user.level, user.xp, user.species.name )) Ifc.msg(' You are %s aligned. (%d)' % ( th.Monster.ALIGNMENT[cmp(user.alignment, 0)], user.alignment )) Ifc.msg(' STR: %d/%d, INT: %d/%d, DEX: %d/%d, HP: %d/%d, RG: 1/%d, AR: %d' % ( user.str, user.mst, user.int, user.min, user.dex, user.mdx, user.hp, user.mhp, user.species.regeneration, user.armor )) Ifc.msg(' Murders: %d/%d; Cannibalism: %d; Peaceful attacks: %d' % ( g.murders, g.allow_murder, g.cannibal, g.peacefuls )) if user.resist_chemical: Ifc.msg(' You are chemical resistant.') if user.resist_bullets: Ifc.msg(' You are bullet resistant.') if user.resist_polymorph: Ifc.msg(' You are polymorph resistant.') if user.resist_gas: Ifc.msg(' You are poison gas resistant.') Ifc.msg('') Ifc.pk() elif tmp == 3: if len(here.mons) < 2: Ifc.you("don't see anyone here to zap.") return Item.RETURN_FALSE if Utl.rn(60) > user.int: Ifc.you("can't seem to get it to work.") else: which = Ifc.choice('Aim at whom? ', here.mons) if not which or which is g.player: return Item.RETURN_FALSE Ifc.your('Zaurus fires a beam of energy at %s!' % Ifc.the_mon(which), user) which.damage(Utl.d(8, 12), user, msg='a high-powered laser blast') return Item.HANDLED_NONE *** *) (*Functions*conical_hat* def monUse(self, itm, user, here): if user.species.boss: return False return True *** def use(self, itm, user, here): success = user.int + Utl.rn(-5) if success < 7 or itm.tainted: Ifc.you('experience|s| a transporter malfunction!', user) tmp = Utl.rn(4) if tmp == 0: if user.species.resist_polymorph: Ifc.you('shiver|s|.', user) else: spe = Utl.rn_seq(th.data.Species.all_creatures) Ifc.you('turn|s| into %s!' % spe.adesc, user) user.species = spe user.reroll_stats() if user is g.player: g.polymorphed += 1 user.damage(Utl.rn(10), usearmor=0, msg='incompatible biochemistry') elif tmp == 1: Ifc.you('become|s| embedded in the wall!', user) user.damage(0, msg='playing with a hat', setamt=1) elif tmp == 2: if not user.inventory: Ifc.you('feel|s| slightly queasy.', user) else: which = Utl.rn_seq(user.inventory) Ifc.your('%s turns to smoke and blows away.' % which.kind.name, user) which.destroy() else: Ifc.you('ha|ve| attracted some attention from the management!', user) here.add(th.data.Species.debugger.make()) here.add(th.data.Species.debugger.make()) here.add(th.data.Species.garbage_collector.make()) elif success < 12 or not itm.worn: Ifc.you('wait|s|, but nothing happens.', user) else: Ifc.you('disappear|s| in a flash of light!', user) where = Utl.rn_node(False, 0) here.mons.remove(user) where.add(user) if user is g.player: g.teleported += 1 Ifc.you('suddenly appear|s| in a flash of light!', user) return Item.HANDLED_NONE *** *) (*Functions*mirror* def use(self, itm, user, here): who = Ifc.choice('Aim the mirror at whom? ', here.mons) if not who: return Item.RETURN_FALSE Ifc.you('gaze|s| into the mirror...', who) Ifc.msg('%s -<%% The Most Awesome %s-kind in the Land %%>-%s' % (Ifc.color(Ifc.CYAN), who.species.name, Ifc.color())) mons = [] equals = superiors = 0 for m in g.monsters: if m.species is not who.species: continue mons.append(m) if m.level > who.level: superiors += 1 elif m.level == who.level: equals += 1 mons.sort(key=lambda m: m.xp, reverse=True) for m in mons[:5]: Ifc.msg(' * %s' % Ifc.the_mon(m)) Ifc.msg(' Level: %d, Kills: %d, Gender: %s' % (m.level, m.vanquished, th.Monster.GENDER[m.gender])) Ifc.msg(' Location: %s %s' % ('the' if m.here.unique else 'a', m.here.name)) if m.wielded: Ifc.msg(' Weapon: %s' % m.wielded.kind.adesc) Ifc.msg(' %s' % m.describe()) Ifc.msg('') if len(mons) == 1: Ifc.you('|are| unique among all beings.', who) elif superiors == 0 and equals == 0: Ifc.you('|are| the most awesome %s.' % who.species.name, who) elif superiors == 0: Ifc.you('|are| awesome, but %s equally awesome.' % ('another is' if equals == 1 else 'others are'), who) else: Ifc.you("|are|n't that impressive, really.", who) return Item.HANDLED_NONE *** *) (*Functions*scythe* def used_as_weapon(self, itm, wielder, here, target, hit): if not hit and not itm.blessed: Ifc.your('scythe continues its follow-through for you, ending its sweep in you!', wielder) wielder.damage(Utl.d(6, 6), usearmor=False, msg='a bloodthirsty scythe') *** *) (*Functions*briefcase* def used_as_weapon(self, itm, wielder, here, target, hit): if not hit: return if Utl.rn(4) == 0 and target.species.smart: Ifc.you('take|s| a document from the briefcase and show|s| it to %s!' % Ifc.the_mon(target), wielder) Ifc.you('|are| dumbfounded by the doubletalk of the document!', target) target.int -= Utl.rn(2) target.stun(Utl.rn(2), 'confused by obsfucated legal verbage') *** *) (*Functions*lab_coat* def use(self, itm, user, here): Ifc.you("examine the lab coat. There isn't a mongram.") return Item.RETURN_FALSE *** def wear(self, itm, wearer, here): if wearer.resist_chemical and not wearer.species.resist_chemical: if wearer is g.player: Ifc.you("can't help but think that wearing two lab coats would look awfully unprofessional.") return Item.RETURN_FALSE return Item.HANDLED_NONE *** def wield_action(self, itm, wearer, here): if wearer.species.alignment <= 0: Ifc.you('look|s| geeky.', wearer) else: Ifc.you('look|s| sharp.', wearer) *** def wield_update(self, itm, wearer, here): wearer.resist_chemical = True *** def unwield_update(self, itm, wearer, here): wearer.resist_chemical = wearer.species.resist_chemical *** *) (*Functions*mask* def use(self, itm, user, here): Ifc.you("examine the gas mask. It looks sound.") return Item.RETURN_FALSE *** def wear(self, itm, wearer, here): if wearer.resist_gas and not wearer.species.resist_gas: if wearer is g.player: Ifc.you("can't figure out how to fit one gask mask over the other.") return Item.RETURN_FALSE return Item.HANDLED_NONE *** def wield_update(self, itm, wearer, here): wearer.resist_gas = True *** def unwield_update(self, itm, wearer, here): wearer.resist_gas = wearer.species.resist_gas *** *) (*Functions*furry_costume* def xmake(self, itm): itm.costume = Utl.rn_seq(th.data.Species.one_of_everything).adesc *** def use(self, itm, user, here): Ifc.msg('This is a costume of %s.' % itm.costume) return Item.RETURN_FALSE *** def wear(self, itm, wearer, here): if wearer.armor > 3: if wearer is g.player: Ifc.you('are wearing too much armor to wear a costume over all of it.') return Item.RETURN_FALSE elif wearer.resist_polymorph and not wearer.species.resist_polymorph: if wearer is g.player: Ifc.you("don't want to try to fit another costume over your first.") return Item.RETURN_FALSE return Item.HANDLED_NONE *** def wield_update(self, itm, wearer, here): wearer.resist_polymorph = True *** def unwield_update(self, itm, wearer, here): wearer.resist_polymorph = wearer.species.resist_polymorph *** *) (*Functions*bulletproof_vest* def wear(self, itm, wearer, here): if wearer.resist_bullets and not wearer.species.resist_bullets: if wearer is g.player: Ifc.you("realize that the bulletproof vests are far too bulky to wear two at once.") return Item.RETURN_FALSE return Item.HANDLED_NONE *** def wield_action(self, itm, wearer, here): if wearer.species.alignment >= 0: Ifc.you('look|s| paranoid.', wearer) else: Ifc.you('look|s| tough.', wearer) *** def wield_update(self, itm, wearer, here): wearer.resist_bullets = True *** def unwield_update(self, itm, wearer, here): wearer.resist_bullets = wearer.species.resist_bullets *** *) (*Functions*spock_ears* def xmake(self, itm): itm.orig_alignment = 0 *** def wear(self, itm, wearer, here): if wearer.alignment > 0: if wearer is g.player: Ifc.you('look geeky enough as it is!', wearer) return Item.RETURN_FALSE return Item.HANDLED_NONE *** def wield_action(self, itm, wearer, here): if wearer.alignment == 0: Ifc.you('look|s| like a trekkie.', wearer) else: Ifc.you('look|s| like a nerd.', wearer) *** def wield_update(self, itm, wearer, here): itm.orig_alignment, wearer.alignment = wearer.alignment, 10 *** def unwield_update(self, itm, wearer, here): wearer.alignment = itm.orig_alignment *** *) (*Functions*pencil* def wield_action(self, itm, wielder, here): Ifc.you("stab|s| |your|self with the pencil's point.", wielder) wielder.damage(1, msg='carelessness with a pencil.') *** *)