Fixed modifier weights and chances not being respected properly

The system should now work as intended
This commit is contained in:
ASangarin 2020-10-21 01:00:06 +02:00
parent 34c123309b
commit 59c8976d8d
2 changed files with 3 additions and 2 deletions

View File

@ -64,12 +64,12 @@ public class MMOItemBuilder {
mmoitem.setData(ItemStat.TIER, new StringData(tier.getId()));
if (level > 0)
mmoitem.setData(ItemStat.ITEM_LEVEL, new DoubleData(level));
// roll item gen modifiers
for (TemplateModifier modifier : rollModifiers(template)) {
// roll modifier chance
// only apply if enough item weight
if (!modifier.rollChance() && modifier.getWeight() > capacity)
if (!modifier.rollChance() || modifier.getWeight() > capacity)
continue;
capacity -= modifier.getWeight();

View File

@ -60,6 +60,7 @@ public class TemplateModifier {
weight = config.getDouble("weight", parent.weight);
nameModifier = parent.nameModifier;
data = parent.data;
System.out.println("Got modifier from file.");
return;
}