LTTP: Shop and Arrow fixes (#4067)
Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									1f966ee705
								
							
						
					
					
						commit
						4c734b467f
					
				|  | @ -119,7 +119,9 @@ def KholdstareDefeatRule(state, player: int) -> bool: | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def VitreousDefeatRule(state, player: int) -> bool: | def VitreousDefeatRule(state, player: int) -> bool: | ||||||
|     return can_shoot_arrows(state, player) or has_melee_weapon(state, player) |     return ((can_shoot_arrows(state, player) and can_use_bombs(state, player, 10)) | ||||||
|  |             or can_shoot_arrows(state, player, 35) or state.has("Silver Bow", player) | ||||||
|  |             or has_melee_weapon(state, player)) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def TrinexxDefeatRule(state, player: int) -> bool: | def TrinexxDefeatRule(state, player: int) -> bool: | ||||||
|  |  | ||||||
|  | @ -484,8 +484,7 @@ def generate_itempool(world): | ||||||
|     if multiworld.randomize_cost_types[player]: |     if multiworld.randomize_cost_types[player]: | ||||||
|         # Heart and Arrow costs require all Heart Container/Pieces and Arrow Upgrades to be advancement items for logic |         # Heart and Arrow costs require all Heart Container/Pieces and Arrow Upgrades to be advancement items for logic | ||||||
|         for item in items: |         for item in items: | ||||||
|             if (item.name in ("Boss Heart Container", "Sanctuary Heart Container", "Piece of Heart") |             if item.name in ("Boss Heart Container", "Sanctuary Heart Container", "Piece of Heart"): | ||||||
|                     or "Arrow Upgrade" in item.name): |  | ||||||
|                 item.classification = ItemClassification.progression |                 item.classification = ItemClassification.progression | ||||||
|     else: |     else: | ||||||
|         # Otherwise, logic has some branches where having 4 hearts is one possible requirement (of several alternatives) |         # Otherwise, logic has some branches where having 4 hearts is one possible requirement (of several alternatives) | ||||||
|  | @ -713,7 +712,7 @@ def get_pool_core(world, player: int): | ||||||
|         pool.remove("Rupees (20)") |         pool.remove("Rupees (20)") | ||||||
| 
 | 
 | ||||||
|     if retro_bow: |     if retro_bow: | ||||||
|         replace = {'Single Arrow', 'Arrows (10)', 'Arrow Upgrade (+5)', 'Arrow Upgrade (+10)', 'Arrow Upgrade (50)'} |         replace = {'Single Arrow', 'Arrows (10)', 'Arrow Upgrade (+5)', 'Arrow Upgrade (+10)', 'Arrow Upgrade (70)'} | ||||||
|         pool = ['Rupees (5)' if item in replace else item for item in pool] |         pool = ['Rupees (5)' if item in replace else item for item in pool] | ||||||
|     if world.small_key_shuffle[player] == small_key_shuffle.option_universal: |     if world.small_key_shuffle[player] == small_key_shuffle.option_universal: | ||||||
|         pool.extend(diff.universal_keys) |         pool.extend(diff.universal_keys) | ||||||
|  |  | ||||||
|  | @ -110,9 +110,9 @@ item_table = {'Bow': ItemData(IC.progression, None, 0x0B, 'You have\nchosen the\ | ||||||
|               'Crystal 7': ItemData(IC.progression, 'Crystal', (0x08, 0x34, 0x64, 0x40, 0x7C, 0x06), None, None, None, None, None, None, "a blue crystal"), |               'Crystal 7': ItemData(IC.progression, 'Crystal', (0x08, 0x34, 0x64, 0x40, 0x7C, 0x06), None, None, None, None, None, None, "a blue crystal"), | ||||||
|               'Single Arrow': ItemData(IC.filler, None, 0x43, 'a lonely arrow\nsits here.', 'and the arrow', 'stick-collecting kid', 'sewing needle for sale', 'fungus for arrow', 'archer boy sews again', 'an arrow'), |               'Single Arrow': ItemData(IC.filler, None, 0x43, 'a lonely arrow\nsits here.', 'and the arrow', 'stick-collecting kid', 'sewing needle for sale', 'fungus for arrow', 'archer boy sews again', 'an arrow'), | ||||||
|               'Arrows (10)': ItemData(IC.filler, None, 0x44, 'This will give\nyou ten shots\nwith your bow!', 'and the arrow pack','stick-collecting kid', 'sewing kit for sale', 'fungus for arrows', 'archer boy sews again','ten arrows'), |               'Arrows (10)': ItemData(IC.filler, None, 0x44, 'This will give\nyou ten shots\nwith your bow!', 'and the arrow pack','stick-collecting kid', 'sewing kit for sale', 'fungus for arrows', 'archer boy sews again','ten arrows'), | ||||||
|               'Arrow Upgrade (+10)': ItemData(IC.useful, None, 0x54, 'increase arrow\nstorage, low\nlow price', 'and the quiver', 'quiver-enlarging kid', 'arrow boost for sale', 'witch and more skewers', 'upgrade boy sews more again', 'arrow capacity'), |               'Arrow Upgrade (+10)': ItemData(IC.progression_skip_balancing, None, 0x54, 'increase arrow\nstorage, low\nlow price', 'and the quiver', 'quiver-enlarging kid', 'arrow boost for sale', 'witch and more skewers', 'upgrade boy sews more again', 'arrow capacity'), | ||||||
|               'Arrow Upgrade (+5)': ItemData(IC.useful, None, 0x53, 'increase arrow\nstorage, low\nlow price', 'and the quiver', 'quiver-enlarging kid', 'arrow boost for sale', 'witch and more skewers', 'upgrade boy sews more again', 'arrow capacity'), |               'Arrow Upgrade (+5)': ItemData(IC.progression_skip_balancing, None, 0x53, 'increase arrow\nstorage, low\nlow price', 'and the quiver', 'quiver-enlarging kid', 'arrow boost for sale', 'witch and more skewers', 'upgrade boy sews more again', 'arrow capacity'), | ||||||
|               'Arrow Upgrade (70)': ItemData(IC.useful, None, 0x4D, 'increase arrow\nstorage, low\nlow price', 'and the quiver', 'quiver-enlarging kid', 'arrow boost for sale', 'witch and more skewers', 'upgrade boy sews more again', 'arrow capacity'), |               'Arrow Upgrade (70)': ItemData(IC.progression_skip_balancing, None, 0x4D, 'increase arrow\nstorage, low\nlow price', 'and the quiver', 'quiver-enlarging kid', 'arrow boost for sale', 'witch and more skewers', 'upgrade boy sews more again', 'arrow capacity'), | ||||||
|               'Single Bomb': ItemData(IC.filler, None, 0x27, 'I make things\ngo BOOM! But\njust once.', 'and the explosion', 'the bomb-holding kid', 'firecracker for sale', 'blend fungus into bomb', '\'splosion boy explodes again', 'a bomb'), |               'Single Bomb': ItemData(IC.filler, None, 0x27, 'I make things\ngo BOOM! But\njust once.', 'and the explosion', 'the bomb-holding kid', 'firecracker for sale', 'blend fungus into bomb', '\'splosion boy explodes again', 'a bomb'), | ||||||
|               'Bombs (3)': ItemData(IC.filler, None, 0x28, 'I make things\ngo triple\nBOOM!!!', 'and the explosions', 'the bomb-holding kid', 'firecrackers for sale', 'blend fungus into bombs', '\'splosion boy explodes again', 'three bombs'), |               'Bombs (3)': ItemData(IC.filler, None, 0x28, 'I make things\ngo triple\nBOOM!!!', 'and the explosions', 'the bomb-holding kid', 'firecrackers for sale', 'blend fungus into bombs', '\'splosion boy explodes again', 'three bombs'), | ||||||
|               'Bombs (10)': ItemData(IC.filler, None, 0x31, 'I make things\ngo BOOM! Ten\ntimes!', 'and the explosions', 'the bomb-holding kid', 'firecrackers for sale', 'blend fungus into bombs', '\'splosion boy explodes again', 'ten bombs'), |               'Bombs (10)': ItemData(IC.filler, None, 0x31, 'I make things\ngo BOOM! Ten\ntimes!', 'and the explosions', 'the bomb-holding kid', 'firecrackers for sale', 'blend fungus into bombs', '\'splosion boy explodes again', 'ten bombs'), | ||||||
|  |  | ||||||
|  | @ -170,7 +170,8 @@ def push_shop_inventories(multiworld): | ||||||
|         # Retro Bow arrows will already have been pushed |         # Retro Bow arrows will already have been pushed | ||||||
|         if (not multiworld.retro_bow[location.player]) or ((item_name, location.item.player) |         if (not multiworld.retro_bow[location.player]) or ((item_name, location.item.player) | ||||||
|                                                            != ("Single Arrow", location.player)): |                                                            != ("Single Arrow", location.player)): | ||||||
|             location.shop.push_inventory(location.shop_slot, item_name, location.shop_price, |             location.shop.push_inventory(location.shop_slot, item_name, | ||||||
|  |                                          round(location.shop_price * get_price_modifier(location.item)), | ||||||
|                                          1, location.item.player if location.item.player != location.player else 0, |                                          1, location.item.player if location.item.player != location.player else 0, | ||||||
|                                          location.shop_price_type) |                                          location.shop_price_type) | ||||||
|             location.shop_price = location.shop.inventory[location.shop_slot]["price"] = min(location.shop_price, |             location.shop_price = location.shop.inventory[location.shop_slot]["price"] = min(location.shop_price, | ||||||
|  |  | ||||||
|  | @ -23,10 +23,10 @@ def can_buy(state: CollectionState, item: str, player: int) -> bool: | ||||||
|                shop in state.multiworld.shops) |                shop in state.multiworld.shops) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def can_shoot_arrows(state: CollectionState, player: int) -> bool: | def can_shoot_arrows(state: CollectionState, player: int, count: int = 0) -> bool: | ||||||
|     if state.multiworld.retro_bow[player]: |     if state.multiworld.retro_bow[player]: | ||||||
|         return (state.has('Bow', player) or state.has('Silver Bow', player)) and can_buy(state, 'Single Arrow', player) |         return (state.has('Bow', player) or state.has('Silver Bow', player)) and can_buy(state, 'Single Arrow', player) | ||||||
|     return state.has('Bow', player) or state.has('Silver Bow', player) |     return (state.has('Bow', player) or state.has('Silver Bow', player)) and can_hold_arrows(state, player, count) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def has_triforce_pieces(state: CollectionState, player: int) -> bool: | def has_triforce_pieces(state: CollectionState, player: int) -> bool: | ||||||
|  | @ -84,11 +84,18 @@ def can_extend_magic(state: CollectionState, player: int, smallmagic: int = 16, | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def can_hold_arrows(state: CollectionState, player: int, quantity: int): | def can_hold_arrows(state: CollectionState, player: int, quantity: int): | ||||||
|     arrows = 30 + ((state.count("Arrow Upgrade (+5)", player) * 5) + (state.count("Arrow Upgrade (+10)", player) * 10) |     if state.multiworld.worlds[player].options.shuffle_capacity_upgrades: | ||||||
|                    + (state.count("Bomb Upgrade (50)", player) * 50)) |         if quantity == 0: | ||||||
|  |             return True | ||||||
|  |         if state.has("Arrow Upgrade (70)", player): | ||||||
|  |             arrows = 70 | ||||||
|  |         else: | ||||||
|  |             arrows = (30 + (state.count("Arrow Upgrade (+5)", player) * 5) | ||||||
|  |                       + (state.count("Arrow Upgrade (+10)", player) * 10)) | ||||||
|             # Arrow Upgrade (+5) beyond the 6th gives +10 |             # Arrow Upgrade (+5) beyond the 6th gives +10 | ||||||
|             arrows += max(0, ((state.count("Arrow Upgrade (+5)", player) - 6) * 10)) |             arrows += max(0, ((state.count("Arrow Upgrade (+5)", player) - 6) * 10)) | ||||||
|         return min(70, arrows) >= quantity |         return min(70, arrows) >= quantity | ||||||
|  |     return quantity <= 30 or state.has("Capacity Upgrade Shop", player) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def can_use_bombs(state: CollectionState, player: int, quantity: int = 1) -> bool: | def can_use_bombs(state: CollectionState, player: int, quantity: int = 1) -> bool: | ||||||
|  |  | ||||||
|  | @ -77,5 +77,5 @@ class TestMiseryMire(TestDungeon): | ||||||
|             ["Misery Mire - Boss", False, [], ['Bomb Upgrade (+5)', 'Bomb Upgrade (+10)', 'Bomb Upgrade (50)']], |             ["Misery Mire - Boss", False, [], ['Bomb Upgrade (+5)', 'Bomb Upgrade (+10)', 'Bomb Upgrade (50)']], | ||||||
|             ["Misery Mire - Boss", True, ['Bomb Upgrade (+5)', 'Big Key (Misery Mire)', 'Lamp', 'Cane of Somaria', 'Progressive Sword', 'Pegasus Boots']], |             ["Misery Mire - Boss", True, ['Bomb Upgrade (+5)', 'Big Key (Misery Mire)', 'Lamp', 'Cane of Somaria', 'Progressive Sword', 'Pegasus Boots']], | ||||||
|             ["Misery Mire - Boss", True, ['Bomb Upgrade (+5)', 'Big Key (Misery Mire)', 'Lamp', 'Cane of Somaria', 'Hammer', 'Pegasus Boots']], |             ["Misery Mire - Boss", True, ['Bomb Upgrade (+5)', 'Big Key (Misery Mire)', 'Lamp', 'Cane of Somaria', 'Hammer', 'Pegasus Boots']], | ||||||
|             ["Misery Mire - Boss", True, ['Bomb Upgrade (+5)', 'Big Key (Misery Mire)', 'Lamp', 'Cane of Somaria', 'Progressive Bow', 'Pegasus Boots']], |             ["Misery Mire - Boss", True, ['Bomb Upgrade (+5)', 'Big Key (Misery Mire)', 'Lamp', 'Cane of Somaria', 'Progressive Bow', 'Arrow Upgrade (+5)', 'Pegasus Boots']], | ||||||
|         ]) |         ]) | ||||||
		Loading…
	
		Reference in New Issue