Skip to content
Snippets Groups Projects
Commit 0f015330 authored by Nos's avatar Nos
Browse files

BETA: Improvement for [9966]

	* Reverted trait effects parameters back to float.

Reviewed by: UnAfraid
parent cab39a87
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@ public class AttackTrait extends L2Effect
{
private static final Logger _log = Logger.getLogger(AttackTrait.class.getName());
private final Map<TraitType, Integer> _attackTraits = new HashMap<>();
private final Map<TraitType, Float> _attackTraits = new HashMap<>();
/**
* @param env
......@@ -54,12 +54,12 @@ public class AttackTrait extends L2Effect
try
{
final TraitType traitType = TraitType.valueOf(param.getKey());
final int value = Integer.parseInt((String) param.getValue());
final float value = (Float.parseFloat((String) param.getValue()) + 100) / 100;
_attackTraits.put(traitType, value);
}
catch (NumberFormatException e)
{
_log.warning(getClass().getSimpleName() + ": value of " + param.getKey() + " enum must be int value " + param.getValue() + " found.");
_log.warning(getClass().getSimpleName() + ": value of " + param.getKey() + " must be float value " + param.getValue() + " found.");
}
catch (Exception e)
{
......@@ -85,14 +85,9 @@ public class AttackTrait extends L2Effect
final CharStat charStat = getEffected().getStat();
synchronized (charStat.getAttackTraits())
{
for (Entry<TraitType, Integer> trait : _attackTraits.entrySet())
for (Entry<TraitType, Float> trait : _attackTraits.entrySet())
{
if (trait.getValue() == 0)
{
continue;
}
charStat.getAttackTraits()[trait.getKey().getId()] *= (trait.getValue() + 100) / 100f;
charStat.getAttackTraits()[trait.getKey().getId()] *= trait.getValue();
charStat.getAttackTraitsCount()[trait.getKey().getId()]++;
}
}
......@@ -105,14 +100,9 @@ public class AttackTrait extends L2Effect
final CharStat charStat = getEffected().getStat();
synchronized (charStat.getAttackTraits())
{
for (Entry<TraitType, Integer> trait : _attackTraits.entrySet())
for (Entry<TraitType, Float> trait : _attackTraits.entrySet())
{
if (trait.getValue() == 0)
{
continue;
}
charStat.getAttackTraits()[trait.getKey().getId()] /= (trait.getValue() + 100) / 100f;
charStat.getAttackTraits()[trait.getKey().getId()] /= trait.getValue();
charStat.getAttackTraitsCount()[trait.getKey().getId()]--;
}
}
......
......@@ -38,7 +38,7 @@ public class DefenceTrait extends L2Effect
{
private static final Logger _log = Logger.getLogger(DefenceTrait.class.getName());
private final Map<TraitType, Integer> _defenceTraits = new HashMap<>();
private final Map<TraitType, Float> _defenceTraits = new HashMap<>();
/**
* @param env
......@@ -54,12 +54,16 @@ public class DefenceTrait extends L2Effect
try
{
final TraitType traitType = TraitType.valueOf(param.getKey());
final int value = Integer.parseInt((String) param.getValue());
_defenceTraits.put(traitType, value);
final float value = Float.parseFloat((String) param.getValue());
if (value == 0)
{
continue;
}
_defenceTraits.put(traitType, (value + 100) / 100);
}
catch (NumberFormatException e)
{
_log.warning(getClass().getSimpleName() + ": value of " + param.getKey() + " enum must be int value " + param.getValue() + " found.");
_log.warning(getClass().getSimpleName() + ": value of " + param.getKey() + " must be float value " + param.getValue() + " found.");
}
catch (Exception e)
{
......@@ -85,15 +89,11 @@ public class DefenceTrait extends L2Effect
final CharStat charStat = getEffected().getStat();
synchronized (charStat.getDefenceTraits())
{
for (Entry<TraitType, Integer> trait : _defenceTraits.entrySet())
for (Entry<TraitType, Float> trait : _defenceTraits.entrySet())
{
if (trait.getValue() == 0)
if (trait.getValue() < 2.0f)
{
continue;
}
else if (trait.getValue() < 100)
{
charStat.getDefenceTraits()[trait.getKey().getId()] *= (trait.getValue() + 100) / 100f;
charStat.getDefenceTraits()[trait.getKey().getId()] *= trait.getValue();
charStat.getDefenceTraitsCount()[trait.getKey().getId()]++;
}
else
......@@ -111,15 +111,11 @@ public class DefenceTrait extends L2Effect
final CharStat charStat = getEffected().getStat();
synchronized (charStat.getDefenceTraits())
{
for (Entry<TraitType, Integer> trait : _defenceTraits.entrySet())
for (Entry<TraitType, Float> trait : _defenceTraits.entrySet())
{
if (trait.getValue() == 0)
{
continue;
}
else if (trait.getValue() < 100)
if (trait.getValue() < 2.0f)
{
charStat.getDefenceTraits()[trait.getKey().getId()] /= (trait.getValue() + 100) / 100f;
charStat.getDefenceTraits()[trait.getKey().getId()] /= trait.getValue();
charStat.getDefenceTraitsCount()[trait.getKey().getId()]--;
}
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment