CreatureStat previous comparison moved in lock.

This commit is contained in:
MobiusDevelopment
2020-06-20 20:17:59 +00:00
parent 61157a6d03
commit 1c1eaddde3
15 changed files with 330 additions and 330 deletions

View File

@@ -987,33 +987,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -987,33 +987,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -987,33 +987,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -987,33 +987,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -987,33 +987,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -987,33 +987,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -987,33 +987,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -987,33 +987,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -977,33 +977,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -977,33 +977,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -977,33 +977,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -977,33 +977,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -977,33 +977,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -977,33 +977,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)

View File

@@ -977,33 +977,33 @@ public class CreatureStat
} }
_attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature); _attackSpeedMultiplier = Formulas.calcAtkSpdMultiplier(_creature);
_mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature); _mAttackSpeedMultiplier = Formulas.calcMAtkSpdMultiplier(_creature);
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
finally finally
{ {
_lock.writeLock().unlock(); _lock.writeLock().unlock();
} }
// Notify recalculation to child classes
onRecalculateStats(broadcast);
if (broadcast && (adds != null) && (muls != null)) // adds and muls cannot be null when broadcast is true, but Eclipse throws warning bellow.
{
// Calculate the difference between old and new stats
final Set<Stat> changed = new HashSet<>();
for (Stat stat : Stat.values())
{
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
{
changed.add(stat);
}
else if ((_statsMul.containsKey(stat) ? _statsMul.get(stat) : stat.getResetMulValue()) != (muls.containsKey(stat) ? muls.get(stat) : stat.getResetMulValue()))
{
changed.add(stat);
}
}
_creature.broadcastModifiedStats(changed);
}
} }
protected void onRecalculateStats(boolean broadcast) protected void onRecalculateStats(boolean broadcast)