Sync with L2jServer HighFive Nov 14th 2015.
This commit is contained in:
@@ -2973,7 +2973,27 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
@Override
|
||||
public boolean isInvul()
|
||||
{
|
||||
return _isInvul || _isTeleporting || isAffected(EffectFlag.INVUL);
|
||||
return _isInvul || _isTeleporting;
|
||||
}
|
||||
|
||||
public boolean isHpBlocked()
|
||||
{
|
||||
return isAffected(EffectFlag.BLOCK_HP);
|
||||
}
|
||||
|
||||
public boolean isMpBlocked()
|
||||
{
|
||||
return isAffected(EffectFlag.BLOCK_MP);
|
||||
}
|
||||
|
||||
public boolean isBuffBlocked()
|
||||
{
|
||||
return isAffected(EffectFlag.BLOCK_BUFF);
|
||||
}
|
||||
|
||||
public boolean isDebuffBlocked()
|
||||
{
|
||||
return isAffected(EffectFlag.BLOCK_DEBUFF);
|
||||
}
|
||||
|
||||
public void setIsMortal(boolean b)
|
||||
|
@@ -338,8 +338,8 @@ public final class L2CubicInstance implements IIdentifiable
|
||||
// Duel targeting
|
||||
if (_owner.isInDuel())
|
||||
{
|
||||
L2PcInstance PlayerA = DuelManager.getInstance().getDuel(_owner.getDuelId()).getPlayerA();
|
||||
L2PcInstance PlayerB = DuelManager.getInstance().getDuel(_owner.getDuelId()).getPlayerB();
|
||||
L2PcInstance PlayerA = DuelManager.getInstance().getDuel(_owner.getDuelId()).getTeamLeaderA();
|
||||
L2PcInstance PlayerB = DuelManager.getInstance().getDuel(_owner.getDuelId()).getTeamLeaderB();
|
||||
|
||||
if (DuelManager.getInstance().getDuel(_owner.getDuelId()).isPartyDuel())
|
||||
{
|
||||
|
@@ -83,6 +83,7 @@ import com.l2jserver.gameserver.datatables.SkillData;
|
||||
import com.l2jserver.gameserver.enums.CastleSide;
|
||||
import com.l2jserver.gameserver.enums.CategoryType;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.enums.DuelState;
|
||||
import com.l2jserver.gameserver.enums.HtmlActionScope;
|
||||
import com.l2jserver.gameserver.enums.IllegalActionPunishmentType;
|
||||
import com.l2jserver.gameserver.enums.InstanceType;
|
||||
@@ -500,10 +501,8 @@ public final class L2PcInstance extends L2Playable
|
||||
private int _olyBuffsCount = 0;
|
||||
|
||||
/** Duel */
|
||||
private boolean _isInDuel = false;
|
||||
private int _duelState = Duel.DUELSTATE_NODUEL;
|
||||
private DuelState _duelState = DuelState.NO_DUEL;
|
||||
private int _duelId = 0;
|
||||
private SystemMessageId _noDuelReason = SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL;
|
||||
|
||||
/** Boat and AirShip */
|
||||
private L2Vehicle _vehicle = null;
|
||||
@@ -4756,6 +4755,14 @@ public final class L2PcInstance extends L2Playable
|
||||
@Override
|
||||
public void doCast(Skill skill)
|
||||
{
|
||||
if (getCurrentSkill() != null)
|
||||
{
|
||||
if (!checkUseMagicConditions(skill, getCurrentSkill().isCtrlPressed(), getCurrentSkill().isShiftPressed()))
|
||||
{
|
||||
setIsCastingNow(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
super.doCast(skill);
|
||||
setRecentFakeDeath(false);
|
||||
}
|
||||
@@ -6721,7 +6728,7 @@ public final class L2PcInstance extends L2Playable
|
||||
@Override
|
||||
public boolean isInvul()
|
||||
{
|
||||
return super.isInvul() || (_teleportProtectEndTime > GameTimeController.getInstance().getGameTicks());
|
||||
return super.isInvul() || _isTeleporting;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -8638,8 +8645,17 @@ public final class L2PcInstance extends L2Playable
|
||||
}
|
||||
|
||||
// is AutoAttackable if both players are in the same duel and the duel is still going on
|
||||
if (attacker.isPlayable() && (getDuelState() == Duel.DUELSTATE_DUELLING) && (getDuelId() == attacker.getActingPlayer().getDuelId()))
|
||||
if (attacker.isPlayable() && (getDuelState() == DuelState.DUELLING) && (getDuelId() == attacker.getActingPlayer().getDuelId()))
|
||||
{
|
||||
Duel duel = DuelManager.getInstance().getDuel(getDuelId());
|
||||
if (duel.getTeamA().contains(this) && duel.getTeamA().contains(attacker))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (duel.getTeamB().contains(this) && duel.getTeamB().contains(attacker))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -8814,12 +8830,6 @@ public final class L2PcInstance extends L2Playable
|
||||
setQueuedSkill(null, false, false);
|
||||
}
|
||||
|
||||
if (!checkUseMagicConditions(skill, forceUse, dontMove))
|
||||
{
|
||||
setIsCastingNow(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the target is correct and Notify the AI with AI_INTENTION_CAST and target
|
||||
L2Object target = null;
|
||||
switch (skill.getTargetType())
|
||||
@@ -10181,7 +10191,7 @@ public final class L2PcInstance extends L2Playable
|
||||
@Override
|
||||
public boolean isInDuel()
|
||||
{
|
||||
return _isInDuel;
|
||||
return _duelState != DuelState.NO_DUEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -10190,12 +10200,12 @@ public final class L2PcInstance extends L2Playable
|
||||
return _duelId;
|
||||
}
|
||||
|
||||
public void setDuelState(int mode)
|
||||
public void setDuelState(DuelState mode)
|
||||
{
|
||||
_duelState = mode;
|
||||
}
|
||||
|
||||
public int getDuelState()
|
||||
public DuelState getDuelState()
|
||||
{
|
||||
return _duelState;
|
||||
}
|
||||
@@ -10208,90 +10218,21 @@ public final class L2PcInstance extends L2Playable
|
||||
{
|
||||
if (duelId > 0)
|
||||
{
|
||||
_isInDuel = true;
|
||||
_duelState = Duel.DUELSTATE_DUELLING;
|
||||
_duelState = DuelState.DUELLING;
|
||||
_duelId = duelId;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_duelState == Duel.DUELSTATE_DEAD)
|
||||
if (_duelState == DuelState.DEAD)
|
||||
{
|
||||
enableAllSkills();
|
||||
getStatus().startHpMpRegeneration();
|
||||
}
|
||||
_isInDuel = false;
|
||||
_duelState = Duel.DUELSTATE_NODUEL;
|
||||
_duelState = DuelState.NO_DUEL;
|
||||
_duelId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns a SystemMessage stating why the player is not available for duelling.
|
||||
* @return S1_CANNOT_DUEL... message
|
||||
*/
|
||||
public SystemMessage getNoDuelReason()
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(_noDuelReason);
|
||||
sm.addPcName(this);
|
||||
_noDuelReason = SystemMessageId.THERE_IS_NO_OPPONENT_TO_RECEIVE_YOUR_CHALLENGE_FOR_A_DUEL;
|
||||
return sm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this player might join / start a duel.<br>
|
||||
* To get the reason use getNoDuelReason() after calling this function.
|
||||
* @return true if the player might join/start a duel.
|
||||
*/
|
||||
public boolean canDuel()
|
||||
{
|
||||
if (isInCombat() || isJailed())
|
||||
{
|
||||
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_ENGAGED_IN_BATTLE;
|
||||
return false;
|
||||
}
|
||||
if (isDead() || isAlikeDead() || ((getCurrentHp() < (getMaxHp() / 2)) || (getCurrentMp() < (getMaxMp() / 2))))
|
||||
{
|
||||
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_S_HP_OR_MP_IS_BELOW_50;
|
||||
return false;
|
||||
}
|
||||
if (isInDuel())
|
||||
{
|
||||
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_ALREADY_ENGAGED_IN_A_DUEL;
|
||||
return false;
|
||||
}
|
||||
if (isInOlympiadMode())
|
||||
{
|
||||
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_PARTICIPATING_IN_THE_OLYMPIAD_OR_THE_CEREMONY_OF_CHAOS;
|
||||
return false;
|
||||
}
|
||||
if (isCursedWeaponEquipped())
|
||||
{
|
||||
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_IN_A_CHAOTIC_OR_PURPLE_STATE;
|
||||
return false;
|
||||
}
|
||||
if (getPrivateStoreType() != PrivateStoreType.NONE)
|
||||
{
|
||||
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_ENGAGED_IN_A_PRIVATE_STORE_OR_MANUFACTURE;
|
||||
return false;
|
||||
}
|
||||
if (isMounted() || isInBoat())
|
||||
{
|
||||
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_RIDING_A_BOAT_FENRIR_OR_STRIDER;
|
||||
return false;
|
||||
}
|
||||
if (isFishing())
|
||||
{
|
||||
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
|
||||
return false;
|
||||
}
|
||||
if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
|
||||
{
|
||||
_noDuelReason = SystemMessageId.C1_CANNOT_MAKE_A_CHALLENGE_TO_A_DUEL_BECAUSE_C1_IS_CURRENTLY_IN_A_DUEL_PROHIBITED_AREA_PEACEFUL_ZONE_BATTLE_ZONE_NEAR_WATER_RESTART_PROHIBITED_AREA;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isNoble()
|
||||
{
|
||||
return _noble;
|
||||
@@ -11959,7 +11900,7 @@ public final class L2PcInstance extends L2Playable
|
||||
if (inst != null)
|
||||
{
|
||||
inst.removePlayer(getObjectId());
|
||||
final Location loc = inst.getSpawnLoc();
|
||||
final Location loc = inst.getExitLoc();
|
||||
if (loc != null)
|
||||
{
|
||||
final int x = loc.getX() + Rnd.get(-30, 30);
|
||||
@@ -12997,7 +12938,7 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
final SystemMessage sm;
|
||||
|
||||
if (target.isInvul() && !target.isVulnerableFor(this) && !target.isNpc())
|
||||
if ((target.isInvul() || target.isHpBlocked()) && !target.isVulnerableFor(this) && !target.isNpc())
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_ATTACK_HAS_BEEN_BLOCKED);
|
||||
}
|
||||
|
@@ -184,40 +184,6 @@ public class L2ServitorInstance extends L2Summon implements Runnable
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Servitors' skills automatically change their level based on the servitor's level.<br>
|
||||
* Until level 70, the servitor gets 1 lv of skill per 10 levels.<br>
|
||||
* After that, it is 1 skill level per 5 servitor levels.<br>
|
||||
* If the resulting skill level doesn't exist use the max that does exist!
|
||||
*/
|
||||
@Override
|
||||
public void doCast(Skill skill)
|
||||
{
|
||||
final int petLevel = getLevel();
|
||||
int skillLevel = petLevel / 10;
|
||||
if (petLevel >= 70)
|
||||
{
|
||||
skillLevel += (petLevel - 65) / 10;
|
||||
}
|
||||
|
||||
// Adjust the level for servitors less than level 1.
|
||||
if (skillLevel < 1)
|
||||
{
|
||||
skillLevel = 1;
|
||||
}
|
||||
|
||||
final Skill skillToCast = SkillData.getInstance().getSkill(skill.getId(), skillLevel);
|
||||
|
||||
if (skillToCast != null)
|
||||
{
|
||||
super.doCast(skillToCast);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.doCast(skill);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRestoreSummon(boolean val)
|
||||
{
|
||||
|
@@ -86,13 +86,13 @@ public class L2SiegeFlagInstance extends L2Npc
|
||||
@Override
|
||||
public boolean canBeAttacked()
|
||||
{
|
||||
return !isInvul();
|
||||
return !(isInvul() || isHpBlocked());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoAttackable(L2Character attacker)
|
||||
{
|
||||
return !isInvul();
|
||||
return !(isInvul() || isHpBlocked());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -338,7 +338,7 @@ public final class L2TrapInstance extends L2Npc
|
||||
OlympiadGameManager.getInstance().notifyCompetitorDamage(getOwner(), damage);
|
||||
}
|
||||
|
||||
if (target.isInvul() && !(target instanceof L2NpcInstance))
|
||||
if ((target.isInvul() || target.isHpBlocked()) && !target.isNpc())
|
||||
{
|
||||
_owner.sendPacket(SystemMessageId.THE_ATTACK_HAS_BEEN_BLOCKED);
|
||||
}
|
||||
|
@@ -141,7 +141,7 @@ public class CharStatus
|
||||
}
|
||||
|
||||
// invul handling
|
||||
if (getActiveChar().isInvul() && !(isDOT || isHPConsumption))
|
||||
if ((getActiveChar().isInvul() || getActiveChar().isHpBlocked()) && !(isDOT || isHPConsumption))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.model.actor.status;
|
||||
|
||||
import com.l2jserver.gameserver.enums.DuelState;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Duel;
|
||||
|
||||
public class NpcStatus extends CharStatus
|
||||
{
|
||||
@@ -49,7 +49,7 @@ public class NpcStatus extends CharStatus
|
||||
final L2PcInstance attackerPlayer = attacker.getActingPlayer();
|
||||
if ((attackerPlayer != null) && attackerPlayer.isInDuel())
|
||||
{
|
||||
attackerPlayer.setDuelState(Duel.DUELSTATE_INTERRUPTED);
|
||||
attackerPlayer.setDuelState(DuelState.INTERRUPTED);
|
||||
}
|
||||
|
||||
// Add attackers to npc's attacker list
|
||||
|
@@ -20,6 +20,7 @@ package com.l2jserver.gameserver.model.actor.status;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.enums.DuelState;
|
||||
import com.l2jserver.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jserver.gameserver.instancemanager.DuelManager;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
@@ -27,7 +28,6 @@ import com.l2jserver.gameserver.model.actor.L2Playable;
|
||||
import com.l2jserver.gameserver.model.actor.L2Summon;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.stat.PcStat;
|
||||
import com.l2jserver.gameserver.model.entity.Duel;
|
||||
import com.l2jserver.gameserver.model.stats.Formulas;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
@@ -83,7 +83,7 @@ public class PcStatus extends PlayableStatus
|
||||
return;
|
||||
}
|
||||
|
||||
if (getActiveChar().isInvul() && !getActiveChar().isVulnerableFor(attacker) && !(isDOT || isHPConsumption))
|
||||
if ((getActiveChar().isInvul() || getActiveChar().isHpBlocked()) && !getActiveChar().isVulnerableFor(attacker) && !(isDOT || isHPConsumption))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -129,11 +129,11 @@ public class PcStatus extends PlayableStatus
|
||||
|
||||
if (getActiveChar().isInDuel())
|
||||
{
|
||||
if (getActiveChar().getDuelState() == Duel.DUELSTATE_DEAD)
|
||||
if (getActiveChar().getDuelState() == DuelState.DEAD)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (getActiveChar().getDuelState() == Duel.DUELSTATE_WINNER)
|
||||
else if (getActiveChar().getDuelState() == DuelState.WINNER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class PcStatus extends PlayableStatus
|
||||
// cancel duel if player got hit by another player, that is not part of the duel
|
||||
if (attackerPlayer.getDuelId() != getActiveChar().getDuelId())
|
||||
{
|
||||
getActiveChar().setDuelState(Duel.DUELSTATE_INTERRUPTED);
|
||||
getActiveChar().setDuelState(DuelState.INTERRUPTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -280,7 +280,10 @@ public class PcStatus extends PlayableStatus
|
||||
{
|
||||
attacker.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
|
||||
attacker.sendPacket(ActionFailed.STATIC_PACKET);
|
||||
attacker.setTarget(null);
|
||||
attacker.abortAttack();
|
||||
}
|
||||
|
||||
// let the DuelManager know of his defeat
|
||||
DuelManager.getInstance().onPlayerDefeat(getActiveChar());
|
||||
value = 1;
|
||||
|
@@ -18,11 +18,11 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.model.actor.status;
|
||||
|
||||
import com.l2jserver.gameserver.enums.DuelState;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.L2Playable;
|
||||
import com.l2jserver.gameserver.model.actor.L2Summon;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Duel;
|
||||
import com.l2jserver.gameserver.model.stats.Stats;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class SummonStatus extends PlayableStatus
|
||||
final L2PcInstance attackerPlayer = attacker.getActingPlayer();
|
||||
if ((attackerPlayer != null) && ((getActiveChar().getOwner() == null) || (getActiveChar().getOwner().getDuelId() != attackerPlayer.getDuelId())))
|
||||
{
|
||||
attackerPlayer.setDuelState(Duel.DUELSTATE_INTERRUPTED);
|
||||
attackerPlayer.setDuelState(DuelState.INTERRUPTED);
|
||||
}
|
||||
|
||||
final L2PcInstance caster = getActiveChar().getTransferingDamageTo();
|
||||
|
Reference in New Issue
Block a user