From c7b63271aa1b40eeb5e480156ec714692154d2f9 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 26 Oct 2014 17:30:23 -0400 Subject: [PATCH] v0.2.2: reworked weightstone --- .../items/Weightstone.java | 27 ++++++++++--------- .../items/weapon/Weapon.java | 10 +++---- .../items/weapon/melee/MeleeWeapon.java | 12 +++++---- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java index 3ff702758..30450e26b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java @@ -37,8 +37,8 @@ import java.util.ArrayList; public class Weightstone extends Item { private static final String TXT_SELECT_WEAPON = "Select a weapon to balance"; - private static final String TXT_FAST = "you balanced your %s to make it faster"; - private static final String TXT_ACCURATE = "you balanced your %s to make it more accurate"; + private static final String TXT_LIGHT = "you balanced your %s to make it lighter"; + private static final String TXT_HEAVY = "you balanced your %s to make it heavier"; private static final float TIME_TO_APPLY = 2; @@ -89,11 +89,11 @@ public class Weightstone extends Item { detach( curUser.belongings.backpack ); if (forSpeed) { - weapon.imbue = Weapon.Imbue.SPEED; - GLog.p( TXT_FAST, weapon.name() ); + weapon.imbue = Weapon.Imbue.LIGHT; + GLog.p( TXT_LIGHT, weapon.name() ); } else { - weapon.imbue = Weapon.Imbue.ACCURACY; - GLog.p( TXT_ACCURATE, weapon.name() ); + weapon.imbue = Weapon.Imbue.HEAVY; + GLog.p( TXT_HEAVY, weapon.name() ); } curUser.sprite.operate( curUser.pos ); @@ -111,7 +111,8 @@ public class Weightstone extends Item { @Override public String info() { return - "Using a weightstone, you can balance your melee weapon to increase its speed or accuracy."; + "Using a weightstone, you can balance your melee weapon to make it lighter or heavier, " + + "increasing either speed or damage at the expense of the other."; } private final WndBag.Listener itemSelector = new WndBag.Listener() { @@ -127,8 +128,8 @@ public class Weightstone extends Item { private static final String TXT_CHOICE = "How would you like to balance your %s?"; - private static final String TXT_SPEED = "For speed"; - private static final String TXT_ACCURACY = "For accuracy"; + private static final String TXT_LIGHT = "Lighter"; + private static final String TXT_HEAVY = "Heavier"; private static final String TXT_CANCEL = "Never mind"; private static final int WIDTH = 120; @@ -152,8 +153,8 @@ public class Weightstone extends Item { float pos = tfMesage.y + tfMesage.height(); - if (weapon.imbue != Weapon.Imbue.SPEED) { - RedButton btnSpeed = new RedButton( TXT_SPEED ) { + if (weapon.imbue != Weapon.Imbue.LIGHT) { + RedButton btnSpeed = new RedButton( TXT_LIGHT ) { @Override protected void onClick() { hide(); @@ -166,8 +167,8 @@ public class Weightstone extends Item { pos = btnSpeed.bottom(); } - if (weapon.imbue != Weapon.Imbue.ACCURACY) { - RedButton btnAccuracy = new RedButton( TXT_ACCURACY ) { + if (weapon.imbue != Weapon.Imbue.HEAVY) { + RedButton btnAccuracy = new RedButton( TXT_HEAVY ) { @Override protected void onClick() { hide(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index 30394c49b..34ae9ba8a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -48,7 +48,7 @@ public class Weapon extends KindOfWeapon { public float DLY = 1f; // Speed modifier public enum Imbue { - NONE, SPEED, ACCURACY + NONE, LIGHT, HEAVY } public Imbue imbue = Imbue.NONE; @@ -113,9 +113,7 @@ public class Weapon extends KindOfWeapon { ACU *= (float)(Math.pow(1.1, bonus)); } - return - (encumbrance > 0 ? (float)(ACU / Math.pow( 1.5, encumbrance )) : ACU) * - (imbue == Imbue.ACCURACY ? 1.5f : 1.0f); + return encumbrance > 0 ? (float)(ACU / Math.pow( 1.5, encumbrance )) : ACU; } @Override @@ -135,7 +133,7 @@ public class Weapon extends KindOfWeapon { return (encumrance > 0 ? (float)(DLY * Math.pow( 1.2, encumrance )) : DLY) * - (imbue == Imbue.SPEED ? 0.6f : 1.0f); + (imbue == Imbue.LIGHT ? 0.667f : (imbue == Imbue.HEAVY ? 1.667f : 1.0f)); } @Override @@ -150,7 +148,7 @@ public class Weapon extends KindOfWeapon { } } - return damage; + return Math.round(damage * (imbue == Imbue.LIGHT ? 0.7f : (imbue == Imbue.HEAVY ? 1.5f : 1f))); } public Item upgrade( boolean enchant ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java index 135af2d6f..2a87e8e8d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java @@ -91,7 +91,9 @@ public class MeleeWeapon extends Weapon { info.append( " tier-" + tier + " melee weapon. " ); if (levelKnown) { - info.append( "Its average damage is " + (MIN + (MAX - MIN) / 2) + " points per hit. " ); + info.append( "Its average damage is " + + Math.round((MIN + (MAX - MIN) / 2)*(imbue == Imbue.LIGHT ? 0.75f : (imbue == Imbue.HEAVY ? 1.5f : 1))) + + " points per hit. " ); } else { info.append( "Its typical average damage is " + (min() + (max() - min()) / 2) + " points per hit " + @@ -116,11 +118,11 @@ public class MeleeWeapon extends Weapon { info.append( "This is a rather " + (ACU > 1f ? "accurate" : "inaccurate") + " weapon. " ); } switch (imbue) { - case SPEED: - info.append( "It was balanced to make it faster. " ); + case LIGHT: + info.append( "It was balanced to be lighter. " ); break; - case ACCURACY: - info.append( "It was balanced to make it more accurate. " ); + case HEAVY: + info.append( "It was balanced to be heavier. " ); break; case NONE: }