Resolves duplicate status calculation on players (#6980)

* Fixes #6930.
* Follow up to a7ee51d.
* Resolves an issue on sc_start where players are doubly calculated on their items and stats.
* Resolves an edge case where AutoSpell3 bonuses can cause a crash if success rate is high or delay is low.
Thanks to @CairoLee!
This commit is contained in:
Aleos 2022-06-16 10:07:08 -04:00 committed by GitHub
parent 2992879ee3
commit b01cac01c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12535,7 +12535,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
sce->timer = INVALID_TIMER; // Infinite duration
if (calc_flag.any()) {
if (sd) {
if (sd != nullptr) {
switch(type) {
// Statuses that adjust HP/SP and heal after starting
case SC_BERSERK:
@ -12544,7 +12544,8 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
status_calc_bl_(bl, calc_flag, SCO_FORCE);
break;
default:
status_calc_bl_(bl, calc_flag);
if (!sd->state.connect_new)
status_calc_bl_(bl, calc_flag);
break;
}
} else
@ -12555,21 +12556,8 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
if (sc_isnew && scdb->state.any())
status_calc_state(bl, sc, scdb->state, true);
if (sd) {
if (sd->pd)
pet_sc_check(sd, type); // Skotlex: Pet Status Effect Healing
switch (type) {
case SC_BERSERK:
case SC_MERC_HPUP:
case SC_MERC_SPUP:
status_calc_pc(sd, SCO_FORCE);
break;
default:
if (!sd->state.connect_new)
status_calc_pc(sd, SCO_NONE);
break;
}
}
if (sd != nullptr && sd->pd != nullptr)
pet_sc_check(sd, type); // Skotlex: Pet Status Effect Healing
// 1st thing to execute when loading status
switch (type) {