Bladeren bron

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://svn.code.sf.net/p/rathena/svn/trunk@16470 54d463be-8e91-2dee-dedb-b68131a5f0ec

cookiecrumbs 13 jaren geleden
bovenliggende
commit
c9269c0db9
6 gewijzigde bestanden met toevoegingen van 28 en 1 verwijderingen
  1. 5 0
      conf/battle/skill.conf
  2. 2 0
      src/map/battle.c
  3. 1 0
      src/map/battle.h
  4. 4 0
      src/map/pc.c
  5. 8 1
      src/map/status.c
  6. 8 0
      src/map/unit.c

+ 5 - 0
conf/battle/skill.conf

@@ -267,3 +267,8 @@ eq_single_target_reflectable: yes
 // When this setting is enabled, it allows you to immune to all kinds of damage, including those stated previous.
 // (The number will show but no actual damage will be done)
 invincible.nodamage: no
+
+// Dancing Weapon Switch
+// On official server, a fix is in place that prevents the switching of weapons to cancel songs.
+// Default: yes
+dancing_weaponswitch_fix: yes

+ 2 - 0
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,          },

+ 1 - 0
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]

+ 4 - 0
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;

+ 8 - 1
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);
 					}
 				}

+ 8 - 0
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;