1 2local wishtest_objects = { 3 ["a rock"] = { otyp_name = "rock", quan = 1, oclass = "*" }, 4 ["a gold piece"] = { otyp_name = "gold piece", quan = 1, oclass = "$" }, 5 ["2 zorkmids"] = { otyp_name = "gold piece", quan = 2, oclass = "$" }, 6 ["2 worthless pieces of red glass"] = { otyp_name = "worthless piece of red glass", quan = 2, oclass = "*" }, 7 ["red glass"] = { otyp_name = "worthless piece of red glass", quan = 1, oclass = "*" }, 8 ["red gem"] = { otyp_descr = "red", oclass = "*" }, 9 ["orange gem"] = { otyp_descr = "orange", oclass = "*" }, 10 ["5 +3 blessed silver daggers"] = { otyp_name = "dagger", blessed = 1, cursed = 0, spe = 3, quan = 5 }, 11 ["an empty locked large box"] = { otyp_name = "large box", is_container = 1, has_contents = 0, olocked = 1 }, 12 ["an empty trapped unlocked chest"] = { otyp_name = "chest", is_container = 1, has_contents = 0, olocked = 0, otrapped = 1 }, 13 ["an empty untrapped locked chest"] = { otyp_name = "chest", is_container = 1, has_contents = 0, olocked = 1, otrapped = 0 }, 14 ["an empty locked broken chest"] = { otyp_name = "chest", is_container = 1, has_contents = 0, olocked = 0, obroken = 1 }, 15 ["broken empty chest"] = { otyp_name = "chest", obroken = 1 }, 16 ["potion of holy water"] = { otyp_name = "water", oclass = "!", blessed = 1, cursed = 0 }, 17 ["potion of unholy water"] = { otyp_name = "water", oclass = "!", blessed = 0, cursed = 1 }, 18 ["cursed greased +2 grey dragon scales"] = { otyp_name = "gray dragon scales", oclass = "[", blessed = 0, cursed = 1, spe = 2, greased = 1 }, 19 ["+1 yellow dragon scales"] = { otyp_name = "yellow dragon scales", oclass = "[", spe = 1 }, 20 ["uncursed magic marker (11)"] = { otyp_name = "magic marker", blessed = 0, cursed = 0, spe = 11 }, 21 ["wand of locking (1:5)"] = { otyp_name = "locking", oclass = "/", recharged = 1, spe = 5 }, 22 ["wand of opening (0:4)"] = { otyp_name = "opening", oclass = "/", recharged = 0, spe = 4 }, 23 ["lit oil lamp"] = { otyp_name = "oil lamp", lamplit = 1 }, 24 ["oil lamp (lit)"] = { otyp_name = "oil lamp", lamplit = 1 }, 25 ["6 burning tallow candles"] = { otyp_name = "tallow candle", lamplit = 1, quan = 6 }, 26 ["unlit oil lamp"] = { otyp_name = "oil lamp", lamplit = 0 }, 27 ["7 extinguished wax candles"] = { otyp_name = "wax candle", lamplit = 0, quan = 7 }, 28 ["2 blank scrolls"] = { otyp_name = "blank paper", quan = 2 }, 29 ["3 unlabeled scrolls"] = { otyp_name = "blank paper", quan = 3 }, 30 ["1 unlabelled scroll"] = { otyp_name = "blank paper", quan = 1 }, 31 ["blank spellbook"] = { otyp_name = "blank paper", oclass = "+" }, 32 ["unlabeled spellbook"] = { otyp_name = "blank paper", oclass = "+" }, 33 ["unlabelled spellbook"] = { otyp_name = "blank paper", oclass = "+" }, 34 ["3 rusty poisoned darts"] = { otyp_name = "dart", quan = 3, opoisoned = 1, oeroded = 1 }, 35 ["4 dark green potions"] = { otyp_descr = "dark green", oclass = "!", quan = 4 }, 36 ["4 diluted booze potions named whisky"] = { otyp_name = "booze", oclass = "!", quan = 4, odiluted = 1, has_oname = 1, oname = "whisky" }, 37 ["poisoned food ration"] = { otyp_name = "food ration", oclass = "%", age = 1 }, 38 ["empty tin"] = { otyp_name = "tin", oclass = "%", corpsenm = -1, spe = 0 }, 39 ["blessed tin of spinach"] = { otyp_name = "tin", oclass = "%", corpsenm = -1, spe = 1, blessed = 1 }, 40 ["spinach"] = { otyp_name = "tin", oclass = "%", corpsenm = -1, spe = 1 }, 41 ["trapped tin of floating eye meat"] = { otyp_name = "tin", oclass = "%", otrapped = 1, corpsenm_name = "floating eye" }, 42 ["hill orc corpse"] = { otyp_name = "corpse", oclass = "%", corpsenm_name = "hill orc" }, 43 ["destroy armor"] = { otyp_name = "destroy armor", oclass = "?" }, 44 ["enchant weapon"] = { otyp_name = "enchant weapon", oclass = "?" }, 45 ["scroll of food detection"] = { otyp_name = "food detection", oclass = "?" }, 46 ["scroll of detect food"] = { otyp_name = "food detection", oclass = "?" }, 47 ["2 scrolls of charging"] = { otyp_name = "charging", oclass = "?", quan = 2 }, 48 ["spellbook of food detection"] = { otyp_name = "detect food", oclass = "+" }, 49 ["spell"] = { NO_OBJ = 1 }, 50 ["-1 ring mail"] = { otyp_name = "ring mail", oclass = "[", spe = -1 }, 51 ["studded armor"] = { otyp_name = "studded armor", oclass = "[" }, 52 ["light armor"] = { otyp_name = "light armor", oclass = "[" }, 53 ["plate armor"] = { otyp_name = "plate mail", oclass = "[" }, 54 ["speed boots"] = { otyp_name = "speed boots", oclass = "[" }, 55 ["speedboots"] = { otyp_name = "speed boots", oclass = "[" }, 56 ["erodeproof speedboots"] = { otyp_name = "speed boots", oclass = "[", oerodeproof = 1 }, 57 ["fixed boots of speed"] = { otyp_name = "speed boots", oclass = "[", oerodeproof = 1 }, 58 ["blessed fireproof +2 pair of speed boots"] = { otyp_name = "speed boots", oclass = "[", oerodeproof = 1, blessed = 1, spe = 2 }, 59 ["tooled horn"] = { otyp_name = "tooled horn", oclass = "(" }, 60 ["meat ring"] = { otyp_name = "meat ring", oclass = "%" }, 61 ["beartrap"] = { otyp_name = "beartrap", oclass = "(" }, 62 ["bear trap"] = { otyp_name = "beartrap", oclass = "(" }, 63 ["landmine"] = { otyp_name = "land mine", oclass = "(" }, 64 ["land mine"] = { otyp_name = "land mine", oclass = "(" }, 65 ["bag of tricks"] = { otyp_name = "bag of tricks", oclass = "(" }, 66 ["bags of tricks"] = { otyp_name = "bag of tricks", oclass = "(" }, 67 ["sprig of wolfsbane"] = { otyp_name = "sprig of wolfsbane", oclass = "%" }, 68 ["wolfsbane"] = { otyp_name = "sprig of wolfsbane", oclass = "%" }, 69 ["clove of garlic"] = { otyp_name = "clove of garlic", oclass = "%" }, 70 ["garlic"] = { otyp_name = "clove of garlic", oclass = "%" }, 71 ["lump of royal jelly"] = { otyp_name = "lump of royal jelly", oclass = "%" }, 72 ["royal jelly"] = { otyp_name = "lump of royal jelly", oclass = "%" }, 73 ["blessed historic statue of woodland-elf named Foo"] = { otyp_name = "statue", blessed = 1, historic = 1, corpsenm_name = "Woodland-elf", oname = "Foo" }, 74 ["blessed figurine of a ki-rin"] = { otyp_name = "figurine", blessed = 1, corpsenm_name = "ki-rin" }, 75 ["partly eaten orange"] = { otyp_name = "orange", oclass = "%", oeaten = function () 76 local oc = obj.class(obj.new("orange")); 77 return (oc.nutrition // 2); 78 end }, 79 ["water"] = { otyp_name = "water", oclass = "!" }, -- shouldn't ever give scroll of water 80 ["gold silver dragon statue"] = { otyp_name = "statue", corpsenm_name = "silver dragon" }, 81 -- Note that this will cause the PYEC to exist. The script can't be loaded again. 82 ["platinum yendorian express card"] = { otyp_name = "credit card", has_oname = 1, oname = "The Platinum Yendorian Express Card" }, 83 ["wax candle"] = { otyp_name = "wax candle" }, 84 ["10 gold"] = { otyp_name = "gold piece", quan = 10 }, 85 ["copper ring"] = { oclass = "=", otyp_descr = "copper" }, 86 ["silver spellbook"] = { oclass = "+", otyp_descr = "silver" }, 87 ["gold wand"] = { oclass = "/", otyp_descr = "gold" }, -- may fail if gold wands don't exist in this particular game... 88}; 89 90for str, tbl in pairs(wishtest_objects) do 91 local o = obj.new(str):totable(); 92 for field, value in pairs(tbl) do 93 local val; 94 if (type(value) == "function") then 95 val = value(); 96 else 97 val = value; 98 end 99 if (o[field] ~= val) then 100 error("wished " .. str .. ", but " .. field .. " is " .. o[field] .. ", not " .. val); 101 end 102 end 103end 104