#!/usr/bin/ruby require "itemappearance.rb" class ElAmuletAppearance < ElItemAppearance def initialize(appearance) super(:amulet, appearance) amulets = [ # identity price [:change, 150], [:ESP, 150], [:life_saving, 150], [:magical_breathing, 150], [:reflection, 150], [:restful_sleep, 150], [:strangulation, 150], [:unchanging, 150], [:versus_poison, 150], [:fake_Amulet, 0], [:Amulet_of_Yendor, 30000], ] @possible_identities = {} amulets.each {|amulet| @possible_identities[amulet[0]] = 0 } @price_of = {} amulets.each {|amulet| @price_of[amulet[0]] = amulet[1] } end # all normal amulets are the same price, AoY would make price_id_useful? # return true, so we override it def price_id_useful?() return false end end # there's a potential problem with the fake AoYs that appear late in the # game, whose appearance are also "Amulet of Yendor"... guess we have to # special-case the AoY then! ElAmuletAppearance.new("cheap plastic imitation of the Amulet of Yendor").identify_as(:fake_Amulet) ElAmuletAppearance.new("Amulet of Yendor").identify_as(:Amulet_of_Yendor) for i in ["circular", "spherical", "oval", "triangular", "pyramidal", "square", "concave", "hexagonal", "octagonal"] ElAmuletAppearance.new(i) end if __FILE__ == $0 require "../utils/assert.rb" print "unit test succeeded\n" end