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("Fear", Fear::new);
EffectHandler.getInstance().registerHandler("Feed", Feed::new); EffectHandler.getInstance().registerHandler("Feed", Feed::new);
EffectHandler.getInstance().registerHandler("Flag", Flag::new); EffectHandler.getInstance().registerHandler("Flag", Flag::new);
EffectHandler.getInstance().registerHandler("FlipBlock", FlipBlock::new);
EffectHandler.getInstance().registerHandler("FlyMove", FlyMove::new); EffectHandler.getInstance().registerHandler("FlyMove", FlyMove::new);
EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new); EffectHandler.getInstance().registerHandler("FocusEnergy", FocusEnergy::new);
EffectHandler.getInstance().registerHandler("FocusMomentum", FocusMomentum::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);
}
}
}
}

View File

@@ -1252,6 +1252,7 @@
<skill id="5852" toLevel="1" name="Flip Block"> <skill id="5852" toLevel="1" name="Flip Block">
<!-- CT2.5 retail confirmed --> <!-- CT2.5 retail confirmed -->
<castRange>40</castRange> <castRange>40</castRange>
<effectPoint>-1</effectPoint>
<effectRange>400</effectRange> <effectRange>400</effectRange>
<hitTime>1000</hitTime> <hitTime>1000</hitTime>
<icon>icon.skill_transform_s_attack</icon> <icon>icon.skill_transform_s_attack</icon>
@@ -1260,12 +1261,16 @@
<reuseDelay>2000</reuseDelay> <reuseDelay>2000</reuseDelay>
<rideState>NONE</rideState> <rideState>NONE</rideState>
<magicCriticalRate>-5</magicCriticalRate> <magicCriticalRate>-5</magicCriticalRate>
<targetType>OTHERS</targetType> <targetType>ENEMY</targetType>
<affectScope>SINGLE</affectScope> <affectScope>SINGLE</affectScope>
<effects>
<effect name="FlipBlock" />
</effects>
</skill> </skill>
<skill id="5853" toLevel="1" name="Flip Block"> <skill id="5853" toLevel="1" name="Flip Block">
<!-- CT2.5 retail confirmed --> <!-- CT2.5 retail confirmed -->
<castRange>40</castRange> <castRange>40</castRange>
<effectPoint>-1</effectPoint>
<effectRange>400</effectRange> <effectRange>400</effectRange>
<hitTime>1000</hitTime> <hitTime>1000</hitTime>
<icon>icon.skill_transform_s_attack</icon> <icon>icon.skill_transform_s_attack</icon>
@@ -1274,8 +1279,11 @@
<reuseDelay>2000</reuseDelay> <reuseDelay>2000</reuseDelay>
<rideState>NONE</rideState> <rideState>NONE</rideState>
<magicCriticalRate>-5</magicCriticalRate> <magicCriticalRate>-5</magicCriticalRate>
<targetType>OTHERS</targetType> <targetType>ENEMY</targetType>
<affectScope>SINGLE</affectScope> <affectScope>SINGLE</affectScope>
<effects>
<effect name="FlipBlock" />
</effects>
</skill> </skill>
<skill id="5854" toLevel="1" name="Decrease Speed"> <skill id="5854" toLevel="1" name="Decrease Speed">
<abnormalLvl>3</abnormalLvl> <abnormalLvl>3</abnormalLvl>

View File

@@ -44,6 +44,7 @@ public enum InstanceType
L2GuardInstance(L2Attackable), L2GuardInstance(L2Attackable),
L2QuestGuardInstance(L2GuardInstance), L2QuestGuardInstance(L2GuardInstance),
L2MonsterInstance(L2Attackable), L2MonsterInstance(L2Attackable),
L2BlockInstance(L2Attackable),
L2ChestInstance(L2MonsterInstance), L2ChestInstance(L2MonsterInstance),
L2ControllableMobInstance(L2MonsterInstance), L2ControllableMobInstance(L2MonsterInstance),
L2FeedableBeastInstance(L2MonsterInstance), L2FeedableBeastInstance(L2MonsterInstance),

View File

@@ -45,7 +45,7 @@ public enum NpcInfoType implements IUpdateTypeComponent
ENCHANT(0x10, 4), ENCHANT(0x10, 4),
FLYING(0x11, 4), FLYING(0x11, 4),
CLONE(0x12, 4), CLONE(0x12, 4),
UNKNOWN8(0x13, 4), COLOR_EFFECT(0x13, 4),
DISPLAY_EFFECT(0x16, 4), DISPLAY_EFFECT(0x16, 4),
TRANSFORMATION(0x17, 4), TRANSFORMATION(0x17, 4),

View File

