diff --git a/Adventures in Lestoria/Ability.cpp b/Adventures in Lestoria/Ability.cpp index 88d7018f..d66e64ea 100644 --- a/Adventures in Lestoria/Ability.cpp +++ b/Adventures in Lestoria/Ability.cpp @@ -92,8 +92,58 @@ const std::string Ability::GetNameWithPlayerModifiers()const{ } const std::string Ability::GetDescriptionWithPlayerModifiers()const{ + using SpecialKey=std::string; + using TranslateFunc=std::function; + std::unordered_mapspecialPrefixes{ + #define TranslateFunc [&](const std::string&val)->std::string + {"DamageMult",TranslateFunc{ + float damageMult{stof((*abilityConfig).get()[val].GetString())}; + int finalDmg{int(damageMult*game->GetPlayer()->GetAttack())}; + return std::format("{}",finalDmg); + }}, + }; + const Pixel specialValCol{69,249,255}; + + const auto ParseVariables=[&](const std::string_view abilityText)->std::string{ + std::string finalText{}; + size_t marker{}; + std::string variableName{}; + bool bracesFound{false}; + + const auto FindAndParse=[&finalText,&bracesFound,&variableName,&specialPrefixes,&specialValCol](datafile&data)->bool{ + if(data.HasProperty(variableName)){ + finalText+=specialValCol.toHTMLColorCode()+data.GetProperty(variableName).GetFullString()+WHITE.toHTMLColorCode(); + bracesFound=false; + variableName=""; + return true; + }else if(size_t separatorMarker{std::string::npos};(separatorMarker=variableName.find(':'))!=std::string::npos){ + std::string separatorKey{variableName.substr(0,separatorMarker)}; + std::string separatorVal{variableName.substr(separatorMarker+1)}; + if(!specialPrefixes.count(separatorKey))ERR(std::format("Could not find translation function for key {} inside special prefixes map!",separatorKey)) + else { + finalText+=specialValCol.toHTMLColorCode()+specialPrefixes[separatorKey](separatorVal)+WHITE.toHTMLColorCode(); + bracesFound=false; + return true; + } + } + return false; + }; + + while(marker0&&modifiers.preDescription)suffixDescription+=" "; suffixDescription+=modifiers.postDescription.value_or(""); - const auto ParseVariables=[&](const std::string_view abilityText)->std::string{ + const auto ParseVariablesForEnchant=[&](const std::string_view abilityText)->std::string{ std::string finalText{}; size_t marker{}; std::string variableName{}; bool bracesFound{false}; - const auto FindAndParse=[&finalText,&bracesFound,&variableName](datafile&data)->bool{ + const auto FindAndParse=[&finalText,&bracesFound,&variableName,&specialPrefixes,&specialValCol](datafile&data)->bool{ if(data.HasProperty(variableName)){ - finalText+=data.GetProperty(variableName).GetFullString(); + finalText+=specialValCol.toHTMLColorCode()+data.GetProperty(variableName).GetFullString()+WHITE.toHTMLColorCode(); bracesFound=false; variableName=""; return true; + }else if(size_t separatorMarker{std::string::npos};(separatorMarker=variableName.find(':'))!=std::string::npos){ + std::string separatorKey{variableName.substr(0,separatorMarker)}; + std::string separatorVal{variableName.substr(separatorMarker+1)}; + if(!specialPrefixes.count(separatorKey))ERR(std::format("Could not find translation function for key {} inside special prefixes map!",separatorKey)) + else { + finalText+=specialValCol.toHTMLColorCode()+specialPrefixes[separatorKey](separatorVal)+WHITE.toHTMLColorCode(); + bracesFound=false; + return true; + } } return false; }; - while(abilityText.length()>marker){ + while(marker0&&newDescription.length()>0)finalDescription+=' '; + finalDescription+=newDescription; + if(finalDescription.length()>0&&suffixDescription.length()>0)finalDescription+=' '; + finalDescription+=suffixDescription; + return finalDescription; } \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index e167a3f3..eddf8aeb 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 12173 +#define VERSION_BUILD 12186 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/classes/Ranger.txt b/Adventures in Lestoria/assets/config/classes/Ranger.txt index a69d89ac..b87754d8 100644 --- a/Adventures in Lestoria/assets/config/classes/Ranger.txt +++ b/Adventures in Lestoria/assets/config/classes/Ranger.txt @@ -64,7 +64,7 @@ Ranger # Whether or not this ability cancels casts. CancelCast = 0 - Description = Shoots {ARROW COUNT} arrows rapidly. Total Damage: {DamageMult:TotalDamageMult} + Description = Shoots {ARROW COUNT} arrows rapidly. Total Damage: {DamageMult:TotalDamageMult}. ARROW COUNT = four @@ -104,7 +104,7 @@ Ranger # Whether or not this ability cancels casts. CancelCast = 0 - Description = Fires an ultrasonic arrow towards a location, piercing everything it comes in contact with. Deals {DamageMult} damage. + Description = Fires an ultrasonic arrow towards a location, piercing everything it comes in contact with. Deals {DamageMult:DamageMult} damage. #RGB Values. Color 1 is the circle at full cooldown, Color 2 is the color at empty cooldown. Cooldown Bar Color 1 = 64, 0, 0, 192 @@ -138,7 +138,7 @@ Ranger # Whether or not this ability cancels casts. CancelCast = 0 - Description = Prepares and fires a fan of {ArrowCount} packed arrows. Total Damage: {DamageMult} + Description = Prepares and fires a fan of {ArrowCount} packed arrows. Total Damage: {DamageMult:DamageMult}. #RGB Values. Color 1 is the circle at full cooldown, Color 2 is the color at empty cooldown. Cooldown Bar Color 1 = 64, 0, 0, 192 diff --git a/Adventures in Lestoria/assets/config/items/ItemEnchants.txt b/Adventures in Lestoria/assets/config/items/ItemEnchants.txt index 89624c39..886e5caf 100644 --- a/Adventures in Lestoria/assets/config/items/ItemEnchants.txt +++ b/Adventures in Lestoria/assets/config/items/ItemEnchants.txt @@ -180,7 +180,7 @@ Item Enchants # Use "Name" to completely overwrite the default ability name (be careful of conflicts with another modification!) Pre-Name = "Mega" DamageMult = 5.0 - Post-Description = "Cast Time increased by {CAST TIME INCREASE}." + Post-Description = Cast time increased by {CAST TIME INCREASE} seconds. } } Multi-Multishot diff --git a/Adventures in Lestoria/olcPixelGameEngine.h b/Adventures in Lestoria/olcPixelGameEngine.h index a98d8998..abd814c4 100644 --- a/Adventures in Lestoria/olcPixelGameEngine.h +++ b/Adventures in Lestoria/olcPixelGameEngine.h @@ -3574,7 +3574,7 @@ namespace olc else if (c=='#') { skip=6; - textCol=BLACK; + textCol={0,0,0,col.a}; for(int i=1;i<7;i++){ if(i<3){ textCol.r*=16; @@ -3687,7 +3687,7 @@ namespace olc else if (c=='#') { skip=6; - textCol=BLACK; + textCol={0,0,0,col.a}; for(int i=1;i<7;i++){ if(i<3){ textCol.r*=16; @@ -4256,7 +4256,7 @@ namespace olc else if (c=='#') { skip=6; - textCol=BLACK; + textCol={0,0,0,col.a}; for(int i=1;i<7;i++){ if(i<3){ textCol.r*=16; @@ -4491,7 +4491,7 @@ namespace olc else if (c=='#') { skip=6; - textCol=BLACK; + textCol={0,0,0,col.a}; for(int i=1;i<7;i++){ if(i<3){ textCol.r*=16; diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 6a78065f..5a836c5a 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