From 04ce57ecc743ec95e79fedab7e00bc650e386d23 Mon Sep 17 00:00:00 2001 From: cookiecrumbs Date: Sun, 22 Jul 2012 01:26:48 +0000 Subject: Added a new configuration option to allow either weapon switching to cancel SC_DANCING or not. Fixed an issue where movement is frozen (caster) with Longing for Freedom (walking outside of the cast). Added checks related to dancing/ensemble skills to prevent frozen characters. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16470 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/battle.c | 2 ++ src/map/battle.h | 1 + src/map/pc.c | 4 ++++ src/map/status.c | 9 ++++++++- src/map/unit.c | 8 ++++++++ 5 files changed, 23 insertions(+), 1 deletion(-) (limited to 'src/map') diff --git a/src/map/battle.c b/src/map/battle.c index 79e7a00b0..e0659ce81 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5309,6 +5309,8 @@ static const struct _battle_data { { "buyer_name", &battle_config.buyer_name, 1, 0, 1, }, { "skill_wall_check", &battle_config.skill_wall_check, 1, 0, 1, }, { "cell_stack_limit", &battle_config.cell_stack_limit, 1, 1, 255, }, + { "dancing_weaponswitch_fix", &battle_config.dancing_weaponswitch_fix, 1, 0, 1, }, + // eAthena additions { "item_logarithmic_drops", &battle_config.logarithmic_drops, 0, 0, 1, }, { "item_drop_common_min", &battle_config.item_drop_common_min, 1, 1, 10000, }, diff --git a/src/map/battle.h b/src/map/battle.h index 7048e35a8..962ca81a7 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -327,6 +327,7 @@ extern struct Battle_Config int sp_rate; int bone_drop; int buyer_name; + int dancing_weaponswitch_fix; // eAthena additions int night_at_start; // added by [Yor] diff --git a/src/map/pc.c b/src/map/pc.c index 459f6ef99..f918ce9ca 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4805,6 +4805,8 @@ int pc_checkallowskill(struct map_session_data *sd) for (i = 0; i < ARRAYLENGTH(scw_list); i++) { // Skills requiring specific weapon types + if( scw_list[i] == SC_DANCING && !battle_config.dancing_weaponswitch_fix ) + continue; if(sd->sc.data[scw_list[i]] && !pc_check_weapontype(sd,skill_get_weapontype(status_sc2skill(scw_list[i])))) status_change_end(&sd->bl, scw_list[i], INVALID_TIMER); @@ -8085,6 +8087,8 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) sd->status.weapon = sd->weapontype2; pc_calcweapontype(sd); clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); + if( !battle_config.dancing_weaponswitch_fix ) + status_change_end(&sd->bl, SC_DANCING, INVALID_TIMER); // Unequipping => stop dancing. } if(sd->status.inventory[n].equip & EQP_HAND_L) { sd->status.shield = sd->weapontype2 = 0; diff --git a/src/map/status.c b/src/map/status.c index 1b12c2ae4..80d194774 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -8858,8 +8858,15 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const {// end status on partner as well dsc = dsd->sc.data[SC_DANCING]; if(dsc) - { //This will prevent recursive loops. + { + struct status_change *tsc = status_get_sc(&dsd->bl); + + //This will prevent recursive loops. dsc->val2 = dsc->val4 = 0; + + // Set cant.move back to 0 to avoid character freezing. + tsc->cant.move = 0; + sc->cant.move = 0; status_change_end(&dsd->bl, SC_DANCING, INVALID_TIMER); } } diff --git a/src/map/unit.c b/src/map/unit.c index 848dd6dea..507bfbb07 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -920,6 +920,14 @@ int unit_can_move(struct block_list *bl) return 0; //Can't move if (sc) { + // Ensemble checks to prevent freezing characters + if( sc->cant.move && sc->data[SC_LONGING] && !((sc->data[SC_DANCING]->val1&0xFFFF) == CG_MOONLIT)) + { + // allow movement + sc->cant.move = 0; + return 1; + } + if( sc->cant.move || (sc->data[SC_FEAR] && sc->data[SC_FEAR]->val2 > 0) || (sc->data[SC_SPIDERWEB] && sc->data[SC_SPIDERWEB]->val1) ) return 0; -- cgit v1.2.3-60-g2f50