Add changes to parse enchants affecting abilities.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Failing after 1m31s

This commit is contained in:
sigonasr2 2025-05-07 14:06:00 -05:00
parent 9722695e5b
commit dcb31a01e1
5 changed files with 26 additions and 29 deletions

View File

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

View File

@ -365,20 +365,13 @@ const bool ItemEnchant::HasAttributes()const{
const std::optional<Class>&ItemEnchant::GetClass()const{
return ItemEnchantInfo::GetEnchant(Name()).GetClass();
}
const std::string ItemEnchantInfo::GetModifiedAbilityDescription()const{
return std::format("{}{}{}",modifiers.preDescription.value_or(""),modifiers.newDescription.value_or(Description()),modifiers.postDescription.value_or(""));
}
const std::string ItemEnchantInfo::GetModifiedAbilityName(const TextStyle style)const{
std::string finalName{std::format("{}{}{}",modifiers.preName.value_or(""),modifiers.newName.value_or(Name()),modifiers.postName.value_or(""))};
using enum TextStyle;
switch(style){
case NORMAL:{
return finalName;
}break;
case COLOR_CODES:{
return ENCHANT_CATEGORIES.at(category).displayCol.toHTMLColorCode()+finalName;
}break;
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);
}
return enchantsAffectingList;
}
const ItemEnchantInfo::AbilityDescriptionModifiers ItemEnchantInfo::GetModifiers()const{
return modifiers;
}

View File

@ -64,6 +64,15 @@ public:
ABILITY_3,
};
struct AbilityDescriptionModifiers{
std::optional<std::string_view>preName;
std::optional<std::string_view>postName;
std::optional<std::string_view>newName;
std::optional<std::string_view>preDescription;
std::optional<std::string_view>postDescription;
std::optional<std::string_view>newDescription;
};
const static Pixel enchantAttributeCol;
static void Initialize();
@ -80,9 +89,8 @@ public:
const Pixel&DisplayCol()const;
const float GetConfigValue(const std::string_view keyName)const;
const float operator[](const std::string&name)const;
const std::string GetModifiedAbilityName(const TextStyle style)const; //The finalized modified name.
const std::string GetModifiedAbilityDescription()const; //The finalized modified description.
static const std::vector<ItemEnchantInfo>GetAllEnchantsAffectingAbility();
const AbilityDescriptionModifiers GetModifiers()const;
static const std::vector<std::reference_wrapper<ItemEnchantInfo>>GetAllEnchantsAffectingAbility(const std::string_view ability);
private:
class ItemEnchantCategoryData{
friend class ItemEnchantInfo;
@ -101,14 +109,6 @@ private:
std::unordered_map<std::string,float>config;
static std::unordered_map<std::string,ItemEnchantInfo>ENCHANT_LIST;
static std::unordered_map<ItemEnchantCategory,ItemEnchantCategoryData>ENCHANT_CATEGORIES;
struct AbilityDescriptionModifiers{
std::optional<std::string_view>preName;
std::optional<std::string_view>postName;
std::optional<std::string_view>newName;
std::optional<std::string_view>preDescription;
std::optional<std::string_view>postDescription;
std::optional<std::string_view>newDescription;
};
AbilityDescriptionModifiers modifiers;
};

View File

@ -21,4 +21,8 @@ Adding new class animations
Player.txt contains animation names the player has to have loaded.
<className>.cpp contains walk and idle animation references that must be loaded in the Initialize() function.
Animation.cpp contains the SetupClassWalkIdleAnimations() function which all classes need to implement with their spritesheet and class name (all caps) to create the WALK and IDLE animations in the animation database.
All other custom player class animations must be added here too.
All other custom player class animations must be added here too.
Silly Large Purple Wizard Cloak
Peace sign on finishing a stage (wink)
Kitty Headband

View File

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