Unhardcoded Flip Block skills.

This commit is contained in:
MobiusDevelopment
2022-12-28 09:12:12 +00:00
parent 410b1d5f04
commit b3374a719a
9 changed files with 203 additions and 118 deletions

View File

@@ -88,6 +88,7 @@ public class EffectMasterHandler
Fear.class, Fear.class,
Fishing.class, Fishing.class,
Flag.class, Flag.class,
FlipBlock.class,
FocusEnergy.class, FocusEnergy.class,
FocusMaxEnergy.class, FocusMaxEnergy.class,
FocusSouls.class, FocusSouls.class,

View File

@@ -0,0 +1,79 @@
/*
* 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 org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager;
import org.l2jmobius.gameserver.model.ArenaParticipantsHolder;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.instance.Block;
import org.l2jmobius.gameserver.model.conditions.Condition;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.skill.BuffInfo;
/**
* Flip Block effect implementation.
* @author Mobius
*/
public class FlipBlock extends AbstractEffect
{
public FlipBlock(Condition attachCond, Condition applyCond, StatSet set, StatSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
final Creature effector = info.getEffector();
final Creature effected = info.getEffected();
final Block block = effected instanceof Block ? (Block) effected : null;
final Player player = effector.isPlayer() ? (Player) 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

@@ -753,25 +753,31 @@
</skill> </skill>
<skill id="5852" levels="1" name="Flip Block"> <skill id="5852" levels="1" name="Flip Block">
<!-- Flips blocks. --> <!-- Flips blocks. -->
<set name="icon" val="icon.skill_transform_s_attack" />
<set name="castRange" val="40" /> <set name="castRange" val="40" />
<set name="effectRange" val="400" /> <set name="effectRange" val="400" />
<set name="hitTime" val="1000" /> <set name="hitTime" val="1000" />
<set name="icon" val="icon.skill_transform_s_attack" />
<set name="magicLevel" val="80" /> <set name="magicLevel" val="80" />
<set name="operateType" val="A1" /> <set name="operateType" val="A1" />
<set name="reuseDelay" val="2000" /> <set name="reuseDelay" val="2000" />
<set name="targetType" val="ONE" /> <set name="targetType" val="ONE" />
<for>
<effect name="FlipBlock" />
</for>
</skill> </skill>
<skill id="5853" levels="1" name="Flip Block"> <skill id="5853" levels="1" name="Flip Block">
<!-- Flips blocks. --> <!-- Flips blocks. -->
<set name="icon" val="icon.skill_transform_s_attack" />
<set name="castRange" val="40" /> <set name="castRange" val="40" />
<set name="effectRange" val="400" /> <set name="effectRange" val="400" />
<set name="hitTime" val="1000" /> <set name="hitTime" val="1000" />
<set name="icon" val="icon.skill_transform_s_attack" />
<set name="magicLevel" val="80" /> <set name="magicLevel" val="80" />
<set name="operateType" val="A1" /> <set name="operateType" val="A1" />
<set name="reuseDelay" val="2000" /> <set name="reuseDelay" val="2000" />
<set name="targetType" val="ONE" /> <set name="targetType" val="ONE" />
<for>
<effect name="FlipBlock" />
</for>
</skill> </skill>
<skill id="5854" levels="1" name="Decrease Speed"> <skill id="5854" levels="1" name="Decrease Speed">
<!-- Speed is decreased. --> <!-- Speed is decreased. -->

View File

@@ -38,15 +38,12 @@ import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.geoengine.GeoEngine; import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.ITargetTypeHandler; import org.l2jmobius.gameserver.handler.ITargetTypeHandler;
import org.l2jmobius.gameserver.handler.TargetHandler; import org.l2jmobius.gameserver.handler.TargetHandler;
import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager;
import org.l2jmobius.gameserver.model.ArenaParticipantsHolder;
import org.l2jmobius.gameserver.model.ExtractableProductItem; import org.l2jmobius.gameserver.model.ExtractableProductItem;
import org.l2jmobius.gameserver.model.ExtractableSkill; import org.l2jmobius.gameserver.model.ExtractableSkill;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.instance.Block;
import org.l2jmobius.gameserver.model.actor.instance.Cubic; import org.l2jmobius.gameserver.model.actor.instance.Cubic;
import org.l2jmobius.gameserver.model.conditions.Condition; import org.l2jmobius.gameserver.model.conditions.Condition;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; import org.l2jmobius.gameserver.model.effects.AbstractEffect;
@@ -1387,65 +1384,24 @@ public class Skill implements IIdentifiable
*/ */
private void activateSkill(Creature caster, Cubic cubic, WorldObject... targets) private void activateSkill(Creature caster, Cubic cubic, WorldObject... targets)
{ {
switch (_id) for (WorldObject obj : targets)
{ {
// TODO: replace with AI final Creature target = (Creature) obj;
case 5852: if (Formulas.calcBuffDebuffReflection(target, this))
case 5853:
{ {
final Block block = targets[0] instanceof Block ? (Block) targets[0] : null; // If skill is reflected instant effects should be casted on target and continuous effects on caster.
final Player player = caster.isPlayer() ? (Player) caster : null; applyEffects(target, caster, false, 0);
if ((block == null) || (player == null))
{
return;
}
final int arena = player.getBlockCheckerArena(); final BuffInfo info = new BuffInfo(caster, target, this);
if (arena != -1) applyEffectScope(EffectScope.GENERAL, info, true, false);
{
final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena);
if (holder == null)
{
return;
}
final int team = holder.getPlayerTeam(player); final EffectScope pvpOrPveEffectScope = caster.isPlayable() && target.isAttackable() ? EffectScope.PVE : caster.isPlayable() && target.isPlayable() ? EffectScope.PVP : null;
final int color = block.getColorEffect(); applyEffectScope(pvpOrPveEffectScope, info, true, false);
if ((team == 0) && (color == 0x00)) applyEffectScope(EffectScope.CHANNELING, info, true, false);
{
block.changeColor(player, holder, team);
}
else if ((team == 1) && (color == 0x53))
{
block.changeColor(player, holder, team);
}
}
break;
} }
default: else
{ {
for (WorldObject obj : targets) applyEffects(caster, target);
{
final Creature target = (Creature) obj;
if (Formulas.calcBuffDebuffReflection(target, this))
{
// if skill is reflected instant effects should be casted on target
// and continuous effects on caster
applyEffects(target, caster, false, 0);
final BuffInfo info = new BuffInfo(caster, target, this);
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);
}
}
break;
} }
} }

View File

@@ -88,6 +88,7 @@ public class EffectMasterHandler
Fear.class, Fear.class,
Fishing.class, Fishing.class,
Flag.class, Flag.class,
FlipBlock.class,
FocusEnergy.class, FocusEnergy.class,
FocusMaxEnergy.class, FocusMaxEnergy.class,
FocusSouls.class, FocusSouls.class,

View File

@@ -0,0 +1,79 @@
/*
* 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 org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager;
import org.l2jmobius.gameserver.model.ArenaParticipantsHolder;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.instance.Block;
import org.l2jmobius.gameserver.model.conditions.Condition;
import org.l2jmobius.gameserver.model.effects.AbstractEffect;
import org.l2jmobius.gameserver.model.skill.BuffInfo;
/**
* Flip Block effect implementation.
* @author Mobius
*/
public class FlipBlock extends AbstractEffect
{
public FlipBlock(Condition attachCond, Condition applyCond, StatSet set, StatSet params)
{
super(attachCond, applyCond, set, params);
}
@Override
public boolean isInstant()
{
return true;
}
@Override
public void onStart(BuffInfo info)
{
final Creature effector = info.getEffector();
final Creature effected = info.getEffected();
final Block block = effected instanceof Block ? (Block) effected : null;
final Player player = effector.isPlayer() ? (Player) 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

@@ -753,25 +753,31 @@
</skill> </skill>
<skill id="5852" levels="1" name="Flip Block"> <skill id="5852" levels="1" name="Flip Block">
<!-- Flips blocks. --> <!-- Flips blocks. -->
<set name="icon" val="icon.skill_transform_s_attack" />
<set name="castRange" val="40" /> <set name="castRange" val="40" />
<set name="effectRange" val="400" /> <set name="effectRange" val="400" />
<set name="hitTime" val="1000" /> <set name="hitTime" val="1000" />
<set name="icon" val="icon.skill_transform_s_attack" />
<set name="magicLevel" val="80" /> <set name="magicLevel" val="80" />
<set name="operateType" val="A1" /> <set name="operateType" val="A1" />
<set name="reuseDelay" val="2000" /> <set name="reuseDelay" val="2000" />
<set name="targetType" val="ONE" /> <set name="targetType" val="ONE" />
<for>
<effect name="FlipBlock" />
</for>
</skill> </skill>
<skill id="5853" levels="1" name="Flip Block"> <skill id="5853" levels="1" name="Flip Block">
<!-- Flips blocks. --> <!-- Flips blocks. -->
<set name="icon" val="icon.skill_transform_s_attack" />
<set name="castRange" val="40" /> <set name="castRange" val="40" />
<set name="effectRange" val="400" /> <set name="effectRange" val="400" />
<set name="hitTime" val="1000" /> <set name="hitTime" val="1000" />
<set name="icon" val="icon.skill_transform_s_attack" />
<set name="magicLevel" val="80" /> <set name="magicLevel" val="80" />
<set name="operateType" val="A1" /> <set name="operateType" val="A1" />
<set name="reuseDelay" val="2000" /> <set name="reuseDelay" val="2000" />
<set name="targetType" val="ONE" /> <set name="targetType" val="ONE" />
<for>
<effect name="FlipBlock" />
</for>
</skill> </skill>
<skill id="5854" levels="1" name="Decrease Speed"> <skill id="5854" levels="1" name="Decrease Speed">
<!-- Speed is decreased. --> <!-- Speed is decreased. -->

View File

@@ -553,6 +553,7 @@
<xs:enumeration value="Fear" /> <xs:enumeration value="Fear" />
<xs:enumeration value="Fishing" /> <xs:enumeration value="Fishing" />
<xs:enumeration value="Flag" /> <xs:enumeration value="Flag" />
<xs:enumeration value="FlipBlock" />
<xs:enumeration value="FocusEnergy" /> <xs:enumeration value="FocusEnergy" />
<xs:enumeration value="FocusMaxEnergy" /> <xs:enumeration value="FocusMaxEnergy" />
<xs:enumeration value="FocusSouls" /> <xs:enumeration value="FocusSouls" />

View File

@@ -38,15 +38,12 @@ import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.geoengine.GeoEngine; import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.handler.ITargetTypeHandler; import org.l2jmobius.gameserver.handler.ITargetTypeHandler;
import org.l2jmobius.gameserver.handler.TargetHandler; import org.l2jmobius.gameserver.handler.TargetHandler;
import org.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager;
import org.l2jmobius.gameserver.model.ArenaParticipantsHolder;
import org.l2jmobius.gameserver.model.ExtractableProductItem; import org.l2jmobius.gameserver.model.ExtractableProductItem;
import org.l2jmobius.gameserver.model.ExtractableSkill; import org.l2jmobius.gameserver.model.ExtractableSkill;
import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.instance.Block;
import org.l2jmobius.gameserver.model.actor.instance.Cubic; import org.l2jmobius.gameserver.model.actor.instance.Cubic;
import org.l2jmobius.gameserver.model.conditions.Condition; import org.l2jmobius.gameserver.model.conditions.Condition;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; import org.l2jmobius.gameserver.model.effects.AbstractEffect;
@@ -1407,65 +1404,24 @@ public class Skill implements IIdentifiable
*/ */
private void activateSkill(Creature caster, Cubic cubic, WorldObject... targets) private void activateSkill(Creature caster, Cubic cubic, WorldObject... targets)
{ {
switch (_id) for (WorldObject obj : targets)
{ {
// TODO: replace with AI final Creature target = (Creature) obj;
case 5852: if (Formulas.calcBuffDebuffReflection(target, this))
case 5853:
{ {
final Block block = targets[0] instanceof Block ? (Block) targets[0] : null; // If skill is reflected instant effects should be casted on target and continuous effects on caster.
final Player player = caster.isPlayer() ? (Player) caster : null; applyEffects(target, caster, false, 0);
if ((block == null) || (player == null))
{
return;
}
final int arena = player.getBlockCheckerArena(); final BuffInfo info = new BuffInfo(caster, target, this);
if (arena != -1) applyEffectScope(EffectScope.GENERAL, info, true, false);
{
final ArenaParticipantsHolder holder = HandysBlockCheckerManager.getInstance().getHolder(arena);
if (holder == null)
{
return;
}
final int team = holder.getPlayerTeam(player); final EffectScope pvpOrPveEffectScope = caster.isPlayable() && target.isAttackable() ? EffectScope.PVE : caster.isPlayable() && target.isPlayable() ? EffectScope.PVP : null;
final int color = block.getColorEffect(); applyEffectScope(pvpOrPveEffectScope, info, true, false);
if ((team == 0) && (color == 0x00)) applyEffectScope(EffectScope.CHANNELING, info, true, false);
{
block.changeColor(player, holder, team);
}
else if ((team == 1) && (color == 0x53))
{
block.changeColor(player, holder, team);
}
}
break;
} }
default: else
{ {
for (WorldObject obj : targets) applyEffects(caster, target);
{
final Creature target = (Creature) obj;
if (Formulas.calcBuffDebuffReflection(target, this))
{
// if skill is reflected instant effects should be casted on target
// and continuous effects on caster
applyEffects(target, caster, false, 0);
final BuffInfo info = new BuffInfo(caster, target, this);
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);
}
}
break;
} }
} }