Переглянути джерело

Custom Bonus - Skill Ratio (#9202)

- Added a custom bonus bSkillRatio that adds a fixed value directly to the skill ratio of attacks/skills
  * Normal attacks are affected (a bonus of 5 makes normal attacks have a skillratio of 105%)
  * Skills are only affected if they use skill ratio and don't deal fixed damage instead
  * Both physical and magical skills are affected
  * Bonus benefits weaker skills more than stronger skills (bonus=5: 200% -> 205%, 800% -> 805%)
  * Bonus is applied to each hit of skills that multiply damage by number of hits (bonus=5: 100%*10 -> 105%*10)
  * This bonus works the same way as "atkpercent" in renewal (e.g. Provoke) and stacks linearly with it
Playtester 1 місяць тому
батько
коміт
91c12fd615
6 змінених файлів з 14 додано та 1 видалено
  1. 1 0
      doc/item_bonus.txt
  2. 5 0
      src/map/battle.cpp
  3. 1 1
      src/map/map.hpp
  4. 5 0
      src/map/pc.cpp
  5. 1 0
      src/map/pc.hpp
  6. 1 0
      src/map/script_constants.hpp

+ 1 - 0
doc/item_bonus.txt

@@ -198,6 +198,7 @@ bonus2 bSkillUseSPrate,sk,n;		Decreases SP consumption of skill sk by n%
 Atk/Def
 -------
 bonus2 bSkillAtk,sk,n;    		Increases damage of skill sk by n%
+bonus bSkillRatio,n;			Adds n to the skillratio of all attacks/skills that use it
 bonus bShortAtkRate,n;			Increases damage of short ranged attacks by n%
 bonus bLongAtkRate,n;     		Increases damage of long ranged attacks by n%
 bonus bCritAtkRate,n;     		Increases critical damage by +n%

+ 5 - 0
src/map/battle.cpp

@@ -4609,6 +4609,8 @@ static int32 battle_calc_attack_skill_ratio(struct Damage* wd, struct block_list
 		//ATK percent modifier (in renewal, it's applied before the skillratio)
 		skillratio = battle_get_atkpercent(*src, skill_id, *sc);
 #endif
+		if (sd != nullptr)
+			skillratio += sd->bonus.skill_ratio;
 		if(sc->getSCE(SC_OVERTHRUST))
 			skillratio += sc->getSCE(SC_OVERTHRUST)->val3;
 		if(sc->getSCE(SC_MAXOVERTHRUST))
@@ -8162,6 +8164,9 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
 
 	if (!flag.infdef) { //No need to do the math for plants
 		uint32 skillratio = 100; //Skill dmg modifiers.
+		if (sd != nullptr)
+			skillratio += sd->bonus.skill_ratio;
+
 #ifdef RENEWAL
 		// Some skills do not use S.MATK and skillratio
 		bool has_skillratio = false;

+ 1 - 1
src/map/map.hpp

@@ -581,7 +581,7 @@ enum _sp {
 	SP_LONG_SP_GAIN_VALUE, SP_LONG_HP_GAIN_VALUE, SP_SHORT_ATK_RATE, SP_MAGIC_SUBSIZE, SP_CRIT_DEF_RATE, // 2093-2097
 	SP_MAGIC_SUBDEF_ELE, SP_REDUCE_DAMAGE_RETURN, SP_ADD_ITEM_SPHEAL_RATE, SP_ADD_ITEMGROUP_SPHEAL_RATE, // 2098-2101
 	SP_WEAPON_SUBSIZE, SP_ABSORB_DMG_MAXHP2, // 2102-2103
-	SP_SP_IGNORE_RES_RACE_RATE, SP_SP_IGNORE_MRES_RACE_RATE, SP_EMATK_HIDDEN, // 2104-2106
+	SP_SP_IGNORE_RES_RACE_RATE, SP_SP_IGNORE_MRES_RACE_RATE, SP_EMATK_HIDDEN, SP_SKILL_RATIO // 2104-2107
 };
 
 enum _look {

+ 5 - 0
src/map/pc.cpp

@@ -4211,6 +4211,10 @@ void pc_bonus(map_session_data *sd,int32 type,int32 val)
 			if (sd->state.lr_flag != LR_FLAG_ARROW)
 				sd->bonus.classchange=val;
 			break;
+		case SP_SKILL_RATIO:
+			if (sd->state.lr_flag != LR_FLAG_ARROW)
+				sd->bonus.skill_ratio += val;
+			break;
 		case SP_SHORT_ATK_RATE:
 			if (sd->state.lr_flag != LR_FLAG_ARROW)	//[Lupus] it should stack, too. As any other cards rate bonuses
 				sd->bonus.short_attack_atk_rate+=val;
@@ -10236,6 +10240,7 @@ int64 pc_readparam(map_session_data* sd,int64 type)
 		case SP_UNBREAKABLE_GARMENT: val = (sd->bonus.unbreakable_equip&EQP_GARMENT)?1:0; break;
 		case SP_UNBREAKABLE_SHOES: val = (sd->bonus.unbreakable_equip&EQP_SHOES)?1:0; break;
 		case SP_CLASSCHANGE:     val = sd->bonus.classchange; break;
+		case SP_SKILL_RATIO:     val = sd->bonus.skill_ratio; break;
 		case SP_SHORT_ATK_RATE:  val = sd->bonus.short_attack_atk_rate; break;
 		case SP_LONG_ATK_RATE:   val = sd->bonus.long_attack_atk_rate; break;
 		case SP_BREAK_WEAPON_RATE: val = sd->bonus.break_weapon_rate; break;

+ 1 - 0
src/map/pc.hpp

@@ -679,6 +679,7 @@ public:
 		uint8 absorb_dmg_maxhp2;
 		int16 critical_rangeatk;
 		int16 weapon_atk_rate, weapon_matk_rate;
+		int32 skill_ratio;
 	} bonus;
 	// zeroed vars end here.
 

+ 1 - 0
src/map/script_constants.hpp

@@ -750,6 +750,7 @@
 	export_constant2("bUnbreakableArmor",SP_UNBREAKABLE_ARMOR);
 	export_constant2("bUnbreakableHelm",SP_UNBREAKABLE_HELM);
 	export_constant2("bUnbreakableShield",SP_UNBREAKABLE_SHIELD);
+	export_constant2("bSkillRatio", SP_SKILL_RATIO);
 	export_constant2("bShortAtkRate",SP_SHORT_ATK_RATE);
 	export_constant2("bLongAtkRate",SP_LONG_ATK_RATE);
 	export_constant2("bCritAtkRate",SP_CRIT_ATK_RATE);