70 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| /*
 | |
|  * This file is part of the L2J Mobius project.
 | |
|  * 
 | |
|  * This program 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.
 | |
|  * 
 | |
|  * This program 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 com.l2jmobius.gameserver.ai.CtrlIntention;
 | |
| import com.l2jmobius.gameserver.model.Location;
 | |
| import com.l2jmobius.gameserver.model.StatsSet;
 | |
| import com.l2jmobius.gameserver.model.actor.L2Character;
 | |
| import com.l2jmobius.gameserver.model.effects.AbstractEffect;
 | |
| import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
 | |
| import com.l2jmobius.gameserver.model.skills.Skill;
 | |
| import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation;
 | |
| import com.l2jmobius.gameserver.network.serverpackets.FlyToLocation.FlyType;
 | |
| import com.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
 | |
| 
 | |
| /**
 | |
|  * This Blink effect switches the location of the caster and the target.<br>
 | |
|  * This effect is totally done based on client description. <br>
 | |
|  * Assume that geodata checks are done on the skill cast and not needed to repeat here.
 | |
|  * @author Nik
 | |
|  */
 | |
| public final class BlinkSwap extends AbstractEffect
 | |
| {
 | |
| 	public BlinkSwap(StatsSet params)
 | |
| 	{
 | |
| 	}
 | |
| 	
 | |
| 	@Override
 | |
| 	public boolean isInstant()
 | |
| 	{
 | |
| 		return true;
 | |
| 	}
 | |
| 	
 | |
| 	@Override
 | |
| 	public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
 | |
| 	{
 | |
| 		final Location effectorLoc = effector.getLocation();
 | |
| 		final Location effectedLoc = effected.getLocation();
 | |
| 		
 | |
| 		effector.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
 | |
| 		effector.broadcastPacket(new FlyToLocation(effector, effectedLoc, FlyType.DUMMY));
 | |
| 		effector.abortAttack();
 | |
| 		effector.abortCast();
 | |
| 		effector.setXYZ(effectedLoc);
 | |
| 		effector.broadcastPacket(new ValidateLocation(effector));
 | |
| 		
 | |
| 		effected.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
 | |
| 		effected.broadcastPacket(new FlyToLocation(effected, effectorLoc, FlyType.DUMMY));
 | |
| 		effected.abortAttack();
 | |
| 		effected.abortCast();
 | |
| 		effected.setXYZ(effectorLoc);
 | |
| 		effected.broadcastPacket(new ValidateLocation(effected));
 | |
| 		effected.revalidateZone(true);
 | |
| 	}
 | |
| }
 | 
