mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
LADX: use custom collect/remove to keep track of logical rupee counts instead of LogixMixin
May contain some pep8, sorry
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
from BaseClasses import Region, Entrance, Location
|
||||
from worlds.AutoWorld import LogicMixin
|
||||
from BaseClasses import Region, Entrance, Location, CollectionState
|
||||
|
||||
|
||||
from .LADXR.checkMetadata import checkMetadataTable
|
||||
from .Common import *
|
||||
from worlds.generic.Rules import add_item_rule
|
||||
from .Items import ladxr_item_to_la_item_name, ItemName, LinksAwakeningItem
|
||||
from .LADXR.locations.tradeSequence import TradeRequirements, TradeSequenceItem
|
||||
from .Items import ladxr_item_to_la_item_name
|
||||
|
||||
|
||||
prefilled_events = ["ANGLER_KEYHOLE", "RAFT", "MEDICINE2", "CASTLE_BUTTON"]
|
||||
|
||||
@@ -80,27 +79,19 @@ class LinksAwakeningLocation(Location):
|
||||
add_item_rule(self, filter_item)
|
||||
|
||||
|
||||
def has_free_weapon(state: "CollectionState", player: int) -> bool:
|
||||
def has_free_weapon(state: CollectionState, player: int) -> bool:
|
||||
return state.has("Progressive Sword", player) or state.has("Magic Rod", player) or state.has("Boomerang", player) or state.has("Hookshot", player)
|
||||
|
||||
|
||||
# If the player has access to farm enough rupees to afford a game, we assume that they can keep beating the game
|
||||
def can_farm_rupees(state: "CollectionState", player: int) -> bool:
|
||||
def can_farm_rupees(state: CollectionState, player: int) -> bool:
|
||||
return has_free_weapon(state, player) and (state.has("Can Play Trendy Game", player=player) or state.has("RAFT", player=player))
|
||||
|
||||
|
||||
class LinksAwakeningLogic(LogicMixin):
|
||||
rupees = {
|
||||
ItemName.RUPEES_20: 0,
|
||||
ItemName.RUPEES_50: 0,
|
||||
ItemName.RUPEES_100: 100,
|
||||
ItemName.RUPEES_200: 200,
|
||||
ItemName.RUPEES_500: 500,
|
||||
}
|
||||
|
||||
def get_credits(self, player: int):
|
||||
if can_farm_rupees(self, player):
|
||||
return 999999999
|
||||
return sum(self.count(item_name, player) * amount for item_name, amount in self.rupees.items())
|
||||
def get_credits(state: CollectionState, player: int):
|
||||
if can_farm_rupees(state, player):
|
||||
return 999999999
|
||||
return state.prog_items["RUPEES", player]
|
||||
|
||||
|
||||
class LinksAwakeningRegion(Region):
|
||||
@@ -137,7 +128,7 @@ class GameStateAdapater:
|
||||
|
||||
def get(self, item, default):
|
||||
if item == "RUPEES":
|
||||
return self.state.get_credits(self.player)
|
||||
return get_credits(self.state, self.player)
|
||||
elif item.endswith("_USED"):
|
||||
return 0
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user