#!/usr/bin/ruby require "itemappearance.rb" class ElSpellbookAppearance < ElItemAppearance def initialize(appearance) super(:spellbook, appearance) spellbooks = [ # identity level [:detect_monsters, 1], [:force_bolt, 1], [:healing, 1], [:jumping, 1], [:knock, 1], [:light, 1], [:protection, 1], [:sleep, 1], [:confuse_monster, 2], [:create_monster, 2], [:cure_blindness, 2], [:detect_food, 2], [:drain_life, 2], [:magic_missile, 2], [:slow_monster, 2], [:wizard_lock, 2], [:cause_fear, 3], [:charm_monster, 3], [:clairvoyance, 3], [:cure_sickness, 3], [:detect_unseen, 3], [:extra_healing, 3], [:haste_self, 3], [:identify, 3], [:remove_curse, 3], [:stone_to_flesh, 3], [:cone_of_cold, 4], [:detect_treasure, 4], [:fireball, 4], [:invisibility, 4], [:levitation, 4], [:restore_ability, 4], [:dig, 5], [:magic_mapping, 5], [:create_familiar, 6], [:polymorph, 6], [:teleport_away, 6], [:turn_undead, 6], [:cancellation, 7], [:finger_of_death, 7] ] @possible_identities = {} spellbooks.each {|spellbook| @possible_identities[spellbook[0]] = 0 } @price_of = {} spellbooks.each {|spellbook| @price_of[spellbook[0]] = 100 * spellbook[1] } end end ElSpellbookAppearance.new("plain").identify_as(:blank_paper) ElSpellbookAppearance.new("papyrus").identify_as(:Book_of_the_Dead) for i in ["parchment", "vellum", "ragged", "dog eared", "mottled", "stained", "cloth", "leather", "white", "pink", "red", "orange", "yellow", "velvet", "light green", "dark green", "turquoise", "cyan", "light blue", "dark blue", "indigo", "magenta", "purple", "violet", "tan", "plaid", "light brown", "dark brown", "gray", "wrinkled", "dusty", "bronze", "copper", "silver", "gold", "glittering", "shining", "dull", "thin", "thick"] ElSpellbookAppearance.new(i) end if __FILE__ == $0 require "../utils/assert.rb" print "unit test succeeded\n" end