Maxed out item rolls now show up in a different color. Release Build 8012.

mac-build
sigonasr2 9 months ago
parent 92ae65270e
commit 3d87f1b241
  1. 18
      Adventures in Lestoria/Item.cpp
  2. 3
      Adventures in Lestoria/Item.h
  3. 2
      Adventures in Lestoria/Version.h
  4. 8
      Adventures in Lestoria/util.cpp
  5. 1
      Adventures in Lestoria/util.h
  6. BIN
      x64/Release/Adventures in Lestoria.exe

@ -72,6 +72,7 @@ ItemEnhancementFunctionPrimingData Item::enhanceFunctionPrimed("CanEnhanceItem()
std::vector<std::shared_ptr<Item>>ItemInfo::craftableConsumables;
std::vector<std::string>ItemSortRules::primarySort;
std::vector<std::string>ItemSortRules::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::map<ItemSet,int>Inventory::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;

@ -80,6 +80,7 @@ using enum CompactText;
struct Stats:ItemAttributable{
static safemap<int,float>maxDamageReductionTable;
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;}
};

@ -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

@ -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;

@ -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);

Loading…
Cancel
Save