v1.0.3: fixed cases where metal could be applied at full durability
This commit is contained in:
parent
da12bb5029
commit
def4d8b598
|
@ -114,21 +114,21 @@ public class LiquidMetal extends Item {
|
|||
int maxToUse = 5*(m.tier+1);
|
||||
maxToUse *= Math.pow(2, m.level());
|
||||
|
||||
float durabilityPerUse = 100 / (float)maxToUse;
|
||||
float durabilityPerMetal = 100 / (float)maxToUse;
|
||||
|
||||
//we remove a tiny amount here to account for rounding errors
|
||||
float percentDurabilityLeft = 0.999f - (m.durabilityLeft()/100f);
|
||||
maxToUse = (int)Math.ceil(maxToUse*percentDurabilityLeft);
|
||||
if (maxToUse == 0){
|
||||
float percentDurabilityLost = 0.999f - (m.durabilityLeft()/100f);
|
||||
maxToUse = (int)Math.ceil(maxToUse*percentDurabilityLost);
|
||||
if (maxToUse == 0 || percentDurabilityLost < m.durabilityPerUse()/100f){
|
||||
GLog.w(Messages.get(LiquidMetal.class, "already_fixed"));
|
||||
return;
|
||||
} else if (maxToUse < quantity()) {
|
||||
m.repair(maxToUse*durabilityPerUse);
|
||||
m.repair(maxToUse*durabilityPerMetal);
|
||||
quantity(quantity()-maxToUse);
|
||||
GLog.i(Messages.get(LiquidMetal.class, "apply", maxToUse));
|
||||
|
||||
} else {
|
||||
m.repair(quantity()*durabilityPerUse);
|
||||
m.repair(quantity()*durabilityPerMetal);
|
||||
GLog.i(Messages.get(LiquidMetal.class, "apply", quantity()));
|
||||
detachAll(Dungeon.hero.belongings.backpack);
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ abstract public class MissileWeapon extends Weapon {
|
|||
durability += amount;
|
||||
}
|
||||
|
||||
protected float durabilityPerUse(){
|
||||
public float durabilityPerUse(){
|
||||
float usages = baseUses * (float)(Math.pow(3, level()));
|
||||
|
||||
//+50%/75% durability
|
||||
|
|
|
@ -48,7 +48,7 @@ public class RotDart extends TippedDart {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected float durabilityPerUse() {
|
||||
public float durabilityPerUse() {
|
||||
return 100f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ public abstract class TippedDart extends Dart {
|
|||
private static int targetPos = -1;
|
||||
|
||||
@Override
|
||||
protected float durabilityPerUse() {
|
||||
public float durabilityPerUse() {
|
||||
float use = super.durabilityPerUse();
|
||||
|
||||
use /= (1 + Dungeon.hero.pointsInTalent(Talent.DURABLE_TIPS));
|
||||
|
|
Loading…
Reference in New Issue
Block a user