From a14dcf4a35db216506494351e515e1895b4b0178 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 30 Nov 2018 09:04:46 -0500 Subject: [PATCH] v0.7.1: tipped darts now tie into durability and synergize with warden --- .../items/weapon/missiles/MissileWeapon.java | 10 +++--- .../items/weapon/missiles/darts/Dart.java | 8 ++--- .../items/weapon/missiles/darts/RotDart.java | 4 +++ .../weapon/missiles/darts/TippedDart.java | 36 ++++++++++++++----- .../messages/actors/actors.properties | 2 +- .../messages/items/items.properties | 7 ++-- 6 files changed, 46 insertions(+), 21 deletions(-) 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 32e48ca04..1bee860c2 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 @@ -59,7 +59,7 @@ abstract public class MissileWeapon extends Weapon { protected static final float MAX_DURABILITY = 100; protected float durability = MAX_DURABILITY; - protected int baseUses = 10; + protected float baseUses = 10; public boolean holster; @@ -202,16 +202,16 @@ abstract public class MissileWeapon extends Weapon { } else { parent.durability -= parent.durabilityPerUse(); if (parent.durability > 0 && parent.durability <= parent.durabilityPerUse()){ - if (level() <= 0)GLog.w(Messages.get(MissileWeapon.class, "about_to_break")); - else GLog.n(Messages.get(MissileWeapon.class, "about_to_break")); + if (level() <= 0)GLog.w(Messages.get(this, "about_to_break")); + else GLog.n(Messages.get(this, "about_to_break")); } } parent = null; } else { durability -= durabilityPerUse(); if (durability > 0 && durability <= durabilityPerUse()){ - if (level() <= 0)GLog.w(Messages.get(MissileWeapon.class, "about_to_break")); - else GLog.n(Messages.get(MissileWeapon.class, "about_to_break")); + if (level() <= 0)GLog.w(Messages.get(this, "about_to_break")); + else GLog.n(Messages.get(this, "about_to_break")); } } if (durability > 0){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/Dart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/Dart.java index 4bbfedd0a..68e6706c3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/Dart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/Dart.java @@ -34,6 +34,9 @@ public class Dart extends MissileWeapon { image = ItemSpriteSheet.DART; tier = 1; + + //infinite, even with penalties + baseUses = 1000; } @Override @@ -58,11 +61,6 @@ public class Dart extends MissileWeapon { } } - @Override - protected float durabilityPerUse() { - return 0; - } - private static Crossbow bow; private void updateCrossbow(){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/RotDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/RotDart.java index 77071eb44..0159a01c6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/RotDart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/RotDart.java @@ -47,4 +47,8 @@ public class RotDart extends TippedDart { return super.proc(attacker, defender, damage); } + @Override + protected float durabilityPerUse() { + return 100f; + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java index adb16ba27..1fb90db63 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/darts/TippedDart.java @@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PinCushion; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Recipe; @@ -50,22 +51,41 @@ public abstract class TippedDart extends Dart { { tier = 2; + + //so that slightly more than 1.5x durability is needed for 2 uses + baseUses = 0.65f; } //exact same damage as regular darts, despite being higher tier. @Override protected void rangedHit(Char enemy, int cell) { - //attempt to stick the dart to the enemy, just drop it if we can't. - Dart d = new Dart(); - if (enemy.isAlive() && sticky) { - PinCushion p = Buff.affect(enemy, PinCushion.class); - if (p.target == enemy){ - p.stick(d); - return; + super.rangedHit( enemy, cell); + + //need to spawn a dart + if (durability <= 0){ + //attempt to stick the dart to the enemy, just drop it if we can't. + Dart d = new Dart(); + if (enemy.isAlive() && sticky) { + PinCushion p = Buff.affect(enemy, PinCushion.class); + if (p.target == enemy){ + p.stick(d); + return; + } } + Dungeon.level.drop( d, enemy.pos ).sprite.drop(); } - Dungeon.level.drop( d, enemy.pos ).sprite.drop(); + } + + @Override + protected float durabilityPerUse() { + float use = super.durabilityPerUse(); + + if (Dungeon.hero.subClass == HeroSubClass.WARDEN){ + use /= 2f; + } + + return use; } private static HashMap, Class> types = new HashMap<>(); diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties index 875aded59..f93514c99 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/actors/actors.properties @@ -335,7 +335,7 @@ actors.hero.herosubclass.freerunner_desc=The _Freerunner_ builds momentum as he actors.hero.herosubclass.sniper=sniper actors.hero.herosubclass.sniper_desc=The _Sniper_ is a master of ranged combat, with increased vision and bonus accuracy and armor piercing based on attack distance. After striking with a thrown weapon, she can follow up with a special attack from her bow. actors.hero.herosubclass.warden=warden -actors.hero.herosubclass.warden_desc=The _Warden_ has a strong connection to nature which allows her to see through tall grass and command furrowed grass to sprout around plants she grows. Plants she tramples will also give bonus effects, tipped darts will last longer, and grass will give her an armor boost when she stands in it. +actors.hero.herosubclass.warden_desc=The _Warden_ has a strong connection to nature which allows her to see through tall grass and command furrowed grass to sprout around plants she grows. Plants she tramples will also give bonus effects, tipped darts gain 2x durability, and grass will give her an armor boost when she stands in it. diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index 39e80c40f..8583cc516 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -1354,7 +1354,7 @@ items.weapon.missiles.darts.poisondart.name=poison dart items.weapon.missiles.darts.poisondart.desc=These darts are tipped with a sorrowmoss-based compound which will poison their target. items.weapon.missiles.darts.rotdart.name=rot dart -items.weapon.missiles.darts.rotdart.desc=These wicked darts are tipped with an acidic rotberry-based compound, which will aggressively eat through anything the dart comes into contact with. Powerful foes will resist most of the effect, but the corrosion is strong enough to easily kill most standard enemies. +items.weapon.missiles.darts.rotdart.desc=These wicked darts are tipped with an acidic rotberry-based compound, which will aggressively eat through anything the dart comes into contact with. Powerful foes will resist most of the effect, but the corrosion is strong enough to easily kill most standard enemies. Unfortunately, the compound is unstable, and will always expire after a single use. items.weapon.missiles.darts.shockingdart.name=shocking dart items.weapon.missiles.darts.shockingdart.desc=These darts are tipped with a stormvine-based compound which will deliver a nasty shock to their target. @@ -1362,7 +1362,10 @@ items.weapon.missiles.darts.shockingdart.desc=These darts are tipped with a stor items.weapon.missiles.darts.sleepdart.name=sleep dart items.weapon.missiles.darts.sleepdart.desc=These darts are tipped with a dreamfoil-based compound which will instantly put their target into a light sleep. -items.weapon.missiles.darts.tippeddart.unlimited_uses=Tipped darts will expend their effect once used and will become regular darts. +items.weapon.missiles.darts.tippeddart.durability=Tipped darts will lose their tips and become regular darts when used. +items.weapon.missiles.darts.tippeddart.uses_left=This stack of darts has _%d/%d_ uses left before one tip wears off. +items.weapon.missiles.darts.tippeddart.unlimited_uses=_But these are of such high quality that they will effectively last forever._ +items.weapon.missiles.darts.tippeddart.about_to_break=Your dart tip is about to expire. items.weapon.missiles.bolas.name=bolas