@@ -42,13 +42,10 @@ import com.l2jmobius.gameserver.handler.AffectScopeHandler;
import com.l2jmobius.gameserver.handler.IAffectScopeHandler; import com.l2jmobius.gameserver.handler.IAffectScopeHandler;
import com.l2jmobius.gameserver.handler.ITargetTypeHandler; import com.l2jmobius.gameserver.handler.ITargetTypeHandler;
import com.l2jmobius.gameserver.handler.TargetHandler; import com.l2jmobius.gameserver.handler.TargetHandler;
import com.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager;
import com.l2jmobius.gameserver.model.ArenaParticipantsHolder;
import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.PcCondOverride; import com.l2jmobius.gameserver.model.PcCondOverride;
import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.actor.L2Character; 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.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.cubic.CubicInstance; import com.l2jmobius.gameserver.model.cubic.CubicInstance;
import com.l2jmobius.gameserver.model.effects.AbstractEffect; import com.l2jmobius.gameserver.model.effects.AbstractEffect;
@@ -1404,71 +1401,31 @@ public final class Skill implements IIdentifiable
*/ */
public final void activateSkill(L2Character caster, CubicInstance cubic, L2ItemInstance item, L2Object... targets) public final void activateSkill(L2Character caster, CubicInstance cubic, L2ItemInstance item, L2Object... targets)
{ {
// TODO: replace with AI for (L2Object targetObject : targets)
switch (getId())
{ {
case 5852: if (!targetObject.isCharacter())
case 5853:
{ {
final L2BlockInstance block = targets[0] instanceof L2BlockInstance ? (L2BlockInstance) targets[0] : null; continue;
final L2PcInstance player = caster.isPlayer() ? (L2PcInstance) caster : 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);
}
}
break;
} }
default:
final L2Character target = (L2Character) targetObject;
if (Formulas.calcBuffDebuffReflection(target, this))
{ {
for (L2Object targetObject : targets) // if skill is reflected instant effects should be casted on target
{ // and continuous effects on caster
if (!targetObject.isCharacter()) applyEffects(target, caster, false, 0);
{
continue; final BuffInfo info = new BuffInfo(caster, target, this, false, item, null);
} applyEffectScope(EffectScope.GENERAL, info, true, false);
final L2Character target = (L2Character) targetObject; final EffectScope pvpOrPveEffectScope = caster.isPlayable() && target.isAttackable() ? EffectScope.PVE : caster.isPlayable() && target.isPlayable() ? EffectScope.PVP : null;
if (Formulas.calcBuffDebuffReflection(target, this)) applyEffectScope(pvpOrPveEffectScope, info, true, false);
{
// if skill is reflected instant effects should be casted on target applyEffectScope(EffectScope.CHANNELING, info, true, false);
// and continuous effects on caster }
applyEffects(target, caster, false, 0); else
{
final BuffInfo info = new BuffInfo(caster, target, this, false, item, null); applyEffects(caster, target, item);
applyEffectScope(EffectScope.GENERAL, info, true, false);
final EffectScope pvpOrPveEffectScope = caster.isPlayable() && target.isAttackable() ? EffectScope.PVE : caster.isPlayable() && target.isPlayable() ? EffectScope.PVP : null;
applyEffectScope(pvpOrPveEffectScope, info, true, false);
applyEffectScope(EffectScope.CHANNELING, info, true, false);
}
else
{
applyEffects(caster, target, item);
}
}
break;
} }
} }

View File

@@ -158,7 +158,7 @@ public class ExPetInfo extends AbstractMaskPacket<NpcInfoType>
addComponentType(NpcInfoType.CLAN); addComponentType(NpcInfoType.CLAN);
} }
addComponentType(NpcInfoType.UNKNOWN8); addComponentType(NpcInfoType.COLOR_EFFECT);
// TODO: Confirm me // TODO: Confirm me
if (summon.isInCombat()) if (summon.isInCombat())
@@ -312,7 +312,7 @@ public class ExPetInfo extends AbstractMaskPacket<NpcInfoType>
{ {
packet.writeD(0x00); // Player ObjectId with Decoy packet.writeD(0x00); // Player ObjectId with Decoy
} }
if (containsMask(NpcInfoType.UNKNOWN8)) if (containsMask(NpcInfoType.COLOR_EFFECT))
{ {
// No visual effect // No visual effect
packet.writeD(0x00); // Unknown packet.writeD(0x00); // Unknown

View File

@@ -184,7 +184,7 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
} }
} }
addComponentType(NpcInfoType.UNKNOWN8); addComponentType(NpcInfoType.COLOR_EFFECT);
if (npc.getPvpFlag() > 0) if (npc.getPvpFlag() > 0)
{ {
@@ -345,10 +345,9 @@ public class NpcInfo extends AbstractMaskPacket<NpcInfoType>
{ {
packet.writeD(_npc.getCloneObjId()); // Player ObjectId with Decoy packet.writeD(_npc.getCloneObjId()); // Player ObjectId with Decoy
} }
if (containsMask(NpcInfoType.UNKNOWN8)) if (containsMask(NpcInfoType.COLOR_EFFECT))
{ {
// No visual effect packet.writeD(_npc.getColorEffect()); // Color effect
packet.writeD(0x00); // Unknown
} }
if (containsMask(NpcInfoType.DISPLAY_EFFECT)) if (containsMask(NpcInfoType.DISPLAY_EFFECT))
{ {

View File

@@ -158,7 +158,7 @@ public class SummonInfo extends AbstractMaskPacket<NpcInfoType>
addComponentType(NpcInfoType.CLAN); addComponentType(NpcInfoType.CLAN);
} }
addComponentType(NpcInfoType.UNKNOWN8); addComponentType(NpcInfoType.COLOR_EFFECT);
// TODO: Confirm me // TODO: Confirm me
if (summon.isInCombat()) if (summon.isInCombat())
@@ -312,7 +312,7 @@ public class SummonInfo extends AbstractMaskPacket<NpcInfoType>
{ {
packet.writeD(0x00); // Player ObjectId with Decoy packet.writeD(0x00); // Player ObjectId with Decoy
} }
if (containsMask(NpcInfoType.UNKNOWN8)) if (containsMask(NpcInfoType.COLOR_EFFECT))
{ {
// No visual effect // No visual effect
packet.writeD(0x00); // Unknown packet.writeD(0x00); // Unknown