Cleans up some cast time and delay behaviors (#6221)

* Fixes #6135.
* Mystical Amplification should not have the IgnoreStatus CastTime flag.
* Foresight will only apply a cast reduction to learned skills, not those that are granted through item bonuses guild skills, pets, etc.
* Item bonus bDelayRate will now stack with other delay reduction bonuses.
* General cleanups to variable defines.
Thanks to @Everade, @mrjnumber1, and @Lemongrass3110!
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
Aleos 2021-08-31 08:54:28 -04:00 committed by GitHub
parent bccbf8b166
commit 9e4dc7df4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 24 deletions

View File

@ -9660,7 +9660,6 @@ Body:
Duration1: 30000
CastTimeFlags:
IgnoreDex: true
IgnoreStatus: true
IgnoreItemBonus: true
Requires:
SpCost:

View File

@ -9953,7 +9953,6 @@ Body:
FixedCastTime: 700
CastTimeFlags:
IgnoreDex: true
IgnoreStatus: true
Requires:
SpCost:
- Level: 1

View File

@ -17048,10 +17048,10 @@ struct s_skill_condition skill_get_requirement(struct map_session_data* sd, uint
* Does cast-time reductions based on dex, item bonuses and config setting
*------------------------------------------*/
int skill_castfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
double time = skill_get_cast(skill_id, skill_lv);
nullpo_ret(bl);
double time = skill_get_cast(skill_id, skill_lv);
#ifndef RENEWAL_CAST
{
struct map_session_data *sd = BL_CAST(BL_PC, bl);
@ -17099,6 +17099,7 @@ int skill_castfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
reduce_cast_rate += sc->data[SC_POEMBRAGI]->val2;
// Foresight halves the cast time, it does not stack additively
if (sc->data[SC_MEMORIZE]) {
if (!sd || pc_checkskill(sd, skill_id) > 0) { // Foresight only decreases cast times from learned skills, not skills granted by items
if(!(flag&2))
time -= time * 50 / 100;
// Foresight counter gets reduced even if the skill is not affected by it
@ -17106,6 +17107,7 @@ int skill_castfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
status_change_end(bl, SC_MEMORIZE, INVALID_TIMER);
}
}
}
time = time * (1 - (float)reduce_cast_rate / 100);
}
@ -17130,14 +17132,14 @@ int skill_castfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
*/
int skill_castfix_sc(struct block_list *bl, double time, uint8 flag)
{
struct status_change *sc = status_get_sc(bl);
if (time < 0)
return 0;
if (bl->type == BL_MOB || bl->type == BL_NPC)
return (int)time;
status_change *sc = status_get_sc(bl);
if (sc && sc->count) {
if (!(flag&2)) {
if (sc->data[SC_SLOWCAST])
@ -17249,10 +17251,12 @@ int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16
#endif
}
if (sc->data[SC_MEMORIZE]) {
if (!sd || pc_checkskill(sd, skill_id) > 0) { // Foresight only decreases cast times from learned skills, not skills granted by items
reduce_cast_rate += 50;
if ((--sc->data[SC_MEMORIZE]->val2) <= 0)
status_change_end(bl, SC_MEMORIZE, INVALID_TIMER);
}
}
if (sc->data[SC_POEMBRAGI])
reduce_cast_rate += sc->data[SC_POEMBRAGI]->val2;
if (sc->data[SC_IZAYOI])
@ -17310,13 +17314,7 @@ int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16
*------------------------------------------*/
int skill_delayfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv)
{
int delaynodex = skill_get_delaynodex(skill_id);
int time = skill_get_delay(skill_id, skill_lv);
struct map_session_data *sd;
struct status_change *sc = status_get_sc(bl);
nullpo_ret(bl);
sd = BL_CAST(BL_PC, bl);
if (skill_id == SA_ABRACADABRA)
return 0; //Will use picked skill's delay.
@ -17324,9 +17322,14 @@ int skill_delayfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv)
if (bl->type&battle_config.no_skill_delay)
return battle_config.min_skill_delay_limit;
int delaynodex = skill_get_delaynodex(skill_id);
int time = skill_get_delay(skill_id, skill_lv);
if (time < 0)
time = -time + status_get_amotion(bl); // If set to <0, add to attack motion.
status_change* sc = status_get_sc(bl);
// Delay reductions
switch (skill_id) { //Monk combo skills have their delay reduced by agi/dex.
case MO_TRIPLEATTACK:
@ -17393,11 +17396,13 @@ int skill_delayfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv)
}
}
if (!(delaynodex&4) && sd) {
if (sd->delayrate != 100)
time = time * sd->delayrate / 100;
if (!(delaynodex&4) && bl->type == BL_PC) {
map_session_data* sd = (map_session_data*)bl;
for (auto &it : sd->skilldelay) {
if (sd->delayrate != 100) // bonus bDelayRate
time += time * sd->delayrate / 100;
for (auto &it : sd->skilldelay) { // bonus2 bSkillDelay
if (it.id == skill_id) {
time += it.val;
break;