From 1a90711a71c34e8af28c3371cc97c73c82cdeb8a Mon Sep 17 00:00:00 2001 From: "Guilherme G. Menaldo" Date: Fri, 18 Aug 2023 08:28:01 -0300 Subject: [PATCH] Rebalance of SA_AUTOSPELL (Hindsight) - Autocast level changed - Old: The Bolt skills will vary in level from level 1 to 3 The level 1 version will occur 50% of the time, level 2 35%, and level 3 at 15% - New: Levels of autocasted spells is the half of Hindsight level. If autocasted spells has lower level than half of Hindsight levels, actual skill level will be autocasted instead. - Autocast chance changed - Old: 7% - 25% - New: (Skill Level x 2)% - Usable skills changed - Old: Napalm Beat, Fire Bolt, Cold Bolt, Lightning Bolt, Soul Strike, Fire Ball, Frost Diver - New: Fire Bolt, Cold Bolt, Lightning Bolt, Soul Strike, Fire Ball, Earth Spike, Frost Diver, Thunderstorm, Heaven's Drive From massive skills rebalance (1st/2nd/transclass) (2018.10.31) --- src/map/battle.c | 19 ++++++++++++++----- src/map/skill.c | 38 ++++++++++++++++++++++++++++++++++++-- src/map/skill.h | 2 ++ src/map/status.c | 8 ++++++-- 4 files changed, 58 insertions(+), 9 deletions(-) diff --git a/src/map/battle.c b/src/map/battle.c index 17d703427a4..a83da338328 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6832,12 +6832,21 @@ static enum damage_lv battle_weapon_attack(struct block_list *src, struct block_ int sp = 0; uint16 skill_id = sc->data[SC_AUTOSPELL]->val2; uint16 skill_lv = sc->data[SC_AUTOSPELL]->val3; - int i = rnd()%100; - if (sc->data[SC_SOULLINK] && sc->data[SC_SOULLINK]->val2 == SL_SAGE) +#ifndef RENEWAL + int i = rnd() % 100; + if (sc->data[SC_SOULLINK] != NULL && sc->data[SC_SOULLINK]->val2 == SL_SAGE) i = 0; //Max chance, no skill_lv reduction. [Skotlex] - if (i >= 50) skill_lv -= 2; - else if (i >= 15) skill_lv--; - if (skill_lv < 1) skill_lv = 1; + + if (i >= 50) + skill_lv -= 2; + else if (i >= 15) + skill_lv--; + if (skill_lv < 1) + skill_lv = 1; +#else + if (sd != NULL && skill_lv > pc->checkskill(sd, skill_id)) + skill_lv = pc->checkskill(sd, skill_id); +#endif sp = skill->get_sp(skill_id,skill_lv) * 2 / 3; if (status->charge(src, 0, sp)) { diff --git a/src/map/skill.c b/src/map/skill.c index f37cbc3fb3e..8e7d2381946 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -17910,6 +17910,7 @@ static int skill_autospell_list(const struct autospell_skill **list) { nullpo_retr(0, list); +#ifndef RENEWAL // MUST be sorted by autospell_level (first field) static const struct autospell_skill skills_list[] = { { 1, MG_NAPALMBEAT, { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 } }, @@ -17920,6 +17921,20 @@ static int skill_autospell_list(const struct autospell_skill **list) { 8, MG_FIREBALL, { 0, 0, 0, 0, 0, 0, 0, 1, 2, 2 } }, { 10, MG_FROSTDIVER, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } }, }; +#else + // MUST be sorted by autospell_level (first field) + static const struct autospell_skill skills_list[] = { + { 1, MG_COLDBOLT }, + { 1, MG_FIREBOLT }, + { 1, MG_LIGHTNINGBOLT }, + { 4, MG_SOULSTRIKE }, + { 4, MG_FIREBALL }, + { 7, WZ_EARTHSPIKE }, + { 7, MG_FROSTDIVER }, + { 10, MG_THUNDERSTORM }, + { 10, WZ_HEAVENDRIVE }, + }; +#endif static const int list_len = ARRAYLENGTH(skills_list); #if PACKETVER_MAIN_NUM < 20181128 && PACKETVER_RE_NUM < 20181031 @@ -18000,7 +18015,18 @@ static void skill_autospell_select_spell(struct block_list *bl, int skill_lv) skill_idx += rnd() % (upper_idx - lower_idx); const struct autospell_skill *sk = (skills_list + skill_idx); - sc_start4(bl, bl, SC_AUTOSPELL, 100, skill_lv, sk->skill_id, sk->skill_lv[skill_lv - 1], 0, + + int max_lv; +#ifndef RENEWAL + max_lv = sk->skill_lv[skill_lv - 1] +#else + // @TODO: Is this how AutoSpell works for non-players after rebalance? I made it the same as the player one... + max_lv = skill_lv / 2; + if (max_lv == 0) + max_lv = 1; +#endif + + sc_start4(bl, bl, SC_AUTOSPELL, 100, skill_lv, sk->skill_id, max_lv, 0, skill->get_time(SA_AUTOSPELL, skill_lv), SA_AUTOSPELL); } @@ -18034,7 +18060,15 @@ static int skill_autospell_spell_selected(struct map_session_data *sd, uint16 sk if (sk->autospell_level > autospell_lv) return 0; // Don't have enough level to use - int max_lv = sk->skill_lv[autospell_lv - 1]; + int max_lv; +#ifndef RENEWAL + max_lv = sk->skill_lv[autospell_lv - 1]; +#else + max_lv = autospell_lv / 2; + if (max_lv == 0) + max_lv = 1; +#endif + if (sd->sc.data[SC_SOULLINK] != NULL && sd->sc.data[SC_SOULLINK]->val2 == SL_SAGE) { if (skill_id == MG_COLDBOLT || skill_id == MG_FIREBOLT || skill_id == MG_LIGHTNINGBOLT) max_lv = 10; // Soul Linker bonus. [Skotlex] diff --git a/src/map/skill.h b/src/map/skill.h index 4722eb090d6..5a97dc326eb 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -1873,7 +1873,9 @@ struct s_skill_db { struct autospell_skill { int autospell_level; int skill_id; +#ifndef RENEWAL int skill_lv[MAX_SKILL_LEVEL]; +#endif }; struct s_skill_unit_layout { diff --git a/src/map/status.c b/src/map/status.c index a47ad98aefd..a6605e79127 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -7689,8 +7689,12 @@ static int status_change_start_sub(struct block_list *src, struct block_list *bl case SC_AUTOSPELL: //Val1 Skill LV of Autospell //Val2 Skill ID to cast - //Val3 Max Lv to cast - val4 = 5 + val1*2; //Chance of casting + //Val3 Max Lv to cast (pre-re) / Lv to cast (zero) +#ifndef RENEWAL + val4 = 5 + val1 * 2; // Chance of casting +#else + val4 = 2 * val1; // Chance of casting +#endif break; case SC_VOLCANO: #ifndef RENEWAL