Skip to content

Commit

Permalink
Rebalance of SA_AUTOSPELL (Hindsight)
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
guilherme-gm committed Oct 26, 2023
1 parent 5ab76e4 commit a34d121
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 70 deletions.
1 change: 1 addition & 0 deletions db/pre-re/autospell_db.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ autospell_db: (
SkillId: Skill ID/Name (constant string or int)
SkillLevel: Highest usable level (int, defaults to 0) (can be grouped by AutoSpell Levels)
(Level 0 would mean not usable in this AutoSpell level)
(Level "HALF_AUTOSPELL_LEVEL" uses half of casted autospell level)
SpiritBoost: Use max level when under Sage Spirit? (boolean, defaults to false)
},
**************************************************************************/
Expand Down
104 changes: 51 additions & 53 deletions db/re/autospell_db.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,91 +44,89 @@ autospell_db: (
SkillId: Skill ID/Name (constant string or int)
SkillLevel: Highest usable level (int, defaults to 0) (can be grouped by AutoSpell Levels)
(Level 0 would mean not usable in this AutoSpell level)
(Level "HALF_AUTOSPELL_LEVEL" uses half of casted autospell level)
SpiritBoost: Use max level when under Sage Spirit? (boolean, defaults to false)
},
**************************************************************************/

{
SkillId: "MG_NAPALMBEAT"
SkillLevel: 3
SpiritBoost: false
},
{
SkillId: "MG_COLDBOLT"
SkillLevel: {
// Lv1: 0
Lv2: 1
Lv3: 2
Lv4: 3
Lv5: 3
Lv6: 3
Lv7: 3
Lv8: 3
Lv9: 3
Lv10: 3
}
SkillLevel: "HALF_AUTOSPELL_LEVEL"
SpiritBoost: true
},
{
SkillId: "MG_FIREBOLT"
SkillLevel: {
// Lv1: 0
Lv2: 1
Lv3: 2
Lv4: 3
Lv5: 3
Lv6: 3
Lv7: 3
Lv8: 3
Lv9: 3
Lv10: 3
}
SkillLevel: "HALF_AUTOSPELL_LEVEL"
SpiritBoost: true
},
{
SkillId: "MG_LIGHTNINGBOLT"
SkillLevel: {
// Lv1: 0
Lv2: 1
Lv3: 2
Lv4: 3
Lv5: 3
Lv6: 3
Lv7: 3
Lv8: 3
Lv9: 3
Lv10: 3
}
SkillLevel: "HALF_AUTOSPELL_LEVEL"
SpiritBoost: true
},
{
SkillId: "MG_SOULSTRIKE"
SkillLevel: {
// Lv1 .. Lv4: 0
Lv5: 1
Lv6: 2
Lv7: 3
Lv8: 3
Lv9: 3
Lv10: 3
// Lv1 .. Lv3: 0
Lv4: "HALF_AUTOSPELL_LEVEL"
Lv5: "HALF_AUTOSPELL_LEVEL"
Lv6: "HALF_AUTOSPELL_LEVEL"
Lv7: "HALF_AUTOSPELL_LEVEL"
Lv8: "HALF_AUTOSPELL_LEVEL"
Lv9: "HALF_AUTOSPELL_LEVEL"
Lv10: "HALF_AUTOSPELL_LEVEL"
}
SpiritBoost: false
},
{
SkillId: "MG_FIREBALL"
SkillLevel: {
// Lv1 .. Lv7: 0
Lv8: 1
Lv9: 2
Lv10: 2
// Lv1 .. Lv3: 0
Lv4: "HALF_AUTOSPELL_LEVEL"
Lv5: "HALF_AUTOSPELL_LEVEL"
Lv6: "HALF_AUTOSPELL_LEVEL"
Lv7: "HALF_AUTOSPELL_LEVEL"
Lv8: "HALF_AUTOSPELL_LEVEL"
Lv9: "HALF_AUTOSPELL_LEVEL"
Lv10: "HALF_AUTOSPELL_LEVEL"
}
SpiritBoost: false
},
{
SkillId: "WZ_EARTHSPIKE"
SkillLevel: {
// Lv1 .. Lv6: 0
Lv7: "HALF_AUTOSPELL_LEVEL"
Lv8: "HALF_AUTOSPELL_LEVEL"
Lv9: "HALF_AUTOSPELL_LEVEL"
Lv10: "HALF_AUTOSPELL_LEVEL"
}
SpiritBoost: false
},
{
SkillId: "MG_FROSTDIVER"
SkillLevel: {
// Lv1 .. Lv6: 0
Lv7: "HALF_AUTOSPELL_LEVEL"
Lv8: "HALF_AUTOSPELL_LEVEL"
Lv9: "HALF_AUTOSPELL_LEVEL"
Lv10: "HALF_AUTOSPELL_LEVEL"
}
SpiritBoost: false
},
{
SkillId: "MG_THUNDERSTORM"
SkillLevel: {
// Lv1 .. Lv9: 0
Lv10: "HALF_AUTOSPELL_LEVEL"
}
SpiritBoost: false
},
{
SkillId: "WZ_HEAVENDRIVE"
SkillLevel: {
// Lv1 .. Lv9: 0
Lv10: 1
Lv10: "HALF_AUTOSPELL_LEVEL"
}
SpiritBoost: false
},
Expand Down
19 changes: 14 additions & 5 deletions src/map/battle.c
Original file line number Diff line number Diff line change
Expand Up @@ -6839,12 +6839,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)) {
Expand Down
3 changes: 3 additions & 0 deletions src/map/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -30155,6 +30155,9 @@ static void script_hardcoded_constants(void)
script->set_constant("HOMINFO_RENAME", HOMINFO_RENAME, false, false);
script->set_constant("HOMINFO_LEVEL", HOMINFO_LEVEL, false, false);

script->constdb_comment("autospell db constants");
script->set_constant2("HALF_AUTOSPELL_LEVEL", HALF_AUTOSPELL_LEVEL, false, false);

script->constdb_comment("Renewal");
#ifdef RENEWAL
script->set_constant("RENEWAL", 1, false, false);
Expand Down
31 changes: 24 additions & 7 deletions src/map/skill.c
Original file line number Diff line number Diff line change
Expand Up @@ -5318,7 +5318,7 @@ static int skill_castend_damage_id(struct block_list *src, struct block_list *bl
} else {
sc_start(src, src, SC_NO_SWITCH_WEAPON, 100, 1, skill->get_time(skill_id, skill_lv), skill_id);
skill->area_temp[0] = map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, BCT_ENEMY, skill->area_sub_count);

// recursive invocation of skill->castend_damage_id() with flag|1
map->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), skill->splash_target(src), src, skill_id, skill_lv, tick, flag | BCT_ENEMY | SD_SPLASH | 1, skill->castend_damage_id);
}
Expand Down Expand Up @@ -10145,7 +10145,7 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
int level = 0;
if (sd != NULL)
level = skill_id == AB_CLEMENTIA ? pc->checkskill(sd, AL_BLESSING) : pc->checkskill(sd, AL_INCAGI);

