diff --git a/common/ruletypes.h b/common/ruletypes.h index e01dbfa71..f611d02bd 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -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") diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 066562bb5..067c2aba4 100644 --- a/zone/tradeskills.cpp +++ b/zone/tradeskills.cpp @@ -19,6 +19,7 @@ #include "../common/global_define.h" #include "../common/events/player_event_logs.h" +#include #include #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)) {