diff --git a/Adventures in Lestoria Tests/EnchantTests.cpp b/Adventures in Lestoria Tests/EnchantTests.cpp index f18c6f69..7192f64b 100644 --- a/Adventures in Lestoria Tests/EnchantTests.cpp +++ b/Adventures in Lestoria Tests/EnchantTests.cpp @@ -112,10 +112,12 @@ namespace EnchantTests std::weak_ptrnullRing2{Inventory::AddItem("Null Ring"s)}; Assert::AreEqual(100,player->GetMaxHealth(),L"Player starts with 100 health."); Inventory::EquipItem(nullRing,EquipSlot::RING1); + std::unordered_mapstatDistribution; for(int i:std::ranges::iota_view(0,1000)){ nullRing.lock()->EnchantItem("Health Boost"); - Test::InRange(player->GetMaxHealth(),{103,105},L"Max Health not in expected range."); + statDistribution[player->GetMaxHealth()]++; } + Assert::AreEqual(size_t(3),statDistribution.size(),L"There should be three entries generated. If not, then the RNG picking is likely not working!"); Inventory::EquipItem(nullRing2,EquipSlot::RING2); for(int i:std::ranges::iota_view(0,1000)){ nullRing2.lock()->EnchantItem("Health Boost"); diff --git a/Adventures in Lestoria/Item.h b/Adventures in Lestoria/Item.h index e2652de6..6f4057a2 100644 --- a/Adventures in Lestoria/Item.h +++ b/Adventures in Lestoria/Item.h @@ -169,6 +169,10 @@ namespace PlayerTests{ class PlayerTest; }; +namespace EnchantTests{ + class EnchantTest; +}; + using IncreaseAmount=int; using RefineResult=std::pair; @@ -180,6 +184,7 @@ class Item{ friend void Merchant::PurchaseItem(IT item,uint32_t amt); friend void Merchant::SellItem(std::weak_ptr,uint32_t amt); friend class PlayerTests::PlayerTest; + friend class EnchantTests::EnchantTest; private: //The amount in the current item stack. uint32_t amt; diff --git a/Adventures in Lestoria/ItemEnchant.cpp b/Adventures in Lestoria/ItemEnchant.cpp index a6a18e6d..4df506e3 100644 --- a/Adventures in Lestoria/ItemEnchant.cpp +++ b/Adventures in Lestoria/ItemEnchant.cpp @@ -172,14 +172,14 @@ ItemEnchant::ItemEnchant(const std::string_view enchantName) float maxVal=ItemEnchantInfo::ENCHANT_LIST.at(this->enchantName).maxStatModifiers.A_Read(attr); if(minVal==maxVal)A(attr)=minVal; else{ - const auto&randRange{std::ranges::iota_view(int(minVal),int(maxVal))}; + const auto&randRange{std::ranges::iota_view(int(minVal),int(maxVal+1))}; A(attr)=randRange[util::random()%randRange.size()]; } const std::string wrappedConfigStr{std::vformat("{{{}}}",std::make_format_args(attr.ActualName()))}; size_t configValInd{description.find(wrappedConfigStr)}; if(configValInd==std::string::npos)continue; - std::string formattedFloat{std::format("{}{}#FFFFFF",ItemEnchantInfo::enchantAttributeCol.toHTMLColorCode(),val)}; + std::string formattedFloat{std::format("{}{}#FFFFFF",ItemEnchantInfo::enchantAttributeCol.toHTMLColorCode(),A_Read(attr))}; description=description.replace(configValInd,wrappedConfigStr.length(),formattedFloat); } } diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index f69ab94f..8ed3f602 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 2 #define VERSION_PATCH 3 -#define VERSION_BUILD 10708 +#define VERSION_BUILD 10720 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/items/ItemEnchants.txt b/Adventures in Lestoria/assets/config/items/ItemEnchants.txt index e0f759d3..e9080ec9 100644 --- a/Adventures in Lestoria/assets/config/items/ItemEnchants.txt +++ b/Adventures in Lestoria/assets/config/items/ItemEnchants.txt @@ -554,7 +554,7 @@ Item Enchants Magical Protection { - Description = "Provides a defensive aura granting many boons." + Description = "Provides a defensive aura granting many boons.\n\nHealth +{Health %}%\nDamage Reduction +{Damage Reduction}%\nMove Spd: +{Move Spd %}%\nRestores {HP6 Recovery %}% HP every 6 seconds." # Stat, Lowest, Highest Value Stat Modifier[0] = Health %, 2, 3 Stat Modifier[1] = Damage Reduction, 2, 3 @@ -563,7 +563,7 @@ Item Enchants } Aura of the Beast { - Description = "Provides an offensive aura granting many boons." + Description = "Provides an offensive aura granting many boons.\n\nAttack: +{Attack %}%\nCrit Rate: +{Crit Rate}%\nCDR: +{CDR}%\nCrit Damage: +{Crit Dmg}%" # Stat, Lowest, Highest Value Stat Modifier[0] = Attack %, 2, 3 Stat Modifier[1] = Crit Rate, 2, 3 diff --git a/Adventures in Lestoria/olcUTIL_DataFile.h b/Adventures in Lestoria/olcUTIL_DataFile.h index d97875a4..d14e5b2f 100644 --- a/Adventures in Lestoria/olcUTIL_DataFile.h +++ b/Adventures in Lestoria/olcUTIL_DataFile.h @@ -408,10 +408,18 @@ namespace olc::utils // elements may exist in quotes a, b, c, "d, e", f. So we need to iterate // character by character and break up the value bool bInQuotes = false; + bool bEscapeChar = false; std::string sToken; size_t nTokenCount = 0; for (const auto c : sPropValue) { + if (bEscapeChar&&c == 'n') //Parse a newline. + { + sToken.append(1, '\n'); + bEscapeChar=false; + continue; + } + bEscapeChar=false; // Is character a quote... if (c == '\"') { @@ -419,6 +427,12 @@ namespace olc::utils bInQuotes = !bInQuotes; } else + if (c == '\\') + { + // ...yes, so toggle quote state + bEscapeChar=true; + } + else { // ...no, so proceed creating token. If we are in quote state // then just append characters until we exit quote state. diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index bff2cba1..3a312ff3 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