Quellcode durchsuchen

Several fixes for effects:
1. Effect stat functions should not be applied if start conditions does not met
2. Transformation dispell cast should not be interrupted on skill remove - possible effect stuck.
3. Reverting [3429] until more tests.

Also little cleanup and system message for transformations.

_DS_ vor 15 Jahren
Ursprung
Commit
6e6ea2fea2

+ 9 - 10
L2_GameServer/java/net/sf/l2j/gameserver/model/CharEffectList.java

@@ -603,10 +603,10 @@ public class CharEffectList
 						L2Effect newStackedEffect = listsContains(stackQueue.get(0));
 						if (newStackedEffect != null)
 						{
-							// Add its list of Funcs to the Calculator set of the L2Character
-							_owner.addStatFuncs(newStackedEffect.getStatFuncs());
 							// Set the effect to In Use
-							newStackedEffect.setInUse(true);
+							if (newStackedEffect.setInUse(true))
+								// Add its list of Funcs to the Calculator set of the L2Character
+								_owner.addStatFuncs(newStackedEffect.getStatFuncs());
 						}
 					}
 				}
@@ -779,10 +779,10 @@ public class CharEffectList
 		if ("none".equals(newEffect.getStackType()))
 		{
 			// Set this L2Effect to In Use
-			newEffect.setInUse(true);
+			if (newEffect.setInUse(true))
+				// Add Funcs of this effect to the Calculator set of the L2Character
+				_owner.addStatFuncs(newEffect.getStatFuncs());
 
-			// Add Funcs of this effect to the Calculator set of the L2Character
-			_owner.addStatFuncs(newEffect.getStatFuncs());
 			return;
 		}
 
@@ -860,10 +860,9 @@ public class CharEffectList
 			if (effectToAdd != null)
 			{
 				// Set this L2Effect to In Use
-				effectToAdd.setInUse(true);
-
-				// Add all Func objects corresponding to this stacked effect to the Calculator set of the L2Character
-				_owner.addStatFuncs(effectToAdd.getStatFuncs());
+				if (effectToAdd.setInUse(true))
+					// Add all Func objects corresponding to this stacked effect to the Calculator set of the L2Character
+					_owner.addStatFuncs(effectToAdd.getStatFuncs());
 			}
 		}
 	}

+ 6 - 3
L2_GameServer/java/net/sf/l2j/gameserver/model/L2Effect.java

@@ -302,13 +302,15 @@ public abstract class L2Effect
 		return _inUse;
 	}
 	
-	public void setInUse(boolean inUse)
+	public boolean setInUse(boolean inUse)
 	{
 		_inUse = inUse;
 		if (_inUse)
 			_startConditionsCorrect = onStart();
 		else
 			onExit();
+
+		return _startConditionsCorrect;
 	}
 	
 	public String getStackType()
@@ -417,9 +419,10 @@ public abstract class L2Effect
 			_currentFuture.cancel(false);
 			_currentFuture = null;
 			_currentTask = null;			
+
+			if (getEffected() != null)
+				getEffected().removeEffect(this);
 		}
-		if (getEffected() != null)
-			getEffected().removeEffect(this);
 	}
 	
 	/** returns effect type */

+ 14 - 9
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/L2Character.java

@@ -5793,16 +5793,21 @@ public abstract class L2Character extends L2Object
 			{
 				removeSkill(oldSkill.getTriggeredId(),true);
 			}
-			// Stop casting if this skill is used right now
-			if (getLastSkillCast() != null && isCastingNow())
-			{
-				if (oldSkill.getId() == getLastSkillCast().getId())
-					abortCast();
-			}
-			if (getLastSimultaneousSkillCast() != null && isCastingSimultaneouslyNow())
+
+			// does not abort casting of the transformation dispell
+			if (oldSkill.getSkillType() != L2SkillType.TRANSFORMDISPEL)
 			{
-				if (oldSkill.getId() == getLastSimultaneousSkillCast().getId())
-					abortCast();
+				// Stop casting if this skill is used right now
+				if (getLastSkillCast() != null && isCastingNow())
+				{
+					if (oldSkill.getId() == getLastSkillCast().getId())
+						abortCast();
+				}
+				if (getLastSimultaneousSkillCast() != null && isCastingSimultaneouslyNow())
+				{
+					if (oldSkill.getId() == getLastSimultaneousSkillCast().getId())
+						abortCast();
+				}
 			}
 			
 			if (cancelEffect || oldSkill.isToggle())

+ 16 - 18
L2_GameServer/java/net/sf/l2j/gameserver/skills/effects/EffectTransformation.java

@@ -18,6 +18,8 @@ package net.sf.l2j.gameserver.skills.effects;
 import net.sf.l2j.gameserver.instancemanager.TransformationManager;
 import net.sf.l2j.gameserver.model.L2Effect;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
 import net.sf.l2j.gameserver.skills.Env;
 import net.sf.l2j.gameserver.templates.effects.EffectTemplate;
 import net.sf.l2j.gameserver.templates.skills.L2EffectType;
@@ -32,13 +34,13 @@ public class EffectTransformation extends L2Effect
 	{
 		super(env, template);
 	}
-	
+
 	// Special constructor to steal this effect
 	public EffectTransformation(Env env, L2Effect effect)
 	{
 		super(env, effect);
 	}
-	
+
 	/**
 	 * 
 	 * @see net.sf.l2j.gameserver.model.L2Effect#getEffectType()
@@ -48,7 +50,7 @@ public class EffectTransformation extends L2Effect
 	{
 		return L2EffectType.TRANSFORMATION;
 	}
-	
+
 	/**
 	 * 
 	 * @see net.sf.l2j.gameserver.model.L2Effect#onStart()
@@ -56,30 +58,26 @@ public class EffectTransformation extends L2Effect
 	@Override
 	public boolean onStart()
 	{
-		if (getEffected().isAlikeDead())
-			return false;
-		
 		if (!(getEffected() instanceof L2PcInstance))
 			return false;
-		
+
 		L2PcInstance trg = (L2PcInstance) getEffected();
 		if (trg == null)
 			return false;
-		
+
 		if (trg.isAlikeDead() || trg.isCursedWeaponEquipped())
 			return false;
-		
-		int transformId = getSkill().getTransformId();
-		
-		if (!trg.isTransformed() && !trg.isInStance())
+
+		if (trg.getTransformation() != null)
 		{
-			TransformationManager.getInstance().transformPlayer(transformId, trg);
-			return true;
+			trg.sendPacket(new SystemMessage(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN));
+			return false;
 		}
-		return false;
-		
+
+		TransformationManager.getInstance().transformPlayer(getSkill().getTransformId(), trg);
+		return true;
 	}
-	
+
 	/**
 	 * 
 	 * @see net.sf.l2j.gameserver.model.L2Effect#onActionTime()
@@ -89,7 +87,7 @@ public class EffectTransformation extends L2Effect
 	{
 		return false;
 	}
-	
+
 	@Override
 	public void onExit()
 	{