Refactored Items to one concise table and factory. Added credits texts.
This commit is contained in:
parent
7af2425c9f
commit
bbd52c780d
|
@ -4,7 +4,7 @@ import logging
|
|||
|
||||
class World(object):
|
||||
|
||||
def __init__(self, shuffle, logic, mode, difficulty, goal):
|
||||
def __init__(self, shuffle, logic, mode, difficulty, goal, place_dungeon_items):
|
||||
self.shuffle = shuffle
|
||||
self.logic = logic
|
||||
self.mode = mode
|
||||
|
@ -22,7 +22,7 @@ class World(object):
|
|||
self._location_cache = {}
|
||||
self._item_cache = {}
|
||||
self.spoiler = ''
|
||||
self.place_dungeon_items = True # configurable in future
|
||||
self.place_dungeon_items = place_dungeon_items # configurable in future
|
||||
self.agahnim_fix_required = False
|
||||
self.swamp_patch_required = False
|
||||
|
||||
|
@ -432,14 +432,21 @@ class Location(object):
|
|||
return '%s' % self.name
|
||||
|
||||
|
||||
class Item(object):
|
||||
class Item(object):
|
||||
|
||||
def __init__(self, name='', advancement=False, key=False, code=None):
|
||||
def __init__(self, name='', advancement=False, key=False, crystal=False, code=None, altar_hint=None, altar_credit=None, sickkid_credit=None, zora_credit=None, witch_credit=None, fluteboy_credit=None):
|
||||
self.name = name
|
||||
self.advancement = advancement
|
||||
self.key = key
|
||||
self.location = None
|
||||
self.crystal = crystal
|
||||
self.altar_hint_text = altar_hint
|
||||
self.altar_credit_text = altar_credit
|
||||
self.sickkid_credit_text = sickkid_credit
|
||||
self.zora_credit_text = zora_credit
|
||||
self.magicshop_credit_text = witch_credit
|
||||
self.fluteboy_credit_text = fluteboy_credit
|
||||
self.code = code
|
||||
self.location = None
|
||||
|
||||
def __str__(self):
|
||||
return str(self.__unicode__())
|
||||
|
|
30
Dungeons.py
30
Dungeons.py
|
@ -1,27 +1,27 @@
|
|||
from Items import *
|
||||
from Items import ItemFactory
|
||||
import random
|
||||
from BaseClasses import CollectionState
|
||||
|
||||
|
||||
def fill_dungeons(world):
|
||||
ES = (['Hyrule Castle'], None, [ESSmallKey()], [ESMap()])
|
||||
EP = (['Eastern Palace'], EPBigKey(), [], [EPMap(), EPCompass()])
|
||||
DP = (['Desert Palace Main', 'Desert Palace East', 'Desert Palace North'], DPBigKey(), [DPSmallKey()], [DPCompass(), DPMap()])
|
||||
ToH = (['Tower of Hera (Bottom)', 'Tower of Hera (Basement)', 'Tower of Hera (Top)'], THBigKey(), [THSmallKey()], [THCompass(), THMap()])
|
||||
AT = (['Agahnims Tower', 'Agahnim 1'], None, [ATSmallKey(), ATSmallKey()], [])
|
||||
PoD = (['Dark Palace (Entrance)', 'Dark Palace (Center)', 'Dark Palace (Big Key Chest)', 'Dark Palace (Bonk Section)', 'Dark Palace (North)', 'Dark Palace (Maze)', 'Dark Palace (Spike Statue Room)', 'Dark Palace (Final Section)'], PDBigKey(), [PDSmallKey(), PDSmallKey(), PDSmallKey(), PDSmallKey(), PDSmallKey(), PDSmallKey()], [PDCompass(), PDMap()])
|
||||
TT = (['Thieves Town (Entrance)', 'Thieves Town (Deep)', 'Blind Fight'], TTBigKey(), [TTSmallKey()], [TTCompass(), TTMap()])
|
||||
SW = (['Skull Woods First Section', 'Skull Woods Second Section', 'Skull Woods Final Section (Entrance)', 'Skull Woods Final Section (Mothula)'], SWBigKey(), [SWSmallKey(), SWSmallKey()], [SWCompass(), SWMap()])
|
||||
SP = (['Swamp Palace (Entrance)', 'Swamp Palace (First Room)', 'Swamp Palace (Starting Area)', 'Swamp Palace (Center)', 'Swamp Palace (North)'], SPBigKey(), [SPSmallKey()], [SPMap(), SPCompass()])
|
||||
IP = (['Ice Palace (Entrance)', 'Ice Palace (Main)', 'Ice Palace (East)', 'Ice Palace (East Top)', 'Ice Palace (Kholdstare)'], IPBigKey(), [IPSmallKey(), IPSmallKey()], [IPMap(), IPCompass()])
|
||||
MM = (['Misery Mire (Entrance)', 'Misery Mire (Main)', 'Misery Mire (West)', 'Misery Mire (Final Area)', 'Misery Mire (Vitreous)'], MMBigKey(), [MMSmallKey(), MMSmallKey(), MMSmallKey()], [MMCompass(), MMMap()])
|
||||
TR = (['Turtle Rock (Entrance)', 'Turtle Rock (First Section)', 'Turtle Rock (Chain Chomp Room)', 'Turtle Rock (Second Section)', 'Turtle Rock (Big Chest)', 'Turtle Rock (Roller Switch Room)', 'Turtle Rock (Dark Room)', 'Turtle Rock (Eye Bridge)', 'Turtle Rock (Trinexx)'], TRBigKey(), [TRSmallKey(), TRSmallKey(), TRSmallKey(), TRSmallKey()], [TRMap(), TRCompass()])
|
||||
GT = (['Ganons Tower (Entrance)', 'Ganons Tower (Tile Room)', 'Ganons Tower (Compass Room)', 'Ganons Tower (Hookshot Room)', 'Ganons Tower (Map Room)', 'Ganons Tower (Firesnake Room)', 'Ganons Tower (Teleport Room)', 'Ganons Tower (Bottom)', 'Ganons Tower (Top)', 'Ganons Tower (Before Moldorm)', 'Ganons Tower (Moldorm)', 'Agahnim 2'], GTBigKey(), [GTSmallKey(), GTSmallKey(), GTSmallKey(), GTSmallKey()], [GTMap(), GTCompass()])
|
||||
ES = (['Hyrule Castle'], None, [ItemFactory('Small Key (Escape)')], [ItemFactory('Map (Escape)')])
|
||||
EP = (['Eastern Palace'], ItemFactory('Big Key (Eastern Palace)'), [], ItemFactory(['Map (Eastern Palace)', 'Compass (Eastern Palace)']))
|
||||
DP = (['Desert Palace Main', 'Desert Palace East', 'Desert Palace North'], ItemFactory('Big Key (Desert Palace)'), [ItemFactory('Small Key (Desert Palace)')], ItemFactory(['Map (Desert Palace)', 'Compass (Desert Palace)']))
|
||||
ToH = (['Tower of Hera (Bottom)', 'Tower of Hera (Basement)', 'Tower of Hera (Top)'], ItemFactory('Big Key (Tower of Hera)'), [ItemFactory('Small Key (Tower of Hera)')], ItemFactory(['Map (Tower of Hera)', 'Compass (Tower of Hera)']))
|
||||
AT = (['Agahnims Tower', 'Agahnim 1'], None, ItemFactory(['Small Key (Agahnims Tower)'] * 2), [])
|
||||
PoD = (['Dark Palace (Entrance)', 'Dark Palace (Center)', 'Dark Palace (Big Key Chest)', 'Dark Palace (Bonk Section)', 'Dark Palace (North)', 'Dark Palace (Maze)', 'Dark Palace (Spike Statue Room)', 'Dark Palace (Final Section)'], ItemFactory('Big Key (Palace of Darkness)'), ItemFactory(['Small Key (Palace of Darkness)'] * 6), ItemFactory(['Map (Palace of Darkness)', 'Compass (Palace of Darkness)']))
|
||||
TT = (['Thieves Town (Entrance)', 'Thieves Town (Deep)', 'Blind Fight'], ItemFactory('Big Key (Thieves Town)'), [ItemFactory('Small Key (Thieves Town)')], ItemFactory(['Map (Thieves Town)', 'Compass (Thieves Town)']))
|
||||
SW = (['Skull Woods First Section', 'Skull Woods Second Section', 'Skull Woods Final Section (Entrance)', 'Skull Woods Final Section (Mothula)'], ItemFactory('Big Key (Skull Woods)'), ItemFactory(['Small Key (Skull Woods)'] * 2), ItemFactory(['Map (Skull Woods)', 'Compass (Skull Woods)']))
|
||||
SP = (['Swamp Palace (Entrance)', 'Swamp Palace (First Room)', 'Swamp Palace (Starting Area)', 'Swamp Palace (Center)', 'Swamp Palace (North)'], ItemFactory('Big Key (Swamp Palace)'), [ItemFactory('Small Key (Swamp Palace)')], ItemFactory(['Map (Swamp Palace)', 'Compass (Swamp Palace)']))
|
||||
IP = (['Ice Palace (Entrance)', 'Ice Palace (Main)', 'Ice Palace (East)', 'Ice Palace (East Top)', 'Ice Palace (Kholdstare)'], ItemFactory('Big Key (Ice Palace)'), ItemFactory(['Small Key (Ice Palace)'] * 2), ItemFactory(['Map (Ice Palace)', 'Compass (Ice Palace)']))
|
||||
MM = (['Misery Mire (Entrance)', 'Misery Mire (Main)', 'Misery Mire (West)', 'Misery Mire (Final Area)', 'Misery Mire (Vitreous)'], ItemFactory('Big Key (Misery Mire)'), ItemFactory(['Small Key (Misery Mire)'] * 3), ItemFactory(['Map (Misery Mire)', 'Compass (Misery Mire)']))
|
||||
TR = (['Turtle Rock (Entrance)', 'Turtle Rock (First Section)', 'Turtle Rock (Chain Chomp Room)', 'Turtle Rock (Second Section)', 'Turtle Rock (Big Chest)', 'Turtle Rock (Roller Switch Room)', 'Turtle Rock (Dark Room)', 'Turtle Rock (Eye Bridge)', 'Turtle Rock (Trinexx)'], ItemFactory('Big Key (Turtle Rock)'), ItemFactory(['Small Key (Turtle Rock)'] * 4), ItemFactory(['Map (Turtle Rock)', 'Compass (Turtle Rock)']))
|
||||
GT = (['Ganons Tower (Entrance)', 'Ganons Tower (Tile Room)', 'Ganons Tower (Compass Room)', 'Ganons Tower (Hookshot Room)', 'Ganons Tower (Map Room)', 'Ganons Tower (Firesnake Room)', 'Ganons Tower (Teleport Room)', 'Ganons Tower (Bottom)', 'Ganons Tower (Top)', 'Ganons Tower (Before Moldorm)', 'Ganons Tower (Moldorm)', 'Agahnim 2'], ItemFactory('Big Key (Ganons Tower)'), ItemFactory(['Small Key (Ganons Tower)'] * 4), ItemFactory(['Map (Ganons Tower)', 'Compass (Ganons Tower)']))
|
||||
|
||||
freebes = ['[dungeon-A2-1F] Ganons Tower - Map Room', '[dungeon-D1-1F] Dark Palace - Spike Statue Room', '[dungeon-D1-1F] Dark Palace - Big Key Room']
|
||||
|
||||
# this key is in a fixed location (for now)
|
||||
world.push_item(world.get_location('[dungeon - D3 - B1] Skull Woods - South of Big Chest'), SWSmallKey(), False)
|
||||
world.push_item(world.get_location('[dungeon - D3 - B1] Skull Woods - South of Big Chest'), ItemFactory('Small Key (Skull Woods)'), False)
|
||||
|
||||
for dungeon_regions, big_key, small_keys, dungeon_items in [TR, ES, EP, DP, ToH, AT, PoD, TT, SW, SP, IP, MM, GT]:
|
||||
# this is what we need to fill
|
||||
|
|
748
Items.py
748
Items.py
|
@ -1,604 +1,148 @@
|
|||
from BaseClasses import Item
|
||||
import random
|
||||
|
||||
|
||||
class Bow(Item):
|
||||
|
||||
def __init__(self):
|
||||
super(Bow, self).__init__('Bow', True, code=0x0B)
|
||||
|
||||
|
||||
class Book(Item):
|
||||
|
||||
def __init__(self):
|
||||
super(Book, self).__init__('Book of Mudora', True, code=0x1D)
|
||||
|
||||
|
||||
class Hammer(Item):
|
||||
|
||||
def __init__(self):
|
||||
super(Hammer, self).__init__('Hammer', True, code=0x09)
|
||||
|
||||
|
||||
class Hookshot(Item):
|
||||
|
||||
def __init__(self):
|
||||
super(Hookshot, self).__init__('Hookshot', True, code=0x0A)
|
||||
|
||||
|
||||
class Mirror(Item):
|
||||
|
||||
def __init__(self):
|
||||
super(Mirror, self).__init__('Magic Mirror', True, code=0x1A)
|
||||
|
||||
|
||||
class Ocarina(Item):
|
||||
def __init__(self):
|
||||
super(Ocarina, self).__init__('Ocarina', True, code=0x14)
|
||||
|
||||
|
||||
class Boots(Item):
|
||||
def __init__(self):
|
||||
super(Boots, self).__init__('Pegasus Boots', True, code=0x4B)
|
||||
|
||||
|
||||
class Glove(Item):
|
||||
def __init__(self):
|
||||
super(Glove, self).__init__('Power Glove', True, code=0x1B)
|
||||
|
||||
|
||||
class Cape(Item):
|
||||
def __init__(self):
|
||||
super(Cape, self).__init__('Cape', True, code=0x19)
|
||||
|
||||
|
||||
class Mushroom(Item):
|
||||
def __init__(self):
|
||||
super(Mushroom, self).__init__('Mushroom', True, code=0x29)
|
||||
|
||||
|
||||
class Shovel(Item):
|
||||
def __init__(self):
|
||||
super(Shovel, self).__init__('Shovel', True, code=0x13)
|
||||
|
||||
|
||||
class Lamp(Item):
|
||||
def __init__(self):
|
||||
super(Lamp, self).__init__('Lamp', True, code=0x12)
|
||||
|
||||
|
||||
class Powder(Item):
|
||||
def __init__(self):
|
||||
super(Powder, self).__init__('Magic Powder', True, code=0x0D)
|
||||
|
||||
|
||||
class Pearl(Item):
|
||||
def __init__(self):
|
||||
super(Pearl, self).__init__('Moon Pearl', True, code=0x1F)
|
||||
|
||||
|
||||
class Somaria(Item):
|
||||
def __init__(self):
|
||||
super(Somaria, self).__init__('Cane of Somaria', True, code=0x15)
|
||||
|
||||
|
||||
class FireRod(Item):
|
||||
def __init__(self):
|
||||
super(FireRod, self).__init__('Fire Rod', True, code=0x07)
|
||||
|
||||
|
||||
class Flippers(Item):
|
||||
def __init__(self):
|
||||
super(Flippers, self).__init__('Flippers', True, code=0x1E)
|
||||
|
||||
|
||||
class IceRod(Item):
|
||||
def __init__(self):
|
||||
super(IceRod, self).__init__('Ice Rod', True, code=0x08)
|
||||
|
||||
|
||||
class Mitts(Item):
|
||||
def __init__(self):
|
||||
super(Mitts, self).__init__("Titans Mitts", True, code=0x1C)
|
||||
|
||||
|
||||
class Ether(Item):
|
||||
def __init__(self):
|
||||
super(Ether, self).__init__('Ether', True, code=0x10)
|
||||
|
||||
|
||||
class Bombos(Item):
|
||||
def __init__(self):
|
||||
super(Bombos, self).__init__('Bombos', True, code=0x0F)
|
||||
|
||||
|
||||
class Quake(Item):
|
||||
def __init__(self):
|
||||
super(Quake, self).__init__('Quake', True, code=0x11)
|
||||
|
||||
|
||||
class Bottle(Item):
|
||||
def __init__(self):
|
||||
super(Bottle, self).__init__('Bottle', True, code=[0x16, 0x2B, 0x2C, 0x2D, 0x3C, 0x3D, 0x48][random.randint(0, 6)])
|
||||
|
||||
|
||||
class MasterSword(Item):
|
||||
def __init__(self):
|
||||
super(MasterSword, self).__init__('Master Sword', True, code=0x50)
|
||||
|
||||
|
||||
class TemperedSword(Item):
|
||||
def __init__(self):
|
||||
super(TemperedSword, self).__init__('Tempered Sword', True, code=0x02)
|
||||
|
||||
|
||||
class FighterSword(Item):
|
||||
def __init__(self):
|
||||
super(FighterSword, self).__init__('Fighter Sword', True, code=0x49)
|
||||
|
||||
|
||||
class GoldenSword(Item):
|
||||
def __init__(self):
|
||||
super(GoldenSword, self).__init__('GoldenSword', True, code=0x03)
|
||||
|
||||
|
||||
class ProgressiveSword(Item):
|
||||
def __init__(self):
|
||||
super(ProgressiveSword, self).__init__('Progressive Sword', True, code=0x5E)
|
||||
|
||||
|
||||
class ProgressiveGlove(Item):
|
||||
def __init__(self):
|
||||
super(ProgressiveGlove, self).__init__('Progressive Glove', True, code=0x61)
|
||||
|
||||
|
||||
class SilverArrows(Item):
|
||||
def __init__(self):
|
||||
super(SilverArrows, self).__init__('Silver Arrows', True, code=0x58)
|
||||
|
||||
|
||||
class GreenPendant(Item):
|
||||
def __init__(self):
|
||||
super(GreenPendant, self).__init__('Green Pendant', True, code=[0x04, 0x38, 0x60, 0x00, 0x69, 0x01])
|
||||
|
||||
|
||||
class RedPendant(Item):
|
||||
def __init__(self):
|
||||
super(RedPendant, self).__init__('Red Pendant', True, code=[0x02, 0x34, 0x60, 0x00, 0x69, 0x02])
|
||||
|
||||
|
||||
class BluePendant(Item):
|
||||
def __init__(self):
|
||||
super(BluePendant, self).__init__('Blue Pendant', True, code=[0x01, 0x32, 0x60, 0x00, 0x69, 0x03])
|
||||
|
||||
|
||||
class Triforce(Item):
|
||||
def __init__(self):
|
||||
super(Triforce, self).__init__('Triforce', True, code=0x6A)
|
||||
|
||||
|
||||
class Crystal1(Item):
|
||||
def __init__(self):
|
||||
super(Crystal1, self).__init__('Crystal 1', True, code=[0x02, 0x34, 0x64, 0x40, 0x7F, 0x06])
|
||||
|
||||
|
||||
class Crystal2(Item):
|
||||
def __init__(self):
|
||||
super(Crystal2, self).__init__('Crystal 2', True, code=[0x10, 0x34, 0x64, 0x40, 0x79, 0x06])
|
||||
|
||||
|
||||
class Crystal3(Item):
|
||||
def __init__(self):
|
||||
super(Crystal3, self).__init__('Crystal 3', True, code=[0x40, 0x34, 0x64, 0x40, 0x6C, 0x06])
|
||||
|
||||
|
||||
class Crystal4(Item):
|
||||
def __init__(self):
|
||||
super(Crystal4, self).__init__('Crystal 4', True, code=[0x20, 0x34, 0x64, 0x40, 0x6D, 0x06])
|
||||
|
||||
|
||||
class Crystal5(Item):
|
||||
def __init__(self):
|
||||
super(Crystal5, self).__init__('Crystal 5', True, code=[0x04, 0x34, 0x64, 0x40, 0x6E, 0x06])
|
||||
|
||||
|
||||
class Crystal6(Item):
|
||||
def __init__(self):
|
||||
super(Crystal6, self).__init__('Crystal 6', True, code=[0x01, 0x34, 0x64, 0x40, 0x6F, 0x06])
|
||||
|
||||
|
||||
class Crystal7(Item):
|
||||
def __init__(self):
|
||||
super(Crystal7, self).__init__('Crystal 7', True, code=[0x08, 0x34, 0x64, 0x40, 0x7C, 0x06])
|
||||
|
||||
|
||||
class SingleArrow(Item):
|
||||
def __init__(self):
|
||||
super(SingleArrow, self).__init__('Single Arrow', False, code=0x43)
|
||||
|
||||
|
||||
class Arrows10(Item):
|
||||
def __init__(self):
|
||||
super(Arrows10, self).__init__('Arrows (10)', False, code=0x44)
|
||||
|
||||
|
||||
class ArrowUpgrade10(Item):
|
||||
def __init__(self):
|
||||
super(ArrowUpgrade10, self).__init__('Arrow Upgrade (+10)', False, code=0x54)
|
||||
|
||||
|
||||
class ArrowUpgrade5(Item):
|
||||
def __init__(self):
|
||||
super(ArrowUpgrade5, self).__init__('Arrow Upgrade (+5)', False, code=0x53)
|
||||
|
||||
|
||||
class SingleBomb(Item):
|
||||
def __init__(self):
|
||||
super(SingleBomb, self).__init__('Single Bomb', False, code=0x27)
|
||||
|
||||
|
||||
class Bombs3(Item):
|
||||
def __init__(self):
|
||||
super(Bombs3, self).__init__('Bombs (3)', False, code=0x28)
|
||||
|
||||
|
||||
class BombUpgrade10(Item):
|
||||
def __init__(self):
|
||||
super(BombUpgrade10, self).__init__('Bomb Upgrade (+10)', False, code=0x52)
|
||||
|
||||
|
||||
class BombUpgrade5(Item):
|
||||
def __init__(self):
|
||||
super(BombUpgrade5, self).__init__('Bomb Upgrade (+5)', False, code=0x51)
|
||||
|
||||
|
||||
class BlueMail(Item):
|
||||
def __init__(self):
|
||||
super(BlueMail, self).__init__('Blue Mail', False, code=0x22)
|
||||
|
||||
|
||||
class RedMail(Item):
|
||||
def __init__(self):
|
||||
super(RedMail, self).__init__('Red Mail', False, code=0x23)
|
||||
|
||||
|
||||
class ProgressiveArmor(Item):
|
||||
def __init__(self):
|
||||
super(ProgressiveArmor, self).__init__('Progressive Armor', False, code=0x60)
|
||||
|
||||
|
||||
class BlueBoomerang(Item):
|
||||
def __init__(self):
|
||||
super(BlueBoomerang, self).__init__('Blue Boomerang', False, code=0x0C)
|
||||
|
||||
|
||||
class RedBoomerang(Item):
|
||||
def __init__(self):
|
||||
super(RedBoomerang, self).__init__('Red Boomerang', False, code=0x2A)
|
||||
|
||||
|
||||
class BlueShield(Item):
|
||||
def __init__(self):
|
||||
super(BlueShield, self).__init__('Blue Shield', False, code=0x04)
|
||||
|
||||
|
||||
class RedShield(Item):
|
||||
def __init__(self):
|
||||
super(RedShield, self).__init__('Red Shield', False, code=0x05)
|
||||
|
||||
|
||||
class MirrorShield(Item):
|
||||
def __init__(self):
|
||||
super(MirrorShield, self).__init__('Mirror Shield', False, code=0x06)
|
||||
|
||||
|
||||
class ProgressiveShield(Item):
|
||||
def __init__(self):
|
||||
super(ProgressiveShield, self).__init__('Progressive Shield', False, code=0x5F)
|
||||
|
||||
|
||||
class Net(Item):
|
||||
def __init__(self):
|
||||
super(Net, self).__init__('Bug Catching Net', False, code=0x21)
|
||||
|
||||
|
||||
class Byrna(Item):
|
||||
def __init__(self):
|
||||
super(Byrna, self).__init__('Cane of Byrna', False, code=0x18)
|
||||
|
||||
|
||||
class HeartContainer(Item):
|
||||
def __init__(self):
|
||||
super(HeartContainer, self).__init__('Boss Heart Container', False, code=0x3E)
|
||||
|
||||
|
||||
class SancHeart(Item):
|
||||
def __init__(self):
|
||||
super(SancHeart, self).__init__('Sanctuary Heart Container', False, code=0x3F)
|
||||
|
||||
|
||||
class PieceOfHeart(Item):
|
||||
def __init__(self):
|
||||
super(PieceOfHeart, self).__init__('Piece of Heart', False, code=0x17)
|
||||
|
||||
|
||||
class Rupee(Item):
|
||||
def __init__(self):
|
||||
super(Rupee, self).__init__('Rupee (1)', False, code=0x34)
|
||||
|
||||
|
||||
class Rupees5(Item):
|
||||
def __init__(self):
|
||||
super(Rupees5, self).__init__('Rupees (5)', False, code=0x35)
|
||||
|
||||
|
||||
class Rupees20(Item):
|
||||
def __init__(self):
|
||||
super(Rupees20, self).__init__('Rupees (20)', False, code=0x36)
|
||||
|
||||
|
||||
class Rupees50(Item):
|
||||
def __init__(self):
|
||||
super(Rupees50, self).__init__('Rupees (50)', False, code=0x41)
|
||||
|
||||
|
||||
class Rupees100(Item):
|
||||
def __init__(self):
|
||||
super(Rupees100, self).__init__('Rupees (100)', False, code=0x40)
|
||||
|
||||
|
||||
class Rupees300(Item):
|
||||
def __init__(self):
|
||||
super(Rupees300, self).__init__('Rupees (300)', False, code=0x46)
|
||||
|
||||
|
||||
class HalfMagic(Item):
|
||||
def __init__(self):
|
||||
super(HalfMagic, self).__init__('Magic Upgrade (1/2)', True, code=0x4E) # can be required to beat mothula in an open seed in very very rare circumstance
|
||||
|
||||
|
||||
class QuarterMagic(Item):
|
||||
def __init__(self):
|
||||
super(QuarterMagic, self).__init__('Magic Upgrade (1/4)', True, code=0x4F) # can be required to beat mothula in an open seed in very very rare circumstance
|
||||
|
||||
|
||||
# ToDo Use dungeons specific items once they work correctly
|
||||
|
||||
class EPSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(EPSmallKey, self).__init__('Small Key (Eastern Palace)', False, True, code=0x24)
|
||||
|
||||
|
||||
class EPBigKey(Item):
|
||||
def __init__(self):
|
||||
super(EPBigKey, self).__init__('Big Key (Eastern Palace)', False, True, code=0x32)
|
||||
|
||||
|
||||
class EPCompass(Item):
|
||||
def __init__(self):
|
||||
super(EPCompass, self).__init__('Compass (Eastern Palace)', False, code=0x25)
|
||||
|
||||
|
||||
class EPMap(Item):
|
||||
def __init__(self):
|
||||
super(EPMap, self).__init__('Map (Eastern Palace)', False, code=0x33)
|
||||
|
||||
|
||||
class DPSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(DPSmallKey, self).__init__('Small Key (Desert Palace)', False, True, code=0x24)
|
||||
|
||||
|
||||
class DPBigKey(Item):
|
||||
def __init__(self):
|
||||
super(DPBigKey, self).__init__('Big Key (Desert Palace)', False, True, code=0x32)
|
||||
|
||||
|
||||
class DPCompass(Item):
|
||||
def __init__(self):
|
||||
super(DPCompass, self).__init__('Compass (Desert Palace)', False, code=0x25)
|
||||
|
||||
|
||||
class DPMap(Item):
|
||||
def __init__(self):
|
||||
super(DPMap, self).__init__('Map (Desert Palace)', False, code=0x33)
|
||||
|
||||
|
||||
class THSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(THSmallKey, self).__init__('Small Key (Tower of Hera)', False, True, code=0x24)
|
||||
|
||||
|
||||
class THBigKey(Item):
|
||||
def __init__(self):
|
||||
super(THBigKey, self).__init__('Big Key (Tower of Hera)', False, True, code=0x32)
|
||||
|
||||
|
||||
class THCompass(Item):
|
||||
def __init__(self):
|
||||
super(THCompass, self).__init__('Compass (Tower of Hera)', False, code=0x25)
|
||||
|
||||
|
||||
class THMap(Item):
|
||||
def __init__(self):
|
||||
super(THMap, self).__init__('Map (Tower of Hera)', False, code=0x33)
|
||||
|
||||
|
||||
class ESSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(ESSmallKey, self).__init__('Small Key (Escape)', False, True, code=0x24)
|
||||
|
||||
|
||||
class ESBigKey(Item):
|
||||
def __init__(self):
|
||||
super(ESBigKey, self).__init__('Big Key (Escape)', False, True, code=0x32)
|
||||
|
||||
|
||||
class ESMap(Item):
|
||||
def __init__(self):
|
||||
super(ESMap, self).__init__('Map (Escape)', False, code=0x33)
|
||||
|
||||
|
||||
class ATSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(ATSmallKey, self).__init__('Small Key (Agahnims Tower)', False, True, code=0x24)
|
||||
|
||||
|
||||
class PDSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(PDSmallKey, self).__init__('Small Key (Palace of Darkness)', False, True, code=0x24)
|
||||
|
||||
|
||||
class PDBigKey(Item):
|
||||
def __init__(self):
|
||||
super(PDBigKey, self).__init__('Big Key (Palace of Darkness)', False, True, code=0x32)
|
||||
|
||||
|
||||
class PDCompass(Item):
|
||||
def __init__(self):
|
||||
super(PDCompass, self).__init__('Compass (Palace of Darkness)', False, code=0x25)
|
||||
|
||||
|
||||
class PDMap(Item):
|
||||
def __init__(self):
|
||||
super(PDMap, self).__init__('Map (Palace of Darkness)', False, code=0x33)
|
||||
|
||||
|
||||
class TTSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(TTSmallKey, self).__init__('Small Key (Thieves Town)', False, True, code=0x24)
|
||||
|
||||
|
||||
class TTBigKey(Item):
|
||||
def __init__(self):
|
||||
super(TTBigKey, self).__init__('Big Key (Thieves Town)', False, True, code=0x32)
|
||||
|
||||
|
||||
class TTCompass(Item):
|
||||
def __init__(self):
|
||||
super(TTCompass, self).__init__('Compass (Thieves Town)', False, code=0x25)
|
||||
|
||||
|
||||
class TTMap(Item):
|
||||
def __init__(self):
|
||||
super(TTMap, self).__init__('Map (Thieves Town)', False, code=0x33)
|
||||
|
||||
|
||||
class SWSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(SWSmallKey, self).__init__('Small Key (Skull Woods)', False, True, code=0x24)
|
||||
|
||||
|
||||
class SWBigKey(Item):
|
||||
def __init__(self):
|
||||
super(SWBigKey, self).__init__('Big Key (Skull Woods)', False, True, code=0x32)
|
||||
|
||||
|
||||
class SWCompass(Item):
|
||||
def __init__(self):
|
||||
super(SWCompass, self).__init__('Compass (Skull Woods)', False, code=0x25)
|
||||
|
||||
|
||||
class SWMap(Item):
|
||||
def __init__(self):
|
||||
super(SWMap, self).__init__('Map (Skull Woods)', False, code=0x33)
|
||||
|
||||
|
||||
class SPSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(SPSmallKey, self).__init__('Small Key (Swamp Palace)', False, True, code=0x24)
|
||||
|
||||
|
||||
class SPBigKey(Item):
|
||||
def __init__(self):
|
||||
super(SPBigKey, self).__init__('Big Key (Swamp Palace)', False, True, code=0x32)
|
||||
|
||||
|
||||
class SPCompass(Item):
|
||||
def __init__(self):
|
||||
super(SPCompass, self).__init__('Compass (Swamp Palace)', False, code=0x25)
|
||||
|
||||
|
||||
class SPMap(Item):
|
||||
def __init__(self):
|
||||
super(SPMap, self).__init__('Map (Swamp Palace)', False, code=0x33)
|
||||
|
||||
|
||||
class IPSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(IPSmallKey, self).__init__('Small Key (Ice Palace)', False, True, code=0x24)
|
||||
|
||||
|
||||
class IPBigKey(Item):
|
||||
def __init__(self):
|
||||
super(IPBigKey, self).__init__('Big Key (Ice Palace)', False, True, code=0x32)
|
||||
|
||||
|
||||
class IPCompass(Item):
|
||||
def __init__(self):
|
||||
super(IPCompass, self).__init__('Compass (Ice Palace)', False, code=0x25)
|
||||
|
||||
|
||||
class IPMap(Item):
|
||||
def __init__(self):
|
||||
super(IPMap, self).__init__('Map (Ice Palace)', False, code=0x33)
|
||||
|
||||
|
||||
class MMSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(MMSmallKey, self).__init__('Small Key (Misery Mire)', False, True, code=0x24)
|
||||
|
||||
|
||||
class MMBigKey(Item):
|
||||
def __init__(self):
|
||||
super(MMBigKey, self).__init__('Big Key (Misery Mire)', False, True, code=0x32)
|
||||
|
||||
|
||||
class MMCompass(Item):
|
||||
def __init__(self):
|
||||
super(MMCompass, self).__init__('Compass (Misery Mire)', False, code=0x25)
|
||||
|
||||
|
||||
class MMMap(Item):
|
||||
def __init__(self):
|
||||
super(MMMap, self).__init__('Map (Misery Mire)', False, code=0x33)
|
||||
|
||||
|
||||
class TRSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(TRSmallKey, self).__init__('Small Key (Turtle Rock)', False, True, code=0x24)
|
||||
|
||||
|
||||
class TRBigKey(Item):
|
||||
def __init__(self):
|
||||
super(TRBigKey, self).__init__('Big Key (Turtle Rock)', False, True, code=0x32)
|
||||
|
||||
|
||||
class TRCompass(Item):
|
||||
def __init__(self):
|
||||
super(TRCompass, self).__init__('Compass (Turtle Rock)', False, code=0x25)
|
||||
|
||||
|
||||
class TRMap(Item):
|
||||
def __init__(self):
|
||||
super(TRMap, self).__init__('Map (Turtle Rock)', False, code=0x33)
|
||||
|
||||
|
||||
class GTSmallKey(Item):
|
||||
def __init__(self):
|
||||
super(GTSmallKey, self).__init__('Small Key (Ganons Tower)', False, True, code=0x24)
|
||||
|
||||
|
||||
class GTBigKey(Item):
|
||||
def __init__(self):
|
||||
super(GTBigKey, self).__init__('Big Key (Ganons Tower)', False, True, code=0x32)
|
||||
|
||||
|
||||
class GTCompass(Item):
|
||||
def __init__(self):
|
||||
super(GTCompass, self).__init__('Compass (Ganons Tower)', False, code=0x25)
|
||||
|
||||
|
||||
class GTMap(Item):
|
||||
def __init__(self):
|
||||
super(GTMap, self).__init__('Map (Ganons Tower)', False, code=0x33)
|
||||
import logging
|
||||
|
||||
|
||||
def ItemFactory(items):
|
||||
ret = []
|
||||
singleton = False
|
||||
if isinstance(items, str):
|
||||
items = [items]
|
||||
singleton = True
|
||||
for item in items:
|
||||
if item in item_table:
|
||||
advancement, key, crystal, code, altar_hint, altar_credit, sickkid_credit, zora_credit, witch_credit, fluteboy_credit = item_table[item]
|
||||
if item == 'Bottle':
|
||||
# randomly fill bottle
|
||||
code = [0x16, 0x2B, 0x2C, 0x2D, 0x3C, 0x3D, 0x48][random.randint(0, 6)]
|
||||
ret.append(Item(item, advancement, key, crystal, code, altar_hint, altar_credit, sickkid_credit, zora_credit, witch_credit, fluteboy_credit))
|
||||
else:
|
||||
logging.getLogger('').warning('Unknown Items: %s' % item)
|
||||
|
||||
if singleton:
|
||||
return ret[0]
|
||||
else:
|
||||
return ret
|
||||
|
||||
|
||||
# Format: Name: (Advancement, Key, Crystal, ItemCode, Altar Hint Text, Altar Credit Text, Sick Kid Credit Text, Zora Credit Text, Witch Credit Text, Flute Boy Credit Text)
|
||||
item_table = {'Bow': (True, False, False, 0x0B, 'You have\nchosen the\narcher class.', None, None, None, None, None),
|
||||
'Book of Mudora': (True, False, False, 0x1D, 'This is a\nparadox?!', None, None, None, None, None),
|
||||
'Hammer': (True, False, False, 0x09, 'stop\nhammer time!', None, None, None, None, None),
|
||||
'Hookshot': (True, False, False, 0x0A, 'BOING!!!\nBOING!!!\nBOING!!!', None, None, None, None, None),
|
||||
'Magic Mirror': (True, False, False, 0x1A, 'Isn\'t your\nreflection so\npretty?', None, None, None, None, None),
|
||||
'Ocarina': (True, False, False, 0x14, 'Save the duck\nand fly to\nfreedom!', None, None, None, None, None),
|
||||
'Pegasus Boots': (True, False, False, 0x4B, 'Gotta go fast!', None, None, None, None, None),
|
||||
'Power Glove': (True, False, False, 0x1B, 'Now you can\nlift weak\nstuff!', None, None, None, None, None),
|
||||
'Cape': (True, False, False, 0x19, 'Wear this to\nbecome\ninvisible!', None, None, None, None, None),
|
||||
'Mushroom': (True, False, False, 0x29, 'I\'m a fun guy!\n\nI\'m a funghi!', None, None, None, None, None),
|
||||
'Shovel': (True, False, False, 0x13, 'Can\n You\n Dig it?', None, None, None, None, None),
|
||||
'Lamp': (True, False, False, 0x12, 'Baby, baby,\nbaby.\nLight my way!', None, None, None, None, None),
|
||||
'Magic Powder': (True, False, False, 0x0D, 'you can turn\nanti-faeries\ninto fairies', None, None, None, None, None),
|
||||
'Moon Pearl': (True, False, False, 0x1F, ' Bunny Link\n be\n gone!', None, None, None, None, None),
|
||||
'Cane of Somaria': (True, False, False, 0x15, 'I make blocks\nto hold down\nswitches!', None, None, None, None, None),
|
||||
'Fire Rod': (True, False, False, 0x07, 'I\'m the hot\nrod. I make\nthings burn!', None, None, None, None, None),
|
||||
'Flippers': (True, False, False, 0x1E, 'fancy a swim?', None, None, None, None, None),
|
||||
'Ice Rod': (True, False, False, 0x08, 'I\'m the cold\nrod. I make\nthings freeze!', None, None, None, None, None),
|
||||
'Titans Mitts': (True, False, False, 0x1C, 'Now you can\nlift heavy\nstuff!', None, None, None, None, None),
|
||||
'Ether': (True, False, False, 0x10, 'Zero Kelvin!\nAbsolute zero!\nFear the cold!', None, None, None, None, None),
|
||||
'Bombos': (True, False, False, 0x0F, 'Burn, baby,\nburn! Fear my\nring of fire!', None, None, None, None, None),
|
||||
'Quake': (True, False, False, 0x11, 'Maxing out the\nRichter scale\nis what I do!', None, None, None, None, None),
|
||||
'Bottle': (True, False, False, 0xFF, 'Now you can\nstore potions\nand stuff!', None, None, None, None, None), # specific content written on creation
|
||||
'Master Sword': (True, False, False, 0x50, 'I thought this\nwas meant to\nbe randomized?', None, None, None, None, None),
|
||||
'Tempered Sword': (True, False, False, 0x02, 'I stole the\nblacksmith\'s\njob!', None, None, None, None, None),
|
||||
'Fighter Sword': (True, False, False, 0x49, 'A pathetic\nsword rests\nhere!', None, None, None, None, None),
|
||||
'GoldenSword': (True, False, False, 0x03, 'The butter\nsword rests\nhere!', None, None, None, None, None),
|
||||
'Progressive Sword': (True, False, False, 0x5E, 'a better copy\nof your sword\nfor your time', None, None, None, None, None),
|
||||
'Progressive Glove': (True, False, False, 0x61, 'a way to lift\nheavier things', None, None, None, None, None),
|
||||
'Silver Arrows': (True, False, False, 0x58, 'Do you fancy\nsilver tipped\narrows?', None, None, None, None, None),
|
||||
'Green Pendant': (True, False, True, [0x04, 0x38, 0x60, 0x00, 0x69, 0x01], None, None, None, None, None, None),
|
||||
'Red Pendant': (True, False, True, [0x02, 0x34, 0x60, 0x00, 0x69, 0x02], None, None, None, None, None, None),
|
||||
'Blue Pendant': (True, False, True, [0x01, 0x32, 0x60, 0x00, 0x69, 0x03], None, None, None, None, None, None),
|
||||
'Triforce': (True, False, False, 0x6A, '\n YOU WIN!', None, None, None, None, None),
|
||||
'Crystal 1': (True, False, True, [0x02, 0x34, 0x64, 0x40, 0x7F, 0x06], None, None, None, None, None, None),
|
||||
'Crystal 2': (True, False, True, [0x10, 0x34, 0x64, 0x40, 0x79, 0x06], None, None, None, None, None, None),
|
||||
'Crystal 3': (True, False, True, [0x40, 0x34, 0x64, 0x40, 0x6C, 0x06], None, None, None, None, None, None),
|
||||
'Crystal 4': (True, False, True, [0x20, 0x34, 0x64, 0x40, 0x6D, 0x06], None, None, None, None, None, None),
|
||||
'Crystal 5': (True, False, True, [0x04, 0x34, 0x64, 0x40, 0x6E, 0x06], None, None, None, None, None, None),
|
||||
'Crystal 6': (True, False, True, [0x01, 0x34, 0x64, 0x40, 0x6F, 0x06], None, None, None, None, None, None),
|
||||
'Crystal 7': (True, False, True, [0x08, 0x34, 0x64, 0x40, 0x7C, 0x06], None, None, None, None, None, None),
|
||||
'Single Arrow': (False, False, False, 0x43, 'a lonely arrow\nsits here.', None, None, None, None, None),
|
||||
'Arrows (10)': (False, False, False, 0x44, 'This will give\nyou ten shots\nwith your bow!', None, None, None, None, None),
|
||||
'Arrow Upgrade (+10)': (False, False, False, 0x54, 'increase arrow\nstorage, low\nlow price', None, None, None, None, None),
|
||||
'Arrow Upgrade (+5)': (False, False, False, 0x53, 'increase arrow\nstorage, low\nlow price', None, None, None, None, None),
|
||||
'Single Bomb': (False, False, False, 0x27, 'I make things\ngo BOOM! But\njust once.', None, None, None, None, None),
|
||||
'Bombs (3)': (False, False, False, 0x28, 'I make things\ngo triple\nBOOM!!!', None, None, None, None, None),
|
||||
'Bomb Upgrade (+10)': (False, False, False, 0x52, 'increase bomb\nstorage, low\nlow price', None, None, None, None, None),
|
||||
'Bomb Upgrade (+5)': (False, False, False, 0x51, 'increase bomb\nstorage, low\nlow price', None, None, None, None, None),
|
||||
'Blue Mail': (False, False, False, 0x22, 'Now you\'re a\nblue elf!', None, None, None, None, None),
|
||||
'Red Mail': (False, False, False, 0x23, 'Now you\'re a\nred elf!', None, None, None, None, None),
|
||||
'Progressive Armor': (False, False, False, 0x60, 'time for a\nchange of\nclothes?', None, None, None, None, None),
|
||||
'Blue Boomerang': (False, False, False, 0x0C, 'No matter what\nyou do, blue\nreturns to you', None, None, None, None, None),
|
||||
'Red Boomerang': (False, False, False, 0x2A, 'No matter what\nyou do, red\nreturns to you', None, None, None, None, None),
|
||||
'Blue Shield': (False, False, False, 0x04, 'Now you can\ndefend against\npebbles!', None, None, None, None, None),
|
||||
'Red Shield': (False, False, False, 0x05, 'Now you can\ndefend against\nfireballs!', None, None, None, None, None),
|
||||
'Mirror Shield': (False, False, False, 0x06, 'Now you can\ndefend against\nlasers!', None, None, None, None, None),
|
||||
'Progressive Shield': (False, False, False, 0x5F, 'have a better\nblocker in\nfront of you', None, None, None, None, None),
|
||||
'Bug Catching Net': (False, False, False, 0x21, 'Let\'s catch\nsome bees and\nfaeries!', None, None, None, None, None),
|
||||
'Cane of Byrna': (False, False, False, 0x18, 'Use this to\nbecome\ninvincible!', None, None, None, None, None),
|
||||
'Boss Heart Container': (False, False, False, 0x3E, 'Maximum health\nincreased!\nYeah!', None, None, None, None, None),
|
||||
'Sanctuary Heart Container': (False, False, False, 0x3F, 'Maximum health\nincreased!\nYeah!', None, None, None, None, None),
|
||||
'Piece of Heart': (False, False, False, 0x17, 'Just a little\npiece of love!', None, None, None, None, None),
|
||||
'Rupee (1)': (False, False, False, 0x34, 'Just pocket\nchange. Move\nright along.', None, None, None, None, None),
|
||||
'Rupees (5)': (False, False, False, 0x35, 'Just pocket\nchange. Move\nright along.', None, None, None, None, None),
|
||||
'Rupees (20)': (False, False, False, 0x36, 'Just couch\ncash. Move\nright along.', None, None, None, None, None),
|
||||
'Rupees (50)': (False, False, False, 0x41, 'Just couch\ncash. Move\nright along.', None, None, None, None, None),
|
||||
'Rupees (100)': (False, False, False, 0x40, 'A rupee stash!\nHell yeah!', None, None, None, None, None),
|
||||
'Rupees (300)': (False, False, False, 0x46, 'A rupee hoard!\nHell yeah!', None, None, None, None, None),
|
||||
'Magic Upgrade (1/2)': (True, False, False, 0x4E, 'Your magic\npower has been\ndoubled!', None, None, None, None, None), # can be required to beat mothula in an open seed in very very rare circumstance
|
||||
'Magic Upgrade (1/4)': (True, False, False, 0x4F, 'Your magic\npower has been\nquadrupled!', None, None, None, None, None), # can be required to beat mothula in an open seed in very very rare circumstance
|
||||
# ToDo Use dungeons specific items once they work correctly
|
||||
'Small Key (Eastern Palace)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Big Key (Eastern Palace)': (False, True, False, 0x32, None, None, None, None, None, None),
|
||||
'Compass (Eastern Palace)': (False, False, False, 0x25, None, None, None, None, None, None),
|
||||
'Map (Eastern Palace)': (False, False, False, 0x33, None, None, None, None, None, None),
|
||||
'Small Key (Desert Palace)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Big Key (Desert Palace)': (False, True, False, 0x32, None, None, None, None, None, None),
|
||||
'Compass (Desert Palace)': (False, False, False, 0x25, None, None, None, None, None, None),
|
||||
'Map (Desert Palace)': (False, False, False, 0x33, None, None, None, None, None, None),
|
||||
'Small Key (Tower of Hera)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Big Key (Tower of Hera)': (False, True, False, 0x32, None, None, None, None, None, None),
|
||||
'Compass (Tower of Hera)': (False, False, False, 0x25, None, None, None, None, None, None),
|
||||
'Map (Tower of Hera)': (False, False, False, 0x33, None, None, None, None, None, None),
|
||||
'Small Key (Escape)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Big Key (Escape)': (False, True, False, 0x32, None, None, None, None, None, None),
|
||||
'Map (Escape)': (False, False, False, 0x33, None, None, None, None, None, None),
|
||||
'Small Key (Agahnims Tower)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Small Key (Palace of Darkness)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Big Key (Palace of Darkness)': (False, True, False, 0x32, None, None, None, None, None, None),
|
||||
'Compass (Palace of Darkness)': (False, False, False, 0x25, None, None, None, None, None, None),
|
||||
'Map (Palace of Darkness)': (False, False, False, 0x33, None, None, None, None, None, None),
|
||||
'Small Key (Thieves Town)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Big Key (Thieves Town)': (False, True, False, 0x32, None, None, None, None, None, None),
|
||||
'Compass (Thieves Town)': (False, False, False, 0x25, None, None, None, None, None, None),
|
||||
'Map (Thieves Town)': (False, False, False, 0x33, None, None, None, None, None, None),
|
||||
'Small Key (Skull Woods)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Big Key (Skull Woods)': (False, True, False, 0x32, None, None, None, None, None, None),
|
||||
'Compass (Skull Woods)': (False, False, False, 0x25, None, None, None, None, None, None),
|
||||
'Map (Skull Woods)': (False, False, False, 0x33, None, None, None, None, None, None),
|
||||
'Small Key (Swamp Palace)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Big Key (Swamp Palace)': (False, True, False, 0x32, None, None, None, None, None, None),
|
||||
'Compass (Swamp Palace)': (False, False, False, 0x25, None, None, None, None, None, None),
|
||||
'Map (Swamp Palace)': (False, False, False, 0x33, None, None, None, None, None, None),
|
||||
'Small Key (Ice Palace)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Big Key (Ice Palace)': (False, True, False, 0x32, None, None, None, None, None, None),
|
||||
'Compass (Ice Palace)': (False, False, False, 0x25, None, None, None, None, None, None),
|
||||
'Map (Ice Palace)': (False, False, False, 0x33, None, None, None, None, None, None),
|
||||
'Small Key (Misery Mire)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Big Key (Misery Mire)': (False, True, False, 0x32, None, None, None, None, None, None),
|
||||
'Compass (Misery Mire)': (False, False, False, 0x25, None, None, None, None, None, None),
|
||||
'Map (Misery Mire)': (False, False, False, 0x33, None, None, None, None, None, None),
|
||||
'Small Key (Turtle Rock)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Big Key (Turtle Rock)': (False, True, False, 0x32, None, None, None, None, None, None),
|
||||
'Compass (Turtle Rock)': (False, False, False, 0x25, None, None, None, None, None, None),
|
||||
'Map (Turtle Rock)': (False, False, False, 0x33, None, None, None, None, None, None),
|
||||
'Small Key (Ganons Tower)': (False, True, False, 0x24, None, None, None, None, None, None),
|
||||
'Big Key (Ganons Tower)': (False, True, False, 0x32, None, None, None, None, None, None),
|
||||
'Compass (Ganons Tower)': (False, False, False, 0x25, None, None, None, None, None, None),
|
||||
'Map (Ganons Tower)': (False, False, False, 0x33, None, None, None, None, None, None)}
|
||||
|
|
102
Main.py
102
Main.py
|
@ -1,10 +1,10 @@
|
|||
from BaseClasses import World, CollectionState
|
||||
from BaseClasses import World, CollectionState, Item
|
||||
from Regions import create_regions
|
||||
from EntranceShuffle import link_entrances
|
||||
from Rom import patch_rom
|
||||
from Rules import set_rules
|
||||
from Dungeons import fill_dungeons
|
||||
from Items import *
|
||||
from Items import ItemFactory
|
||||
import random
|
||||
import time
|
||||
import logging
|
||||
|
@ -14,11 +14,11 @@ import os
|
|||
__version__ = '0.1-dev'
|
||||
|
||||
|
||||
def main(seed=None, shuffle='default', logic='noglitches', mode='standard', difficulty='normal', goal='ganon', algo='regular', spoiler=True, base_rom='Base_Rom.sfc', quickswap=False):
|
||||
def main(args, seed=None):
|
||||
start = time.clock()
|
||||
|
||||
# initialize the world
|
||||
world = World(shuffle, logic, mode, difficulty, goal)
|
||||
world = World(args.shuffle, args.logic, args.mode, args.difficulty, args.goal, not args.nodungeonitems)
|
||||
logger = logging.getLogger('')
|
||||
|
||||
if seed is None:
|
||||
|
@ -29,7 +29,7 @@ def main(seed=None, shuffle='default', logic='noglitches', mode='standard', diff
|
|||
random.seed(world.seed)
|
||||
|
||||
world.spoiler += 'ALttP Entrance Randomizer Version %s - Seed: %s\n\n' % (__version__, world.seed)
|
||||
world.spoiler += 'Logic: %s Mode: %s Goal: %s Entrance Shuffle: %s Filling Algorithm: %s\n\n' % (logic, mode, goal, shuffle, algo) # todo
|
||||
world.spoiler += 'Logic: %s Mode: %s Goal: %s Entrance Shuffle: %s Filling Algorithm: %s\n\n' % (args.logic, args.mode, args.goal, args.shuffle, args.algorithm) # todo
|
||||
|
||||
logger.info(world.spoiler)
|
||||
|
||||
|
@ -49,7 +49,7 @@ def main(seed=None, shuffle='default', logic='noglitches', mode='standard', diff
|
|||
|
||||
logger.info('Fill the world.')
|
||||
|
||||
if algo == 'flood':
|
||||
if args.algorithm == 'flood':
|
||||
flood_items(world) # different algo, biased towards early game progress items
|
||||
else:
|
||||
distribute_items(world)
|
||||
|
@ -61,14 +61,14 @@ def main(seed=None, shuffle='default', logic='noglitches', mode='standard', diff
|
|||
|
||||
logger.info('Patching ROM.')
|
||||
|
||||
rom = bytearray(open(base_rom, 'rb').read())
|
||||
patched_rom = patch_rom(world, rom, quickswap)
|
||||
rom = bytearray(open(args.rom, 'rb').read())
|
||||
patched_rom = patch_rom(world, rom, args.quickswap)
|
||||
|
||||
outfilebase = 'ER_%s_%s_%s_%s' % (world.mode, world.goal, world.shuffle, world.seed)
|
||||
|
||||
with open('%s.sfc' % outfilebase, 'wb') as outfile:
|
||||
outfile.write(patched_rom)
|
||||
if spoiler:
|
||||
if args.create_spoiler:
|
||||
with open('%s_Spoiler.txt' % outfilebase, 'w') as outfile:
|
||||
outfile.write(world.spoiler)
|
||||
|
||||
|
@ -199,72 +199,33 @@ def generate_itempool(world):
|
|||
if world.difficulty != 'normal' or world.goal not in ['ganon', 'pedestal', 'dungeons'] or world.mode not in ['open', 'standard']:
|
||||
raise NotImplementedError('Not supported yet')
|
||||
|
||||
world.push_item('Ganon', Triforce(), False)
|
||||
world.push_item('Ganon', ItemFactory('Triforce'), False)
|
||||
|
||||
# set up item pool
|
||||
world.itempool = [
|
||||
ArrowUpgrade5(), ArrowUpgrade5(), ArrowUpgrade5(), ArrowUpgrade5(), ArrowUpgrade5(), ArrowUpgrade5(),
|
||||
ArrowUpgrade10(),
|
||||
SingleArrow(),
|
||||
ProgressiveArmor(), ProgressiveArmor(),
|
||||
BombUpgrade5(), BombUpgrade5(), BombUpgrade5(), BombUpgrade5(), BombUpgrade5(), BombUpgrade5(),
|
||||
BombUpgrade10(),
|
||||
Bombos(),
|
||||
Book(),
|
||||
BlueBoomerang(),
|
||||
Bottle(), Bottle(), Bottle(), Bottle(),
|
||||
Bow(),
|
||||
Net(),
|
||||
Byrna(),
|
||||
Somaria(),
|
||||
Ether(),
|
||||
Rupees50(), Rupees50(), Rupees50(), Rupees50(), Rupees50(), Rupees50(), Rupees50(),
|
||||
ProgressiveShield(), ProgressiveShield(), ProgressiveShield(),
|
||||
ProgressiveSword(), ProgressiveSword(), ProgressiveSword(),
|
||||
FireRod(),
|
||||
Rupees5(), Rupees5(), Rupees5(), Rupees5(),
|
||||
Flippers(),
|
||||
Ocarina(),
|
||||
Hammer(),
|
||||
SancHeart(),
|
||||
HeartContainer(), HeartContainer(), HeartContainer(), HeartContainer(), HeartContainer(), HeartContainer(), HeartContainer(), HeartContainer(), HeartContainer(), HeartContainer(),
|
||||
Hookshot(),
|
||||
IceRod(),
|
||||
Lamp(),
|
||||
Cape(),
|
||||
Powder(),
|
||||
RedBoomerang(),
|
||||
Mushroom(),
|
||||
Rupees100(),
|
||||
Rupee(), Rupee(),
|
||||
Boots(),
|
||||
PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(),
|
||||
PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(), PieceOfHeart(),
|
||||
ProgressiveGlove(), ProgressiveGlove(),
|
||||
Quake(),
|
||||
Shovel(),
|
||||
SilverArrows(),
|
||||
Arrows10(), Arrows10(), Arrows10(), Arrows10(),
|
||||
Bombs3(), Bombs3(), Bombs3(), Bombs3(), Bombs3(), Bombs3(), Bombs3(), Bombs3(), Bombs3(), Bombs3(),
|
||||
Rupees300(), Rupees300(), Rupees300(), Rupees300(),
|
||||
Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(),
|
||||
Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20(), Rupees20()
|
||||
]
|
||||
world.itempool = ItemFactory(['Arrow Upgrade (+5)'] * 6 + ['Bomb Upgrade (+5)'] * 6 + ['Arrow Upgrade (+10)', 'Bomb Upgrade (+10)'] +
|
||||
['Progressive Armor'] * 2 + ['Progressive Shield'] * 3 + ['Progressive Sword'] * 3 + ['Progressive Glove'] * 2 +
|
||||
['Bottle'] * 4 +
|
||||
['Bombos', 'Book of Mudora', 'Blue Boomerang', 'Bow', 'Bug Catching Net', 'Cane of Byrna', 'Cane of Somaria',
|
||||
'Ether', 'Fire Rod', 'Flippers', 'Ocarina', 'Hammer', 'Hookshot', 'Ice Rod', 'Lamp', 'Cape', 'Magic Powder',
|
||||
'Red Boomerang', 'Mushroom', 'Pegasus Boots', 'Quake', 'Shovel', 'Silver Arrows'] +
|
||||
['Single Arrow', 'Sanctuary Heart Container', 'Rupees (100)'] + ['Boss Heart Container'] * 10 + ['Piece of Heart'] * 24 +
|
||||
['Rupees (50)'] * 7 + ['Rupees (5)'] * 4 + ['Rupee (1)'] * 2 + ['Rupees (300)'] * 4 + ['Rupees (20)'] * 28 +
|
||||
['Arrows (10)'] * 4 + ['Bombs (3)'] * 10)
|
||||
|
||||
if world.mode == 'standard':
|
||||
world.push_item('Uncle', ProgressiveSword())
|
||||
world.push_item('Uncle', ItemFactory('Progressive Sword'))
|
||||
else:
|
||||
world.itempool.append(ProgressiveSword())
|
||||
world.itempool.append(ItemFactory('Progressive Sword'))
|
||||
|
||||
# provide mirror and pearl so you can avoid fake DW/LW and do dark world exploration as intended by algorithm, for now
|
||||
if world.shuffle == 'insanity':
|
||||
world.push_item('[cave-040] Links House', Mirror())
|
||||
world.push_item('[dungeon-C-1F] Sanctuary', Pearl())
|
||||
world.push_item('[cave-040] Links House', ItemFactory('Magic Mirror'))
|
||||
world.push_item('[dungeon-C-1F] Sanctuary', ItemFactory('Moon Pearl'))
|
||||
else:
|
||||
world.itempool.extend([Mirror(), Pearl()])
|
||||
world.itempool.extend(ItemFactory(['Magic Mirror', 'Moon Pearl']))
|
||||
|
||||
if world.goal == 'pedestal':
|
||||
world.push_item('Altar', Triforce())
|
||||
world.push_item('Altar', ItemFactory('Triforce'))
|
||||
items = list(world.itempool)
|
||||
random.shuffle(items)
|
||||
for item in items:
|
||||
|
@ -275,12 +236,12 @@ def generate_itempool(world):
|
|||
# ToDo what to do if EVERYTHING is a progress item?
|
||||
|
||||
if random.randint(0, 3) == 0:
|
||||
world.itempool.append(QuarterMagic())
|
||||
world.itempool.append(ItemFactory('Magic Upgrade (1/4)'))
|
||||
else:
|
||||
world.itempool.append(HalfMagic())
|
||||
world.itempool.append(ItemFactory('Magic Upgrade (1/2)'))
|
||||
|
||||
# distribute crystals
|
||||
crystals = [GreenPendant(), RedPendant(), BluePendant(), Crystal1(), Crystal2(), Crystal3(), Crystal4(), Crystal5(), Crystal6(), Crystal7()]
|
||||
crystals = ItemFactory(['Green Pendant', 'Red Pendant', 'Blue Pendant', 'Crystal 1', 'Crystal 2', 'Crystal 3', 'Crystal 4', 'Crystal 5', 'Crystal 6', 'Crystal 7'])
|
||||
crystal_locations = [world.get_location('Armos - Pendant'), world.get_location('Lanmolas - Pendant'), world.get_location('Moldorm - Pendant'), world.get_location('Helmasaur - Crystal'),
|
||||
world.get_location('Blind - Crystal'), world.get_location('Mothula - Crystal'), world.get_location('Arrghus - Crystal'), world.get_location('Kholdstare - Crystal'),
|
||||
world.get_location('Vitreous - Crystal'), world.get_location('Trinexx - Crystal')]
|
||||
|
@ -301,7 +262,7 @@ def generate_itempool(world):
|
|||
|
||||
def copy_world(world):
|
||||
# ToDo: Not good yet
|
||||
ret = World(world.shuffle, world.logic, world.mode, world.difficulty, world.goal)
|
||||
ret = World(world.shuffle, world.logic, world.mode, world.difficulty, world.goal, world.place_dungeon_items)
|
||||
ret.required_medallions = list(world.required_medallions)
|
||||
create_regions(ret)
|
||||
|
||||
|
@ -407,6 +368,7 @@ if __name__ == '__main__':
|
|||
parser.add_argument('--seed', help='Define seed number to generate.', type=int)
|
||||
parser.add_argument('--count', help='Use to batch generate multiple seeds with same settings. If --seed is provided, it will be used for the first seed, then used to derive the next seed (i.e. generating 10 seeds with --seed given will produce the same 10 (different) roms each time).', type=int)
|
||||
parser.add_argument('--quickswap', help='Enable quick item swapping with L and R.', action='store_true')
|
||||
parser.add_argument('--nodungeonitems', help='Remove Maps and Compasses from Itempool, replacing them by empty slots.', action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
if not os.path.isfile(args.rom):
|
||||
|
@ -420,7 +382,7 @@ if __name__ == '__main__':
|
|||
if args.count is not None:
|
||||
seed = args.seed
|
||||
for i in range(args.count):
|
||||
main(seed=seed, logic=args.logic, mode=args.mode, goal=args.goal, difficulty=args.difficulty, algo=args.algorithm, shuffle=args.shuffle, base_rom=args.rom, spoiler=args.create_spoiler, quickswap=args.quickswap)
|
||||
main(seed=seed, args=args)
|
||||
seed = random.randint(0, 999999999)
|
||||
else:
|
||||
main(seed=args.seed, logic=args.logic, mode=args.mode, goal=args.goal, difficulty=args.difficulty, algo=args.algorithm, shuffle=args.shuffle, base_rom=args.rom, spoiler=args.create_spoiler, quickswap=args.quickswap)
|
||||
main(seed=args.seed, args=args)
|
||||
|
|
79
Rom.py
79
Rom.py
|
@ -1,6 +1,8 @@
|
|||
from Regions import location_addresses, crystal_locations, dungeon_music_addresses
|
||||
from EntranceShuffle import door_addresses, single_doors
|
||||
from Text import string_to_alttp_text, text_addresses, altar_text
|
||||
from Text import string_to_alttp_text, text_addresses, credits_addresses, string_to_credits
|
||||
from Text import Uncle_texts, Ganon1_texts, PyramidFairy_texts, TavernMan_texts, Sahasrahla2_texts, Triforce_texts, Blind_texts, BombShop2_texts
|
||||
from Text import KingsReturn_texts, Sanctuary_texts, Kakariko_texts, Blacksmiths_texts, DeathMountain_texts, LostWoods_texts, WishingWell_texts, DesertPalace_texts, MountainTower_texts, LinksHouse_texts, Lumberjacks_texts, SickKid_texts, FluteBoy_texts, Zora_texts, MagicShop_texts
|
||||
import random
|
||||
|
||||
|
||||
|
@ -167,7 +169,7 @@ def patch_rom(world, rom, quickswap=False):
|
|||
random.shuffle(droprates)
|
||||
write_bytes(rom, 0x37A62, droprates)
|
||||
|
||||
# deal with sprize prize packs (ToDo: figure out what this ACTUALLY does Probably assigns sprites to drop classes
|
||||
# shuffle enemies to prize packs
|
||||
for i in range(243):
|
||||
if rom[0x6B632 + i] & 0x0F != 0x00:
|
||||
rom[0x6B632 + i] = (rom[0x6B632 + i] & 0xF0) | random.randint(1, 7)
|
||||
|
@ -217,21 +219,7 @@ def patch_rom(world, rom, quickswap=False):
|
|||
0xF3, 0x7E, 0xA2, 0x10, 0x80, 0xE0, 0xA2, 0x0F, 0x80, 0xD6, 0x60, 0xA9, 0x20, 0x8D, 0x2F, 0x01,
|
||||
0x8E, 0x02, 0x02, 0x22, 0x7F, 0xDB, 0x0D, 0xFA, 0x60, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF])
|
||||
|
||||
# write strings
|
||||
write_string_to_rom(rom, 'Ganon2', 'Did you find the silver arrows in Hyrule?')
|
||||
write_string_to_rom(rom, 'Uncle', 'Good Luck!\nYou will need it.')
|
||||
write_string_to_rom(rom, 'Triforce', 'Product has Hole in center. Bad seller, 0 out of 5.')
|
||||
write_string_to_rom(rom, 'BombShop1', 'Big Bomb?\nI Uh … Never heard of that. Move along.')
|
||||
write_string_to_rom(rom, 'BombShop2', 'Bombs!\nBombs!\nBiggest!\nBestest!\nGreatest!\nBoomest!')
|
||||
write_string_to_rom(rom, 'PyramidFairy', 'May I talk to you about our lord and savior, Ganon?')
|
||||
write_string_to_rom(rom, 'Sahasrahla1', 'How Did you Find me?')
|
||||
write_string_to_rom(rom, 'Sahasrahla2', 'You already got my item, idiot.')
|
||||
write_string_to_rom(rom, 'Blind', 'I bet you expected a vision related pun?\n\nNot Today.\n Didn\'t see that coming, did you?')
|
||||
write_string_to_rom(rom, 'Ganon1', '\n\n\n\n\n\n\n\n\nWhy are you reading an empty textbox?')
|
||||
write_string_to_rom(rom, 'TavernMan', 'Did you know that talking to random NPCs wastes time in a race? I hope this information may be of use to you in the future.')
|
||||
|
||||
altaritem = world.get_location('Altar').item.name if world.get_location('Altar').item is not None else 'Nothing'
|
||||
write_string_to_rom(rom, 'Altar', altar_text.get(altaritem, 'Unknown Item.'))
|
||||
write_strings(rom, world)
|
||||
|
||||
return rom
|
||||
|
||||
|
@ -247,4 +235,59 @@ def write_bytes(rom, startaddress, values):
|
|||
|
||||
def write_string_to_rom(rom, target, string):
|
||||
address, maxbytes = text_addresses[target]
|
||||
write_bytes(rom, address, string_to_alttp_text(string, maxbytes))
|
||||
write_bytes(rom, address, string_to_alttp_text(string, maxbytes))
|
||||
|
||||
|
||||
def write_credits_string_to_rom(rom, target, string):
|
||||
address, length = credits_addresses[target]
|
||||
write_bytes(rom, address, string_to_credits(string, length))
|
||||
|
||||
|
||||
def write_strings(rom, world):
|
||||
# ToDo should read location of items and give hint
|
||||
write_string_to_rom(rom, 'Ganon2', 'Did you find the silver arrows in Hyrule?')
|
||||
write_string_to_rom(rom, 'BombShop1', 'Big Bomb?\nI Uh … Never heard of that. Move along.')
|
||||
write_string_to_rom(rom, 'Sahasrahla1', 'How Did you Find me?')
|
||||
|
||||
write_string_to_rom(rom, 'Uncle', Uncle_texts[random.randint(0, len(Uncle_texts) - 1)])
|
||||
write_string_to_rom(rom, 'Triforce', Triforce_texts[random.randint(0, len(Triforce_texts) - 1)])
|
||||
write_string_to_rom(rom, 'BombShop2', BombShop2_texts[random.randint(0, len(BombShop2_texts) - 1)])
|
||||
write_string_to_rom(rom, 'PyramidFairy', PyramidFairy_texts[random.randint(0, len(PyramidFairy_texts) - 1)])
|
||||
write_string_to_rom(rom, 'Sahasrahla2', Sahasrahla2_texts[random.randint(0, len(Sahasrahla2_texts) - 1)])
|
||||
write_string_to_rom(rom, 'Blind', Blind_texts[random.randint(0, len(Blind_texts) - 1)])
|
||||
write_string_to_rom(rom, 'Ganon1', Ganon1_texts[random.randint(0, len(Ganon1_texts) - 1)])
|
||||
write_string_to_rom(rom, 'TavernMan', TavernMan_texts[random.randint(0, len(TavernMan_texts) - 1)])
|
||||
|
||||
altaritem = world.get_location('Altar').item
|
||||
altar_text = 'Some Hot Air' if altaritem is None else altaritem.altar_hint_text if altaritem.altar_hint_text is not None else 'Unknown Item.'
|
||||
write_string_to_rom(rom, 'Altar', altar_text)
|
||||
altar_credit_text = 'and the Hot Air' if altaritem is None else altaritem.altar_credit_text if altaritem.altar_credit_text is not None else ' and the Unknown Item.'
|
||||
write_credits_string_to_rom(rom, 'Altar', altar_credit_text)
|
||||
|
||||
write_credits_string_to_rom(rom, 'KingsReturn', KingsReturn_texts[random.randint(0, len(KingsReturn_texts) - 1)])
|
||||
write_credits_string_to_rom(rom, 'Sanctuary', Sanctuary_texts[random.randint(0, len(Sanctuary_texts) - 1)])
|
||||
write_credits_string_to_rom(rom, 'Kakariko', Kakariko_texts[random.randint(0, len(Kakariko_texts) - 1)])
|
||||
write_credits_string_to_rom(rom, 'Blacksmiths', Blacksmiths_texts[random.randint(0, len(Blacksmiths_texts) - 1)])
|
||||
write_credits_string_to_rom(rom, 'DeathMountain', DeathMountain_texts[random.randint(0, len(DeathMountain_texts) - 1)])
|
||||
write_credits_string_to_rom(rom, 'LostWoods', LostWoods_texts[random.randint(0, len(LostWoods_texts) - 1)])
|
||||
write_credits_string_to_rom(rom, 'WishingWell', WishingWell_texts[random.randint(0, len(WishingWell_texts) - 1)])
|
||||
write_credits_string_to_rom(rom, 'DesertPalace', DesertPalace_texts[random.randint(0, len(DesertPalace_texts) - 1)])
|
||||
write_credits_string_to_rom(rom, 'MountainTower', MountainTower_texts[random.randint(0, len(MountainTower_texts) - 1)])
|
||||
write_credits_string_to_rom(rom, 'LinksHouse', LinksHouse_texts[random.randint(0, len(LinksHouse_texts) - 1)])
|
||||
write_credits_string_to_rom(rom, 'Lumberjacks', Lumberjacks_texts[random.randint(0, len(Lumberjacks_texts) - 1)])
|
||||
|
||||
sickkiditem = world.get_location('Sick Kid').item
|
||||
sickkiditem_text = SickKid_texts[random.randint(0, len(SickKid_texts) - 1)] if sickkiditem is None or sickkiditem.sickkid_credit_text is None else sickkiditem.sickkid_credit_text
|
||||
write_credits_string_to_rom(rom, 'SickKid', sickkiditem_text)
|
||||
|
||||
zoraitem = world.get_location('King Zora').item
|
||||
zoraitem_text = Zora_texts[random.randint(0, len(Zora_texts) - 1)] if zoraitem is None or zoraitem.zora_credit_text is None else zoraitem.zora_credit_text
|
||||
write_credits_string_to_rom(rom, 'Zora', zoraitem_text)
|
||||
|
||||
magicshopitem = world.get_location('Witch').item
|
||||
magicshopitem_text = MagicShop_texts[random.randint(0, len(MagicShop_texts) - 1)] if magicshopitem is None or magicshopitem.magicshop_credit_text is None else magicshopitem.magicshop_credit_text
|
||||
write_credits_string_to_rom(rom, 'MagicShop', magicshopitem_text)
|
||||
|
||||
fluteboyitem = world.get_location('Flute Boy').item
|
||||
fluteboyitem_text = FluteBoy_texts[random.randint(0, len(FluteBoy_texts) - 1)] if fluteboyitem is None or fluteboyitem.fluteboy_credit_text is None else fluteboyitem.fluteboy_credit_text
|
||||
write_credits_string_to_rom(rom, 'FluteBoy', fluteboyitem_text)
|
||||
|
|
139
Text.py
139
Text.py
|
@ -11,68 +11,72 @@ text_addresses = {'Altar': (0x180300, 256),
|
|||
'BombShop2': (0x180D00, 256),
|
||||
'PyramidFairy': (0x180900, 256)}
|
||||
|
||||
credits_addresses = {'KingsReturn': (0x76928, 22),
|
||||
'Sanctuary': (0x76964, 16),
|
||||
'Kakariko': (0x76997, 23),
|
||||
'DesertPalace': (0x769D4, 24),
|
||||
'MountainTower': (0x76A12, 24),
|
||||
'LinksHouse': (0x76A52, 19),
|
||||
'Zora': (0x76A85, 20),
|
||||
'MagicShop': (0x76AC5, 23),
|
||||
'Lumberjacks': (0x76AFC, 16),
|
||||
'FluteBoy': (0x76B34, 23),
|
||||
'WishingWell': (0x76B71, 23),
|
||||
'Blacksmiths': (0x76BAC, 23),
|
||||
'SickKid': (0x76BDF, 20),
|
||||
'DeathMountain': (0x76C19, 16),
|
||||
'LostWoods': (0x76C51, 16),
|
||||
'Altar': (0x76C81, 20)}
|
||||
|
||||
altar_text = {'Fighter Sword': 'A pathetic\nsword rests\nhere!',
|
||||
'Master Sword': 'I thought this\nwas meant to\nbe randomized?',
|
||||
'Tempered Sword': 'I stole the\nblacksmith\'s\njob!',
|
||||
'Golden Sword': 'The butter\nsword rests\nhere!',
|
||||
'Blue Shield': 'Now you can\ndefend against\npebbles!',
|
||||
'Red Shield': 'Now you can\ndefend against\nfireballs!',
|
||||
'Mirror Shield': 'Now you can\ndefend against\nlasers!',
|
||||
'Fir eRod': 'I\'m the hot\nrod. I make\nthings burn!',
|
||||
'Ice Rod': 'I\'m the cold\nrod. I make\nthings freeze!',
|
||||
'Hammer': 'stop\nhammer time!',
|
||||
'Hookshot': 'BOING!!!\nBOING!!!\nBOING!!!',
|
||||
'Bow': 'You have\nchosen the\narcher class.',
|
||||
'Blue Boomerang': 'No matter what\nyou do, blue\nreturns to you',
|
||||
'Red Boomerang': 'No matter what\nyou do, red\nreturns to you',
|
||||
'Magic Powder': 'you can turn\nanti-faeries\ninto fairies',
|
||||
'Bombos': 'Burn, baby,\nburn! Fear my\nring of fire!',
|
||||
'Ether': 'Zero Kelvin!\nAbsolute zero!\nFear the cold!',
|
||||
'Quake': 'Maxing out the\nRichter scale\nis what I do!',
|
||||
'Lamp': 'Baby, baby,\nbaby.\nLight my way!',
|
||||
'Shovel': 'Can\n You\n Dig it?',
|
||||
'Cane of Somaria': 'I make blocks\nto hold down\nswitches!',
|
||||
'Cane of Byrna': 'Use this to\nbecome\ninvincible!',
|
||||
'Cape': 'Wear this to\nbecome\ninvisible!',
|
||||
'Magic Mirror': 'Isn\'t your\nreflection so\npretty?',
|
||||
'Power Glove': 'Now you can\nlift weak\nstuff!',
|
||||
'Titans Mitt': 'Now you can\nlift heavy\nstuff!',
|
||||
'Book of Mudora': 'This is a\nparadox?!',
|
||||
'Flippers': 'fancy a swim?',
|
||||
'Moon Pearl': ' Bunny Link\n be\n gone!',
|
||||
'Bug Catching Net': 'Let\'s catch\nsome bees and\nfaeries!',
|
||||
'Blue Mail': 'Now you\'re a\nblue elf!',
|
||||
'Red Mail': 'Now you\'re a\nred elf!',
|
||||
'Piece of Heart': 'Just a little\npiece of love!',
|
||||
'Boss Heart Container': 'Maximum health\nincreased!\nYeah!',
|
||||
'Single Bomb': 'I make things\ngo BOOM! But\njust once.',
|
||||
'Bombs (3)': 'I make things\ngo triple\nBOOM!!!',
|
||||
'Mushroom': 'I\'m a fun guy!\n\nI\'m a funghi!',
|
||||
'Bottle': 'Now you can\nstore potions\nand stuff!',
|
||||
'Single Arrow': 'a lonely arrow\nsits here.',
|
||||
'Arrows (10)': 'This will give\nyou ten shots\nwith your bow!',
|
||||
'Rupee (1)': 'Just pocket\nchange. Move\nright along.',
|
||||
'Rupees (5)': 'Just pocket\nchange. Move\nright along.',
|
||||
'Rupees (20)': 'Just couch\ncash. Move\nright along.',
|
||||
'Rupees (50)': 'Just couch\ncash. Move\nright along.',
|
||||
'Rupees (100)': 'A rupee stash!\nHell yeah!',
|
||||
'Rupees (300)': 'A rupee hoard!\nHell yeah!',
|
||||
'Ocarina': 'Save the duck\nand fly to\nfreedom!',
|
||||
'Pegasus Boots': 'Gotta go fast!',
|
||||
'Bomb Upgrade (+5)': 'increase bomb\nstorage, low\nlow price',
|
||||
'Bomb Upgrade (+10)': 'increase bomb\nstorage, low\nlow price',
|
||||
'Arrow Upgrade (+5)': 'increase arrow\nstorage, low\nlow price',
|
||||
'Arrow Upgrade (+10)': 'increase arrow\nstorage, low\nlow price',
|
||||
'Silver Arrows': 'Do you fancy\nsilver tipped\narrows?',
|
||||
'Magic Upgrade (1/2)': 'Your magic\npower has been\ndoubled!',
|
||||
'Magic Upgrade (1/4)': 'Your magic\npower has been\nquadrupled!',
|
||||
'Progressive Sword': 'a better copy\nof your sword\nfor your time',
|
||||
'Progressive Shield': 'have a better\nblocker in\nfront of you',
|
||||
'Progressive Armor': 'time for a\nchange of\nclothes?',
|
||||
'Progressive Glove': 'a way to lift\nheavier things',
|
||||
'Triforce': '\n YOU WIN!',
|
||||
'Nothing': 'Some Hot Air'}
|
||||
Uncle_texts = ['Good Luck!\nYou will need it.']
|
||||
Triforce_texts = ['Product has Hole in center. Bad seller, 0 out of 5.']
|
||||
BombShop2_texts = ['Bombs!\nBombs!\nBiggest!\nBestest!\nGreatest!\nBoomest!']
|
||||
PyramidFairy_texts = ['May I talk to you about our lord and savior, Ganon?']
|
||||
Sahasrahla2_texts = ['You already got my item, idiot.']
|
||||
Blind_texts = ['I bet you expected a vision related pun?\n\nNot Today.\n Didn\'t see that coming, did you?']
|
||||
Ganon1_texts = ['\n\n\n\n\n\n\n\n\nWhy are you reading an empty textbox?']
|
||||
TavernMan_texts = ['Did you know that talking to random NPCs wastes time in a race? I hope this information may be of use to you in the future.']
|
||||
|
||||
KingsReturn_texts = ['Who is this even']
|
||||
Sanctuary_texts = ['A Priest\'s love']
|
||||
Kakariko_texts = ['Shasschahshahsahahrahsashsa']
|
||||
Blacksmiths_texts = ['frogs for bread']
|
||||
DeathMountain_texts = ['lost again']
|
||||
LostWoods_texts = ['thieve\'s stump']
|
||||
WishingWell_texts = ['Bottle for Bottle']
|
||||
DesertPalace_texts = ['literacy moves']
|
||||
MountainTower_texts = ['up up and away']
|
||||
LinksHouse_texts = ['Home Sweet Home']
|
||||
Lumberjacks_texts = ['agahnim\'s axes']
|
||||
SickKid_texts = ['Next Time Stay Down']
|
||||
Zora_texts = ['Splashes For Sale']
|
||||
MagicShop_texts = ['Drug deal']
|
||||
FluteBoy_texts = ['Stumped']
|
||||
|
||||
|
||||
def write_texts_to_rom(rom, world):
|
||||
pass
|
||||
|
||||
|
||||
def write_credits_to_rom(rom, world):
|
||||
pass
|
||||
|
||||
|
||||
def string_to_credits(s, length):
|
||||
buf = bytearray()
|
||||
|
||||
if len(s) > length:
|
||||
s = s[:length]
|
||||
|
||||
padding = length - len(s)
|
||||
leftpadding = padding // 2
|
||||
rightpadding = padding - leftpadding
|
||||
s = ' '*leftpadding + s + ' '*rightpadding
|
||||
|
||||
for char in s.lower():
|
||||
buf.append(char_to_credit_char(char))
|
||||
|
||||
return buf
|
||||
|
||||
|
||||
def string_to_alttp_text(s, maxbytes=256):
|
||||
|
@ -306,6 +310,12 @@ char_map = {' ': 0xFF,
|
|||
'ェ': 0x9E,
|
||||
'ォ': 0x9F}
|
||||
|
||||
credit_char_map = {' ': 0x9F,
|
||||
',': 0x37,
|
||||
'.': 0x37,
|
||||
'-': 0x36,
|
||||
"'": 0x35}
|
||||
|
||||
|
||||
def char_to_alttp_char(char):
|
||||
if 0x30 <= ord(char) <= 0x39:
|
||||
|
@ -316,3 +326,10 @@ def char_to_alttp_char(char):
|
|||
|
||||
return char_map.get(char, 0xFF)
|
||||
|
||||
|
||||
def char_to_credit_char(char):
|
||||
if 0x61 <= ord(char) <= 0x7A:
|
||||
return ord(char) - 0x47
|
||||
|
||||
return credit_char_map.get(char, 0x9F)
|
||||
|
||||
|
|
Loading…
Reference in New Issue