A Project for Chronicle 4 based on L2JServer.


    EffectDeflectBuff code

    Share

    manutuning2

    Posts : 33
    Join date : 2013-10-30

    EffectDeflectBuff code

    Post  manutuning2 on 7th February 2014, 21:39

    I am wanting to add this effect to make the antibuffskill,
    achievement do not load the effect.

    I share what I'm working,

    java/net/sf/l2j/gameserver/skills/effects/EffectDeflectBuff.java

    Code:
    @@ -0,0 +1,73 @@
    +package net.sf.l2j.gameserver.skills.effects;
    +
    +import net.sf.l2j.gameserver.model.L2Character;
    +import net.sf.l2j.gameserver.model.L2Effect;
    +import net.sf.l2j.gameserver.model.L2Skill;
    +import net.sf.l2j.gameserver.serverpackets.SystemMessage;
    +import net.sf.l2j.gameserver.skills.Env;
    +
    +public class EffectDeflectBuff extends L2Effect
    +{
    +  
    +   /**
    +    * @param env
    +    * @param template
    +    */
    +   protected EffectDeflectBuff(Env env, EffectTemplate template)
    +   {
    +      super(env, template);
    +      // TODO Auto-generated constructor stub
    +   }
    +  
    +   /*
    +    * (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()
    +   {
    +      L2Character activeChar = null;
    +      activeChar = this.getEffected();
    +      
    +      if (getSkill().getSkillType() != L2Skill.SkillType.CONT)
    +      {
    +         return false;
    +      }
    +      
    +      double manaDam = calc();
    +      
    +      if (manaDam > getEffected().getCurrentMp())
    +      {
    +         SystemMessage sm = new SystemMessage(24);
    +         activeChar.sendPacket(sm);
    +         return false;
    +      }
    +      
    +      getEffected().reduceCurrentMp(manaDam);
    +      
    +      return true;
    +   }
    +  
    +   @Override
    +   public void onStart()
    +   {
    +      getEffected().setIsBuffProtected(true);
    +   }
    +  
    +   @Override
    +   public void onExit()
    +   {
    +      getEffected().setIsBuffProtected(false);
    +   }
    +  
    +}

    handler/skillshandlers/continuos.java
    Code:
    L2Skill.SkillType.BUFF,
      L2Skill.SkillType.DEBUFF,
    +  L2Skill.SkillType.PREVENT_BUFF,

    // Walls and Door should not be buffed
      if ((target instanceof L2DoorInstance) && ((skill.getSkillType() == L2Skill.SkillType.BUFF) || (skill.getSkillType() == L2Skill.SkillType.HOT)))
      {
        continue;
      }
    +  if ((((activeChar instanceof L2PlayableInstance) && (target != activeChar) && target.isBuffProtected() && (skill.getSkillType() == L2Skill.SkillType.BUFF)) || (skill.getSkillType() == L2Skill.SkillType.HEAL_PERCENT) || (skill.getSkillType() == L2Skill.SkillType.MANAHEAL) || (skill.getSkillType() == L2Skill.SkillType.COMBATPOINTHEAL) || (skill.getSkillType() == L2Skill.SkillType.REFLECT)))
    +  {
     +  continue;
     +  }

    net.sf.l2j.gameserver.model.L2Effect.java

    Code:
    public static enum EffectType
     {
      BUFF,
      DEBUFF,
    +  PREVENT_BUFF,

    net.sf.l2j.gameserver.model.L2Skill.java

    Code:
    public static enum SkillType
     {
      PDAM,
      MDAM,
      DOT,
      BLEED,
      POISON,
      HEAL,
      HOT,
      COMBATPOINTHEAL,
      CPHOT,
      MANAHEAL,
      MANARECHARGE,
      MPHOT,
      AGGDAMAGE,
      BUFF,
      DEBUFF,
    +  PREVENT_BUFF,

    net.sf.l2j.gameserver.model.L2Character

    Code:
    private boolean _isAttackingNow = false; // Attack End Time
     protected boolean _IsTeleporting = false;
    + protected boolean _isBuffProtected = false;

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

    and this is the model of skil

    Code:

    <skill id="7014" levels="1" name="Anti-Buff">
      <set name="mpConsume" val="1"/>
      <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="1" val="1"/>
      </for>
    </skill>

    Might I dnr please guide me to the solution, I can not ride the effect

    Greetings and thanks for any help
    avatar
    DnR
    Admin
    Admin

    Posts : 1023
    Join date : 2012-12-03

    Re: EffectDeflectBuff code

    Post  DnR on 8th February 2014, 13:57

    That's my work few years ago, when i was quite a newbie, but this doesn't matter because shield works fine.
    It's made so that you can receive buffs from npcs and yourself.
    Try casting buffs with another character.

    manutuning2

    Posts : 33
    Join date : 2013-10-30

    Re: EffectDeflectBuff code

    Post  manutuning2 on 8th February 2014, 21:50

    yes dnr. the problem that I can not create the effect, that's why I'm asking for help from you. achievement do not load the eclipse effect.
    you only need if you can just add the effect to the trunk, the rest I add it manually.

    manutuning2

    Posts : 33
    Join date : 2013-10-30

    Re: EffectDeflectBuff code

    Post  manutuning2 on 8th March 2014, 21:49

    DNR can add DEFLECTBUFF please log effect please
    I tried a thousand ways

    bye and thanks

    manutuning2

    Posts : 33
    Join date : 2013-10-30

    Re: EffectDeflectBuff code

    Post  manutuning2 on 21st March 2014, 20:16

    Please DNR you can add this effect to the trunk.

    my server is very important to have this upgrade

    Thanks and hope to answer

    Sponsored content

    Re: EffectDeflectBuff code

    Post  Sponsored content


      Current date/time is 20th September 2017, 15:45