if (sd == NULL || sd->status.party_id == 0 || flag & 1) {
clif->skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(src, bl, type, 100, level, skill->get_time(skill_id, skill_lv), skill_id));
} else if (sd != NULL) {
Expand Down Expand Up @@ -17962,8 +17962,17 @@ static void skill_autospell_select_spell(struct block_list *bl, int skill_lv)
if ((upper_idx - lower_idx) > 1)
skill_idx += rnd() % (upper_idx - lower_idx);

// @TODO: Is this how AutoSpell works for non-players after rebalance? I made it the same as the player one...
const struct s_autospell_db *sk = &skill->dbs->autospell_db[skill_idx];
sc_start4(bl, bl, SC_AUTOSPELL, 100, skill_lv, sk->skill_id, sk->skill_lv[skill_lv - 1], 0,
int spell_level = sk->skill_lv[skill_lv - 1];
if (spell_level == HALF_AUTOSPELL_LEVEL) {
spell_level = skill_lv / 2;

if (spell_level == 0)
spell_level = 1;
}

sc_start4(bl, bl, SC_AUTOSPELL, 100, skill_lv, sk->skill_id, spell_level, 0,
skill->get_time(SA_AUTOSPELL, skill_lv), SA_AUTOSPELL);
}

Expand Down Expand Up @@ -17995,6 +18004,14 @@ static int skill_autospell_spell_selected(struct map_session_data *sd, uint16 sk
return 0; // Don't have enough level to use

int max_lv = sk->skill_lv[autospell_lv - 1];

if (max_lv == HALF_AUTOSPELL_LEVEL) {
max_lv = autospell_lv / 2;

if (max_lv == 0)
max_lv = 1;
}

if (sk->spirit_boost && sd->sc.data[SC_SOULLINK] != NULL && sd->sc.data[SC_SOULLINK]->val2 == SL_SAGE)
max_lv = skill->dbs->db[skill->get_index(skill_id)].max; // Soul Linker bonus. [Skotlex]

Expand Down Expand Up @@ -24919,8 +24936,8 @@ static void skill_read_autospell_skill_level(struct config_setting_t *conf, stru
snprintf(lv, sizeof(lv), "Lv%d", i + 1);

int level;
if (libconfig->setting_lookup_int(t, lv, &level) == CONFIG_TRUE) {
if (level >= 0 && level <= MAX_SKILL_LEVEL)
if (map->setting_lookup_const(t, lv, &level) == CONFIG_TRUE) {
if ((level >= 0 && level <= MAX_SKILL_LEVEL) || level == HALF_AUTOSPELL_LEVEL)
sk->skill_lv[i] = level;
else
ShowWarning("%s: Invalid SkillLevel %d specified in level %d for skill ID %d in %s! Minimum is 0, maximum is %d. Defaulting to 0...\n",
Expand All @@ -24932,8 +24949,8 @@ static void skill_read_autospell_skill_level(struct config_setting_t *conf, stru
}

int level;
if (libconfig->setting_lookup_int(conf, "SkillLevel", &level) == CONFIG_TRUE) {
if (level >= 0 && level <= MAX_SKILL_LEVEL)
if (map->setting_lookup_const(conf, "SkillLevel", &level) == CONFIG_TRUE) {
if ((level >= 0 && level <= MAX_SKILL_LEVEL) || level == HALF_AUTOSPELL_LEVEL)
skill->level_set_value(sk->skill_lv, level);
else
ShowWarning("%s: Invalid SkillLevel %d specified for skill ID %d in %s! Minimum is 0, maximum is %d. Defaulting to 0...\n",
Expand Down
9 changes: 6 additions & 3 deletions src/map/skill.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,17 @@ struct status_change_entry;

#define MAX_SKILL_SPELLBOOK_DB 17
#define MAX_SKILL_MAGICMUSHROOM_DB 23
#define MAX_AUTOSPELL_DB 7
#define MAX_AUTOSPELL_DB 9

//Walk intervals at which chase-skills are attempted to be triggered.
#define WALK_SKILL_INTERVAL 5

// Max Crimson Marker targets (RL_C_MARKER)
#define MAX_SKILL_CRIMSON_MARKER 3

// Autospell db special level/constant for "use half of casted level"
#define HALF_AUTOSPELL_LEVEL -1

/**
* Enumerations
**/
Expand Down Expand Up @@ -143,7 +146,7 @@ enum e_skill_inf2 {
INF2_HIDDEN_TRAP = 0x00080000, ///< Traps that are hidden (based on trap_visiblity battle conf)
INF2_IS_COMBO_SKILL = 0x00100000, ///< Sets whether a skill can be used in combos or not
INF2_NO_STASIS = 0x00200000,
INF2_NO_KAGEHUMI = 0x00400000,
INF2_NO_KAGEHUMI = 0x00400000,
INF2_RANGE_VULTURE = 0x00800000, ///< Range is modified by AC_VULTURE
INF2_RANGE_SNAKEEYE = 0x01000000, ///< Range is modified by GS_SNAKEEYE
INF2_RANGE_SHADOWJUMP = 0x02000000, ///< Range is modified by NJ_SHADOWJUMP
Expand Down Expand Up @@ -1815,7 +1818,7 @@ enum skill_enabled_npc_flags {
struct s_autospell_db {
int autospell_level; //< Minimum AutoSpell level to show this skill
int skill_id; //< Skill Id
int skill_lv[MAX_SKILL_LEVEL]; //< Maximum usable skill level at each AutoSpell level
int skill_lv[MAX_SKILL_LEVEL]; //< Maximum usable skill level at each AutoSpell level (also accepts HALF_AUTOSPELL_LEVEL as level)
bool spirit_boost; //< Whether Sage's Spirit boosts this skill to maximum level
};

Expand Down
8 changes: 6 additions & 2 deletions src/map/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -7701,8 +7701,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
Expand Down

0 comments on commit a34d121

Please sign in to comment.