Add upgrade stats check

if upgraded item doesn't have the stat specified in the template,
it wouldn't add the stat to the item
This commit is contained in:
Blackdigits 2020-02-06 12:18:32 +07:00
parent e161801662
commit 39520155b0
2 changed files with 4 additions and 4 deletions

View File

@ -60,9 +60,9 @@ public class UpgradeTemplate {
return stats.get(stat);
}
public void upgrade(MMOItem mmoitem, UpgradeData upgrade) {
public void upgrade(MMOItem mmoitem) {
for (ItemStat stat : stats.keySet())
// if (mmoitem.hasData(stat))
((Upgradable) stat).apply(mmoitem, stats.get(stat));
if (mmoitem.hasData(stat))
((Upgradable) stat).apply(mmoitem, stats.get(stat));
}
}

View File

@ -211,7 +211,7 @@ public class Upgrade_Stat extends ItemStat {
}
// apply stat updates
getTemplate().upgrade(mmoitem, this);
getTemplate().upgrade(mmoitem);
// increase the level
level++;