[Feature] Add Character:TradeskillUpMinChance rule (#4867)

This commit is contained in:
zrix-eq 2025-05-14 21:27:09 -04:00 committed by GitHub
parent 20da490bda
commit 4a9779635d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -156,6 +156,7 @@ RULE_REAL(Character, TradeskillUpPottery, 4.0, "Pottery skillup rate adjustment.
RULE_REAL(Character, TradeskillUpResearch, 1.0, "Research skillup rate adjustment. Lower is faster")
RULE_REAL(Character, TradeskillUpTinkering, 2.0, "Tinkering skillup rate adjustment. Lower is faster")
RULE_REAL(Character, TradeskillUpTailoring, 2.0, "Tailoring skillup rate adjustment. Lower is faster")
RULE_REAL(Character, TradeskillUpMinChance, 2.5, "Determines the minimum percentage chance to gain a skill increase from a tradeskill. Cannot go below 2.5")
RULE_BOOL(Character, MarqueeHPUpdates, false, "Will show health percentage in center of screen if health lesser than 100%")
RULE_INT(Character, IksarCommonTongue, 95, "Starting value for Common Tongue for Iksars")
RULE_INT(Character, OgreCommonTongue, 95, "Starting value for Common Tongue for Ogres")

View File

@ -19,6 +19,7 @@
#include "../common/global_define.h"
#include "../common/events/player_event_logs.h"
#include <algorithm>
#include <list>
#ifndef WIN32
@ -1234,15 +1235,18 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float
return; //not allowed to go higher.
uint16 maxskill = MaxSkill(tradeskill);
float min_skill_up_chance = RuleR(Character, TradeskillUpMinChance);
min_skill_up_chance = std::max(min_skill_up_chance, 2.5f);
float chance_stage2 = 0;
//A successfull combine doubles the stage1 chance for an skillup
//Some tradeskill are harder than others. See above for more.
float chance_stage1 = (bonusstat - stat_modifier) / (skillup_modifier * success_modifier);
chance_stage1 = std::max(min_skill_up_chance, chance_stage1);
//In stage2 the only thing that matters is your current unmodified skill.
//If you want to customize here you probbably need to implement your own
//formula instead of tweaking the below one.
//In stage2 the only thing that matters is your current unmodified skill
//and the Character:TradeskillUpMinChance rule.
if (chance_stage1 > zone->random.Real(0, 99)) {
if (current_raw_skill < 15) {
//Always succeed
@ -1254,6 +1258,7 @@ void Client::CheckIncreaseTradeskill(int16 bonusstat, int16 stat_modifier, float
//At skill 175, your chance of success falls linearly from 12.5% to 2.5% at skill 300.
chance_stage2 = 12.5 - (.08 * (current_raw_skill - 175));
}
chance_stage2 = std::max(min_skill_up_chance, chance_stage2);
}
if (chance_stage2 > zone->random.Real(0, 99)) {