Changeset 2259

Show
Ignore:
Timestamp:
07/10/08 16:46:35 (3 months ago)
Author:
DrHouse
Message:

Fixes for EffectFear?:

  • Skill and effected checks are done on onStart() now, only once and not for every "onActionTime"
  • Direction will not change depending on relative effector position once effect is in use
  • Minor clean up
  • Also fixes #2698
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/L2_GameServer/java/net/sf/l2j/gameserver/skills/effects/EffectFear.java

    r1859 r2259  
    3434{ 
    3535        public static final int FEAR_RANGE = 500; 
     36         
     37        private int _dX = -1; 
     38        private int _dY = -1; 
    3639 
    3740        public EffectFear(Env env, EffectTemplate template) 
     
    5053        public void onStart() 
    5154        { 
     55                // Fear skills cannot be used l2pcinstance to l2pcinstance. Heroic Dread, Curse: Fear, Fear, Horror, Sword Symphony, Word of Fear and Mass Curse Fear are the exceptions. 
     56                if(getEffected() instanceof L2PcInstance && getEffector() instanceof L2PcInstance                                
     57                                && getSkill().getId() != 1376  
     58                                && getSkill().getId() != 1169  
     59                                && getSkill().getId() != 65  
     60                                && getSkill().getId() != 1092  
     61                                && getSkill().getId() != 98  
     62                                && getSkill().getId() != 1272  
     63                                && getSkill().getId() != 1381)  
     64                        return; 
     65                 
     66                if(getEffected() instanceof L2FolkInstance 
     67                                || getEffected() instanceof L2SiegeGuardInstance 
     68                                || getEffected() instanceof L2SiegeFlagInstance 
     69                                || getEffected() instanceof L2SiegeSummonInstance)  
     70                        return; 
     71                 
    5272                if (!getEffected().isAfraid()) 
    5373                { 
     74                        if (getEffected().getX() > getEffector().getX()) 
     75                                _dX = 1; 
     76                        if (getEffected().getY() > getEffector().getY()) 
     77                                _dY = 1; 
     78                         
    5479                        getEffected().startFear(); 
    5580                        onActionTime(); 
     
    6792        public boolean onActionTime() 
    6893        { 
    69                 // Fear skills cannot be used l2pcinstance to l2pcinstance. Heroic Dread, Curse: Fear, Fear, Horror, Sword Symphony, Word of Fear and Mass Curse Fear are the exceptions. 
    70                 if(getEffected() instanceof L2PcInstance && getEffector() instanceof L2PcInstance && getSkill().getId() != 1376 && getSkill().getId() != 1169 && getSkill().getId() != 65 && getSkill().getId() != 1092 && getSkill().getId() != 98 && getSkill().getId() != 1272 && getSkill().getId() != 1381) return false; 
    71                 if(getEffected() instanceof L2FolkInstance) return false; 
    72                 if(getEffected() instanceof L2SiegeGuardInstance) return false; 
    73                 // Fear skills cannot be used on Headquarters Flag. 
    74                 if(getEffected() instanceof L2SiegeFlagInstance) return false; 
    75  
    76                 if(getEffected() instanceof L2SiegeSummonInstance)  
    77                         return false; 
    78  
    7994                int posX = getEffected().getX(); 
    8095                int posY = getEffected().getY(); 
    8196                int posZ = getEffected().getZ(); 
    8297                 
    83                 int signx=-1; 
    84                 int signy=-1; 
    85                 if (getEffected().getX() > getEffector().getX()) 
    86                         signx=1; 
    87                 if (getEffected().getY() > getEffector().getY()) 
    88                         signy=1; 
    89                 posX += signx*FEAR_RANGE; 
    90                 posY += signy*FEAR_RANGE; 
     98                posX += _dX*FEAR_RANGE; 
     99                posY += _dY*FEAR_RANGE; 
     100                 
    91101                getEffected().setRunning(); 
    92102                getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,new L2CharPosition(posX,posY,posZ,0));