Jump to content

[Share] A real Anti-Buff Shield


DnR

Recommended Posts

Just looking at the old AntiBuff Shield made me -beep-ing sick,so i share you my own :).

By declaring the skilltypes in this skillhandler,buffs of Core Buffer won't be prevented.

Also,a core support has been made to let the skill work like toggle.

This shield protects you only from buffs casted by other players.You are free to use your self buffs ^^.

 

L2Effect.java

       CHARMOFCOURAGE,
       SIGNET_EFFECT,
       SIGNET_GROUND,
+       PREVENT_BUFF,
       PREVENT_MAGIC,
       TRANSFERDMG,
       CANCEL,
       WARP
   }

 

L2Character.java

       private boolean _isAfraid                               = false; // Flee in a random direction

+       private boolean _isBuffProtected                        = false;
private boolean _isConfused                             = false; // Attack anyone randomly

private boolean _isFakeDeath                            = false; // Fake death
private boolean _isFlying                               = false; //Is flying Wyvern?

+   public final void setIsBuffProtected(boolean value)
+   {
+      _isBuffProtected = value;
+   }
+
+   public boolean isBuffProtected()
+   {
+      return _isBuffProtected;	
+   }
}

 

Continuous.java

           // Walls and Door should not be buffed
           if (target instanceof L2DoorInstance && (skill.getSkillType() == L2Skill.SkillType.BUFF || skill.getSkillType() == L2Skill.SkillType.HOT))
           	continue;

+           // Anti-Buff Protection prevents you from getting buffs by other players
+	    if (activeChar instanceof L2PlayableInstance && target != activeChar && target.isBuffProtected() && !skill.isHeroSkill()
+           && (skill.getSkillType() == L2Skill.SkillType.BUFF
+           || skill.getSkillType() == L2Skill.SkillType.HEAL_PERCENT
+           || skill.getSkillType() == L2Skill.SkillType.FORCE_BUFF
+           || skill.getSkillType() == L2Skill.SkillType.MANAHEAL_PERCENT
+           || skill.getSkillType() == L2Skill.SkillType.COMBATPOINTHEAL
+           || skill.getSkillType() == L2Skill.SkillType.REFLECT))
+		continue;

 

EffectDeflectBuff.java

package net.sf.l2j.gameserver.skills.effects;

import net.sf.l2j.gameserver.model.L2Effect;
import net.sf.l2j.gameserver.model.L2Effect.EffectType;
import net.sf.l2j.gameserver.model.L2Skill.SkillType;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.skills.Env;

/**
* @author Java
*/
public final class EffectDeflectBuff extends L2Effect
{
/**
 * @param env
 * @param template
 */
public EffectDeflectBuff(Env env, EffectTemplate template)
{
	super(env, template);
}

/*
 * (non-Javadoc)
 * 
 * @see net.sf.l2j.gameserver.model.L2Effect#getEffectType()
 */
@Override
public EffectType getEffectType()
{
	return EffectType.PREVENT_BUFF;
}

/*
 * (non-Javadoc)
 * 
 * @see net.sf.l2j.gameserver.model.L2Effect#onActionTime()
 */
@Override
public boolean onActionTime()
{
	// Only cont skills shouldn't end
	if(getSkill().getSkillType() != SkillType.CONT)
		return false;

	double manaDam = calc();

	if(manaDam > getEffected().getCurrentMp())
	{
		SystemMessage sm = new SystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP);
		getEffected().sendPacket(sm);
		return false;
	}

	getEffected().reduceCurrentMp(manaDam);
	return true;
}

/*
 * (non-Javadoc)
 * 
 * @see net.sf.l2j.gameserver.model.L2Effect#onStart()
 */
@Override
public void onStart()
{
	getEffected().setIsBuffProtected(true);
	return;
}

/*
 * (non-Javadoc)
 * 
 * @see net.sf.l2j.gameserver.model.L2Effect#onExit()
 */
@Override
public void onExit()
{
	getEffected().setIsBuffProtected(false);
}
}

 

And this is how the skill should be in DP:

<skill id="add the skill id here" levels="1" name="AntiBuff-Shield">
 <set name="target" val="TARGET_SELF"/>
 <set name="skillType" val="CONT"/>
 <set name="operateType" val="OP_TOGGLE"/>
 <set name="castRange" val="-1"/>
 <set name="effectRange" val="-1"/>
 <for>
   <effect count="0x7fffffff" name="DeflectBuff" time="3" val="0"/>
 </for>
</skill>

 

Have fun!

Link to comment
Share on other sites

I'll test it to how exactly working. ;)

Thnx for share.

Good work,keep up

 

Can I have a picture after you test it? I'm curious.

Link to comment
Share on other sites

u can't wait until get Boss replay or u need increase the number of posts ?

 

As a matter of fact more than 1 hour has passed.

« Reply #6 on: Today at 06:40:21 PM »

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...