diff --git a/core/src/main/assets/messages/items/items.properties b/core/src/main/assets/messages/items/items.properties index e29c181c7..541ee1bba 100644 --- a/core/src/main/assets/messages/items/items.properties +++ b/core/src/main/assets/messages/items/items.properties @@ -2369,7 +2369,7 @@ items.liquidmetal.ac_apply=APPLY items.liquidmetal.prompt=Select a thrown weapon items.liquidmetal.already_fixed=That thrown weapon is already in perfect condition! items.liquidmetal.apply=You use %d liquid metal to repair your thrown weapon. -items.liquidmetal.desc=When poured over a thrown weapon, this magical liquid will fill into the cracks and tears from use, restoring the thrown weapon to perfect condition!\n\nA tier 1 weapon requires 10 liquid metal to be fully repaired, a tier 5 weapon requires 30. Each upgrade also increases the amount of metal needed by 33%.\n\nLiquid metal cannot be used to repair the tips on tipped darts. +items.liquidmetal.desc=This magical liquid can fill into the cracks and tears on a thrown weapon, restoring it to perfect condition! If a set of weapons is missing a weapon but otherwise fully repaired, then liquid metal can even be used to replace a missing weapon from the set!\n\nA tier 1 weapon requires 10 liquid metal to be fully repaired, a tier 5 weapon requires 30. Each upgrade also increases the amount of metal needed by 33%.\n\nLiquid metal cannot be used to repair the tips on tipped darts. items.liquidmetal.discover_hint=You can craft this item via alchemy. items.lostbackpack.name=lost backpack diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/LiquidMetal.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/LiquidMetal.java index 0dc56c867..678384fb6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/LiquidMetal.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/LiquidMetal.java @@ -144,11 +144,31 @@ public class LiquidMetal extends Item { //we remove a tiny amount here to account for rounding errors float percentDurabilityLost = 0.999f - (m.durabilityLeft()/100f); int toUse = (int)Math.ceil(maxToUse*percentDurabilityLost); - float durPerUse = m.durabilityPerUse()/100f; if (toUse == 0 || Math.ceil(m.durabilityLeft()/ m.durabilityPerUse()) >= Math.ceil(m.MAX_DURABILITY/ m.durabilityPerUse()) ){ - GLog.w(Messages.get(LiquidMetal.class, "already_fixed")); - return; + + if (m.quantity() < m.defaultQuantity()){ + if (quantity()*durabilityPerMetal >= m.durabilityPerUse()){ + m.quantity(m.quantity()+1); + if (maxToUse < quantity()){ + Catalog.countUses(LiquidMetal.class, (int)Math.ceil(maxToUse)); + GLog.i(Messages.get(LiquidMetal.class, "apply", (int)Math.ceil(maxToUse))); + quantity -= (int)Math.ceil(maxToUse); + } else { + Catalog.countUses(LiquidMetal.class, quantity()); + m.damage(100f); + m.repair(quantity()*durabilityPerMetal-1); + GLog.i(Messages.get(LiquidMetal.class, "apply", quantity())); + detachAll(Dungeon.hero.belongings.backpack); + } + } else { + GLog.w(Messages.get(LiquidMetal.class, "already_fixed")); + return; + } + } else { + GLog.w(Messages.get(LiquidMetal.class, "already_fixed")); + return; + } } else if (toUse < quantity()) { Catalog.countUses(LiquidMetal.class, toUse); m.repair(maxToUse*durabilityPerMetal); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java index 6fdf30125..cc7096d3a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java @@ -528,6 +528,12 @@ abstract public class MissileWeapon extends Weapon { durability += MAX_DURABILITY; } + //hashcode check is for pre-3.2 saves + if (quantity > defaultQuantity() && setID != getClass().getSimpleName().hashCode()){ + quantity = defaultQuantity(); + durability = MAX_DURABILITY; + } + masteryPotionBonus = masteryPotionBonus || ((MissileWeapon) other).masteryPotionBonus; levelKnown = levelKnown || other.levelKnown; cursedKnown = cursedKnown || other.cursedKnown;