Addition of Creature isDisabled method.
This commit is contained in:
@@ -153,7 +153,7 @@ public class QueenAnt extends Quest
|
||||
_larva = (MonsterInstance) addSpawn(LARVA, -21600, 179482, -5846, Rnd.get(360), false, 0);
|
||||
_larva.setUnkillable(true);
|
||||
_larva.setImmobilized(true);
|
||||
_larva.setAttackDisabled(true);
|
||||
_larva.setPhysicalAttackMuted(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -188,7 +188,7 @@ public class QueenAnt extends Quest
|
||||
final int x = (int) (radius * Math.cos(i * 1.407)); // 1.407~2pi/6
|
||||
final int y = (int) (radius * Math.sin(i * 1.407));
|
||||
_nurses.add((MonsterInstance) addSpawn(NURSE, npc.getX() + x, npc.getY() + y, npc.getZ(), 0, false, 0));
|
||||
_nurses.get(i).setAttackDisabled(true);
|
||||
_nurses.get(i).setPhysicalAttackMuted(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -750,7 +750,7 @@ public class AttackableAI extends CreatureAI
|
||||
}
|
||||
}
|
||||
|
||||
if (_actor.isAttackingDisabled())
|
||||
if (_actor.isAttackDisabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@@ -493,7 +493,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
if (/* _selfAnalysis.hasHealOrResurrect && */(creature instanceof PlayerInstance) && ((NpcInstance) _actor).getFort().getSiege().checkIsDefender(((PlayerInstance) creature).getClan()))
|
||||
{
|
||||
// heal friends
|
||||
if (!_actor.isAttackingDisabled() && (creature.getCurrentHp() < (creature.getMaxHp() * 0.6)) && (_actor.getCurrentHp() > (_actor.getMaxHp() / 2)) && (_actor.getCurrentMp() > (_actor.getMaxMp() / 2)) && creature.isInCombat())
|
||||
if (!_actor.isAttackDisabled() && (creature.getCurrentHp() < (creature.getMaxHp() * 0.6)) && (_actor.getCurrentHp() > (_actor.getMaxHp() / 2)) && (_actor.getCurrentMp() > (_actor.getMaxMp() / 2)) && creature.isInCombat())
|
||||
{
|
||||
for (Skill sk : /* _selfAnalysis.healSkills */healSkills)
|
||||
{
|
||||
@@ -554,7 +554,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
}
|
||||
}
|
||||
// heal friends
|
||||
if (/* _selfAnalysis.hasHealOrResurrect && */ !_actor.isAttackingDisabled() && (npc.getCurrentHp() < (npc.getMaxHp() * 0.6)) && (_actor.getCurrentHp() > (_actor.getMaxHp() / 2)) && (_actor.getCurrentMp() > (_actor.getMaxMp() / 2)) && npc.isInCombat())
|
||||
if (/* _selfAnalysis.hasHealOrResurrect && */ !_actor.isAttackDisabled() && (npc.getCurrentHp() < (npc.getMaxHp() * 0.6)) && (_actor.getCurrentHp() > (_actor.getMaxHp() / 2)) && (_actor.getCurrentMp() > (_actor.getMaxMp() / 2)) && npc.isInCombat())
|
||||
{
|
||||
for (Skill sk : /* _selfAnalysis.healSkills */ healSkills)
|
||||
{
|
||||
|
@@ -182,7 +182,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
protected boolean _isTeleporting = false;
|
||||
protected boolean _isInvul = false;
|
||||
protected boolean _isUnkillable = false;
|
||||
protected boolean _isAttackDisabled = false;
|
||||
protected boolean _isPhysicalAttackMuted = false;
|
||||
private int _lastHealAmount = 0;
|
||||
private CreatureStat _stat;
|
||||
private CreatureStatus _status;
|
||||
@@ -762,7 +762,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAttackingDisabled())
|
||||
if (isAttackDisabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -2172,12 +2172,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
}
|
||||
|
||||
/**
|
||||
* Return True if the Creature can't attack (stun, sleep, attackEndTime, fakeDeath, paralyse).
|
||||
* @return true, if is attacking disabled
|
||||
* @return True if the Creature can't attack (attackEndTime, attackMute, fake death, stun, sleep, paralyze).
|
||||
*/
|
||||
public boolean isAttackingDisabled()
|
||||
public boolean isAttackDisabled()
|
||||
{
|
||||
return _isImmobileUntilAttacked || _isStunned || _isSleeping || _isFallsdown || (_attackEndTime > GameTimeTaskManager.getGameTicks()) || _isFakeDeath || _isParalyzed || _isAttackDisabled;
|
||||
return isAttackingNow() || isDisabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if the Creature is disabled (attackMute, fake death, stun, sleep, paralyze).
|
||||
*/
|
||||
public boolean isDisabled()
|
||||
{
|
||||
return _isFakeDeath || _isPhysicalAttackMuted || _isImmobileUntilAttacked || _isStunned || _isSleeping || _isFallsdown || _isParalyzed;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -9410,20 +9417,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
_isUnkillable = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the _isAttackDisabled
|
||||
*/
|
||||
public boolean isAttackDisabled()
|
||||
public boolean isPhysicalAttackMuted()
|
||||
{
|
||||
return _isAttackDisabled;
|
||||
return _isPhysicalAttackMuted;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value the _isAttackDisabled to set
|
||||
*/
|
||||
public void setAttackDisabled(boolean value)
|
||||
public void setPhysicalAttackMuted(boolean value)
|
||||
{
|
||||
_isAttackDisabled = value;
|
||||
_isPhysicalAttackMuted = value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3149,7 +3149,7 @@ public class PlayerInstance extends Playable
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_waitTypeSitting && !isAttackingDisabled() && !isOutOfControl() && !isImmobilized())
|
||||
if (!_waitTypeSitting && !isAttackDisabled() && !isOutOfControl() && !isImmobilized())
|
||||
{
|
||||
breakAttack();
|
||||
setSitting(true);
|
||||
|
@@ -166,7 +166,7 @@ public class RequestActionUse implements IClientIncomingPacket
|
||||
{
|
||||
if ((target != null) && (pet != null) && (pet != target) && !player.isBetrayed())
|
||||
{
|
||||
if (pet.isAttackingDisabled())
|
||||
if (pet.isAttackDisabled())
|
||||
{
|
||||
if (pet.getAttackEndTime() > GameTimeTaskManager.getGameTicks())
|
||||
{
|
||||
|
Reference in New Issue
Block a user