Dynamically determine and append all prefix and suffix names and descriptions and name/description replacements for all enhancements that affect abilities.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Failing after 3m50s

This commit is contained in:
sigonasr2 2025-05-07 16:34:15 -04:00
parent dcb31a01e1
commit 2447a6bbb1
6 changed files with 32 additions and 11 deletions

View File

@ -69,9 +69,31 @@ const bool Ability::operator==(const Ability&a)const{
}
const std::string Ability::GetName()const{
return std::format("{}",name);
std::string prefixName{};
std::string newName{};
std::string suffixName{};
for(const auto&enchant:ItemEnchantInfo::GetAllEnchantsAffectingAbility(name)){
const ItemEnchantInfo::AbilityDescriptionModifiers&modifiers{enchant.get().GetModifiers()};
if(prefixName.length()>0&&modifiers.preName)prefixName+=" ";
prefixName+=modifiers.preName.value_or("");
newName=modifiers.newName.value_or(name);
if(suffixName.length()>0&&modifiers.preName)suffixName+=" ";
suffixName+=modifiers.postName.value_or("");
}
return std::format("{}{}{}",prefixName,newName,suffixName);
}
const std::string_view Ability::GetDescription()const{
return description;
std::string prefixDescription{};
std::string newDescription{};
std::string suffixDescription{};
for(const auto&enchant:ItemEnchantInfo::GetAllEnchantsAffectingAbility(name)){
const ItemEnchantInfo::AbilityDescriptionModifiers&modifiers{enchant.get().GetModifiers()};
if(prefixDescription.length()>0&&modifiers.preName)prefixDescription+=" ";
prefixDescription+=modifiers.preDescription.value_or("");
newDescription=modifiers.newDescription.value_or(name);
if(suffixDescription.length()>0&&modifiers.preName)suffixDescription+=" ";
suffixDescription+=modifiers.postDescription.value_or("");
}
return std::format("{}{}{}",prefixDescription,newDescription,suffixDescription);
}

View File

@ -2183,8 +2183,7 @@ void AiL::RenderCooldowns(){
if(HasEnchantWithAbilityAffected)abilityTitleCol=Pixel{0xFFCD00};
if(a.itemAbility)abilityTitleCol=Pixel{0xA2FF00};
Ability::tooltipTitleCol=abilityTitleCol;
const std::vector<std::reference_wrapper<ItemEnchantInfo>>
else Ability::tooltipTitle=std::format("{}",a.GetName());
Ability::tooltipTitle=std::format("{}",a.GetName());
Ability::tooltipText=std::format("{}",a.GetDescription());
}
}else heldDownAnyAbilityKey=true;

View File

@ -367,8 +367,9 @@ const std::optional<Class>&ItemEnchant::GetClass()const{
}
const std::vector<std::reference_wrapper<ItemEnchantInfo>>ItemEnchantInfo::GetAllEnchantsAffectingAbility(const std::string_view ability){
std::vector<std::reference_wrapper<ItemEnchantInfo>>enchantsAffectingList{};
for(const auto&[enchant,info]:ItemEnchantInfo::GetEnchants()){
if(info.GetAbility()&&(*info.GetAbility())->GetName()==ability)enchantsAffectingList.emplace_back(info);
for(const auto&enchantName:game->GetPlayer()->GetEnchants()){
const ItemEnchantInfo&enchant{ItemEnchantInfo::GetEnchant(enchantName)};
if(enchant.GetAbility()&&(*enchant.GetAbility())->GetName()==ability)enchantsAffectingList.emplace_back(std::ref(enchant));
}
return enchantsAffectingList;
}

View File

@ -2324,8 +2324,6 @@ const vf2d&Player::GetPreviousPos()const{
return previousPos;
}
const std::optional<ItemEnchantInfo>Player::HasEnchantWithAbilityAffected(const std::string_view abilityName)const{
ItemEnchantInfo::GetEnchant(abilityName)
const std::unordered_set<std::string>&Player::GetEnchants()const{
return enchantList;
}

View File

@ -340,6 +340,7 @@ public:
void SetTestScreenAimingLocation(vf2d forcedAimingLoc);
const bool CoveredInInk()const;
const vf2d&GetPreviousPos()const; //The position the player was at on the last frame, can be used for comparison purposes to predict where the player may be next.
const std::unordered_set<std::string>&GetEnchants()const; //Get all enchants currently affeting the player.
private:
static std::vector<std::reference_wrapper<Ability>>ABILITY_LIST;
const int SHIELD_CAPACITY{32};

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 12148
#define VERSION_BUILD 12151
#define stringify(a) stringify_(a)
#define stringify_(a) #a