* Calculate accessible checks and show them in the check tracker. * Added added DoorUnlocked checks to the Fire Temple doors. This is needed when calculating Accessible checks while playing and using small keys. Otherwise checks will appear unaccessible because Keys have been used. * Changed RecalculateAccessibleChecks to use the logic ReachabilitySearch. * Reverted DoorUnlocked changes. * Added recalculate_accessible_checks debug console command. * Skip CanBuy check when calculating accessible checks, it spoils that some items can't be bought with the current wallet. * Set RAND_INF_ZELDAS_LETTER. * Don't add locations to the pool when calculating accessible checks. * Save and Load randomizer trick options. * Get the number of used small keys. * Added check if bean was planted. * Show number of Accessible checks in each Area. * Accounted for missing RG_POCKET_CUCCO in logic HasItem and ApplyItemEffect. * Show accessible checks via an icon. * Check shop price against current wallet. * Recalculate Accessible Checks in CheckTrackerLoadGame instead of LoadFile. * RecalculateAccessibleChecks on save. * Don't unset Zelda's Letter. * Added Only Show Available Checks checkbox. * Rename Accessible Checks to Available Checks. * Added option to Enable Available Checks. * Remove debug console to recalculate available checks, this can now be done by toggling Enable Available Checks in the settings. * Remove extra requiredTrial. * Default "Hide unshuffled shop item checks" unchecked. * Updated GetSmallKeyCount to return int8_t. * Default AmmoDrop to true until the setting is implemented. * Fixed Sleeping Waterfall timesaver. * Updated Only Show Available Checks to let Show Hidden Items reveal hidden available checks. * Revert "Don't unset Zelda's Letter." This reverts commit 4b5903940f18a20b69620f3741760fd19ac3876f. * Set RAND_INF_ZELDAS_LETTER. * Revert "Fixed Sleeping Waterfall timesaver." This reverts commit 9b62fd5297cf5bf778ba26bd593c4728c9038be8. * Added isMagicAcquired to Logic::HasItem. * GetDungeonSmallKeyDoors return static emptyVector. * Comment out AmmoCanDrop in ResetLogic. * Added location_access CanBuy todo. * Reverted Get and Set SmallKeyCount to use uint8_t and handled -1 keys. * Added todo for MQ Water GetUsedSmallKeyCount.
241 lines
5.4 KiB
C++
241 lines
5.4 KiB
C++
#include "item_location.h"
|
|
#include "context.h"
|
|
#include "logic.h"
|
|
|
|
namespace Rando {
|
|
ItemLocation::ItemLocation() : rc(RC_UNKNOWN_CHECK) {}
|
|
ItemLocation::ItemLocation(const RandomizerCheck rc_) : rc(rc_) {}
|
|
|
|
RandomizerCheck ItemLocation::GetRandomizerCheck() const {
|
|
return rc;
|
|
}
|
|
|
|
bool ItemLocation::IsAddedToPool() const {
|
|
return addedToPool;
|
|
}
|
|
|
|
void ItemLocation::AddToPool() {
|
|
addedToPool = true;
|
|
}
|
|
|
|
void ItemLocation::RemoveFromPool() {
|
|
addedToPool = false;
|
|
}
|
|
|
|
const Item& ItemLocation::GetPlacedItem() const {
|
|
return StaticData::RetrieveItem(placedItem);
|
|
}
|
|
|
|
RandomizerGet& ItemLocation::RefPlacedItem() {
|
|
return placedItem;
|
|
}
|
|
|
|
const Text& ItemLocation::GetPlacedItemName() const {
|
|
return StaticData::RetrieveItem(placedItem).GetName();
|
|
}
|
|
|
|
RandomizerGet ItemLocation::GetPlacedRandomizerGet() const {
|
|
return placedItem;
|
|
}
|
|
|
|
void ItemLocation::SetPlacedItem(const RandomizerGet item) {
|
|
placedItem = item;
|
|
SetPrice (StaticData::RetrieveItem(placedItem).GetPrice());
|
|
}
|
|
|
|
void ItemLocation::SetDelayedItem(const RandomizerGet item) {
|
|
delayedItem = item;
|
|
}
|
|
|
|
void ItemLocation::SaveDelayedItem () {
|
|
placedItem = delayedItem;
|
|
delayedItem = RG_NONE;
|
|
}
|
|
|
|
void ItemLocation::SetParentRegion(const RandomizerRegion region) {
|
|
parentRegion = region;
|
|
}
|
|
|
|
//RANDOTODO only used in tracker now, could possibly be removed
|
|
RandomizerRegion ItemLocation::GetParentRegionKey() const {
|
|
return parentRegion;
|
|
}
|
|
|
|
void ItemLocation::MergeAreas(std::set<RandomizerArea> newAreas) {
|
|
areas.merge(newAreas);
|
|
if (areas.size() >= 2){
|
|
//if we have more than 1 area, remove any RA_NONE as that's not a real area. can happen if an entrance is in 2 regions and 1 is disconnected
|
|
areas.erase(RA_NONE);
|
|
}
|
|
}
|
|
|
|
std::set<RandomizerArea> ItemLocation::GetAreas() const {
|
|
return areas;
|
|
}
|
|
|
|
RandomizerArea ItemLocation::GetFirstArea() const {
|
|
if (areas.empty()){
|
|
assert(false);
|
|
return RA_NONE;
|
|
} else {
|
|
return *areas.begin();
|
|
}
|
|
}
|
|
|
|
RandomizerArea ItemLocation::GetRandomArea() const {
|
|
if (areas.empty()){
|
|
SPDLOG_DEBUG("Attempted to get random area of location with no areas: ");
|
|
SPDLOG_DEBUG(Rando::StaticData::GetLocation(rc)->GetName());
|
|
assert(false);
|
|
return RA_NONE;
|
|
} else {
|
|
return RandomElementFromSet(areas);
|
|
}
|
|
}
|
|
|
|
void ItemLocation::PlaceVanillaItem() {
|
|
placedItem = StaticData::GetLocation(rc)->GetVanillaItem();
|
|
}
|
|
|
|
void ItemLocation::ApplyPlacedItemEffect() const {
|
|
StaticData::RetrieveItem(placedItem).ApplyEffect();
|
|
}
|
|
|
|
uint16_t ItemLocation::GetPrice() const {
|
|
//RANDOTODO if we ever change price of shop items, this needs replacing with proper price assignment in Fill
|
|
if (StaticData::RetrieveItem(placedItem).GetItemType() == ITEMTYPE_SHOP) {
|
|
return StaticData::RetrieveItem(placedItem).GetPrice();
|
|
}
|
|
return price;
|
|
}
|
|
|
|
void ItemLocation::SetPrice(const uint16_t price_) {
|
|
if (hasCustomPrice) {
|
|
return;
|
|
}
|
|
price = price_;
|
|
}
|
|
|
|
bool ItemLocation::HasCustomPrice() const {
|
|
return hasCustomPrice;
|
|
}
|
|
|
|
void ItemLocation::SetCustomPrice(const uint16_t price_) {
|
|
price = price_;
|
|
hasCustomPrice = true;
|
|
}
|
|
|
|
bool ItemLocation::HasObtained() const {
|
|
return status == RCSHOW_COLLECTED || status == RCSHOW_SAVED;
|
|
}
|
|
|
|
void ItemLocation::SetCheckStatus(RandomizerCheckStatus status_) {
|
|
status = status_;
|
|
}
|
|
|
|
RandomizerCheckStatus ItemLocation::GetCheckStatus() {
|
|
return status;
|
|
}
|
|
|
|
void ItemLocation::SetIsSkipped(bool isSkipped_) {
|
|
isSkipped = isSkipped_;
|
|
}
|
|
|
|
bool ItemLocation::GetIsSkipped() {
|
|
return isSkipped;
|
|
}
|
|
|
|
bool ItemLocation::IsHintable() const {
|
|
return isHintable;
|
|
}
|
|
|
|
void ItemLocation::SetAsHintable() {
|
|
isHintable = true;
|
|
}
|
|
|
|
bool ItemLocation::IsAHintAccessible() const {
|
|
return hintAccesible;
|
|
}
|
|
|
|
void ItemLocation::SetHintAccesible() {
|
|
hintAccesible = true;
|
|
}
|
|
|
|
const std::vector<RandomizerHint>& ItemLocation::GetHintedBy() const {
|
|
return hintedBy;
|
|
}
|
|
|
|
void ItemLocation::AddHintedBy(const RandomizerHint hintKey) {
|
|
hintedBy.push_back(hintKey);
|
|
}
|
|
|
|
bool ItemLocation::IsHidden() const {
|
|
return hidden;
|
|
}
|
|
|
|
void ItemLocation::SetHidden(const bool hidden_) {
|
|
hidden = hidden_;
|
|
}
|
|
|
|
bool ItemLocation::IsExcluded() {
|
|
return excludedOption.Is(RO_LOCATION_EXCLUDE);
|
|
}
|
|
|
|
OptionValue& ItemLocation::GetExcludedOption() {
|
|
return excludedOption;
|
|
}
|
|
|
|
void ItemLocation::SetExcludedOption(uint8_t val) {
|
|
excludedOption.Set(val);
|
|
}
|
|
|
|
bool ItemLocation::IsVisible() const {
|
|
return visibleInImGui;
|
|
}
|
|
void ItemLocation::SetVisible(const bool visibleInImGui_) {
|
|
visibleInImGui = visibleInImGui_;
|
|
|
|
}
|
|
|
|
bool ItemLocation::IsWothCandidate() const {
|
|
return wothCandidate;
|
|
}
|
|
|
|
void ItemLocation::SetWothCandidate() {
|
|
wothCandidate = true;
|
|
}
|
|
|
|
bool ItemLocation::IsFoolishCandidate() const {
|
|
return barrenCandidate;
|
|
}
|
|
|
|
void ItemLocation::SetBarrenCandidate() {
|
|
barrenCandidate = true;
|
|
}
|
|
|
|
void ItemLocation::ResetVariables() {
|
|
addedToPool = false;
|
|
placedItem = RG_NONE;
|
|
delayedItem = RG_NONE;
|
|
isHintable = false;
|
|
hintAccesible = false;
|
|
hintedBy = {};
|
|
price = 0;
|
|
hasCustomPrice = false;
|
|
hidden = false;
|
|
wothCandidate = false;
|
|
barrenCandidate = false;
|
|
areas = {};
|
|
status = RCSHOW_UNCHECKED;
|
|
isSkipped = false;
|
|
isAvailable = false;
|
|
}
|
|
|
|
bool ItemLocation::IsAvailable() const {
|
|
return isAvailable;
|
|
}
|
|
|
|
void ItemLocation::SetAvailable(bool isAvailable_) {
|
|
isAvailable = isAvailable_;
|
|
}
|
|
} |