v0.2.2: reworked weightstone

This commit is contained in:
Evan Debenham 2014-10-26 17:30:23 -04:00
parent a1fd965145
commit c7b63271aa
3 changed files with 25 additions and 24 deletions

View File

@ -37,8 +37,8 @@ import java.util.ArrayList;
public class Weightstone extends Item { public class Weightstone extends Item {
private static final String TXT_SELECT_WEAPON = "Select a weapon to balance"; 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_LIGHT = "you balanced your %s to make it lighter";
private static final String TXT_ACCURATE = "you balanced your %s to make it more accurate"; private static final String TXT_HEAVY = "you balanced your %s to make it heavier";
private static final float TIME_TO_APPLY = 2; private static final float TIME_TO_APPLY = 2;
@ -89,11 +89,11 @@ public class Weightstone extends Item {
detach( curUser.belongings.backpack ); detach( curUser.belongings.backpack );
if (forSpeed) { if (forSpeed) {
weapon.imbue = Weapon.Imbue.SPEED; weapon.imbue = Weapon.Imbue.LIGHT;
GLog.p( TXT_FAST, weapon.name() ); GLog.p( TXT_LIGHT, weapon.name() );
} else { } else {
weapon.imbue = Weapon.Imbue.ACCURACY; weapon.imbue = Weapon.Imbue.HEAVY;
GLog.p( TXT_ACCURATE, weapon.name() ); GLog.p( TXT_HEAVY, weapon.name() );
} }
curUser.sprite.operate( curUser.pos ); curUser.sprite.operate( curUser.pos );
@ -111,7 +111,8 @@ public class Weightstone extends Item {
@Override @Override
public String info() { public String info() {
return 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() { 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_CHOICE = "How would you like to balance your %s?";
private static final String TXT_SPEED = "For speed"; private static final String TXT_LIGHT = "Lighter";
private static final String TXT_ACCURACY = "For accuracy"; private static final String TXT_HEAVY = "Heavier";
private static final String TXT_CANCEL = "Never mind"; private static final String TXT_CANCEL = "Never mind";
private static final int WIDTH = 120; private static final int WIDTH = 120;
@ -152,8 +153,8 @@ public class Weightstone extends Item {
float pos = tfMesage.y + tfMesage.height(); float pos = tfMesage.y + tfMesage.height();
if (weapon.imbue != Weapon.Imbue.SPEED) { if (weapon.imbue != Weapon.Imbue.LIGHT) {
RedButton btnSpeed = new RedButton( TXT_SPEED ) { RedButton btnSpeed = new RedButton( TXT_LIGHT ) {
@Override @Override
protected void onClick() { protected void onClick() {
hide(); hide();
@ -166,8 +167,8 @@ public class Weightstone extends Item {
pos = btnSpeed.bottom(); pos = btnSpeed.bottom();
} }
if (weapon.imbue != Weapon.Imbue.ACCURACY) { if (weapon.imbue != Weapon.Imbue.HEAVY) {
RedButton btnAccuracy = new RedButton( TXT_ACCURACY ) { RedButton btnAccuracy = new RedButton( TXT_HEAVY ) {
@Override @Override
protected void onClick() { protected void onClick() {
hide(); hide();

View File

@ -48,7 +48,7 @@ public class Weapon extends KindOfWeapon {
public float DLY = 1f; // Speed modifier public float DLY = 1f; // Speed modifier
public enum Imbue { public enum Imbue {
NONE, SPEED, ACCURACY NONE, LIGHT, HEAVY
} }
public Imbue imbue = Imbue.NONE; public Imbue imbue = Imbue.NONE;
@ -113,9 +113,7 @@ public class Weapon extends KindOfWeapon {
ACU *= (float)(Math.pow(1.1, bonus)); ACU *= (float)(Math.pow(1.1, bonus));
} }
return return encumbrance > 0 ? (float)(ACU / Math.pow( 1.5, encumbrance )) : ACU;
(encumbrance > 0 ? (float)(ACU / Math.pow( 1.5, encumbrance )) : ACU) *
(imbue == Imbue.ACCURACY ? 1.5f : 1.0f);
} }
@Override @Override
@ -135,7 +133,7 @@ public class Weapon extends KindOfWeapon {
return return
(encumrance > 0 ? (float)(DLY * Math.pow( 1.2, encumrance )) : DLY) * (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 @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 ) { public Item upgrade( boolean enchant ) {

View File

@ -91,7 +91,9 @@ public class MeleeWeapon extends Weapon {
info.append( " tier-" + tier + " melee weapon. " ); info.append( " tier-" + tier + " melee weapon. " );
if (levelKnown) { 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 { } else {
info.append( info.append(
"Its typical average damage is " + (min() + (max() - min()) / 2) + " points per hit " + "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. " ); info.append( "This is a rather " + (ACU > 1f ? "accurate" : "inaccurate") + " weapon. " );
} }
switch (imbue) { switch (imbue) {
case SPEED: case LIGHT:
info.append( "It was balanced to make it faster. " ); info.append( "It was balanced to be lighter. " );
break; break;
case ACCURACY: case HEAVY:
info.append( "It was balanced to make it more accurate. " ); info.append( "It was balanced to be heavier. " );
break; break;
case NONE: case NONE:
} }