diff --git a/Adventures in Lestoria/Item.cpp b/Adventures in Lestoria/Item.cpp index 3dfdd7a2..23797947 100644 --- a/Adventures in Lestoria/Item.cpp +++ b/Adventures in Lestoria/Item.cpp @@ -72,6 +72,7 @@ ItemEnhancementFunctionPrimingData Item::enhanceFunctionPrimed("CanEnhanceItem() std::vector>ItemInfo::craftableConsumables; std::vectorItemSortRules::primarySort; std::vectorItemSortRules::secondarySort; +Stats Stats::NO_MAX_HIGHLIGHT; ItemInfo::ItemInfo() :customProps({nullptr,nullptr}),img(nullptr){} @@ -653,10 +654,10 @@ const std::string Item::Description(CompactText compact)const{ if(IsEquippable()){ if(HasRandomizedStats()){ description+='\n'; - description+=randomizedStats.GetStatsString(); + description+=randomizedStats.GetStatsString(it->GetMaxStats()); } description+='\n'; - description+=GetStats().GetStatsString(compact); + description+=GetStats().GetStatsString(Stats::NO_MAX_HIGHLIGHT,compact); if(ItemSet()){ const::ItemSet*const set=ItemSet().value(); if(compact==COMPACT){ @@ -676,7 +677,7 @@ const std::string Item::Description(CompactText compact)const{ description+="\n"; } } - description+="("+std::to_string(pieceCount)+"): "+bonuses.GetStatsString(compact)+"#FFFFFF"; + description+="("+std::to_string(pieceCount)+"): "+bonuses.GetStatsString(Stats::NO_MAX_HIGHLIGHT,compact)+"#FFFFFF"; first=false; } } @@ -961,7 +962,7 @@ const std::mapInventory::GetEquippedItemSets(){ return setCounts; } -const std::string Stats::GetStatsString(CompactText compact)const{ +const std::string Stats::GetStatsString(const Stats&maxStats,CompactText compact)const{ std::string description=""; for(bool first=true;const auto&[attr,val]:attributes){ if(!first){ @@ -975,7 +976,14 @@ const std::string Stats::GetStatsString(CompactText compact)const{ if(attr.ShowAsDecimal()){ statNumber=std::format("{:.2f}",val); } - description+=std::string(attr.Name())+": "+statNumber+(attr.DisplayAsPercent()?"%":""); + + std::string col=""; + if(maxStats.attributes.count(attr)&&int(val)>=int(maxStats.attributes.at(attr))){ + Pixel shimmeringCol=PixelLerp({255,196,60},{254,217,133},sin((70*game->GetRuntime())/2.f+0.5f)); + col=util::PixelToHTMLColorCode(shimmeringCol); + } + + description+=col+std::string(attr.Name())+": "+statNumber+(attr.DisplayAsPercent()?"%":"")+"#FFFFFF"; first=false; } return description; diff --git a/Adventures in Lestoria/Item.h b/Adventures in Lestoria/Item.h index 887dd86c..5fe290eb 100644 --- a/Adventures in Lestoria/Item.h +++ b/Adventures in Lestoria/Item.h @@ -80,6 +80,7 @@ using enum CompactText; struct Stats:ItemAttributable{ static safemapmaxDamageReductionTable; static void InitializeDamageReductionTable(); + static Stats NO_MAX_HIGHLIGHT; public: inline static const float&GetDamageReductionPct(int defense){ return maxDamageReductionTable.at(std::clamp(defense,0,1000)); @@ -105,7 +106,7 @@ public: const size_t size()const{ return attributes.size(); } - const std::string GetStatsString(CompactText compact=NON_COMPACT)const; + const std::string GetStatsString(const Stats&maxStats,CompactText compact=NON_COMPACT)const; friend const bool operator==(const Stats&lhs,const Stats&rhs){return lhs.attributes==rhs.attributes;} }; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index ba6e4f8a..51ea8732 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 5 #define VERSION_PATCH 0 -#define VERSION_BUILD 7998 +#define VERSION_BUILD 8012 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/util.cpp b/Adventures in Lestoria/util.cpp index 5c9c446a..7b97f0c3 100644 --- a/Adventures in Lestoria/util.cpp +++ b/Adventures in Lestoria/util.cpp @@ -72,6 +72,14 @@ float util::lerp(float n1,float n2,double t){ return float(n1*(1-t)+n2*t); } +std::string util::PixelToHTMLColorCode(const Pixel&col){ + std::string hexCode=std::format("#{:2x}{:2x}{:2x}",col.r,col.g,col.b); + for(char&c:hexCode){ + c=toupper(c); + } + return hexCode; +} + std::string util::timerStr(float time){ int seconds=int(time); int hours=seconds/3600; diff --git a/Adventures in Lestoria/util.h b/Adventures in Lestoria/util.h index 551b35ed..88c81870 100644 --- a/Adventures in Lestoria/util.h +++ b/Adventures in Lestoria/util.h @@ -53,6 +53,7 @@ namespace olc::util{ float degToRad(float deg); float radToDeg(float rad); float lerp(float n1,float n2,double t); + std::string PixelToHTMLColorCode(const Pixel&col); std::string timerStr(float time); std::string WrapText(PixelGameEngine*pge,std::string str,int width,bool proportional,vd2d scale); std::u32string WrapText(PixelGameEngine*pge,std::u32string str,int width,Font&font,vd2d scale); diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index ba25b5d7..fd55d58b 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