v0.3.4: externalized weapon strings

This commit is contained in:
Evan Debenham
2016-01-03 17:52:26 -05:00
committed by Evan Debenham
parent 26b5fd7ac4
commit 77c583b6b1
26 changed files with 134 additions and 291 deletions
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.utils.Random;
@@ -88,87 +89,49 @@ public class MeleeWeapon extends Weapon {
@Override
public String info() {
String name = name();
final String p = "\n\n";
StringBuilder info = new StringBuilder( desc() );
String quality = levelKnown && level() != 0 ? (level() > 0 ? "upgraded" : "degraded") : "";
info.append( p );
info.append( "This " + name + " is " + Utils.indefinite( quality ) );
info.append( " tier-" + tier + " melee weapon. " );
String info = desc();
info += "\n\n" + Messages.get(MeleeWeapon.class, "tier", tier);
if (levelKnown) {
int min = min();
int max = max();
info.append( "Its average damage is " +
Math.round((min + (max - min) / 2)*(imbue == Imbue.LIGHT ? 0.7f : (imbue == Imbue.HEAVY ? 1.5f : 1)))
+ " points per hit. " );
float dmgfactor = (imbue == Imbue.LIGHT ? 0.7f : imbue == Imbue.HEAVY ? 1.5f : 1);
info += " " + Messages.get(Weapon.class, "avg_dmg", Math.round((min + (max - min) / 2)*dmgfactor));
} else {
int min = minBase();
int max = maxBase();
info.append(
"Its typical average damage is " + (min + (max - min) / 2) + " points per hit " +
"and usually it requires " + typicalSTR() + " points of strength. " );
info += " " + Messages.get(MeleeWeapon.class, "unknown", (min + (max - min) / 2), typicalSTR());
if (typicalSTR() > Dungeon.hero.STR()) {
info.append( "Probably this weapon is too heavy for you. " );
info += " " + Messages.get(MeleeWeapon.class, "probably_too_heavy");
}
}
if (DLY != 1f) {
info.append( "This is a rather " + (DLY < 1f ? "fast" : "slow") );
if (ACU != 1f) {
if ((ACU > 1f) == (DLY < 1f)) {
info.append( " and ");
} else {
info.append( " but ");
}
info.append( ACU > 1f ? "accurate" : "inaccurate" );
}
info.append( " weapon. ");
} else if (ACU != 1f) {
info.append( "This is a rather " + (ACU > 1f ? "accurate" : "inaccurate") + " weapon. " );
}
switch (imbue) {
case LIGHT:
info.append( "It was balanced to be lighter. " );
info += " " + Messages.get(Weapon.class, "lighter");
break;
case HEAVY:
info.append( "It was balanced to be heavier. " );
info += " " + Messages.get(Weapon.class, "heavier");
break;
case NONE:
}
if (enchantment != null) {
info.append( "It is enchanted." );
String stats_desc = Messages.get(this, "stats_desc");
if (!stats_desc.equals("")) info+= "\n\n" + stats_desc;
if (levelKnown && STR > Dungeon.hero.STR()) {
info += "\n\n" + Messages.get(Weapon.class, "too_heavy");
}
if (cursed && isEquipped( Dungeon.hero )) {
info += "\n\n" + Messages.get(MeleeWeapon.class, "cursed_worn");
} else if (cursedKnown && cursed) {
info += "\n\n" + Messages.get(MeleeWeapon.class, "cursed");
}
if (levelKnown && Dungeon.hero.belongings.backpack.items.contains( this )) {
if (STR > Dungeon.hero.STR()) {
info.append( p );
info.append(
"Because of your inadequate strength the accuracy and speed " +
"of your attack with this " + name + " is decreased." );
}
if (STR < Dungeon.hero.STR()) {
info.append( p );
info.append(
"Because of your excess strength the damage " +
"of your attack with this " + name + " is increased." );
}
}
if (isEquipped( Dungeon.hero )) {
info.append( p );
info.append( "You hold the " + name + " at the ready" +
(cursed ? ", and because it is cursed, you are powerless to let go." : ".") );
} else {
if (cursedKnown && cursed) {
info.append( p );
info.append( "You can feel a malevolent magic lurking within the " + name +"." );
}
}
return info.toString();
return info;
}
@Override