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

View File

@ -202,31 +202,30 @@ public class Armor extends EquipableItem {
@Override @Override
public String info() { public String info() {
String name = name();
String info = desc(); String info = desc();
if (levelKnown) { if (levelKnown) {
info += Messages.get(Armor.class, "curr_absorb", name, Math.max( DR(), 0 )); info += "\n\n" + Messages.get(Armor.class, "curr_absorb", Math.max( DR(), 0 ));
if (STR > Dungeon.hero.STR()) { if (STR > Dungeon.hero.STR()) {
info += Messages.get(Armor.class, "too_heavy"); info += "\n\n" + Messages.get(Armor.class, "too_heavy");
} }
} else { } else {
info += Messages.get(Armor.class, "avg_absorb", name, typicalDR(), typicalSTR()); info += "\n\n" + Messages.get(Armor.class, "avg_absorb", typicalDR(), typicalSTR());
if (typicalSTR() > Dungeon.hero.STR()) { if (typicalSTR() > Dungeon.hero.STR()) {
info += Messages.get(Armor.class, "probably_too_heavy"); info += "\n\n" + Messages.get(Armor.class, "probably_too_heavy");
} }
} }
if (glyph != null) { if (glyph != null) {
info += Messages.get(Armor.class, "inscribed", glyph.name()); info += "\n\n" + Messages.get(Armor.class, "inscribed", glyph.name());
} }
if (cursed && isEquipped( Dungeon.hero )) { if (cursed && isEquipped( Dungeon.hero )) {
info += Messages.get(Armor.class, "cursed_word"); info += "\n\n" + Messages.get(Armor.class, "cursed_worn");
} else if (cursedKnown && cursed) { } else if (cursedKnown && cursed) {
info += Messages.get(Armor.class, "cursed"); info += "\n\n" + Messages.get(Armor.class, "cursed");
} }
return info; return info;

View File

@ -242,12 +242,12 @@ public class Ring extends KindofMisc {
if (isEquipped( Dungeon.hero )) { if (isEquipped( Dungeon.hero )) {
desc += Messages.get(Ring.class, "on_finger", name()); desc += "\n\n" + Messages.get(Ring.class, "on_finger", name());
if (cursed) desc += Messages.get(Ring.class, "cursed_worn"); if (cursed) desc += " " + Messages.get(Ring.class, "cursed_worn");
} else if (cursed && cursedKnown) { } else if (cursed && cursedKnown) {
desc += Messages.get(Ring.class, "curse_known", name()); desc += "\n\n" + Messages.get(Ring.class, "curse_known", name());
} }

View File

@ -179,7 +179,7 @@ public abstract class Wand extends Item {
@Override @Override
public String info() { public String info() {
return (cursed && cursedKnown) ? return (cursed && cursedKnown) ?
desc() + Messages.get(Wand.class, "cursed") : desc() + "\n\n" + Messages.get(Wand.class, "cursed") :
desc(); desc();
} }

View File

@ -44,10 +44,6 @@ abstract public class Weapon extends KindOfWeapon {
private static final int HITS_TO_KNOW = 20; private static final int HITS_TO_KNOW = 20;
private static final String TXT_IDENTIFY =
"You are now familiar enough with your %s to identify it. It is %s.";
private static final String TXT_INCOMPATIBLE =
"Interaction of different types of magic has negated the enchantment on this weapon!";
private static final String TXT_TO_STRING = "%s :%d"; private static final String TXT_TO_STRING = "%s :%d";
public int STR = 10; public int STR = 10;
@ -73,7 +69,7 @@ abstract public class Weapon extends KindOfWeapon {
if (!levelKnown) { if (!levelKnown) {
if (--hitsToKnow <= 0) { if (--hitsToKnow <= 0) {
levelKnown = true; levelKnown = true;
GLog.i( TXT_IDENTIFY, name(), toString() ); GLog.i( Messages.get(Weapon.class, "identify", name(), toString()) );
Badges.validateItemLevelAquired( this ); Badges.validateItemLevelAquired( this );
} }
} }
@ -167,7 +163,7 @@ abstract public class Weapon extends KindOfWeapon {
public Item upgrade( boolean enchant ) { public Item upgrade( boolean enchant ) {
if (enchantment != null) { if (enchantment != null) {
if (!enchant && Random.Int( level() ) > 0) { if (!enchant && Random.Int( level() ) > 0) {
GLog.w( TXT_INCOMPATIBLE ); GLog.w( Messages.get(Weapon.class, "incompatible") );
enchant( null ); enchant( null );
} }
} else { } else {

View File

@ -31,9 +31,5 @@ public class BattleAxe extends MeleeWeapon {
public BattleAxe() { public BattleAxe() {
super( 4, 1.2f, 1f ); super( 4, 1.2f, 1f );
} }
@Override
public String desc() {
return "The enormous steel head of this battle axe puts considerable heft behind each stroke.";
}
} }

View File

@ -31,9 +31,5 @@ public class Dagger extends MeleeWeapon {
public Dagger() { public Dagger() {
super( 1, 1.2f, 1f ); super( 1, 1.2f, 1f );
} }
@Override
public String desc() {
return "A simple iron dagger with a well worn wooden handle.";
}
} }

View File

@ -31,9 +31,5 @@ public class Glaive extends MeleeWeapon {
public Glaive() { public Glaive() {
super( 5, 1f, 1f ); super( 5, 1f, 1f );
} }
@Override
public String desc() {
return "A polearm consisting of a sword blade on the end of a pole.";
}
} }

View File

@ -31,9 +31,5 @@ public class Knuckles extends MeleeWeapon {
public Knuckles() { public Knuckles() {
super( 1, 1f, 0.5f ); super( 1, 1f, 0.5f );
} }
@Override
public String desc() {
return "A piece of iron shaped to fit around the knuckles.";
}
} }

View File

@ -31,9 +31,5 @@ public class Longsword extends MeleeWeapon {
public Longsword() { public Longsword() {
super( 4, 1f, 1f ); super( 4, 1f, 1f );
} }
@Override
public String desc() {
return "This towering blade inflicts heavy damage by investing its heft into every cut.";
}
} }

View File

@ -31,9 +31,5 @@ public class Mace extends MeleeWeapon {
public Mace() { public Mace() {
super( 3, 1f, 0.8f ); super( 3, 1f, 0.8f );
} }
@Override
public String desc() {
return "The iron head of this weapon inflicts substantial damage.";
}
} }

View File

@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRecharging;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.*; import com.shatteredpixel.shatteredpixeldungeon.items.wands.*;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; 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_IMBUE = "IMBUE";
public static final String AC_ZAP = "ZAP"; 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; private static final float STAFF_SCALE_FACTOR = 0.75f;
{ {
name = "mage's staff";
image = ItemSpriteSheet.MAGES_STAFF; image = ItemSpriteSheet.MAGES_STAFF;
defaultAction = AC_ZAP; defaultAction = AC_ZAP;
@ -86,7 +84,7 @@ public class MagesStaff extends MeleeWeapon {
this.wand = wand; this.wand = wand;
wand.maxCharges = Math.min(wand.maxCharges + 1, 10); wand.maxCharges = Math.min(wand.maxCharges + 1, 10);
wand.curCharges = wand.maxCharges; wand.curCharges = wand.maxCharges;
name = wand.name().replace("Wand", "Staff"); name = wand.name().replace(Messages.get(this, "wand"), Messages.get(this, "staff"));
} }
@Override @Override
@ -109,7 +107,7 @@ public class MagesStaff extends MeleeWeapon {
if (action.equals(AC_IMBUE)) { if (action.equals(AC_IMBUE)) {
curUser = hero; 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)){ } else if (action.equals(AC_ZAP)){
if (wand == null) if (wand == null)
@ -151,10 +149,10 @@ public class MagesStaff extends MeleeWeapon {
this.wand = null; this.wand = null;
GLog.p("You imbue your staff with the " + wand.name()); GLog.p( Messages.get(this, "imbue", wand.name()));
if (enchantment != null) { if (enchantment != null) {
GLog.w("The conflicting magics erase the enchantment on your staff."); GLog.w( Messages.get(this, "conflict") );
enchant(null); enchant(null);
} }
@ -180,12 +178,11 @@ public class MagesStaff extends MeleeWeapon {
wand.cursed = false; wand.cursed = false;
wand.charge(owner); wand.charge(owner);
name = wand.name().replace("Wand", "Staff"); name = wand.name().replace(Messages.get(this, "wand"), Messages.get(this, "staff"));
updateQuickslot(); updateQuickslot();
return this; return this;
} }
@Override @Override
@ -259,64 +256,28 @@ public class MagesStaff extends MeleeWeapon {
wand = (Wand) bundle.get(WAND); wand = (Wand) bundle.get(WAND);
if (wand != null) { if (wand != null) {
wand.maxCharges = Math.min(wand.maxCharges + 1, 10); 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() { private final WndBag.Listener itemSelector = new WndBag.Listener() {
@Override @Override
public void onSelect( final Item item ) { public void onSelect( final Item item ) {
if (item != null) { if (item != null) {
if (!item.isIdentified()) { if (!item.isIdentified()) {
GLog.w("You'll need to identify this wand first."); GLog.w(Messages.get(this, "id_first"));
return; return;
} else if (item.cursed){ } else if (item.cursed){
GLog.w("You can't use a cursed wand."); GLog.w(Messages.get(this, "cursed"));
return; return;
} }
GameScene.show( GameScene.show(
new WndOptions("", new WndOptions("",
"Are you sure you want to imbue your staff with this " + item.name() + "?\n\n" + Messages.get(this, "warning"),
"Your staff will inherit the highest level between it and the wand, " + Messages.get(this, "yes"),
"and all magic currently affecting the staff will be lost.", Messages.get(this, "no")) {
"Yes, i'm sure.",
"No, I changed my mind") {
@Override @Override
protected void onSelect(int index) { protected void onSelect(int index) {
if (index == 0) { if (index == 0) {

View File

@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.utils.Random; import com.watabou.utils.Random;
@ -88,87 +89,49 @@ public class MeleeWeapon extends Weapon {
@Override @Override
public String info() { public String info() {
String name = name(); String name = name();
final String p = "\n\n";
StringBuilder info = new StringBuilder( desc() ); String info = desc();
String quality = levelKnown && level() != 0 ? (level() > 0 ? "upgraded" : "degraded") : ""; info += "\n\n" + Messages.get(MeleeWeapon.class, "tier", tier);
info.append( p );
info.append( "This " + name + " is " + Utils.indefinite( quality ) );
info.append( " tier-" + tier + " melee weapon. " );
if (levelKnown) { if (levelKnown) {
int min = min(); int min = min();
int max = max(); int max = max();
info.append( "Its average damage is " + float dmgfactor = (imbue == Imbue.LIGHT ? 0.7f : imbue == Imbue.HEAVY ? 1.5f : 1);
Math.round((min + (max - min) / 2)*(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));
+ " points per hit. " );
} else { } else {
int min = minBase(); int min = minBase();
int max = maxBase(); int max = maxBase();
info.append( info += " " + Messages.get(MeleeWeapon.class, "unknown", (min + (max - min) / 2), typicalSTR());
"Its typical average damage is " + (min + (max - min) / 2) + " points per hit " +
"and usually it requires " + typicalSTR() + " points of strength. " );
if (typicalSTR() > Dungeon.hero.STR()) { 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) { switch (imbue) {
case LIGHT: case LIGHT:
info.append( "It was balanced to be lighter. " ); info += " " + Messages.get(Weapon.class, "lighter");
break; break;
case HEAVY: case HEAVY:
info.append( "It was balanced to be heavier. " ); info += " " + Messages.get(Weapon.class, "heavier");
break; break;
case NONE: case NONE:
} }
if (enchantment != null) { String stats_desc = Messages.get(this, "stats_desc");
info.append( "It is enchanted." ); 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 )) { return info;
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();
} }
@Override @Override

View File

@ -31,9 +31,5 @@ public class Quarterstaff extends MeleeWeapon {
public Quarterstaff() { public Quarterstaff() {
super( 2, 1f, 1f ); super( 2, 1f, 1f );
} }
@Override
public String desc() {
return "A staff of hardwood, its ends are shod with iron.";
}
} }

View File

@ -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() { private final WndBag.Listener itemSelector = new WndBag.Listener() {
@Override @Override
public void onSelect( Item item ) { public void onSelect( Item item ) {

View File

@ -31,9 +31,5 @@ public class Spear extends MeleeWeapon {
public Spear() { public Spear() {
super( 2, 1f, 1.5f ); super( 2, 1f, 1.5f );
} }
@Override
public String desc() {
return "A slender wooden rod tipped with sharpened iron.";
}
} }

View File

@ -31,9 +31,5 @@ public class Sword extends MeleeWeapon {
public Sword() { public Sword() {
super( 3, 1f, 1f ); super( 3, 1f, 1f );
} }
@Override
public String desc() {
return "The razor-sharp length of steel blade shines reassuringly.";
}
} }

View File

@ -31,11 +31,5 @@ public class WarHammer extends MeleeWeapon {
public WarHammer() { public WarHammer() {
super( 5, 1.2f, 1f ); 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.";
}
} }

View File

@ -24,6 +24,8 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite;
@ -113,14 +115,13 @@ public class Boomerang extends MissileWeapon {
@Override @Override
public String desc() { public String desc() {
String info = String info = super.desc();
"Thrown to the enemy this flat curved wooden missile will return to the hands of its thrower.";
switch (imbue) { switch (imbue) {
case LIGHT: case LIGHT:
info += "\n\nIt was balanced to be lighter. "; info += "\n\n" + Messages.get(Weapon.class, "lighter");
break; break;
case HEAVY: case HEAVY:
info += "\n\nIt was balanced to be heavier. "; info += "\n\n" + Messages.get(Weapon.class, "heavier");
break; break;
case NONE: case NONE:
} }

View File

@ -62,13 +62,6 @@ public class CurareDart extends MissileWeapon {
super.proc( attacker, defender, damage ); super.proc( attacker, defender, damage );
} }
@Override
public String desc() {
return
"These little evil darts don't do much damage but they can paralyze " +
"the target leaving it helpless and motionless for some time.";
}
@Override @Override
public Item random() { public Item random() {
quantity = Random.Int( 2, 5 ); quantity = Random.Int( 2, 5 );

View File

@ -51,13 +51,6 @@ public class Dart extends MissileWeapon {
quantity = number; quantity = number;
} }
@Override
public String desc() {
return
"These simple metal spikes are weighted to fly true and " +
"sting their prey with a flick of the wrist.";
}
@Override @Override
public Item random() { public Item random() {
quantity = Random.Int( 5, 15 ); quantity = Random.Int( 5, 15 );

View File

@ -76,13 +76,6 @@ public class IncendiaryDart extends MissileWeapon {
super.proc( attacker, defender, damage ); super.proc( attacker, defender, damage );
} }
@Override
public String desc() {
return
"The spike on each of these darts is designed to pin it to its target " +
"while the unstable compounds strapped to its length burst into brilliant flames.";
}
@Override @Override
public Item random() { public Item random() {
quantity = Random.Int( 3, 6 ); quantity = Random.Int( 3, 6 );

View File

@ -60,13 +60,6 @@ public class Javelin extends MissileWeapon {
Buff.prolong( defender, Cripple.class, Cripple.DURATION ); Buff.prolong( defender, Cripple.class, Cripple.DURATION );
} }
@Override
public String desc() {
return
"This length of metal is weighted to keep the spike " +
"at its tip foremost as it sails through the air.";
}
@Override @Override
public Item random() { public Item random() {
quantity = Random.Int( 5, 15 ); quantity = Random.Int( 5, 15 );

View File

@ -32,18 +32,13 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.watabou.utils.Random; import com.watabou.utils.Random;
abstract public class MissileWeapon extends Weapon { abstract public class MissileWeapon extends Weapon {
private static final String TXT_MISSILES = "Missile weapon";
private static final String TXT_YES = "Yes, I know what I'm doing";
private static final String TXT_NO = "No, I changed my mind";
private static final String TXT_R_U_SURE =
"Do you really want to equip it as a melee weapon?";
{ {
stackable = true; stackable = true;
levelKnown = true; levelKnown = true;
@ -55,8 +50,8 @@ abstract public class MissileWeapon extends Weapon {
@Override @Override
public ArrayList<String> actions( Hero hero ) { public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
if (hero.heroClass != HeroClass.HUNTRESS && hero.heroClass != HeroClass.ROGUE) { actions.remove( AC_EQUIP );
actions.remove( AC_EQUIP ); if (!isEquipped( hero )) {
actions.remove( AC_UNEQUIP ); actions.remove( AC_UNEQUIP );
} }
return actions; return actions;
@ -114,22 +109,6 @@ abstract public class MissileWeapon extends Weapon {
} }
} }
@Override
public boolean doEquip( final Hero hero ) {
GameScene.show(
new WndOptions( TXT_MISSILES, TXT_R_U_SURE, TXT_YES, TXT_NO ) {
@Override
protected void onSelect(int index) {
if (index == 0) {
MissileWeapon.super.doEquip( hero );
}
};
}
);
return false;
}
@Override @Override
public Item random() { public Item random() {
return this; return this;
@ -148,30 +127,16 @@ abstract public class MissileWeapon extends Weapon {
@Override @Override
public String info() { public String info() {
String name = name(); String info = desc();
StringBuilder info = new StringBuilder( desc() );
info.append( "\n\nAverage damage of this weapon equals to " + (min() + (max() - min()) / 2) + " points per hit. " ); info += "\n\n" + Messages.get( Weapon.class, "avg_dmg",(min() + (max() - min()) / 2));
if (Dungeon.hero.belongings.backpack.items.contains( this )) { if (STR > Dungeon.hero.STR()) {
if (STR > Dungeon.hero.STR()) { info += Messages.get(Weapon.class, "too_heavy");
info.append(
"\n\nBecause of your inadequate strength the accuracy and speed " +
"of your attack with this " + name + " is decreased." );
}
if (STR < Dungeon.hero.STR() && Dungeon.hero.heroClass == HeroClass.HUNTRESS) {
info.append(
"\n\nBecause of your excess strength the damage " +
"of your attack with this " + name + " is increased." );
}
} }
info.append( "\n\nAs this weapon is designed to be used at a distance, it is much less accurate if used at melee range."); info += "\n\n" + Messages.get(MissileWeapon.class, "distance");
if (isEquipped( Dungeon.hero )) { return info;
info.append( "\n\nYou hold the " + name + " at the ready." );
}
return info.toString();
} }
} }

View File

@ -53,13 +53,6 @@ public class Shuriken extends MissileWeapon {
quantity = number; quantity = number;
} }
@Override
public String desc() {
return
"Star-shaped pieces of metal with razor-sharp blades do significant damage " +
"when they hit a target. They can be thrown at very high rate.";
}
@Override @Override
public Item random() { public Item random() {
quantity = Random.Int( 5, 15 ); quantity = Random.Int( 5, 15 );

View File

@ -60,13 +60,6 @@ public class Tamahawk extends MissileWeapon {
Buff.affect( defender, Bleeding.class ).set( damage ); Buff.affect( defender, Bleeding.class ).set( damage );
} }
@Override
public String desc() {
return
"This throwing axe is not that heavy, but it still " +
"requires significant strength to be used effectively.";
}
@Override @Override
public Item random() { public Item random() {
quantity = Random.Int( 5, 12 ); quantity = Random.Int( 5, 12 );

View File

@ -415,13 +415,13 @@ items.armor.glyphs.viscosity$defereddamage.desc=While your armor's glyph has pro
items.armor.armor.equip_cursed=your %s constricts around you painfully items.armor.armor.equip_cursed=your %s constricts around you painfully
items.armor.armor.identify=you are now familiar enough with your %s to identify it. It is %s. items.armor.armor.identify=you are now familiar enough with your %s to identify it. It is %s.
items.armor.armor.incompatible=Interaction of different types of magic has erased the glyph on this armor! items.armor.armor.incompatible=Interaction of different types of magic has erased the glyph on this armor!
items.armor.armor.curr_absorb=\n\nThis %s provides damage absorption up to %s points per attack. items.armor.armor.curr_absorb=This armor provides damage absorption up to %d points per attack.
items.armor.armor.avg_absorb=\n\nTypical %s provides damage absorption up to %d points per attack and requires %d points of strength. items.armor.armor.avg_absorb=Typically this armor provides damage absorption up to %d points per attack and requires %d points of strength.
items.armor.armor.too_heavy=\n\nBecause of your inadequate strength wearing this armor will decrease your movement speed and defense skill. items.armor.armor.too_heavy=Because of your inadequate strength wearing this armor will decrease your movement speed and defense skill.
items.armor.armor.probably_too_heavy=\n\nProbably this armor is too heavy for you. items.armor.armor.probably_too_heavy=Probably this armor is too heavy for you.
items.armor.armor.inscribed=\n\nIt is inscribed with a %s. items.armor.armor.inscribed=It is inscribed with a %s.
items.armor.armor.cursed_word=\n\nBecause this armor is cursed, you are powerless to remove it. items.armor.armor.cursed_worn=Because this armor is cursed, you are powerless to remove it.
items.armor.armor.cursed=\n\nYou can feel a malevolent magic lurking within this armor. items.armor.armor.cursed=You can feel a malevolent magic lurking within this armor.
items.armor.armor$glyph.glyph=glyph items.armor.armor$glyph.glyph=glyph
items.armor.armor$glyph.killed=%s killed you... items.armor.armor$glyph.killed=%s killed you...
items.armor.classarmor.low_hp=Your health is too low! items.armor.classarmor.low_hp=Your health is too low!
@ -632,9 +632,9 @@ items.rings.ring.unknown_name=%s ring
items.rings.ring.unknown_desc=This metal band is adorned with a large %s gem that glitters in the darkness. Who knows what effect it has when worn? items.rings.ring.unknown_desc=This metal band is adorned with a large %s gem that glitters in the darkness. Who knows what effect it has when worn?
items.rings.ring.known=This is a %s items.rings.ring.known=This is a %s
items.rings.ring.identify=You are now familiar enough with your %s to identify it. It is %s. items.rings.ring.identify=You are now familiar enough with your %s to identify it. It is %s.
items.rings.ring.on_finger=\n\nThe %s is on your finger. items.rings.ring.on_finger=The %s is on your finger.
items.rings.ring.cursed_worn=Because it is cursed, you are powerless to remove it. items.rings.ring.cursed_worn=Because it is cursed, you are powerless to remove it.
items.rings.ring.curse_known=\n\nYou can feel a malevolent magic lurking within the %s. items.rings.ring.curse_known=You can feel a malevolent magic lurking within the %s.
items.rings.ring.unequip_title=Unequip one item items.rings.ring.unequip_title=Unequip one item
items.rings.ring.unequip_message=You can only wear two misc items at a time. items.rings.ring.unequip_message=You can only wear two misc items at a time.
items.rings.ringofaccuracy.name=ring of accuracy items.rings.ringofaccuracy.name=ring of accuracy
@ -743,7 +743,7 @@ items.wands.cursedwand.transmogrify=your wand transmogrifies into a different it
items.wands.wand.fizzles=your wand fizzles; it must not have enough charge. items.wands.wand.fizzles=your wand fizzles; it must not have enough charge.
items.wands.wand.self_target=You can't target yourself items.wands.wand.self_target=You can't target yourself
items.wands.wand.identify=You are now familiar with your %s. items.wands.wand.identify=You are now familiar with your %s.
items.wands.wand.cursed=\n\nThis wand is cursed, making its magic chaotic and random. items.wands.wand.cursed=This wand is cursed, making its magic chaotic and random.
items.wands.wand.curse_discover=This %s is cursed! items.wands.wand.curse_discover=This %s is cursed!
items.wands.wand.prompt=Choose a location to zap items.wands.wand.prompt=Choose a location to zap
items.wands.wandofblastwave.name=wand of blast wave items.wands.wandofblastwave.name=wand of blast wave
@ -791,24 +791,72 @@ items.weapon.enchantment.poison.name=venomous %s
items.weapon.enchantment.shock.name=shocking %s items.weapon.enchantment.shock.name=shocking %s
items.weapon.enchantment.slow.name=chilling %s items.weapon.enchantment.slow.name=chilling %s
items.weapon.melee.battleaxe.name=battle axe items.weapon.melee.battleaxe.name=battle axe
items.weapon.melee.battleaxe.stats_desc=This is a rather accurate weapon.
items.weapon.melee.battleaxe.desc=The enormous steel head of this battle axe puts considerable heft behind each stroke.
items.weapon.melee.dagger.name=dagger items.weapon.melee.dagger.name=dagger
items.weapon.melee.dagger.stats_desc=This is a rather accurate weapon.
items.weapon.melee.dagger.desc=A simple iron dagger with a well worn wooden handle.
items.weapon.melee.glaive.name=glaive items.weapon.melee.glaive.name=glaive
items.weapon.melee.glaive.desc=A polearm consisting of a sword blade on the end of a pole.
items.weapon.melee.knuckles.name=knuckleduster items.weapon.melee.knuckles.name=knuckleduster
items.weapon.melee.knuckles.stats_desc=This is a rather fast weapon.
items.weapon.melee.knuckles.desc=A piece of iron shaped to fit around the knuckles.
items.weapon.melee.longsword.name=longsword items.weapon.melee.longsword.name=longsword
items.weapon.melee.longsword.desc=This towering blade inflicts heavy damage by investing its heft into every cut.
items.weapon.melee.mace.name=mace items.weapon.melee.mace.name=mace
#items.weapon.melee.magesstaff.name= items.weapon.melee.mace.stats_desc=This is a slightly fast weapon.
items.weapon.melee.mace.desc=The iron head of this weapon inflicts substantial damage.
items.weapon.melee.magesstaff.name=mage's staff
items.weapon.melee.magesstaff.wand=wand
items.weapon.melee.magesstaff.staff=staff
items.weapon.melee.magesstaff.prompt=Select a wand to consume
items.weapon.melee.magesstaff.imbue=You imbue your staff with the %s.
items.weapon.melee.magesstaff.conflict=The conflicting magics erase the enchantment on your staff.
items.weapon.melee.magesstaff.id_first=You'll need to identify this wand first.
items.weapon.melee.magesstaff.cursed=You can't use a cursed wand.
items.weapon.melee.magesstaff.warning=Are you sure you want to imbue your staff with this wand?\n\nYour staff will inherit the highest level between it and the wand, and all magic currently affecting the staff will be lost.
items.weapon.melee.magesstaff.yes=Yes, I'm sure.
items.weapon.melee.magesstaff.no=No, I changed my mind
items.weapon.melee.magesstaff.desc=Crafted by the mage himself, this extraordinary staff is a one of a kind multi-purpose magical weapon. Rather than having an innate magic in it, this staff is instead imbued with magical energy from a wand, granting it new power.
items.weapon.melee.meleeweapon.tier=This a tier-%d melee weapon.
items.weapon.melee.meleeweapon.unknown=Its typical average damage per hit is %d and usually it requires %d points of strength.
items.weapon.melee.meleeweapon.probably_too_heavy=Probably this weapon is too heavy for you.
items.weapon.melee.meleeweapon.stats_desc=
items.weapon.melee.meleeweapon.cursed_worn=Because this weapon is cursed, you are powerless to remove it.
items.weapon.melee.meleeweapon.cursed=You can feel a malevolent magic lurking within this weapon.
items.weapon.melee.quarterstaff.name=quarterstaff items.weapon.melee.quarterstaff.name=quarterstaff
items.weapon.melee.quarterstaff.desc=A staff of hardwood, its ends are shod with iron.
items.weapon.melee.shortsword.name=short sword items.weapon.melee.shortsword.name=short sword
items.weapon.melee.shortsword.desc=It is indeed quite short, just a few inches longer, than a dagger.
items.weapon.melee.spear.name=spear items.weapon.melee.spear.name=spear
items.weapon.melee.spear.stats_desc=This is a rather slow weapon.
items.weapon.melee.spear.desc=A slender wooden rod tipped with sharpened iron.
items.weapon.melee.sword.name=sword items.weapon.melee.sword.name=sword
items.weapon.melee.sword.desc=The razor-sharp length of steel blade shines reassuringly.
items.weapon.melee.warhammer.name=war hammer items.weapon.melee.warhammer.name=war hammer
items.weapon.melee.warhammer.stats_desc=This is a rather accurate weapon.
items.weapon.melee.warhammer.desc=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.
items.weapon.missiles.boomerang.name=boomerang items.weapon.missiles.boomerang.name=boomerang
items.weapon.missiles.boomerang.desc=Thrown to the enemy this flat curved wooden missile will return to the hands of its thrower.
items.weapon.missiles.curaredart.name=curare dart items.weapon.missiles.curaredart.name=curare dart
items.weapon.missiles.curaredart.desc=These little evil darts don't do much damage but they can paralyze the target leaving it helpless and motionless for some time.
items.weapon.missiles.dart.name=dart items.weapon.missiles.dart.name=dart
items.weapon.weapon.missiles.incendiarydart.name=incendiary dart items.weapon.missiles.dart.desc=These simple metal spikes are weighted to fly true and sting their prey with a flick of the wrist.
items.weapon.missiles.incendiarydart.name=incendiary dart
items.weapon.missiles.incendiarydart.desc=The spike on each of these darts is designed to pin it to its target while the unstable compounds strapped to its length burst into brilliant flames.
items.weapon.missiles.javelin.name=javelin items.weapon.missiles.javelin.name=javelin
items.weapon.missiles.javelin.desc=This length of metal is weighted to keep the spike at its tip foremost as it sails through the air.
items.weapon.missiles.missileweapon.distance=This weapon is designed to be used at a distance, it is much less accurate at melee range.
items.weapon.missiles.shuriken.name=shuriken items.weapon.missiles.shuriken.name=shuriken
items.weapon.missiles.shuriken.desc=Star-shaped pieces of metal with razor-sharp blades do significant damage when they hit a target. They can be thrown at very high rate.
items.weapon.missiles.tamahawk.name=tomahawk items.weapon.missiles.tamahawk.name=tomahawk
items.weapon.missiles.tamahawk.desc=This throwing axe is not that heavy, but it still requires significant strength to be used effectively.
items.weapon.weapon.identify=You are now familiar enough with your %s to identify it. It is %s.
items.weapon.weapon.avg_dmg=Its average damage per hit is %d.
items.weapon.weapon.too_heavy=Because of your inadequate strength the accuracy and speed of your attack with this weapon will be decreased.
items.weapon.weapon.incompatible=Interaction of different types of magic has negated the enchantment on this weapon!
items.weapon.weapon.lighter=It was balanced to be lighter.
items.weapon.weapon.heavier=It was balanced to be heavier.
items.amulet.name=amulet of yendor items.amulet.name=amulet of yendor
items.ankh.name=ankh items.ankh.name=ankh