Minor Attackable class cleanup.

This commit is contained in:
MobiusDevelopment 2022-01-06 21:18:55 +00:00
parent e4d6b3190f
commit eb59d00dac
25 changed files with 121 additions and 152 deletions

View File

@ -324,8 +324,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1850,12 +1850,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -320,8 +320,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1796,12 +1796,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -320,8 +320,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1796,12 +1796,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -320,8 +320,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1796,12 +1796,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -319,8 +319,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1784,12 +1784,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -319,8 +319,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1784,12 +1784,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -319,8 +319,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1784,12 +1784,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -319,8 +319,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1795,12 +1795,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -319,8 +319,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1795,12 +1795,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -319,8 +319,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1795,12 +1795,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -319,8 +319,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1795,12 +1795,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -512,13 +512,10 @@ public class Attackable extends Npc
}
setChampion(false);
if (Config.CHAMPION_ENABLE)
// Set champion on next spawn.
if (Config.CHAMPION_ENABLE && !(this instanceof GrandBoss) && !(this instanceof RaidBoss) && (this instanceof Monster) /* && !getTemplate().isQuestMonster */ && (Config.CHAMPION_FREQUENCY > 0) && (getLevel() >= Config.CHAMP_MIN_LEVEL) && (getLevel() <= Config.CHAMP_MAX_LEVEL) && (Rnd.get(100) < Config.CHAMPION_FREQUENCY))
{
// Set champion on next spawn.
if (!(this instanceof GrandBoss) && !(this instanceof RaidBoss) && (this instanceof Monster) /* && !getTemplate().isQuestMonster */ && (Config.CHAMPION_FREQUENCY > 0) && (getLevel() >= Config.CHAMP_MIN_LEVEL) && (getLevel() <= Config.CHAMP_MAX_LEVEL) && (Rnd.get(100) < Config.CHAMPION_FREQUENCY))
{
setChampion(true);
}
setChampion(true);
}
return true;
@ -2190,10 +2187,8 @@ public class Attackable extends Npc
return;
}
final int maxAbsorbLevel = getAbsorbLevel();
int minAbsorbLevel = 0;
// If this is not a valid Attackable, clears the _absorbersList and just return
final int maxAbsorbLevel = getAbsorbLevel();
if (maxAbsorbLevel == 0)
{
resetAbsorbList();
@ -2201,6 +2196,7 @@ public class Attackable extends Npc
}
// All boss mobs with maxAbsorbLevel 13 have minAbsorbLevel of 12 else 10
int minAbsorbLevel = 0;
if (maxAbsorbLevel > 10)
{
minAbsorbLevel = maxAbsorbLevel > 12 ? 12 : 10;
@ -2547,8 +2543,7 @@ public class Attackable extends Npc
final double overhitExp = (overhitPercentage / 100) * normalExp;
// Return the rounded ammount of exp points to be added to the player's normal exp reward
final long bonusOverhit = Math.round(overhitExp);
return bonusOverhit;
return Math.round(overhitExp);
}
@Override

View File

@ -513,13 +513,10 @@ public class Attackable extends Npc
}
setChampion(false);
if (Config.CHAMPION_ENABLE)
// Set champion on next spawn.
if (Config.CHAMPION_ENABLE && !(this instanceof GrandBoss) && !(this instanceof RaidBoss) && (this instanceof Monster) /* && !getTemplate().isQuestMonster */ && (Config.CHAMPION_FREQUENCY > 0) && (getLevel() >= Config.CHAMP_MIN_LEVEL) && (getLevel() <= Config.CHAMP_MAX_LEVEL) && (Rnd.get(100) < Config.CHAMPION_FREQUENCY))
{
// Set champion on next spawn.
if (!(this instanceof GrandBoss) && !(this instanceof RaidBoss) && (this instanceof Monster) /* && !getTemplate().isQuestMonster */ && (Config.CHAMPION_FREQUENCY > 0) && (getLevel() >= Config.CHAMP_MIN_LEVEL) && (getLevel() <= Config.CHAMP_MAX_LEVEL) && (Rnd.get(100) < Config.CHAMPION_FREQUENCY))
{
setChampion(true);
}
setChampion(true);
}
return true;
@ -2542,10 +2539,8 @@ public class Attackable extends Npc
return;
}
final int maxAbsorbLevel = getAbsorbLevel();
int minAbsorbLevel = 0;
// If this is not a valid Attackable, clears the _absorbersList and just return
final int maxAbsorbLevel = getAbsorbLevel();
if (maxAbsorbLevel == 0)
{
resetAbsorbList();
@ -2553,6 +2548,7 @@ public class Attackable extends Npc
}
// All boss mobs with maxAbsorbLevel 13 have minAbsorbLevel of 12 else 10
int minAbsorbLevel = 0;
if (maxAbsorbLevel > 10)
{
minAbsorbLevel = maxAbsorbLevel > 12 ? 12 : 10;
@ -2899,8 +2895,7 @@ public class Attackable extends Npc
final double overhitExp = (overhitPercentage / 100) * normalExp;
// Return the rounded ammount of exp points to be added to the player's normal exp reward
final long bonusOverhit = Math.round(overhitExp);
return bonusOverhit;
return Math.round(overhitExp);
}
@Override

View File

@ -338,8 +338,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{

View File

@ -338,8 +338,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{

View File

@ -320,8 +320,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1788,12 +1788,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -320,8 +320,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1788,12 +1788,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -320,8 +320,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1788,12 +1788,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -322,8 +322,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1809,12 +1809,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -322,8 +322,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1809,12 +1809,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -322,8 +322,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1809,12 +1809,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -324,8 +324,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1842,12 +1842,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -323,8 +323,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1805,12 +1805,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -328,8 +328,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1810,12 +1810,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{

View File

@ -328,8 +328,8 @@ public class Attackable extends Npc
static class PartyContainer
{
Party party;
long damage = 0L;
public Party party;
public long damage;
public PartyContainer(Party party, long damage)
{
@ -1810,12 +1810,11 @@ public class Attackable extends Npc
if (object == null)
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if ((target != null) && (aggroList != null))
if (target != null)
{
aggroList.remove(target);
_aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
if (_aggroList.isEmpty())
{
if (getAI() instanceof AttackableAI)
{