Explorar el Código

BETA: Added new effect !StealAbnormal and deleted old skillType.
Patch by: Adry_85, Zoey76

Adry_85 hace 12 años
padre
commit
318b281634

+ 1 - 0
L2J_DataPack_BETA/dist/game/data/scripts/handlers/EffectMasterHandler.java

@@ -132,6 +132,7 @@ public final class EffectMasterHandler
 		Sleep.class,
 		Spoil.class,
 		StaticDamage.class,
+		StealAbnormal.class,
 		Stun.class,
 		SummonAgathion.class,
 		SummonNpc.class,

+ 0 - 2
L2J_DataPack_BETA/dist/game/data/scripts/handlers/MasterHandler.java

@@ -222,7 +222,6 @@ import handlers.skillhandlers.RefuelAirShip;
 import handlers.skillhandlers.Resurrect;
 import handlers.skillhandlers.ShiftTarget;
 import handlers.skillhandlers.Sow;
-import handlers.skillhandlers.StealBuffs;
 import handlers.skillhandlers.SummonFriend;
 import handlers.skillhandlers.TakeCastle;
 import handlers.skillhandlers.TakeFort;
@@ -525,7 +524,6 @@ public class MasterHandler
 			Resurrect.class,
 			ShiftTarget.class,
 			Sow.class,
-			StealBuffs.class,
 			SummonFriend.class,
 			TakeCastle.class,
 			TakeFort.class,

+ 94 - 0
L2J_DataPack_BETA/dist/game/data/scripts/handlers/effecthandlers/StealAbnormal.java

@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2004-2013 L2J DataPack
+ * 
+ * This file is part of L2J DataPack.
+ * 
+ * L2J DataPack 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.
+ * 
+ * L2J DataPack 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 handlers.effecthandlers;
+
+import java.util.List;
+
+import com.l2jserver.gameserver.model.effects.EffectTemplate;
+import com.l2jserver.gameserver.model.effects.L2Effect;
+import com.l2jserver.gameserver.model.effects.L2EffectType;
+import com.l2jserver.gameserver.model.stats.Env;
+import com.l2jserver.gameserver.model.stats.Formulas;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ * Steal Abnormal effect implementation.
+ * @author Adry_85, Zoey76
+ */
+public class StealAbnormal extends L2Effect
+{
+	public StealAbnormal(Env env, EffectTemplate template)
+	{
+		super(env, template);
+	}
+	
+	@Override
+	public boolean calcSuccess()
+	{
+		return true;
+	}
+	
+	@Override
+	public boolean canBeStolen()
+	{
+		return false;
+	}
+	
+	@Override
+	public L2EffectType getEffectType()
+	{
+		return L2EffectType.NONE;
+	}
+	
+	@Override
+	public boolean onStart()
+	{
+		if ((getEffected() != null) && getEffected().isPlayer() && (getEffector() != getEffected()))
+		{
+			final List<L2Effect> toSteal = Formulas.calcCancelStealEffects(getEffector(), getEffected(), getSkill(), getSkill().getPower());
+			if (toSteal.isEmpty())
+			{
+				return false;
+			}
+			final Env env = new Env();
+			env.setCharacter(getEffected());
+			env.setTarget(getEffector());
+			for (L2Effect eff : toSteal)
+			{
+				env.setSkill(eff.getSkill());
+				final L2Effect effect = eff.getEffectTemplate().getStolenEffect(env, eff);
+				if (effect != null)
+				{
+					effect.scheduleEffect();
+					if (effect.isIconDisplay() && getEffector().isPlayer())
+					{
+						final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
+						sm.addSkillName(effect);
+						getEffector().sendPacket(sm);
+					}
+					getEffector().getEffectList().add(effect);
+				}
+				eff.exit();
+			}
+			return true;
+		}
+		return false;
+	}
+}

+ 0 - 124
L2J_DataPack_BETA/dist/game/data/scripts/handlers/skillhandlers/StealBuffs.java

