Anti Buff Acis 399

Mayhem

Новичок
Hey forum, whatsapp i'm new, not rus speaking but i can share somethings anyways.
as the title says Anti buff for acis 399 (the Do not the know the if the this datapack Already have IT)

You need to add a new skills to your system with the ID "8000" and name "Antibuff" or whatever you want.

Java:
diff --git a/java/net/sf/l2j/gameserver/enums/skills/EffectType.java b/java/net/sf/l2j/gameserver/enums/skills/EffectType.java
index 89d25a5..88484b4 100644
--- a/java/net/sf/l2j/gameserver/enums/skills/EffectType.java
+++ b/java/net/sf/l2j/gameserver/enums/skills/EffectType.java
@@ -4,7 +4,7 @@
 {
     BLOCK_BUFF,
     BLOCK_DEBUFF,
-   
+    PREVENT_BUFF,
     BUFF,
     DEBUFF,
    
diff --git a/java/net/sf/l2j/gameserver/handler/skillhandlers/Continuous.java b/java/net/sf/l2j/gameserver/handler/skillhandlers/Continuous.java
index ba43c88..967a29e 100644
--- a/java/net/sf/l2j/gameserver/handler/skillhandlers/Continuous.java
+++ b/java/net/sf/l2j/gameserver/handler/skillhandlers/Continuous.java
@@ -72,7 +72,14 @@
                     // Target under buff immunity.
                     if (target.getFirstEffect(EffectType.BLOCK_BUFF) != null)
                         continue;
-                   
+                    // Anti-Buff Protection prevents you from getting buffs by other players
+                    if (activeChar instanceof Player && target != activeChar && target.isBuffProtected() && !skill.isHeroSkill()
+                        && (skill.getSkillType() == SkillType.BUFF
+                        || skill.getSkillType() == SkillType.HEAL_PERCENT
+                        || skill.getSkillType() == SkillType.MANAHEAL_PERCENT
+                        || skill.getSkillType() == SkillType.COMBATPOINTHEAL
+                        || skill.getSkillType() == SkillType.REFLECT))
+                        continue;
                     // Player holding a cursed weapon can't be buffed and can't buff
                     if (!(activeChar instanceof ClanHallManagerNpc) && target != activeChar)
                     {
diff --git a/java/net/sf/l2j/gameserver/model/actor/Creature.java b/java/net/sf/l2j/gameserver/model/actor/Creature.java
index 776522a..07e206a 100644
--- a/java/net/sf/l2j/gameserver/model/actor/Creature.java
+++ b/java/net/sf/l2j/gameserver/model/actor/Creature.java
@@ -81,6 +81,16 @@
  */
 public abstract class Creature extends WorldObject
 {
+    private boolean _isBuffProtected = false;
+    public final void setIsBuffProtected(boolean value)
+    {
+        _isBuffProtected = value;
+    }
+   
+    public boolean isBuffProtected()
+    {
+        return _isBuffProtected;   
+    }
     protected String _title;
    
     protected volatile CreatureAI _ai;
diff --git a/java/net/sf/l2j/gameserver/skills/effects/EffectDeflectBuff.java b/java/net/sf/l2j/gameserver/skills/effects/EffectDeflectBuff.java
new file mode 100644
index 0000000..a6adb01
--- /dev/null
+++ b/java/net/sf/l2j/gameserver/skills/effects/EffectDeflectBuff.java
@@ -0,0 +1,43 @@
+package net.sf.l2j.gameserver.skills.effects;
+
+import net.sf.l2j.gameserver.enums.skills.EffectType;
+import net.sf.l2j.gameserver.enums.skills.SkillType;
+import net.sf.l2j.gameserver.model.actor.Creature;
+import net.sf.l2j.gameserver.skills.AbstractEffect;
+import net.sf.l2j.gameserver.skills.L2Skill;
+
+public final class EffectDeflectBuff extends AbstractEffect
+{
+    public EffectDeflectBuff(EffectTemplate template, L2Skill skill, Creature effected, Creature effector)
+    {
+        super(template, skill, effected, effector);
+    }
+   
+    @Override
+    public EffectType getEffectType()
+    {
+        return EffectType.PREVENT_BUFF;
+    }
+   
+    @Override
+    public boolean onActionTime()
+    {
+        if (getSkill().getSkillType() != SkillType.CONT)
+            return false;
+        return true;
+       
+    }
+   
+    @Override
+    public boolean onStart()
+    {
+        getEffected().setIsBuffProtected(true);
+        return true;
+    }
+   
+    @Override
+    public void onExit()
+    {
+        getEffected().setIsBuffProtected(false);
+    }
+}

diff --git a/data/xml/skills/AntiBuff.xml b/data/xml/skills/AntiBuff.xml
new file mode 100644
index 0000000..b5c8f2d
--- /dev/null
+++ b/data/xml/skills/AntiBuff.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<list>
+    <skill id="8000" levels="1" name="AntiBuff">
+        <set name="target" val="SELF"/>
+        <set name="skillType" val="CONT"/>
+        <set name="operateType" val="TOGGLE"/>
+        <for>
+            <effect count="0x7fffffff" name="DeflectBuff" time="5" val="0"/>
+        </for>
+    </skill>
+</list>
\ No newline at end of file
 
Сверху