v0.7.1: fixes and QOL improvements to missile weapons

This commit is contained in:
Evan Debenham 2018-11-15 19:36:58 -05:00
parent 4c120528ec
commit 7603fc030a
2 changed files with 15 additions and 3 deletions

View File

@ -37,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.Projecting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.TippedDart; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.TippedDart;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
import com.watabou.utils.Random; import com.watabou.utils.Random;
@ -200,10 +201,18 @@ abstract public class MissileWeapon extends Weapon {
parent.durability = MAX_DURABILITY; parent.durability = MAX_DURABILITY;
} else { } else {
parent.durability -= parent.durabilityPerUse(); parent.durability -= parent.durabilityPerUse();
if (parent.durability <= parent.durabilityPerUse()){
if (level() <= 0)GLog.w(Messages.get(Weapon.class, "about_to_break"));
else GLog.n(Messages.get(Weapon.class, "about_to_break"));
}
} }
parent = null; parent = null;
} else { } else {
durability -= durabilityPerUse(); durability -= durabilityPerUse();
if (durability <= durabilityPerUse()){
if (level() <= 0)GLog.w(Messages.get(Weapon.class, "about_to_break"));
else GLog.n(Messages.get(Weapon.class, "about_to_break"));
}
} }
if (durability > 0){ if (durability > 0){
//attempt to stick the missile weapon to the enemy, just drop it if we can't. //attempt to stick the missile weapon to the enemy, just drop it if we can't.
@ -231,9 +240,11 @@ abstract public class MissileWeapon extends Weapon {
usages *= RingOfSharpshooting.durabilityMultiplier( Dungeon.hero ); usages *= RingOfSharpshooting.durabilityMultiplier( Dungeon.hero );
float usage = MAX_DURABILITY/usages; //at 100 uses, items just last forever.
//after 100 uses, items just last forever. if (usages >= 100f) return 0;
return usage >= (MAX_DURABILITY/100f) ? usage : 0;
//add a tiny amount to account for rounding error for calculations like 1/3
return (MAX_DURABILITY/usages) + 0.001f;
} }
@Override @Override

View File

@ -1366,6 +1366,7 @@ items.weapon.missiles.missileweapon.distance=This weapon is designed to be used
items.weapon.missiles.missileweapon.durability=Missile weapons will wear out and break as they are used. items.weapon.missiles.missileweapon.durability=Missile weapons will wear out and break as they are used.
items.weapon.missiles.missileweapon.uses_left=This stack of weapons has _%d/%d_ uses left before one breaks. items.weapon.missiles.missileweapon.uses_left=This stack of weapons has _%d/%d_ uses left before one breaks.
items.weapon.missiles.missileweapon.unlimited_uses=_But these are of such high quality that they will effectively last forever._ items.weapon.missiles.missileweapon.unlimited_uses=_But these are of such high quality that they will effectively last forever._
ttems.weapon.missiles.missileweapon.about_to_break=Your thrown weapon is about to break.
items.weapon.missiles.shuriken.name=shuriken items.weapon.missiles.shuriken.name=shuriken
items.weapon.missiles.shuriken.desc=Star-shaped pieces of metal with razor-sharp blades. They are lightweight and easy to use on the move. A single shuriken can be thrown instantly after moving. items.weapon.missiles.shuriken.desc=Star-shaped pieces of metal with razor-sharp blades. They are lightweight and easy to use on the move. A single shuriken can be thrown instantly after moving.