v0.3.4: externalized weapon strings
This commit is contained in:
committed by
Evan Debenham
parent
26b5fd7ac4
commit
77c583b6b1
@@ -31,9 +31,5 @@ public class BattleAxe extends MeleeWeapon {
|
||||
public BattleAxe() {
|
||||
super( 4, 1.2f, 1f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "The enormous steel head of this battle axe puts considerable heft behind each stroke.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,9 +31,5 @@ public class Dagger extends MeleeWeapon {
|
||||
public Dagger() {
|
||||
super( 1, 1.2f, 1f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "A simple iron dagger with a well worn wooden handle.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,9 +31,5 @@ public class Glaive extends MeleeWeapon {
|
||||
public Glaive() {
|
||||
super( 5, 1f, 1f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "A polearm consisting of a sword blade on the end of a pole.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,9 +31,5 @@ public class Knuckles extends MeleeWeapon {
|
||||
public Knuckles() {
|
||||
super( 1, 1f, 0.5f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "A piece of iron shaped to fit around the knuckles.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,9 +31,5 @@ public class Longsword extends MeleeWeapon {
|
||||
public Longsword() {
|
||||
super( 4, 1f, 1f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "This towering blade inflicts heavy damage by investing its heft into every cut.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,9 +31,5 @@ public class Mace extends MeleeWeapon {
|
||||
public Mace() {
|
||||
super( 3, 1f, 0.8f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "The iron head of this weapon inflicts substantial damage.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.wands.*;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
@@ -52,12 +53,9 @@ public class MagesStaff extends MeleeWeapon {
|
||||
public static final String AC_IMBUE = "IMBUE";
|
||||
public static final String AC_ZAP = "ZAP";
|
||||
|
||||
private static final String TXT_SELECT_WAND = "Select a wand to consume";
|
||||
|
||||
private static final float STAFF_SCALE_FACTOR = 0.75f;
|
||||
|
||||
{
|
||||
name = "mage's staff";
|
||||
image = ItemSpriteSheet.MAGES_STAFF;
|
||||
|
||||
defaultAction = AC_ZAP;
|
||||
@@ -86,7 +84,7 @@ public class MagesStaff extends MeleeWeapon {
|
||||
this.wand = wand;
|
||||
wand.maxCharges = Math.min(wand.maxCharges + 1, 10);
|
||||
wand.curCharges = wand.maxCharges;
|
||||
name = wand.name().replace("Wand", "Staff");
|
||||
name = wand.name().replace(Messages.get(this, "wand"), Messages.get(this, "staff"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,7 +107,7 @@ public class MagesStaff extends MeleeWeapon {
|
||||
if (action.equals(AC_IMBUE)) {
|
||||
|
||||
curUser = hero;
|
||||
GameScene.selectItem(itemSelector, WndBag.Mode.WAND, TXT_SELECT_WAND);
|
||||
GameScene.selectItem(itemSelector, WndBag.Mode.WAND, Messages.get(this, "prompt"));
|
||||
|
||||
} else if (action.equals(AC_ZAP)){
|
||||
if (wand == null)
|
||||
@@ -151,10 +149,10 @@ public class MagesStaff extends MeleeWeapon {
|
||||
|
||||
this.wand = null;
|
||||
|
||||
GLog.p("You imbue your staff with the " + wand.name());
|
||||
GLog.p( Messages.get(this, "imbue", wand.name()));
|
||||
|
||||
if (enchantment != null) {
|
||||
GLog.w("The conflicting magics erase the enchantment on your staff.");
|
||||
GLog.w( Messages.get(this, "conflict") );
|
||||
enchant(null);
|
||||
}
|
||||
|
||||
@@ -180,12 +178,11 @@ public class MagesStaff extends MeleeWeapon {
|
||||
wand.cursed = false;
|
||||
wand.charge(owner);
|
||||
|
||||
name = wand.name().replace("Wand", "Staff");
|
||||
name = wand.name().replace(Messages.get(this, "wand"), Messages.get(this, "staff"));
|
||||
|
||||
updateQuickslot();
|
||||
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -259,64 +256,28 @@ public class MagesStaff extends MeleeWeapon {
|
||||
wand = (Wand) bundle.get(WAND);
|
||||
if (wand != null) {
|
||||
wand.maxCharges = Math.min(wand.maxCharges + 1, 10);
|
||||
name = wand.name().replace("wand", "staff");
|
||||
name = wand.name().replace(Messages.get(this, "wand"), Messages.get(this, "staff"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
String result = "Crafted by the mage himself, this extraordinary staff is a one of a kind multi-purpose magical weapon.\n" +
|
||||
"\n" +
|
||||
"Rather than having an innate magic in it, this staff is instead imbued with magical energy from a wand, permanently granting it new power.\n" +
|
||||
"\n";
|
||||
|
||||
if (wand == null) {
|
||||
result += "The staff is currently a slightly magical stick, it needs a wand!";
|
||||
} else if (wand instanceof WandOfMagicMissile){
|
||||
result += "The staff radiates consistent magical energy from the wand it is imbued with.";
|
||||
} else if (wand instanceof WandOfFireblast){
|
||||
result += "The staff burns and sizzles with fiery energy from the wand it is imbued with.";
|
||||
} else if (wand instanceof WandOfLightning){
|
||||
result += "The staff fizzes and crackles with electrical energy from the wand it is imbued with.";
|
||||
} else if (wand instanceof WandOfDisintegration){
|
||||
result += "The staff hums with deep and powerful energy from the wand it is imbued with.";
|
||||
} else if (wand instanceof WandOfVenom){
|
||||
result += "The staff drips and hisses with corrosive energy from the wand it is imbued with.";
|
||||
} else if (wand instanceof WandOfPrismaticLight){
|
||||
result += "The staff glows and shimmers with bright energy from the wand it is imbued with.";
|
||||
} else if (wand instanceof WandOfFrost){
|
||||
result += "The staff chills the air with the cold energy from the wand it is imbued with.";
|
||||
} else if (wand instanceof WandOfBlastWave){
|
||||
result += "The staff pops and crackles with explosive energy from the wand it is imbued with.";
|
||||
} else if (wand instanceof WandOfRegrowth){
|
||||
result += "The staff flourishes and grows with natural energy from the wand it is imbued with.";
|
||||
} else if (wand instanceof WandOfTransfusion){
|
||||
result += "The staff courses and flows with life energy from the wand it is imbued with.";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private final WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( final Item item ) {
|
||||
if (item != null) {
|
||||
|
||||
if (!item.isIdentified()) {
|
||||
GLog.w("You'll need to identify this wand first.");
|
||||
GLog.w(Messages.get(this, "id_first"));
|
||||
return;
|
||||
} else if (item.cursed){
|
||||
GLog.w("You can't use a cursed wand.");
|
||||
GLog.w(Messages.get(this, "cursed"));
|
||||
return;
|
||||
}
|
||||
|
||||
GameScene.show(
|
||||
new WndOptions("",
|
||||
"Are you sure you want to imbue your staff with this " + item.name() + "?\n\n" +
|
||||
"Your staff will inherit the highest level between it and the wand, " +
|
||||
"and all magic currently affecting the staff will be lost.",
|
||||
"Yes, i'm sure.",
|
||||
"No, I changed my mind") {
|
||||
Messages.get(this, "warning"),
|
||||
Messages.get(this, "yes"),
|
||||
Messages.get(this, "no")) {
|
||||
@Override
|
||||
protected void onSelect(int index) {
|
||||
if (index == 0) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -31,9 +31,5 @@ public class Quarterstaff extends MeleeWeapon {
|
||||
public Quarterstaff() {
|
||||
super( 2, 1f, 1f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "A staff of hardwood, its ends are shod with iron.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -99,12 +99,6 @@ public class ShortSword extends MeleeWeapon {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"It is indeed quite short, just a few inches longer, than a dagger.";
|
||||
}
|
||||
|
||||
private final WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||
@Override
|
||||
public void onSelect( Item item ) {
|
||||
|
||||
@@ -31,9 +31,5 @@ public class Spear extends MeleeWeapon {
|
||||
public Spear() {
|
||||
super( 2, 1f, 1.5f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "A slender wooden rod tipped with sharpened iron.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,9 +31,5 @@ public class Sword extends MeleeWeapon {
|
||||
public Sword() {
|
||||
super( 3, 1f, 1f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return "The razor-sharp length of steel blade shines reassuringly.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,11 +31,5 @@ public class WarHammer extends MeleeWeapon {
|
||||
public WarHammer() {
|
||||
super( 5, 1.2f, 1f );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String desc() {
|
||||
return
|
||||
"Few creatures can withstand the crushing blow of this towering mass of lead and steel, " +
|
||||
"but only the strongest of adventurers can use it effectively.";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user