v0.6.5: replaced weightstone with runestone of augmentation

This commit is contained in:
Evan Debenham 2018-04-19 13:10:37 -04:00 committed by Evan Debenham
parent 99af96ee0e
commit 55bb6e3121
22 changed files with 335 additions and 341 deletions

View File

@ -139,7 +139,7 @@ public class WaterOfTransmutation extends WellWater {
n.levelKnown = w.levelKnown;
n.cursedKnown = w.cursedKnown;
n.cursed = w.cursed;
n.imbue = w.imbue;
n.augment = w.augment;
return n;

View File

@ -60,12 +60,8 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Flow;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Obfuscation;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Stone;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Swiftness;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Viscosity;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CapeOfThorns;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
@ -323,28 +319,19 @@ public class Hero extends Char {
@Override
public int defenseSkill( Char enemy ) {
float multiplier = 1f * RingOfEvasion.evasionMultiplier( this );
float evasion = defenseSkill;
evasion *= RingOfEvasion.evasionMultiplier( this );
if (paralysed > 0) {
multiplier /= 2;
}
int aEnc = belongings.armor != null ? belongings.armor.STRReq() - STR() : 10 - STR();
if (aEnc > 0) {
multiplier /= Math.pow( 1.5, aEnc );
}
int bonus = 0;
if (belongings.armor != null && belongings.armor.hasGlyph(Swiftness.class))
bonus += 5 + belongings.armor.level()*1.5f;
Momentum momentum = buff(Momentum.class);
if (momentum != null){
bonus += momentum.evasionBonus(Math.max(0, -aEnc));
evasion /= 2;
}
return Math.round((defenseSkill * multiplier) + bonus);
if (belongings.armor != null) {
evasion = belongings.armor.evasionFactor(this, evasion);
}
return Math.round(evasion);
}
@Override
@ -389,20 +376,10 @@ public class Hero extends Char {
float speed = super.speed();
speed *= RingOfHaste.speedMultiplier(this);
Armor armor = belongings.armor;
if (armor != null){
if (armor.hasGlyph(Swiftness.class)) {
speed *= (1.1f + 0.01f * belongings.armor.level());
} else if (armor.hasGlyph(Flow.class) && Dungeon.level.water[pos]){
speed *= (1.5f + 0.05f * belongings.armor.level());
}
}
int aEnc = armor != null ? armor.STRReq() - STR() : 0;
if (aEnc > 0) speed /= Math.pow( 1.2, aEnc );
if (belongings.armor != null) {
speed = belongings.armor.speedFactor(this, speed);
}
Momentum momentum = buff(Momentum.class);
if (momentum != null){
@ -1301,9 +1278,10 @@ public class Hero extends Char {
public int stealth() {
int stealth = super.stealth();
if (belongings.armor != null && belongings.armor.hasGlyph(Obfuscation.class)){
stealth += 1 + belongings.armor.level()/3;
if (belongings.armor != null){
stealth = Math.round(belongings.armor.stealthFactor(this, stealth));
}
return stealth;
}

View File

@ -1,181 +0,0 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2018 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
import com.watabou.noosa.audio.Sample;
import java.util.ArrayList;
public class Weightstone extends Item {
private static final float TIME_TO_APPLY = 2;
private static final String AC_APPLY = "APPLY";
{
image = ItemSpriteSheet.WEIGHT;
stackable = true;
bones = true;
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
actions.add( AC_APPLY );
return actions;
}
@Override
public void execute( Hero hero, String action ) {
super.execute( hero, action );
if (action.equals(AC_APPLY)) {
curUser = hero;
GameScene.selectItem( itemSelector, WndBag.Mode.WEAPON, Messages.get(this, "select") );
}
}
@Override
public boolean isUpgradable() {
return false;
}
@Override
public boolean isIdentified() {
return true;
}
private void apply( Weapon weapon, boolean forSpeed ) {
detach( curUser.belongings.backpack );
if (forSpeed) {
weapon.imbue = Weapon.Imbue.LIGHT;
GLog.p( Messages.get(this, "light") );
} else {
weapon.imbue = Weapon.Imbue.HEAVY;
GLog.p( Messages.get(this, "heavy") );
}
curUser.sprite.operate( curUser.pos );
Sample.INSTANCE.play( Assets.SND_MISS );
curUser.spend( TIME_TO_APPLY );
curUser.busy();
}
@Override
public int price() {
return 50 * quantity;
}
private final WndBag.Listener itemSelector = new WndBag.Listener() {
@Override
public void onSelect( Item item ) {
if (item != null) {
GameScene.show( new WndBalance( (Weapon)item ) );
}
}
};
public class WndBalance extends Window {
private static final int WIDTH = 120;
private static final int MARGIN = 2;
private static final int BUTTON_WIDTH = WIDTH - MARGIN * 2;
private static final int BUTTON_HEIGHT = 20;
public WndBalance( final Weapon weapon ) {
super();
IconTitle titlebar = new IconTitle( weapon );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
RenderedTextMultiline tfMesage = PixelScene.renderMultiline( Messages.get(this, "choice"), 8 );
tfMesage.maxWidth(WIDTH - MARGIN * 2);
tfMesage.setPos(MARGIN, titlebar.bottom() + MARGIN);
add( tfMesage );
float pos = tfMesage.top() + tfMesage.height();
if (weapon.imbue != Weapon.Imbue.LIGHT) {
RedButton btnSpeed = new RedButton( Messages.get(this, "light") ) {
@Override
protected void onClick() {
hide();
Weightstone.this.apply( weapon, true );
}
};
btnSpeed.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
add( btnSpeed );
pos = btnSpeed.bottom();
}
if (weapon.imbue != Weapon.Imbue.HEAVY) {
RedButton btnAccuracy = new RedButton( Messages.get(this, "heavy") ) {
@Override
protected void onClick() {
hide();
Weightstone.this.apply( weapon, false );
}
};
btnAccuracy.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
add( btnAccuracy );
pos = btnAccuracy.bottom();
}
RedButton btnCancel = new RedButton( Messages.get(this, "cancel") ) {
@Override
protected void onClick() {
hide();
}
};
btnCancel.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
add( btnCancel );
resize( WIDTH, (int)btnCancel.bottom() + MARGIN );
}
protected void onSelect( int index ) {};
}
}

View File

@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
@ -68,13 +69,37 @@ public class Armor extends EquipableItem {
protected static final String AC_DETACH = "DETACH";
public enum Augment {
EVASION (1.5f , -1f),
DEFENSE (-1.5f, 1f),
NONE (0f , 0f);
private float evasionFactor;
private float defenceFactor;
Augment(float eva, float df){
evasionFactor = eva;
defenceFactor = df;
}
//TODO balance on this seems good, but needs testing.
public int evasionFactor(int level){
return Math.round((2 + level) * evasionFactor);
}
public int defenseFactor(int level){
return Math.round((2 + level) * defenceFactor);
}
}
public Augment augment = Augment.NONE;
public Glyph glyph;
private BrokenSeal seal;
public int tier;
private int hitsToKnow = HITS_TO_KNOW;
public Glyph glyph;
private BrokenSeal seal;
public Armor( int tier ) {
this.tier = tier;
}
@ -82,6 +107,7 @@ public class Armor extends EquipableItem {
private static final String UNFAMILIRIARITY = "unfamiliarity";
private static final String GLYPH = "glyph";
private static final String SEAL = "seal";
private static final String AUGMENT = "augment";
@Override
public void storeInBundle( Bundle bundle ) {
@ -89,16 +115,16 @@ public class Armor extends EquipableItem {
bundle.put( UNFAMILIRIARITY, hitsToKnow );
bundle.put( GLYPH, glyph );
bundle.put( SEAL, seal);
bundle.put( AUGMENT, augment);
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle(bundle);
if ((hitsToKnow = bundle.getInt( UNFAMILIRIARITY )) == 0) {
hitsToKnow = HITS_TO_KNOW;
}
hitsToKnow = bundle.getInt( UNFAMILIRIARITY );
inscribe((Glyph) bundle.get(GLYPH));
seal = (BrokenSeal)bundle.get(SEAL);
augment = bundle.getEnum(AUGMENT, Augment.class);
}
@Override
@ -220,11 +246,12 @@ public class Armor extends EquipableItem {
}
public int DRMax(int lvl){
int effectiveTier = tier;
if (glyph != null) effectiveTier += glyph.tierDRAdjust();
effectiveTier = Math.max(0, effectiveTier);
return Math.max(DRMin(lvl), effectiveTier * (2 + lvl));
int max = tier * (2 + lvl) + augment.defenseFactor(lvl);
if (lvl > max){
return ((lvl - max)+1)/2;
} else {
return max;
}
}
public final int DRMin(){
@ -232,10 +259,57 @@ public class Armor extends EquipableItem {
}
public int DRMin(int lvl){
if (glyph != null && glyph instanceof Stone)
return 2*lvl;
else
int max = DRMax(lvl);
if (lvl >= max){
return (lvl - max);
} else {
return lvl;
}
}
public float evasionFactor( Char owner, float evasion ){
if (owner instanceof Hero){
int aEnc = STRReq() - ((Hero) owner).STR();
if (aEnc > 0) evasion /= Math.pow(1.5, aEnc);
Momentum momentum = owner.buff(Momentum.class);
if (momentum != null){
evasion += momentum.evasionBonus(Math.max(0, -aEnc));
}
}
if (hasGlyph(Swiftness.class)) {
evasion += 5 + level()*1.5f;
}
return evasion + augment.evasionFactor(level());
}
public float speedFactor( Char owner, float speed ){
if (owner instanceof Hero) {
int aEnc = STRReq() - ((Hero) owner).STR();
if (aEnc > 0) speed /= Math.pow(1.2, aEnc);
}
if (hasGlyph(Swiftness.class)) {
speed *= (1.1f + 0.01f * level());
} else if (hasGlyph(Flow.class) && Dungeon.level.water[owner.pos]){
speed *= (1.5f + 0.05f * level());
}
return speed;
}
public float stealthFactor( Char owner, float stealth ){
if (hasGlyph(Obfuscation.class)){
stealth += 1 + level()/3f;
}
return stealth;
}
@Override
@ -299,6 +373,16 @@ public class Armor extends EquipableItem {
info += " " + Messages.get(Armor.class, "probably_too_heavy");
}
}
switch (augment) {
case EVASION:
info += "\n\n" + Messages.get(Armor.class, "evasion");
break;
case DEFENSE:
info += "\n\n" + Messages.get(Armor.class, "defense");
break;
case NONE:
}
if (glyph != null && (cursedKnown || !glyph.curse())) {
info += "\n\n" + Messages.get(Armor.class, "inscribed", glyph.name());
@ -359,12 +443,9 @@ public class Armor extends EquipableItem {
public int STRReq(int lvl){
lvl = Math.max(0, lvl);
float effectiveTier = tier;
if (glyph != null) effectiveTier += glyph.tierSTRAdjust();
effectiveTier = Math.max(0, effectiveTier);
//strength req decreases at +1,+3,+6,+10,etc.
return (8 + Math.round(effectiveTier * 2)) - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
return (8 + Math.round(tier * 2)) - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
}
@Override
@ -421,6 +502,7 @@ public class Armor extends EquipableItem {
return glyph != null && (cursedKnown || !glyph.curse()) ? glyph.glowing() : null;
}
//FIXME need to adjust glyphs given armor augmentation changes
public static abstract class Glyph implements Bundlable {
private static final Class<?>[] glyphs = new Class<?>[]{
@ -467,14 +549,6 @@ public class Armor extends EquipableItem {
public abstract ItemSprite.Glowing glowing();
public int tierDRAdjust(){
return 0;
}
public float tierSTRAdjust(){
return 0;
}
public boolean checkOwner( Char owner ) {
if (!owner.isAlive() && owner instanceof Hero) {

View File

@ -128,21 +128,19 @@ abstract public class ClassArmor extends Armor {
@Override
public int STRReq(int lvl) {
lvl = Math.max(0, lvl);
float effectiveTier = armorTier;
if (glyph != null) effectiveTier += glyph.tierSTRAdjust();
effectiveTier = Math.max(0, effectiveTier);
//strength req decreases at +1,+3,+6,+10,etc.
return (8 + Math.round(effectiveTier * 2)) - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
return (8 + Math.round(armorTier * 2)) - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
}
@Override
public int DRMax(int lvl){
int effectiveTier = armorTier;
if (glyph != null) effectiveTier += glyph.tierDRAdjust();
effectiveTier = Math.max(0, effectiveTier);
return Math.max(DRMin(lvl), effectiveTier * (2 + lvl));
int max = armorTier * (2 + lvl) + augment.defenseFactor(lvl);
if (lvl > max){
return ((lvl - max)+1)/2;
} else {
return max;
}
}
@Override

View File

@ -31,7 +31,7 @@ public class Flow extends Armor.Glyph {
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
//no proc effect, see hero.speed for effect.
//no proc effect, see armor.speedfactor for effect.
return damage;
}

View File

@ -31,7 +31,7 @@ public class Obfuscation extends Armor.Glyph {
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
//no proc effect, see hero.stealth for effect.
//no proc effect, see armor.stealthfactor for effect.
return damage;
}

View File

@ -31,20 +31,10 @@ public class Swiftness extends Armor.Glyph {
@Override
public int proc(Armor armor, Char attacker, Char defender, int damage) {
//no proc effect, see hero.defenseskill and hero.speed for effect.
//no proc effect, see hero.defenseskill and armor.speedfactor for effect.
return damage;
}
@Override
public int tierDRAdjust() {
return -2;
}
@Override
public float tierSTRAdjust() {
return -1;
}
@Override
public ItemSprite.Glowing glowing() {
return YELLOW;

View File

@ -41,9 +41,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ShaftParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.AntiMagic;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Flow;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Obfuscation;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.glyphs.Swiftness;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfElements;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfPsionicBlast;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon;
@ -552,11 +549,7 @@ public class DriedRose extends Artifact {
float speed = super.speed();
if (rose != null && rose.armor != null){
if (rose.armor.hasGlyph(Swiftness.class)) {
speed *= (1.1f + 0.01f * rose.armor.level());
} else if (rose.armor.hasGlyph(Flow.class) && Dungeon.level.water[pos]){
speed *= (1.5f + 0.05f * rose.armor.level());
}
speed = rose.armor.speedFactor(this, speed);
}
return speed;
@ -566,8 +559,8 @@ public class DriedRose extends Artifact {
public int defenseSkill(Char enemy) {
int defense = super.defenseSkill(enemy);
if (defense != 0 && rose != null && rose.armor != null && rose.armor.hasGlyph(Swiftness.class)){
defense += 5 + rose.armor.level()*1.5f;
if (defense != 0 && rose != null && rose.armor != null ){
defense = Math.round(rose.armor.evasionFactor( this, defense ));
}
return defense;
@ -577,8 +570,8 @@ public class DriedRose extends Artifact {
public int stealth() {
int stealth = super.stealth();
if (rose != null && rose.armor != null && rose.armor.hasGlyph(Obfuscation.class)){
stealth += 1 + rose.armor.level()/3;
if (rose != null && rose.armor != null){
stealth = Math.round(rose.armor.stealthFactor(this, stealth));
}
return stealth;

View File

@ -64,10 +64,13 @@ public abstract class InventoryStone extends Runestone {
GameScene.selectItem( itemSelector, mode, inventoryTitle );
}
private void useAnimation() {
protected void useAnimation() {
curUser.spend( 1f );
curUser.busy();
curUser.sprite.operate(curUser.pos);
Sample.INSTANCE.play( Assets.SND_READ );
Invisibility.dispel();
}
protected abstract void onItemSelected( Item item );
@ -85,10 +88,6 @@ public abstract class InventoryStone extends Runestone {
if (item != null) {
((InventoryStone)curItem).onItemSelected( item );
((InventoryStone)curItem).useAnimation();
Sample.INSTANCE.play( Assets.SND_READ );
Invisibility.dispel();
} else{
curItem.collect( curUser.belongings.backpack );

View File

@ -0,0 +1,142 @@
/*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2018 Evan Debenham
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.items.stones;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
public class StoneOfAugmentation extends InventoryStone {
{
mode = WndBag.Mode.ENCHANTABLE;
image = ItemSpriteSheet.STONE_YNGVI;
}
@Override
protected void onItemSelected(Item item) {
GameScene.show(new WndAugment( item));
}
public void apply( Weapon weapon, Weapon.Augment augment ) {
weapon.augment = augment;
useAnimation();
ScrollOfUpgrade.upgrade(curUser);
}
public void apply( Armor armor, Armor.Augment augment ) {
armor.augment = augment;
useAnimation();
ScrollOfUpgrade.upgrade(curUser);
}
public class WndAugment extends Window {
private static final int WIDTH = 120;
private static final int MARGIN = 2;
private static final int BUTTON_WIDTH = WIDTH - MARGIN * 2;
private static final int BUTTON_HEIGHT = 20;
public WndAugment( final Item toAugment ) {
super();
IconTitle titlebar = new IconTitle( toAugment );
titlebar.setRect( 0, 0, WIDTH, 0 );
add( titlebar );
RenderedTextMultiline tfMesage = PixelScene.renderMultiline( Messages.get(this, "choice"), 8 );
tfMesage.maxWidth(WIDTH - MARGIN * 2);
tfMesage.setPos(MARGIN, titlebar.bottom() + MARGIN);
add( tfMesage );
float pos = tfMesage.top() + tfMesage.height();
if (toAugment instanceof Weapon){
for (final Weapon.Augment aug : Weapon.Augment.values()){
if (((Weapon) toAugment).augment != aug){
RedButton btnSpeed = new RedButton( Messages.get(this, aug.name()) ) {
@Override
protected void onClick() {
hide();
StoneOfAugmentation.this.apply( (Weapon)toAugment, aug );
}
};
btnSpeed.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
add( btnSpeed );
pos = btnSpeed.bottom();
}
}
} else if (toAugment instanceof Armor){
for (final Armor.Augment aug : Armor.Augment.values()){
if (((Armor) toAugment).augment != aug){
RedButton btnSpeed = new RedButton( Messages.get(this, aug.name()) ) {
@Override
protected void onClick() {
hide();
StoneOfAugmentation.this.apply( (Armor) toAugment, aug );
}
};
btnSpeed.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
add( btnSpeed );
pos = btnSpeed.bottom();
}
}
}
RedButton btnCancel = new RedButton( Messages.get(this, "cancel") ) {
@Override
protected void onClick() {
hide();
StoneOfAugmentation.this.collect();
}
};
btnCancel.setRect( MARGIN, pos + MARGIN, BUTTON_WIDTH, BUTTON_HEIGHT );
add( btnCancel );
resize( WIDTH, (int)btnCancel.bottom() + MARGIN );
}
@Override
public void onBackPressed() {
StoneOfAugmentation.this.collect();
super.onBackPressed();
}
}
}

View File

@ -54,12 +54,13 @@ public class StoneOfEnchantment extends InventoryStone {
curUser.sprite.emitter().start( Speck.factory( Speck.LIGHT ), 0.1f, 5 );
Enchanting.show( curUser, item );
//FIXME add this to translations
if (item instanceof Weapon) {
GLog.p(Messages.get(this, "weapon"));
} else {
GLog.p(Messages.get(this, "armor"));
}
useAnimation();
}
}

View File

@ -58,21 +58,19 @@ abstract public class Weapon extends KindOfWeapon {
private static final int HITS_TO_KNOW = 20;
private static final String TXT_TO_STRING = "%s :%d";
public float ACC = 1f; // Accuracy modifier
public float DLY = 1f; // Speed modifier
public int RCH = 1; // Reach modifier (only applies to melee hits)
public enum Imbue {
NONE (1.0f, 1.00f),
LIGHT (0.7f, 0.67f),
HEAVY (1.5f, 1.67f);
public enum Augment {
SPEED (0.7f, 0.67f),
DAMAGE (1.5f, 1.67f),
NONE (1.0f, 1.00f);
private float damageFactor;
private float delayFactor;
Imbue(float dmg, float dly){
Augment(float dmg, float dly){
damageFactor = dmg;
delayFactor = dly;
}
@ -85,7 +83,8 @@ abstract public class Weapon extends KindOfWeapon {
return dly * delayFactor;
}
}
public Imbue imbue = Imbue.NONE;
public Augment augment = Augment.NONE;
private int hitsToKnow = HITS_TO_KNOW;
@ -111,24 +110,29 @@ abstract public class Weapon extends KindOfWeapon {
private static final String UNFAMILIRIARITY = "unfamiliarity";
private static final String ENCHANTMENT = "enchantment";
private static final String IMBUE = "imbue";
private static final String AUGMENT = "augment";
@Override
public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle );
bundle.put( UNFAMILIRIARITY, hitsToKnow );
bundle.put( ENCHANTMENT, enchantment );
bundle.put( IMBUE, imbue );
bundle.put( AUGMENT, augment );
}
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
if ((hitsToKnow = bundle.getInt( UNFAMILIRIARITY )) == 0) {
hitsToKnow = HITS_TO_KNOW;
}
hitsToKnow = bundle.getInt( UNFAMILIRIARITY );
enchantment = (Enchantment)bundle.get( ENCHANTMENT );
imbue = bundle.getEnum( IMBUE, Imbue.class );
//pre-0.6.5 saves
if (bundle.contains( "imbue" )){
if (bundle.getString( "imbue" ).equals( "LIGHT" )) augment = Augment.SPEED;
else augment = Augment.DAMAGE;
} else {
augment = bundle.getEnum(AUGMENT, Augment.class);
}
}
@Override
@ -156,7 +160,7 @@ abstract public class Weapon extends KindOfWeapon {
encumbrance = STRReq() - ((Hero)owner).STR();
}
float DLY = imbue.delayFactor(this.DLY);
float DLY = augment.delayFactor(this.DLY);
DLY = RingOfFuror.modifyAttackDelay(DLY, owner);

View File

@ -49,7 +49,7 @@ public class AssassinsBlade extends MeleeWeapon {
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
//deals 50% toward max to max on surprise, instead of min to max.
int diff = max() - min();
int damage = imbue.damageFactor(Random.NormalIntRange(
int damage = augment.damageFactor(Random.NormalIntRange(
min() + Math.round(diff*0.50f),
max()));
int exStr = hero.STR() - STRReq();

View File

@ -51,7 +51,7 @@ public class Dagger extends MeleeWeapon {
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
//deals 75% toward max to max on surprise, instead of min to max.
int diff = max() - min();
int damage = imbue.damageFactor(Random.NormalIntRange(
int damage = augment.damageFactor(Random.NormalIntRange(
min() + Math.round(diff*0.75f),
max()));
int exStr = hero.STR() - STRReq();

View File

@ -49,7 +49,7 @@ public class Dirk extends MeleeWeapon {
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
//deals 67% toward max to max on surprise, instead of min to max.
int diff = max() - min();
int damage = imbue.damageFactor(Random.NormalIntRange(
int damage = augment.damageFactor(Random.NormalIntRange(
min() + Math.round(diff*0.67f),
max()));
int exStr = hero.STR() - STRReq();

View File

@ -52,7 +52,7 @@ public class MeleeWeapon extends Weapon {
@Override
public int damageRoll(Char owner) {
int damage = imbue.damageFactor(super.damageRoll( owner ));
int damage = augment.damageFactor(super.damageRoll( owner ));
if (owner instanceof Hero) {
int exStr = ((Hero)owner).STR() - STRReq();
@ -70,7 +70,7 @@ public class MeleeWeapon extends Weapon {
String info = desc();
if (levelKnown) {
info += "\n\n" + Messages.get(MeleeWeapon.class, "stats_known", tier, imbue.damageFactor(min()), imbue.damageFactor(max()), STRReq());
info += "\n\n" + Messages.get(MeleeWeapon.class, "stats_known", tier, augment.damageFactor(min()), augment.damageFactor(max()), STRReq());
if (STRReq() > Dungeon.hero.STR()) {
info += " " + Messages.get(Weapon.class, "too_heavy");
} else if (Dungeon.hero.STR() > STRReq()){
@ -86,12 +86,12 @@ public class MeleeWeapon extends Weapon {
String stats_desc = Messages.get(this, "stats_desc");
if (!stats_desc.equals("")) info+= "\n\n" + stats_desc;
switch (imbue) {
case LIGHT:
info += "\n\n" + Messages.get(Weapon.class, "lighter");
switch (augment) {
case SPEED:
info += "\n\n" + Messages.get(Weapon.class, "faster");
break;
case HEAVY:
info += "\n\n" + Messages.get(Weapon.class, "heavier");
case DAMAGE:
info += "\n\n" + Messages.get(Weapon.class, "stronger");
break;
case NONE:
}

View File

@ -132,12 +132,12 @@ public class Boomerang extends MissileWeapon {
@Override
public String desc() {
String info = super.desc();
switch (imbue) {
case LIGHT:
info += "\n\n" + Messages.get(Weapon.class, "lighter");
switch (augment) {
case SPEED:
info += "\n\n" + Messages.get(Weapon.class, "faster");
break;
case HEAVY:
info += "\n\n" + Messages.get(Weapon.class, "heavier");
case DAMAGE:
info += "\n\n" + Messages.get(Weapon.class, "stronger");
break;
case NONE:
}

View File

@ -182,7 +182,7 @@ abstract public class MissileWeapon extends Weapon {
@Override
public int damageRoll(Char owner) {
int damage = imbue.damageFactor(super.damageRoll( owner ));
int damage = augment.damageFactor(super.damageRoll( owner ));
damage = Math.round( damage * RingOfSharpshooting.damageMultiplier( owner ));
if (owner instanceof Hero &&
@ -253,8 +253,8 @@ abstract public class MissileWeapon extends Weapon {
String info = desc();
info += "\n\n" + Messages.get( MissileWeapon.class, "stats",
Math.round(imbue.damageFactor(min()) * RingOfSharpshooting.damageMultiplier( Dungeon.hero )),
Math.round(imbue.damageFactor(max()) * RingOfSharpshooting.damageMultiplier( Dungeon.hero )),
Math.round(augment.damageFactor(min()) * RingOfSharpshooting.damageMultiplier( Dungeon.hero )),
Math.round(augment.damageFactor(max()) * RingOfSharpshooting.damageMultiplier( Dungeon.hero )),
STRReq());
if (STRReq() > Dungeon.hero.STR()) {

View File

@ -69,7 +69,7 @@ public class ThrowingKnife extends MissileWeapon {
if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) {
//deals 75% toward max to max on surprise, instead of min to max.
int diff = max() - min();
int damage = imbue.damageFactor(Random.NormalIntRange(
int damage = augment.damageFactor(Random.NormalIntRange(
min() + Math.round(diff*0.75f),
max()));
damage = Math.round(damage * RingOfSharpshooting.damageMultiplier( hero ));

View File

@ -34,7 +34,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.MerchantsBeacon;
import com.shatteredpixel.shatteredpixeldungeon.items.Stylus;
import com.shatteredpixel.shatteredpixeldungeon.items.Torch;
import com.shatteredpixel.shatteredpixeldungeon.items.Weightstone;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.LeatherArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.MailArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.PlateArmor;
@ -53,6 +52,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.Runestone;
import com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfAugmentation;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.BattleAxe;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Greatsword;
@ -244,14 +244,8 @@ public class ShopRoom extends SpecialRoom {
break;
}
if (Dungeon.depth == 6) {
itemsToSpawn.add( new Ankh() );
itemsToSpawn.add( new Weightstone() );
} else {
itemsToSpawn.add(Random.Int(2) == 0 ? new Ankh() : new Weightstone());
}
itemsToSpawn.add( new Ankh() );
itemsToSpawn.add( new StoneOfAugmentation() );
TimekeepersHourglass hourglass = Dungeon.hero.belongings.getItem(TimekeepersHourglass.class);
if (hourglass != null){

View File

@ -77,6 +77,8 @@ items.armor.armor.avg_absorb=Typically this armor blocks _%1$d-%2$d damage_ and
items.armor.armor.too_heavy=Because of your inadequate strength wearing this armor will decrease your ability to move, evade, and defend.
items.armor.armor.probably_too_heavy=Probably this armor is too heavy for you.
items.armor.armor.excess_str=Because of your excess strength, you are _more evasive_ while wearing this armor.
items.armor.armor.evasion=It is augmented to enhance _evasion._
items.armor.armor.defense=It is augmented to enhance _defense._
items.armor.armor.inscribed=It is inscribed with a _%s._
items.armor.armor.cursed_worn=Because this armor is cursed, you are powerless to remove it.
items.armor.armor.cursed=You can feel a malevolent magic lurking within this armor.
@ -656,6 +658,17 @@ items.scrolls.scrollofupgrade.desc=This scroll will upgrade a single item, impro
###runestones
items.stones.inventorystone.ac_use=USE
items.stones.stoneofaugmentation.name=Stone of Augmentation
items.stones.stoneofaugmentation.inv_title=Augment an item
items.stones.stoneofaugmentation.desc=This runestone possesses pontent magic, which can augment equipment to enhance one property at the cost of another.\n\nUsing on a weapon will allow you to enhance either speed or damage.\n\nUsing on armor will allow you to enhance either defense or evasion.
items.stones.stoneofaugmentation$wndaugment.choice=What would you like to enhance?
items.stones.stoneofaugmentation$wndaugment.speed=Speed
items.stones.stoneofaugmentation$wndaugment.damage=Damage
items.stones.stoneofaugmentation$wndaugment.evasion=Evasion
items.stones.stoneofaugmentation$wndaugment.defense=Defense
items.stones.stoneofaugmentation$wndaugment.none=Remove Augmentation
items.stones.stoneofaugmentation$wndaugment.cancel=Never mind
items.stones.stoneofenchantment.name=Stone of Enchantment
items.stones.stoneofenchantment.inv_title=Enchant an item
items.stones.stoneofenchantment.weapon=Your weapon glows in the darkness!
@ -1023,8 +1036,8 @@ items.weapon.weapon.excess_str=Because of your excess strength, you will deal up
items.weapon.weapon.incompatible=Interaction of different types of magic has negated the enchantment on this weapon!
items.weapon.weapon.cursed_worn=Because this weapon is cursed, you are powerless to remove it.
items.weapon.weapon.cursed=You can feel a malevolent magic lurking within this weapon.
items.weapon.weapon.lighter=It was balanced to be _lighter._
items.weapon.weapon.heavier=It was balanced to be _heavier._
items.weapon.weapon.faster=It is augmented to enhance _speed._
items.weapon.weapon.stronger=It is augmented to enhance _damage._
items.weapon.weapon.enchanted=It has a _%s._
items.weapon.weapon$enchantment.enchant=enchantment
@ -1139,14 +1152,3 @@ items.tomeofmastery.desc=This worn leather book is not that thick, but you feel
items.torch.name=torch
items.torch.ac_light=LIGHT
items.torch.desc=An adventuring staple, when a dungeon goes dark, a torch can help lead the way.
items.weightstone.name=weightstone
items.weightstone.ac_apply=APPLY
items.weightstone.select=Select a weapon
items.weightstone.light=you balanced your weapon to make it lighter
items.weightstone.heavy=you balanced your weapon to make it heavier
items.weightstone.desc=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.
items.weightstone$wndbalance.choice=How would you like to balance your weapon?
items.weightstone$wndbalance.light=Lighter
items.weightstone$wndbalance.heavy=Heavier
items.weightstone$wndbalance.cancel=Never mind