[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
2 changed files with 9 additions and 3 deletions
+8 -3
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)) {