Browse Source

Refactor baked in stats

combat-2
MagicBot 8 months ago
parent
commit
b0f8c758e5
  1. 9
      src/engine/objects/Item.java
  2. 8
      src/engine/objects/ItemBase.java
  3. 10
      src/engine/objects/MobEquipment.java

9
src/engine/objects/Item.java

@ -30,7 +30,6 @@ import org.pmw.tinylog.Logger; @@ -30,7 +30,6 @@ import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantLock;
@ -270,7 +269,7 @@ public class Item extends AbstractWorldObject { @@ -270,7 +269,7 @@ public class Item extends AbstractWorldObject {
writer.putInt(36); //Magical, blue name
else
writer.putInt(40); //Magical, unidentified
else if (item.getItemBase().getBakedInStats().size() > 0)
else if (item.template.item_user_power_action.size() > 0)
writer.putInt(36); //Magical, blue name
else
writer.putInt(4); //Non-Magical, grey name
@ -1064,12 +1063,6 @@ public class Item extends AbstractWorldObject { @@ -1064,12 +1063,6 @@ public class Item extends AbstractWorldObject {
this.magicValue = this.template.item_value + calcMagicValue();
}
public HashMap<Integer, Integer> getBakedInStats() {
if (this.getItemBase() != null)
return this.getItemBase().getBakedInStats();
return null;
}
public void clearEnchantments() {
//Clear permanent enchantment out of database

8
src/engine/objects/ItemBase.java

@ -44,9 +44,6 @@ public class ItemBase { @@ -44,9 +44,6 @@ public class ItemBase {
private final String mastery;
private final engine.Enum.SourceType damageType;
private boolean isConsumable;
// Item stat modifiers
private final HashMap<Integer, Integer> bakedInStats = new HashMap<>();
private final HashMap<Integer, Integer> usedStats = new HashMap<>();
private final boolean isStrBased;
private ArrayList<Integer> animations = new ArrayList<>();
@ -166,11 +163,6 @@ public class ItemBase { @@ -166,11 +163,6 @@ public class ItemBase {
return ID > 7000099 && ID < 7000281;
}
//returns powers tokens baked in to item
public HashMap<Integer, Integer> getBakedInStats() {
return this.bakedInStats;
}
//returns power tokens granted when using item, such as scrolls and potions
public HashMap<Integer, Integer> getUsedStats() {
return this.usedStats;

10
src/engine/objects/MobEquipment.java

@ -229,17 +229,13 @@ public class MobEquipment extends AbstractGameObject { @@ -229,17 +229,13 @@ public class MobEquipment extends AbstractGameObject {
if (itemBase != null)
for (Integer token : itemBase.getBakedInStats().keySet()) {
for (String effectID : this.template.item_user_power_action.keySet()) {
EffectsBase effect = PowersManager.getEffectByToken(token);
AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effectID);
AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effect.getIDString());
if (apa.getEffectsBase() != null)
if (apa.getEffectsBase().getValue() > 0) {
//System.out.println(apa.getEffectsBase().getValue());
if (apa.getEffectsBase().getValue() > 0)
value += apa.getEffectsBase().getValue();
}
if (apa.getEffectsBase2() != null)
value += apa.getEffectsBase2().getValue();

Loading…
Cancel
Save