Only comparison is needed to be inside lock.
This commit is contained in:
@@ -891,6 +891,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -988,13 +990,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -1006,14 +1005,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -891,6 +891,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -988,13 +990,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -1006,14 +1005,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -891,6 +891,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -988,13 +990,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -1006,14 +1005,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -891,6 +891,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -988,13 +990,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -1006,14 +1005,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -891,6 +891,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -988,13 +990,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -1006,14 +1005,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -891,6 +891,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -988,13 +990,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -1006,14 +1005,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -891,6 +891,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -988,13 +990,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -1006,14 +1005,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -891,6 +891,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -988,13 +990,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -1006,14 +1005,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -881,6 +881,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -978,13 +980,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -996,14 +995,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -881,6 +881,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -978,13 +980,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -996,14 +995,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -881,6 +881,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -978,13 +980,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -996,14 +995,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -881,6 +881,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -978,13 +980,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -996,14 +995,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -881,6 +881,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -978,13 +980,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -996,14 +995,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -881,6 +881,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -978,13 +980,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -996,14 +995,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
@@ -881,6 +881,8 @@ public class CreatureStat
|
|||||||
*/
|
*/
|
||||||
public void recalculateStats(boolean broadcast)
|
public void recalculateStats(boolean broadcast)
|
||||||
{
|
{
|
||||||
|
Set<Stat> changed = null;
|
||||||
|
|
||||||
// Copy old data before wiping it out
|
// Copy old data before wiping it out
|
||||||
final Map<Stat, Double> adds;
|
final Map<Stat, Double> adds;
|
||||||
final Map<Stat, Double> muls;
|
final Map<Stat, Double> muls;
|
||||||
@@ -978,13 +980,10 @@ 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.
|
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
|
// Calculate the difference between old and new stats
|
||||||
final Set<Stat> changed = new HashSet<>();
|
changed = new HashSet<>();
|
||||||
for (Stat stat : Stat.values())
|
for (Stat stat : Stat.values())
|
||||||
{
|
{
|
||||||
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
if ((_statsAdd.containsKey(stat) ? _statsAdd.get(stat) : stat.getResetAddValue()) != (adds.containsKey(stat) ? adds.get(stat) : stat.getResetAddValue()))
|
||||||
@@ -996,14 +995,20 @@ public class CreatureStat
|
|||||||
changed.add(stat);
|
changed.add(stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_creature.broadcastModifiedStats(changed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_lock.writeLock().unlock();
|
_lock.writeLock().unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
_creature.broadcastModifiedStats(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify recalculation to child classes
|
||||||
|
onRecalculateStats(broadcast);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onRecalculateStats(boolean broadcast)
|
protected void onRecalculateStats(boolean broadcast)
|
||||||
|
Reference in New Issue
Block a user