Handy's Block Checker Event related improvements.

This commit is contained in:
MobiusDev
2016-08-23 21:42:58 +00:00
parent fc19d4cf01
commit 2823174ded
9 changed files with 117 additions and 75 deletions

View File

@@ -130,6 +130,7 @@ public final class EffectMasterHandler
EffectHandler.getInstance().registerHandler("Fear", Fear::new);
EffectHandler.getInstance().registerHandler("Feed", Feed::new);
EffectHandler.getInstance().registerHandler("Flag", Flag::new);
EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new);
EffectHandler.getInstance().registerHandler("FlyMove", FlyMove::new);
EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new);
EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::new);

View File

@@ -0,0 +1,76 @@
/*
* 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.instancemanager.HandysBlockCheckerManager;
import com.l2jmobius.gameserver.model.ArenaParticipantsHolder;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2BlockInstance;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
/**
* Flip Block effect implementation.
* @author Mobius
*/
public final class FlipBlock extends AbstractEffect
{
public FlipBlock(StatsSet params)
{
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
final L2BlockInstance block = effected instanceof L2BlockInstance ? (L2BlockInstance) effected : null;
final L2PcInstance player = effector.isPlayer() ? (L2PcInstance) effector : null;
if ((block == null) || (player == null))
{
return;
}
final int arena = player.getBlockCheckerArena();
if (arena != -1)
{
final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena);
if (holder == null)
{
return;
}
final int team = holder.getPlayerTeam(player);
final int color = block.getColorEffect();
if ((team == 0) && (color == 0x00))
{
block.changeColor(player, holder, team);
}
else if ((team == 1) && (color == 0x53))
{
block.changeColor(player, holder, team);
}
}
}
}