Browse Source

Added support for new effect type AbortCast.
Do not send system message about failure if effect does not have icon.
Support for using effectPower without effectType (just plain Rnd(), analog of ignoreResists for effects)

_DS_ 15 years ago
parent
commit
e37dee7ae5

+ 2 - 1
L2_GameServer/java/com/l2jserver/gameserver/model/L2Skill.java

@@ -2340,7 +2340,8 @@ public abstract class L2Skill implements IChanceSkillTrigger
             		effects.add(e);
             	}
         	}
-        	else if (effector instanceof L2PcInstance)
+        	// display fail message only for effects with icons
+        	else if (et.icon && effector instanceof L2PcInstance)
 			{
 				SystemMessage sm = new SystemMessage(SystemMessageId.C1_RESISTED_YOUR_S2);
 				sm.addCharName(effected);

+ 0 - 3
L2_GameServer/java/com/l2jserver/gameserver/skills/DocumentBase.java

@@ -279,9 +279,6 @@ abstract class DocumentBase
     		}
         }
         
-        if (effectPower > -1 && type == null && _log.isLoggable(Level.WARNING))
-        	_log.log(Level.WARNING, "Missing effectType for effect: "+name);
-        
         EffectTemplate lt;
         
         final boolean isChanceSkillTrigger = (name == EffectChanceSkillTrigger.class.getName());

+ 4 - 2
L2_GameServer/java/com/l2jserver/gameserver/skills/Formulas.java

@@ -2307,9 +2307,11 @@ public final class Formulas
 		if (shld == SHIELD_DEFENSE_PERFECT_BLOCK) // perfect block
 			return false;
 		
-		L2SkillType type = effect.effectType  != null ? effect.effectType : skill.getSkillType();
+		final L2SkillType type = effect.effectType;
+		final int value = (int)effect.effectPower;
+		if (type == null)
+			return Rnd.get(100) < value;
 
-		int value = (int)effect.effectPower;
 		int lvlDepend = skill.getLevelDepend();
 
 		// TODO: Temporary fix for skills with Power = 0 or LevelDepend not set

+ 65 - 0
L2_GameServer/java/com/l2jserver/gameserver/skills/effects/EffectAbortCast.java

@@ -0,0 +1,65 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.skills.effects;
+
+import com.l2jserver.gameserver.model.L2Effect;
+import com.l2jserver.gameserver.skills.Env;
+import com.l2jserver.gameserver.templates.effects.EffectTemplate;
+import com.l2jserver.gameserver.templates.skills.L2EffectType;
+
+public class EffectAbortCast extends L2Effect
+{
+	public EffectAbortCast(Env env, EffectTemplate template)
+	{
+		super(env, template);
+	}
+
+	/**
+	 * 
+	 * @see com.l2jserver.gameserver.model.L2Effect#getEffectType()
+	 */
+	@Override
+	public L2EffectType getEffectType()
+	{
+		return L2EffectType.ABORT_CAST;
+	}
+
+	/**
+	 * 
+	 * @see com.l2jserver.gameserver.model.L2Effect#onStart()
+	 */
+	@Override
+	public boolean onStart()
+	{
+		if (getEffected() == null || getEffected() == getEffector())
+			return false;
+
+		if (getEffected().isRaid())
+			return false;
+
+		getEffected().breakCast();
+		return true;
+	}
+
+	/**
+	 * 
+	 * @see com.l2jserver.gameserver.model.L2Effect#onActionTime()
+	 */
+	@Override
+	public boolean onActionTime()
+	{
+		return false;
+	}
+}

+ 2 - 1
L2_GameServer/java/com/l2jserver/gameserver/templates/skills/L2EffectType.java

@@ -69,5 +69,6 @@ public enum L2EffectType
 	CLAN_GATE,
 	NEGATE,
 	THROW_UP,
-	HIDE
+	HIDE,
+	ABORT_CAST
 }