Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add forge chance rate #2080

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ taskHuntingFreeRerollTime = 20 * 60 * 60
-- NOTE: forgeInfluencedLimit, limit of influenced monsters that will be created in interval type and time
-- NOTE: forgeFiendishLimit, limit of diabolic monsters that will be created in interval type and time, less than forgeInfluencedLimit
-- NOTE: forgeFiendishIntervalType: "hour", "minute" or "second"
-- NOTE: forgeRate is the rate compared to the global. Modify to increase or reduce the fatal/dodge/momentum chances
forgeMaxItemTier = 10
forgeCostOneSliver = 20
forgeSliverAmount = 3
Expand All @@ -130,6 +131,9 @@ forgeInfluencedLimit = 300
forgeFiendishLimit = 3
forgeFiendishIntervalType = "hour"
forgeFiendishIntervalTime = "1"
forgeRateFatal = 1
forgeRateDodge = 1
forgeRateMomentum = 1

-- Bestiary & Bosstiary system
-- NOTE: bestiaryKillMultiplier, multiplier value of monster killed, default 1
Expand Down Expand Up @@ -511,3 +515,5 @@ metricsPrometheusAddress = "0.0.0.0:9464"
--- OStream
metricsEnableOstream = false
metricsOstreamInterval = 1000


3 changes: 3 additions & 0 deletions src/config/config_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ enum ConfigKey_t : uint16_t {
FORGE_SLIVER_AMOUNT,
FORGE_TIER_LOSS_REDUCTION,
FORGE_TRANSFER_DUST_COST,
FORGE_RATE_FATAL,
FORGE_RATE_DODGE,
FORGE_RATE_MOMENTUM,
FRAG_TIME,
FREE_DEPOT_LIMIT,
FREE_PREMIUM,
Expand Down
3 changes: 3 additions & 0 deletions src/config/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ bool ConfigManager::load() {
loadIntConfig(L, FORGE_MAX_SLIVERS, "forgeMaxSlivers", 7);
loadIntConfig(L, FORGE_INFLUENCED_CREATURES_LIMIT, "forgeInfluencedLimit", 300);
loadIntConfig(L, FORGE_FIENDISH_CREATURES_LIMIT, "forgeFiendishLimit", 3);
loadFloatConfig(L, FORGE_RATE_FATAL, "forgeRateFatal", 1);
loadFloatConfig(L, FORGE_RATE_DODGE, "forgeRateDodge", 1);
loadFloatConfig(L, FORGE_RATE_MOMENTUM, "forgeRateMomentum", 1);
loadIntConfig(L, DISCORD_WEBHOOK_DELAY_MS, "discordWebhookDelayMs", Webhook::DEFAULT_DELAY_MS);

loadFloatConfig(L, BESTIARY_RATE_CHARM_SHOP_PRICE, "bestiaryRateCharmShopPrice", 1.0);
Expand Down
4 changes: 2 additions & 2 deletions src/items/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1976,9 +1976,9 @@ std::string Item::parseClassificationDescription(std::shared_ptr<Item> item) {
<< "Classification: " << std::to_string(item->getClassification()) << " Tier: " << std::to_string(item->getTier());
if (item->getTier() != 0) {
if (Item::items[item->getID()].weaponType != WEAPON_NONE) {
string << fmt::format(" ({}% Onslaught).", item->getFatalChance());
string << fmt::format(" ({:.2f}% Onslaught).", item->getFatalChance());
} else if (g_game().getObjectCategory(item) == OBJECTCATEGORY_HELMETS) {
string << fmt::format(" ({}% Momentum).", item->getMomentumChance());
string << fmt::format(" ({:.2f}% Momentum).", item->getMomentumChance());
} else if (g_game().getObjectCategory(item) == OBJECTCATEGORY_ARMORS) {
string << fmt::format(" ({:.2f}% Ruse).", item->getDodgeChance());
}
Expand Down
6 changes: 3 additions & 3 deletions src/items/item.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,21 +658,21 @@ class Item : virtual public Thing, public ItemProperties, public SharedObject {
if (getTier() == 0) {
return 0;
}
return (0.0307576 * getTier() * getTier()) + (0.440697 * getTier()) + 0.026;
return g_configManager().getFloat(FORGE_RATE_DODGE, __FUNCTION__) * ((0.0307576 * getTier() * getTier()) + (0.440697 * getTier()) + 0.026);
}

double_t getFatalChance() const {
if (getTier() == 0) {
return 0;
}
return 0.5 * getTier() + 0.05 * ((getTier() - 1) * (getTier() - 1));
return g_configManager().getFloat(FORGE_RATE_FATAL, __FUNCTION__) * (0.5 * getTier() + 0.05 * ((getTier() - 1) * (getTier() - 1)));
}

double_t getMomentumChance() const {
if (getTier() == 0) {
return 0;
}
return 2 * getTier() + 0.05 * ((getTier() - 1) * (getTier() - 1));
return g_configManager().getFloat(FORGE_RATE_MOMENTUM, __FUNCTION__) * (2 * getTier() + 0.05 * ((getTier() - 1) * (getTier() - 1)));
}

uint8_t getTier() const {
Expand Down
Loading