@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2004-2013 L2J DataPack
- * 
- * This file is part of L2J DataPack.
- * 
- * L2J DataPack 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.
- * 
- * L2J DataPack 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 handlers.skillhandlers;
-
-import java.util.List;
-import java.util.logging.Level;
-
-import com.l2jserver.gameserver.handler.ISkillHandler;
-import com.l2jserver.gameserver.model.L2Object;
-import com.l2jserver.gameserver.model.ShotType;
-import com.l2jserver.gameserver.model.actor.L2Character;
-import com.l2jserver.gameserver.model.effects.L2Effect;
-import com.l2jserver.gameserver.model.skills.L2Skill;
-import com.l2jserver.gameserver.model.skills.L2SkillType;
-import com.l2jserver.gameserver.model.stats.Env;
-import com.l2jserver.gameserver.model.stats.Formulas;
-import com.l2jserver.gameserver.network.SystemMessageId;
-import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
-
-public class StealBuffs implements ISkillHandler
-{
-	private static final L2SkillType[] SKILL_IDS =
-	{
-		L2SkillType.STEAL_BUFF
-	};
-	
-	@Override
-	public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
-	{
-		L2Character target;
-		L2Effect effect;
-		for (L2Object obj : targets)
-		{
-			if (!(obj instanceof L2Character))
-			{
-				continue;
-			}
-			target = (L2Character) obj;
-			
-			if (target.isDead())
-			{
-				continue;
-			}
-			
-			if (!target.isPlayer())
-			{
-				continue;
-			}
-			
-			Env env;
-			final List<L2Effect> toSteal = Formulas.calcCancelStealEffects(activeChar, target, skill, skill.getPower());
-			
-			if (toSteal.size() == 0)
-			{
-				continue;
-			}
-			
-			// stealing effects
-			for (L2Effect eff : toSteal)
-			{
-				env = new Env();
-				env.setCharacter(target);
-				env.setTarget(activeChar);
-				env.setSkill(eff.getSkill());
-				try
-				{
-					effect = eff.getEffectTemplate().getStolenEffect(env, eff);
-					if (effect != null)
-					{
-						effect.scheduleEffect();
-						if (effect.isIconDisplay() && activeChar.isPlayer())
-						{
-							SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
-							sm.addSkillName(effect);
-							activeChar.sendPacket(sm);
-						}
-					}
-					// Finishing stolen effect
-					eff.exit();
-				}
-				catch (RuntimeException e)
-				{
-					_log.log(Level.WARNING, "Cannot steal effect: " + eff + " Stealer: " + activeChar + " Stolen: " + target, e);
-				}
-			}
-		}
-		
-		if (skill.hasSelfEffects())
-		{
-			// Applying self-effects
-			effect = activeChar.getFirstEffect(skill.getId());
-			if ((effect != null) && effect.isSelfEffect())
-			{
-				// Replace old effect with new one.
-				effect.exit();
-			}
-			skill.getEffectsSelf(activeChar);
-		}
-		
-		activeChar.setChargedShot(activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOTS) ? ShotType.BLESSED_SPIRITSHOTS : ShotType.SPIRITSHOTS, false);
-	}
-	
-	@Override
-	public L2SkillType[] getSkillIds()
-	{
-		return SKILL_IDS;
-	}
-}

+ 3 - 1
L2J_DataPack_BETA/dist/game/data/stats/skills/01400-01499.xml

@@ -1280,8 +1280,10 @@
 		<set name="power" val="25" /> <!-- Base Land Rate -->
 		<set name="pvp" val="true" />
 		<set name="reuseDelay" val="15000" />
-		<set name="skillType" val="STEAL_BUFF" />
 		<set name="targetType" val="ONE" />
+		<for>
+			<effect name="StealAbnormal" noicon="1" val="0"/>
+		</for>
 	</skill>
 	<skill id="1441" levels="3" name="Soul to Empower">
 		<!-- Confirmed CT2.5 and Updated to H5 -->

+ 3 - 1
L2J_DataPack_BETA/dist/game/data/stats/skills/08300-08399.xml

@@ -361,8 +361,10 @@
 		<set name="power" val="25" /> <!-- Base Land Rate -->
 		<set name="pvp" val="true" />
 		<set name="reuseDelay" val="360000" />
-		<set name="skillType" val="STEAL_BUFF" />
 		<set name="targetType" val="ONE" />
+		<for>
+			<effect name="StealAbnormal" noicon="1" val="0"/>
+		</for>
 	</skill>
 	<skill id="8333" levels="1" name="Red Talisman - Territory Guard">
 		<!-- Confirmed CT2.5 -->