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 Duration1: 30000
CastTimeFlags: CastTimeFlags:
IgnoreDex: true IgnoreDex: true
IgnoreStatus: true
IgnoreItemBonus: true IgnoreItemBonus: true
Requires: Requires:
SpCost: SpCost:

View File

@ -9953,7 +9953,6 @@ Body:
FixedCastTime: 700 FixedCastTime: 700
CastTimeFlags: CastTimeFlags:
IgnoreDex: true IgnoreDex: true
IgnoreStatus: true
Requires: Requires:
SpCost: SpCost:
- Level: 1 - 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 * 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) { 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); nullpo_ret(bl);
double time = skill_get_cast(skill_id, skill_lv);
#ifndef RENEWAL_CAST #ifndef RENEWAL_CAST
{ {
struct map_session_data *sd = BL_CAST(BL_PC, bl); struct map_session_data *sd = BL_CAST(BL_PC, bl);
@ -17099,11 +17099,13 @@ int skill_castfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
reduce_cast_rate += sc->data[SC_POEMBRAGI]->val2; reduce_cast_rate += sc->data[SC_POEMBRAGI]->val2;
// Foresight halves the cast time, it does not stack additively // Foresight halves the cast time, it does not stack additively
if (sc->data[SC_MEMORIZE]) { if (sc->data[SC_MEMORIZE]) {
if(!(flag&2)) if (!sd || pc_checkskill(sd, skill_id) > 0) { // Foresight only decreases cast times from learned skills, not skills granted by items
time -= time * 50 / 100; if(!(flag&2))
// Foresight counter gets reduced even if the skill is not affected by it time -= time * 50 / 100;
if ((--sc->data[SC_MEMORIZE]->val2) <= 0) // Foresight counter gets reduced even if the skill is not affected by it
status_change_end(bl, SC_MEMORIZE, INVALID_TIMER); if ((--sc->data[SC_MEMORIZE]->val2) <= 0)
status_change_end(bl, SC_MEMORIZE, INVALID_TIMER);
}
} }
} }
@ -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) int skill_castfix_sc(struct block_list *bl, double time, uint8 flag)
{ {
struct status_change *sc = status_get_sc(bl);
if (time < 0) if (time < 0)
return 0; return 0;
if (bl->type == BL_MOB || bl->type == BL_NPC) if (bl->type == BL_MOB || bl->type == BL_NPC)
return (int)time; return (int)time;
status_change *sc = status_get_sc(bl);
if (sc && sc->count) { if (sc && sc->count) {
if (!(flag&2)) { if (!(flag&2)) {
if (sc->data[SC_SLOWCAST]) if (sc->data[SC_SLOWCAST])
@ -17249,9 +17251,11 @@ int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16
#endif #endif
} }
if (sc->data[SC_MEMORIZE]) { if (sc->data[SC_MEMORIZE]) {
reduce_cast_rate += 50; if (!sd || pc_checkskill(sd, skill_id) > 0) { // Foresight only decreases cast times from learned skills, not skills granted by items
if ((--sc->data[SC_MEMORIZE]->val2) <= 0) reduce_cast_rate += 50;
status_change_end(bl, SC_MEMORIZE, INVALID_TIMER); if ((--sc->data[SC_MEMORIZE]->val2) <= 0)
status_change_end(bl, SC_MEMORIZE, INVALID_TIMER);
}
} }
if (sc->data[SC_POEMBRAGI]) if (sc->data[SC_POEMBRAGI])
reduce_cast_rate += sc->data[SC_POEMBRAGI]->val2; reduce_cast_rate += sc->data[SC_POEMBRAGI]->val2;
@ -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 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); nullpo_ret(bl);
sd = BL_CAST(BL_PC, bl);
if (skill_id == SA_ABRACADABRA) if (skill_id == SA_ABRACADABRA)
return 0; //Will use picked skill's delay. 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) if (bl->type&battle_config.no_skill_delay)
return battle_config.min_skill_delay_limit; 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) if (time < 0)
time = -time + status_get_amotion(bl); // If set to <0, add to attack motion. time = -time + status_get_amotion(bl); // If set to <0, add to attack motion.
status_change* sc = status_get_sc(bl);
// Delay reductions // Delay reductions
switch (skill_id) { //Monk combo skills have their delay reduced by agi/dex. switch (skill_id) { //Monk combo skills have their delay reduced by agi/dex.
case MO_TRIPLEATTACK: 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 (!(delaynodex&4) && bl->type == BL_PC) {
if (sd->delayrate != 100) map_session_data* sd = (map_session_data*)bl;
time = time * sd->delayrate / 100;
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) { if (it.id == skill_id) {
time += it.val; time += it.val;
break; break;