diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Regeneration.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Regeneration.java index cdb6f0e7c..0cf34664a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Regeneration.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Regeneration.java @@ -48,7 +48,7 @@ public class Regeneration extends Buff { if (regenBuff.isCursed()) spend( REGENERATION_DELAY * 1.5f ); else - spend( REGENERATION_DELAY - regenBuff.level()*0.9f ); + spend( REGENERATION_DELAY - regenBuff.itemLevel()*0.9f ); else spend( REGENERATION_DELAY ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java index ebf76b0af..e2af9667f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java @@ -141,7 +141,7 @@ public class Thief extends Mob { Item item = hero.belongings.randomUnequipped(); - if (item != null && !item.unique && item.level < 1 ) { + if (item != null && !item.unique && item.level() < 1 ) { GLog.w( TXT_STOLE, this.name, item.name() ); Dungeon.quickslot.clearItem( item ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java index fb9b20b00..a456f53bb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/npcs/Ghost.java @@ -338,11 +338,11 @@ public class Ghost extends NPC { do { another = Generator.randomWeapon(10+i); } while (another instanceof MissileWeapon); - if (another.level >= weapon.level) { + if (another.level() >= weapon.level()) { weapon = (Weapon) another; } another = Generator.randomArmor(10+i); - if (another.level >= armor.level) { + if (another.level() >= armor.level()) { armor = (Armor) another; } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java index 44f300b8d..be27a626f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java @@ -20,12 +20,10 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items; -import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; -import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; import com.watabou.noosa.audio.Sample; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; @@ -35,15 +33,12 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BlastParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SmokeParticle; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; -import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.utils.Bundle; import com.watabou.utils.Random; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; public class Bomb extends Item { @@ -131,7 +126,7 @@ public class Bomb extends Item { } if (Level.flamable[c]) { - Level.set( c, Terrain.EMBERS ); + Dungeon.level.destroy( c ); GameScene.updateMap( c ); terrainAffected = true; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index ee5c2e0e4..904c7727e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -292,7 +292,7 @@ public class Heap implements Bundlable { return; //unique and upgraded items can endure the blast - } else if (!(item.level > 0 || item.unique)) + } else if (!(item.level() > 0 || item.unique)) items.remove( item ); } @@ -376,7 +376,7 @@ public class Heap implements Bundlable { //alchemists toolkit gives a chance to cook a potion in two or even one seeds AlchemistsToolkit.alchemy alchemy = Dungeon.hero.buff(AlchemistsToolkit.alchemy.class); - int bonus = alchemy != null ? alchemy.level() : -1; + int bonus = alchemy != null ? alchemy.itemLevel() : -1; if (bonus != -1 ? alchemy.tryCook(count) : count >= SEEDS_TO_POTION) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index ef064027b..01ff5b67c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -74,7 +74,8 @@ public class Item implements Bundlable { public boolean stackable = false; protected int quantity = 1; - public int level = 0; + private int level = 0; + public boolean levelKnown = false; public boolean cursed; @@ -263,6 +264,14 @@ public class Item implements Bundlable { } protected void onDetach(){} + + public int level(){ + return level; + } + + public void level( int value ){ + level = value; + } public Item upgrade() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java index f1116ef64..decfb22fe 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java @@ -28,19 +28,16 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.utils.Random; -public class KindOfWeapon extends EquipableItem { +abstract public class KindOfWeapon extends EquipableItem { private static final String TXT_EQUIP_CURSED = "you wince as your grip involuntarily tightens around your %s"; protected static final float TIME_TO_EQUIP = 1f; - public int MIN = 0; - public int MAX = 1; - @Override public ArrayList actions( Hero hero ) { ArrayList actions = super.actions( hero ); - actions.add( isEquipped( hero ) ? AC_UNEQUIP : AC_EQUIP ); + actions.add(isEquipped(hero) ? AC_UNEQUIP : AC_EQUIP); return actions; } @@ -93,9 +90,12 @@ public class KindOfWeapon extends EquipableItem { public void activate( Hero hero ) { } - + + abstract public int min(); + abstract public int max(); + public int damageRoll( Hero owner ) { - return Random.NormalIntRange( MIN, MAX ); + return Random.NormalIntRange( min(), max() ); } public float acuracyFactor( Hero hero ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java index 735bf4eb5..8af4e4a05 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Stylus.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.effects.Enchanting; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PurpleParticle; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; @@ -34,7 +35,7 @@ import java.util.ArrayList; public class Stylus extends Item { - private static final String TXT_SELECT_ARMOR = "Select an armor to inscribe on"; + private static final String TXT_SELECT_ARMOR = "Select an armor to inscribe"; private static final String TXT_INSCRIBED = "you inscribed your %s with the stylus"; private static final float TIME_TO_INSCRIBE = 2; @@ -83,17 +84,18 @@ public class Stylus extends Item { private void inscribe( Armor armor ) { - detach( curUser.belongings.backpack ); + detach(curUser.belongings.backpack); - GLog.w( TXT_INSCRIBED, armor.name() ); + GLog.w(TXT_INSCRIBED, armor.name()); armor.inscribe(); - curUser.sprite.operate( curUser.pos ); - curUser.sprite.centerEmitter().start( PurpleParticle.BURST, 0.05f, 10 ); - Sample.INSTANCE.play( Assets.SND_BURNING ); + curUser.sprite.operate(curUser.pos); + curUser.sprite.centerEmitter().start(PurpleParticle.BURST, 0.05f, 10); + Enchanting.show(curUser, armor); + Sample.INSTANCE.play(Assets.SND_BURNING); - curUser.spend( TIME_TO_INSCRIBE ); + curUser.spend(TIME_TO_INSCRIBE); curUser.busy(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index a67558a86..63211890a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -54,7 +54,6 @@ public class Armor extends EquipableItem { public int tier; public int STR; - public int DR; private int hitsToKnow = HITS_TO_KNOW; @@ -65,7 +64,6 @@ public class Armor extends EquipableItem { this.tier = tier; STR = typicalSTR(); - DR = typicalDR(); } private static final String UNFAMILIRIARITY = "unfamiliarity"; @@ -79,24 +77,24 @@ public class Armor extends EquipableItem { @Override public void restoreFromBundle( Bundle bundle ) { - super.restoreFromBundle( bundle ); + super.restoreFromBundle(bundle); if ((hitsToKnow = bundle.getInt( UNFAMILIRIARITY )) == 0) { hitsToKnow = HITS_TO_KNOW; } - inscribe( (Glyph)bundle.get( GLYPH ) ); + inscribe((Glyph) bundle.get(GLYPH)); } @Override public ArrayList actions( Hero hero ) { ArrayList actions = super.actions( hero ); - actions.add( isEquipped( hero ) ? AC_UNEQUIP : AC_EQUIP ); + actions.add(isEquipped(hero) ? AC_UNEQUIP : AC_EQUIP); return actions; } @Override public boolean doEquip( Hero hero ) { - detach( hero.belongings.backpack ); + detach(hero.belongings.backpack); if (hero.belongings.armor == null || hero.belongings.armor.doUnequip( hero, true, false )) { @@ -147,6 +145,10 @@ public class Armor extends EquipableItem { return hero.belongings.armor == this; } + public int DR(){ + return tier * (2 + level() + (glyph == null ? 0 : 1)); + } + @Override public Item upgrade() { return upgrade( false ); @@ -155,7 +157,7 @@ public class Armor extends EquipableItem { public Item upgrade( boolean inscribe ) { if (glyph != null) { - if (!inscribe && Random.Int( level ) > 0) { + if (!inscribe && Random.Int( level() ) > 0) { GLog.w( TXT_INCOMPATIBLE ); inscribe( null ); } @@ -164,8 +166,7 @@ public class Armor extends EquipableItem { inscribe( Glyph.random() ); } }; - - DR += tier; + STR--; return super.upgrade(); @@ -173,7 +174,6 @@ public class Armor extends EquipableItem { @Override public Item degrade() { - DR -= tier; STR++; return super.degrade(); @@ -214,7 +214,7 @@ public class Armor extends EquipableItem { if (levelKnown) { info.append( "\n\nThis " + name + " provides damage absorption up to " + - "" + Math.max( DR, 0 ) + " points per attack. " ); + "" + Math.max( DR(), 0 ) + " points per attack. " ); if (STR > Dungeon.hero.STR()) { @@ -297,10 +297,10 @@ public class Armor extends EquipableItem { price /= 2; } if (levelKnown) { - if (level > 0) { - price *= (level + 1); - } else if (level < 0) { - price /= (1 - level); + if (level() > 0) { + price *= (level() + 1); + } else if (level() < 0) { + price /= (1 - level()); } } if (price < 1) { @@ -310,13 +310,6 @@ public class Armor extends EquipableItem { } public Armor inscribe( Glyph glyph ) { - - if (glyph != null && this.glyph == null) { - DR += tier; - } else if (glyph == null && this.glyph != null) { - DR -= tier; - } - this.glyph = glyph; return this; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java index 3cf22b432..c4bf441e9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java @@ -39,6 +39,8 @@ abstract public class ClassArmor extends Armor { bones = false; } + + private int DR; public ClassArmor() { super( 6 ); @@ -64,7 +66,7 @@ abstract public class ClassArmor extends Armor { } classArmor.STR = armor.STR; - classArmor.DR = armor.DR; + classArmor.DR = armor.DR(); classArmor.inscribe( armor.glyph ); @@ -118,6 +120,11 @@ abstract public class ClassArmor extends Armor { abstract public String special(); abstract public void doSpecial(); + + @Override + public int DR(){ + return DR; + } @Override public boolean isUpgradable() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Affection.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Affection.java index c3418d042..c0785e2de 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Affection.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Affection.java @@ -41,7 +41,7 @@ public class Affection extends Glyph { @Override public int proc( Armor armor, Char attacker, Char defender, int damage) { - int level = (int)GameMath.gate( 0, armor.level, 6 ); + int level = (int)GameMath.gate( 0, armor.level(), 6 ); if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level / 2 + 5 ) >= 4) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/AntiEntropy.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/AntiEntropy.java index 18fdf5e0c..4ca4b373b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/AntiEntropy.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/AntiEntropy.java @@ -43,7 +43,7 @@ public class AntiEntropy extends Glyph { @Override public int proc( Armor armor, Char attacker, Char defender, int damage) { - int level = Math.max( 0, armor.level ); + int level = Math.max( 0, armor.level() ); if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 6 ) >= 5) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Bounce.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Bounce.java index a998ef03f..dec5c0ccf 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Bounce.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Bounce.java @@ -37,7 +37,7 @@ public class Bounce extends Glyph { @Override public int proc( Armor armor, Char attacker, Char defender, int damage) { - int level = Math.max( 0, armor.level ); + int level = Math.max( 0, armor.level() ); if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 5) >= 4) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Displacement.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Displacement.java index f285c9871..949606abe 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Displacement.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Displacement.java @@ -44,7 +44,7 @@ public class Displacement extends Glyph { return damage; } - int nTries = (armor.level < 0 ? 1 : armor.level + 1) * 5; + int nTries = (armor.level() < 0 ? 1 : armor.level() + 1) * 5; for (int i=0; i < nTries; i++) { int pos = Random.Int( Level.LENGTH ); if (Dungeon.visible[pos] && Level.passable[pos] && Actor.findChar( pos ) == null) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Entanglement.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Entanglement.java index d942cdd43..8889fb6c1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Entanglement.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Entanglement.java @@ -42,7 +42,7 @@ public class Entanglement extends Glyph { @Override public int proc( Armor armor, Char attacker, Char defender, int damage ) { - int level = Math.max( 0, armor.level ); + int level = Math.max( 0, armor.level() ); if (Random.Int( 4 ) == 0) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Metabolism.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Metabolism.java index 51e435fc2..535553086 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Metabolism.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Metabolism.java @@ -40,7 +40,7 @@ public class Metabolism extends Glyph { @Override public int proc( Armor armor, Char attacker, Char defender, int damage) { - int level = Math.max( 0, armor.level ); + int level = Math.max( 0, armor.level() ); if (Random.Int( level / 2 + 5 ) >= 4) { int healing = Math.min( defender.HT - defender.HP, Random.Int( 1, defender.HT / 5 ) ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Multiplicity.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Multiplicity.java index f8f036f32..ef3ee635f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Multiplicity.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Multiplicity.java @@ -44,7 +44,7 @@ public class Multiplicity extends Glyph { @Override public int proc( Armor armor, Char attacker, Char defender, int damage) { - int level = Math.max( 0, armor.level ); + int level = Math.max( 0, armor.level() ); if (Random.Int( level / 2 + 6 ) >= 5) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Potential.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Potential.java index 7301d57ae..aca59abf5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Potential.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Potential.java @@ -41,7 +41,7 @@ public class Potential extends Glyph { @Override public int proc( Armor armor, Char attacker, Char defender, int damage) { - int level = Math.max( 0, armor.level ); + int level = Math.max( 0, armor.level() ); if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 7 ) >= 6) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stench.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stench.java index db915f2de..9b2be94cf 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stench.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Stench.java @@ -40,7 +40,7 @@ public class Stench extends Glyph { @Override public int proc( Armor armor, Char attacker, Char defender, int damage) { - int level = Math.max( 0, armor.level ); + int level = Math.max( 0, armor.level() ); if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 5 ) >= 4) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Viscosity.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Viscosity.java index b9c673de1..a5f6d6a19 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Viscosity.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/Viscosity.java @@ -49,7 +49,7 @@ public class Viscosity extends Glyph { return 0; } - int level = Math.max( 0, armor.level ); + int level = Math.max( 0, armor.level() ); if (Random.Int( level + 7 ) >= 6) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java index 3d4a6a7b3..3d10e4e09 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/AlchemistsToolkit.java @@ -43,7 +43,6 @@ public class AlchemistsToolkit extends Artifact { name = "Alchemists Toolkit"; image = ItemSpriteSheet.ARTIFACT_TOOLKIT; - level = 0; levelCap = 10; } @@ -79,7 +78,7 @@ public class AlchemistsToolkit extends Artifact { @Override public ArrayList actions( Hero hero ) { ArrayList actions = super.actions( hero ); - if (isEquipped( hero ) && level < levelCap && !cursed) + if (isEquipped( hero ) && level() < levelCap && !cursed) actions.add(AC_BREW); return actions; } @@ -120,15 +119,15 @@ public class AlchemistsToolkit extends Artifact { GLog.i("Your mixture is complete, but none of the potions you used seem to react well. " + "The brew is useless, you throw it away."); - } else if (score > level) { + } else if (score > level()) { - level = score; + level(score); seedsToPotion = 0; bstGuess = curGuess; this.numRight = numRight; this.numWrongPlace = numWrongPlace; - if (level == 10){ + if (level() == 10){ bstGuess = new ArrayList(); GLog.p("The mixture you've created seems perfect, you don't think there is any way to improve it!"); } else { @@ -174,10 +173,10 @@ public class AlchemistsToolkit extends Artifact { else result += "The toolkit rests on your hip, the various tools inside make a light jingling sound as you move.\n\n"; - if (level == 0){ + if (level() == 0){ result += "The toolkit seems to be missing a key tool, a catalyst mixture. You'll have to make your own " + "out of three common potions to get the most out of the toolkit."; - } else if (level == 10) { + } else if (level() == 10) { result += "The mixture you have created seems perfect, and the toolkit is working at maximum efficiency."; } else if (!bstGuess.isEmpty()) { result += "Your current best mixture is made from: " + bstGuess.get(0) + ", " + bstGuess.get(1) + ", " @@ -236,8 +235,8 @@ public class AlchemistsToolkit extends Artifact { //this logic is handled inside the class with a variable so that it may be stored. //to prevent manipulation where a player could keep throwing in 1-2 seeds until they get lucky. if (seedsToPotion == 0){ - if (Random.Int(20) < 10+level){ - if (Random.Int(20) < level){ + if (Random.Int(20) < 10+level()){ + if (Random.Int(20) < level()){ seedsToPotion = 1; } else seedsToPotion = 2; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java index f5a0617b3..4bb9e995b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/Artifact.java @@ -188,7 +188,7 @@ public class Artifact extends KindofMisc { @Override public int visiblyUpgraded() { - return ((level*10)/levelCap); + return ((level()*10)/levelCap); } //transfers upgrades from another artifact, transfer level will equal the displayed level @@ -212,7 +212,7 @@ public class Artifact extends KindofMisc { @Override public String toString() { - if (levelKnown && level/levelCap != 0) { + if (levelKnown && level()/levelCap != 0) { if (chargeCap > 0) { return Utils.format( TXT_TO_STRING_LVL_CHARGE, name(), visiblyUpgraded(), charge, chargeCap ); } else { @@ -273,8 +273,8 @@ public class Artifact extends KindofMisc { @Override public int price() { int price = 100; - if (level > 0) - price += 50*((level*10)/levelCap); + if (level() > 0) + price += 50*((level()*10)/levelCap); if (cursed && cursedKnown) { price /= 2; } @@ -293,8 +293,8 @@ public class Artifact extends KindofMisc { public class ArtifactBuff extends Buff { - public int level() { - return level; + public int itemLevel() { + return level(); } public boolean isCursed() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java index 475e8298d..4845a9bb9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CapeOfThorns.java @@ -34,7 +34,6 @@ public class CapeOfThorns extends Artifact { name = "Cape of Thorns"; image = ItemSpriteSheet.ARTIFACT_CAPE; - level = 0; levelCap = 10; charge = 0; @@ -85,10 +84,10 @@ public class CapeOfThorns extends Artifact { public int proc(int damage, Char attacker, Char defender){ if (cooldown == 0){ - charge += damage*(0.5+level*0.05); + charge += damage*(0.5+level()*0.05); if (charge >= chargeCap){ charge = 0; - cooldown = 10+level; + cooldown = 10+level(); GLog.p("Your Cape begins radiating energy, you feel protected!"); BuffIndicator.refreshHero(); } @@ -104,8 +103,8 @@ public class CapeOfThorns extends Artifact { exp+= deflected; - if (exp >= (level+1)*5 && level < levelCap){ - exp -= (level+1)*5; + if (exp >= (level()+1)*5 && level() < levelCap){ + exp -= (level()+1)*5; upgrade(); GLog.p("Your Cape grows stronger!"); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java index 9945a02fb..399cd16cf 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java @@ -52,7 +52,6 @@ public class ChaliceOfBlood extends Artifact { name = "Chalice of Blood"; image = ItemSpriteSheet.ARTIFACT_CHALICE1; - level = 0; levelCap = 10; } @@ -61,7 +60,7 @@ public class ChaliceOfBlood extends Artifact { @Override public ArrayList actions( Hero hero ) { ArrayList actions = super.actions( hero ); - if (isEquipped( hero ) && level < levelCap && !cursed) + if (isEquipped( hero ) && level() < levelCap && !cursed) actions.add(AC_PRICK); return actions; } @@ -71,7 +70,7 @@ public class ChaliceOfBlood extends Artifact { super.execute(hero, action); if (action.equals(AC_PRICK)){ - int damage = 3*(level*level); + int damage = 3*(level()*level()); if (damage > hero.HP*0.75) { @@ -92,7 +91,7 @@ public class ChaliceOfBlood extends Artifact { } private void prick(Hero hero){ - int damage = 3*(level*level); + int damage = 3*(level()*level()); Earthroot.Armor armor = hero.buff(Earthroot.Armor.class); if (armor != null) { @@ -133,9 +132,9 @@ public class ChaliceOfBlood extends Artifact { @Override public Item upgrade() { - if (level >= 6) + if (level() >= 6) image = ItemSpriteSheet.ARTIFACT_CHALICE3; - else if (level >= 2) + else if (level() >= 2) image = ItemSpriteSheet.ARTIFACT_CHALICE2; return super.upgrade(); } @@ -148,7 +147,7 @@ public class ChaliceOfBlood extends Artifact { @Override public String desc() { String desc = "This shining silver chalice is oddly adorned with sharp gems at the rim. "; - if (level < levelCap) + if (level() < levelCap) desc += "The chalice is pulling your attention strangely, you feel like it wants something from you."; else desc += "The chalice is full and radiating energy."; @@ -157,15 +156,15 @@ public class ChaliceOfBlood extends Artifact { desc += "\n\n"; if (cursed) desc += "The cursed chalice has bound itself to your hand, and is slowly tugging at your life energy."; - else if (level == 0) + else if (level() == 0) desc += "As you hold the chalice, you feel oddly compelled to prick yourself on the sharp gems."; - else if (level < 3) + else if (level() < 3) desc += "Some of your blood is pooled into the chalice, you can subtly feel the chalice feeding life " + "energy into you. You still want to cut yourself on the chalice, even though you know it will hurt."; - else if (level < 7) + else if (level() < 7) desc += "The chalice is about half full of your blood and you can feel it feeding life energy " + "into you. you still want to hurt yourself, the chalice needs your energy, it's your friend."; - else if (level < levelCap) + else if (level() < levelCap) desc += "The chalice is getting pretty full, and the life force it's feeding you is stronger than " + "ever. You should give it more energy, you need too, your friend needs your energy, it needs " + "your help. Your friend knows you have limits though, it doesn't want you to die, just bleed."; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java index 0f08ab962..7172c7277 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java @@ -43,13 +43,12 @@ public class CloakOfShadows extends Artifact { name = "Cloak of Shadows"; image = ItemSpriteSheet.ARTIFACT_CLOAK; - level = 0; exp = 0; levelCap = 15; - charge = level+5; + charge = level()+5; partialCharge = 0; - chargeCap = level+5; + chargeCap = level()+5; cooldown = 0; @@ -145,11 +144,11 @@ public class CloakOfShadows extends Artifact { String desc = "This light silken cloak shimmers in and out of your vision as it sways in the air. When worn, " + "it can be used to hide your presence for a short time.\n\n"; - if (level < 5) + if (level() < 5) desc += "The cloak's magic has faded and it is not very powerful, perhaps it will regain strength through use."; - else if (level < 10) + else if (level() < 10) desc += "The cloak's power has begun to return."; - else if (level < 15) + else if (level() < 15) desc += "The cloak has almost returned to full strength."; else desc += "The cloak is at full potential and will work for extended durations."; @@ -239,9 +238,9 @@ public class CloakOfShadows extends Artifact { if (turnsToCost == 0) exp += 10 + ((Hero)target).lvl; - if (exp >= (level+1)*50 && level < levelCap) { + if (exp >= (level()+1)*50 && level() < levelCap) { upgrade(); - exp -= level*50; + exp -= level()*50; GLog.p("Your cloak grows stronger!"); } @@ -259,9 +258,9 @@ public class CloakOfShadows extends Artifact { exp += 10 + ((Hero)target).lvl; - if (exp >= (level+1)*50 && level < levelCap) { + if (exp >= (level()+1)*50 && level() < levelCap) { upgrade(); - exp -= level*50; + exp -= level()*50; GLog.p("Your cloak grows stronger!"); } @@ -295,7 +294,7 @@ public class CloakOfShadows extends Artifact { if (target.invisible > 0) target.invisible--; stealthed = false; - cooldown = 10 - (level / 3); + cooldown = 10 - (level() / 3); updateQuickslot(); super.detach(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index 864f40877..9640f8a69 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -55,7 +55,6 @@ public class DriedRose extends Artifact { name = "Dried Rose"; image = ItemSpriteSheet.ARTIFACT_ROSE1; - level = 0; levelCap = 10; charge = 100; @@ -103,7 +102,7 @@ public class DriedRose extends Artifact { } if (spawnPoints.size() > 0) { - GhostHero ghost = new GhostHero( level ); + GhostHero ghost = new GhostHero( level() ); ghost.pos = Random.element(spawnPoints); GameScene.add(ghost, 1f); @@ -144,10 +143,10 @@ public class DriedRose extends Artifact { if (!cursed){ desc += "\n\nThe rose rests in your hand, it feels strangely warm."; - if (level < 5) + if (level() < 5) desc+= "\n\nThe rose has lost most of its petals. It feels extremely frail, like it " + "could snap any moment."; - else if (level < 10) + else if (level() < 10) desc+= "\n\nYou have reattached many petals and the rose has started to somehow come back to life."+ " It almost looks like it's ready to bloom."; else @@ -167,13 +166,13 @@ public class DriedRose extends Artifact { @Override public Item upgrade() { - if (level >= 9) + if (level() >= 9) image = ItemSpriteSheet.ARTIFACT_ROSE3; - else if (level >= 4) + else if (level() >= 4) image = ItemSpriteSheet.ARTIFACT_ROSE2; //For upgrade transferring via well of transmutation - droppedPetals = Math.max( level, droppedPetals ); + droppedPetals = Math.max( level(), droppedPetals ); return super.upgrade(); } @@ -261,13 +260,13 @@ public class DriedRose extends Artifact { if (rose == null){ GLog.w("You have no rose to add this petal to."); return false; - } if ( rose.level >= rose.levelCap ){ + } if ( rose.level() >= rose.levelCap ){ GLog.i("There is no room left for this petal, so you discard it."); return true; } else { rose.upgrade(); - if (rose.level == rose.levelCap) { + if (rose.level() == rose.levelCap) { GLog.p("The rose is completed!"); Sample.INSTANCE.play( Assets.SND_GHOST ); GLog.n("sad ghost: \"Thank you...\""); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java index ed47fb4fc..82781072d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java @@ -49,7 +49,6 @@ public class EtherealChains extends Artifact { name = "ethereal chains"; image = ItemSpriteSheet.ARTIFACT_CHAINS; - level = 0; levelCap = 5; exp = 0; @@ -207,7 +206,7 @@ public class EtherealChains extends Artifact { @Override public boolean act() { - int chargeTarget = 5+(level*2); + int chargeTarget = 5+(level()*2); LockedFloor lock = target.buff(LockedFloor.class); if (charge < chargeTarget && !cursed && (lock == null || lock.regenOn())) { partialCharge += 1 / (40f - (chargeTarget - charge)*2f); @@ -233,13 +232,13 @@ public class EtherealChains extends Artifact { exp += Math.round(levelPortion*100); //past the soft charge cap, gaining charge from leveling is slowed. - if (charge > 5+(level*2)){ - levelPortion *= (5+((float)level*2))/charge; + if (charge > 5+(level()*2)){ + levelPortion *= (5+((float)level()*2))/charge; } partialCharge += levelPortion*10f; - if (exp > 100+level*50 && level < levelCap){ - exp -= 100+level*50; + if (exp > 100+level()*50 && level() < levelCap){ + exp -= 100+level()*50; GLog.p("Your chains grow stronger!"); upgrade(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java index 44e4d66a9..6e81a7f03 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java @@ -49,7 +49,6 @@ public class HornOfPlenty extends Artifact { name = "Horn of Plenty"; image = ItemSpriteSheet.ARTIFACT_HORN1; - level = 0; levelCap = 30; charge = 0; @@ -74,7 +73,7 @@ public class HornOfPlenty extends Artifact { ArrayList actions = super.actions( hero ); if (isEquipped( hero ) && charge > 0) actions.add(AC_EAT); - if (isEquipped( hero ) && level < 30 && !cursed) + if (isEquipped( hero ) && level() < 30 && !cursed) actions.add(AC_STORE); return actions; } @@ -158,7 +157,7 @@ public class HornOfPlenty extends Artifact { if (!cursed) { desc += "\n\nThe horn rests at your side and is surprisingly lightweight, even with food in it."; - if (level < 15) + if (level() < 15) desc += " Perhaps there is a way to increase the horn's power by giving it food energy."; } else { desc += "\n\nThe cursed horn has bound itself to your side, " + @@ -178,7 +177,7 @@ public class HornOfPlenty extends Artifact { //generates 0.25 food value every round, +0.015 value per level //to a max of 0.70 food value per round (0.25+0.5, at level 30) - partialCharge += 0.25f + (0.015f*level); + partialCharge += 0.25f + (0.015f*level()); //charge is in increments of 36 food value. if (partialCharge >= 36) { @@ -224,8 +223,8 @@ public class HornOfPlenty extends Artifact { hero.spend( TIME_TO_EAT ); curItem.upgrade(((Food)item).hornValue); - if (curItem.level >= 30){ - curItem.level = 30; + if (curItem.level() >= 30){ + curItem.level(30); GLog.p("your horn has consumed all the food it can!"); } else GLog.p("the horn consumes your food offering and grows in strength!"); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java index 461bd98bc..89b904902 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/LloydsBeacon.java @@ -86,11 +86,10 @@ public class LloydsBeacon extends Artifact { name = "lloyd's beacon"; image = ItemSpriteSheet.ARTIFACT_BEACON; - level = 0; levelCap = 3; charge = 0; - chargeCap = 3+level; + chargeCap = 3+level(); defaultAction = AC_ZAP; usesTargeting = true; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java index c4047c9e8..064965cde 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/MasterThievesArmband.java @@ -30,7 +30,6 @@ public class MasterThievesArmband extends Artifact { name = "Master Thieves' Armband"; image = ItemSpriteSheet.ARTIFACT_ARMBAND; - level = 0; levelCap = 10; charge = 0; @@ -84,7 +83,7 @@ public class MasterThievesArmband extends Artifact { exp += value; } } - while(exp >= 600 && level < levelCap) { + while(exp >= 600 && level() < levelCap) { exp -= 600; upgrade(); } @@ -93,7 +92,7 @@ public class MasterThievesArmband extends Artifact { public float stealChance(int value){ //get lvl*100 gold or lvl*5% item value of free charge, whichever is less. - int chargeBonus = Math.min(level*100, (value*level)/20); + int chargeBonus = Math.min(level()*100, (value*level())/20); return (((float)charge + chargeBonus)/value); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java index 9e546b829..ccd390605 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/SandalsOfNature.java @@ -47,7 +47,6 @@ public class SandalsOfNature extends Artifact { name = "Sandals of Nature"; image = ItemSpriteSheet.ARTIFACT_SANDALS; - level = 0; levelCap = 3; charge = 0; @@ -69,7 +68,7 @@ public class SandalsOfNature extends Artifact { @Override public ArrayList actions( Hero hero ) { ArrayList actions = super.actions( hero ); - if (isEquipped( hero ) && level < 3 && !cursed) + if (isEquipped( hero ) && level() < 3 && !cursed) actions.add(AC_FEED); if (isEquipped( hero ) && charge > 0) actions.add(AC_ROOT); @@ -81,7 +80,7 @@ public class SandalsOfNature extends Artifact { super.execute(hero, action); if (action.equals(AC_FEED)){ GameScene.selectItem(itemSelector, mode, inventoryTitle); - } else if (action.equals(AC_ROOT) && level > 0){ + } else if (action.equals(AC_ROOT) && level() > 0){ if (!isEquipped( hero )) GLog.i("You need to equip them to do that."); else if (charge == 0) GLog.i("They have no energy right now."); @@ -104,13 +103,13 @@ public class SandalsOfNature extends Artifact { @Override public String desc() { String desc = ""; - if (level == 0) + if (level() == 0) desc += "What initially seem like sandals made of twine are actually two plants! The footwear moves ever " + "so slightly when being held. They seem very weak and pale, perhaps they need to be given nutrients?"; - else if (level == 1) + else if (level() == 1) desc += "The footwear has grown and now more closely resemble two tailored shoes. They seem to match the " + "contours of your feet exactly. Some colour has returned to them, perhaps they can still grow further?"; - else if (level == 2) + else if (level() == 2) desc += "The plants have grown again and now resembles a pair of solid tall boots. They appear to be made" + " of solid bark more than vine now, yet are still very flexible. The plants seem to have " + "regained their strength, but perhaps they can still grow further"; @@ -121,15 +120,15 @@ public class SandalsOfNature extends Artifact { if ( isEquipped ( Dungeon.hero ) ){ desc += "\n\n"; - if (level == 0) { + if (level() == 0) { if (!cursed) desc += "The sandals wrap snugly around your feet, they seem happy to be worn."; else desc += "The cursed sandals wrap tightly around your feet."; } - else if (level == 1) + else if (level() == 1) desc += "The shoes fit on loosely but quickly tighten to make a perfect fit."; - else if (level == 2) + else if (level() == 2) desc += "The boots fit snugly and add a nice heft to your step."; else desc += "The greaves are thick and weighty, but very easy to move in, as if they are moving with you."; @@ -139,7 +138,7 @@ public class SandalsOfNature extends Artifact { else desc += " They are blocking any attunement with nature."; - if (level > 0) + if (level() > 0) desc += "\n\nThe footwear has gained the ability to form up into a sort of immobile natural armour, " + "but will need to charge up for it."; } @@ -159,15 +158,15 @@ public class SandalsOfNature extends Artifact { @Override public Item upgrade() { - if (level < 0) + if (level() < 0) image = ItemSpriteSheet.ARTIFACT_SANDALS; - else if (level == 0) + else if (level() == 0) image = ItemSpriteSheet.ARTIFACT_SHOES; - else if (level == 1) + else if (level() == 1) image = ItemSpriteSheet.ARTIFACT_BOOTS; - else if (level >= 2) + else if (level() >= 2) image = ItemSpriteSheet.ARTIFACT_GREAVES; - name = NAMES[level+1]; + name = NAMES[level()+1]; return super.upgrade(); } @@ -194,7 +193,7 @@ public class SandalsOfNature extends Artifact { public void charge() { if (charge < target.HT){ //gain 1+(1*level)% of the difference between current charge and max HP. - charge+= (Math.round( (target.HT-charge) * (.01+ level*0.01) )); + charge+= (Math.round( (target.HT-charge) * (.01+ level()*0.01) )); updateQuickslot(); } } @@ -214,11 +213,11 @@ public class SandalsOfNature extends Artifact { Sample.INSTANCE.play( Assets.SND_PLANT ); hero.busy(); hero.spend( 2f ); - if (seeds.size() >= 5+(level*2)){ + if (seeds.size() >= 5+(level()*2)){ seeds.clear(); upgrade(); - if (level >= 1 && level <= 3) { - GLog.p("Your " + NAMES[level-1] + " surge in size, they are now " + NAMES[level] + "!"); + if (level() >= 1 && level() <= 3) { + GLog.p("Your " + NAMES[level()-1] + " surge in size, they are now " + NAMES[level()] + "!"); } } else { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java index 1432e37a2..1183cf59b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TalismanOfForesight.java @@ -42,7 +42,6 @@ public class TalismanOfForesight extends Artifact { name = "Talisman of Foresight"; image = ItemSpriteSheet.ARTIFACT_TALISMAN; - level = 0; exp = 0; levelCap = 10; @@ -175,7 +174,7 @@ public class TalismanOfForesight extends Artifact { //fully charges in 2500 turns at lvl=0, scaling to 1000 turns at lvl = 10. LockedFloor lock = target.buff(LockedFloor.class); if (charge < chargeCap && !cursed && (lock == null || lock.regenOn())) { - partialCharge += 0.04+(level*0.006); + partialCharge += 0.04+(level()*0.006); if (partialCharge > 1 && charge < chargeCap) { partialCharge--; @@ -190,9 +189,9 @@ public class TalismanOfForesight extends Artifact { } public void charge(){ - charge = Math.min(charge+(2+(level/3)), chargeCap); + charge = Math.min(charge+(2+(level()/3)), chargeCap); exp++; - if (exp >= 4 && level < levelCap) { + if (exp >= 4 && level() < levelCap) { upgrade(); GLog.p("Your Talisman grows stronger!"); exp -= 4; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java index b68a079cb..347e38d67 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/TimekeepersHourglass.java @@ -53,12 +53,11 @@ public class TimekeepersHourglass extends Artifact { name = "Timekeeper's Hourglass"; image = ItemSpriteSheet.ARTIFACT_HOURGLASS; - level = 0; levelCap = 5; - charge = 10+level*2; + charge = 10+level()*2; partialCharge = 0; - chargeCap = 10+level*2; + chargeCap = 10+level()*2; defaultAction = AC_ACTIVATE; } @@ -139,7 +138,7 @@ public class TimekeepersHourglass extends Artifact { chargeCap+= 2; //for artifact transmutation. - while (level+1 > sandBags) + while (level()+1 > sandBags) sandBags ++; return super.upgrade(); @@ -156,7 +155,7 @@ public class TimekeepersHourglass extends Artifact { if (!cursed) { desc += "\n\nThe hourglass rests at your side, the whisper of steadily pouring sand is reassuring."; - if (level < levelCap ) + if (level() < levelCap ) desc += "\n\nThe hourglass seems to have lost some sand with age. While there are no cracks, " + "there is a port on the top of the hourglass to pour sand in, if only you could find some..."; @@ -363,7 +362,7 @@ public class TimekeepersHourglass extends Artifact { if (hourglass != null && !hourglass.cursed) { hourglass.upgrade(); Sample.INSTANCE.play( Assets.SND_DEWDROP ); - if (hourglass.level == hourglass.levelCap) + if (hourglass.level() == hourglass.levelCap) GLog.p("Your hourglass is filled with magical sand!"); else GLog.i("you add the sand to your hourglass."); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java index 13db55692..a95a0b467 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/UnstableSpellbook.java @@ -49,12 +49,11 @@ public class UnstableSpellbook extends Artifact { name = "Unstable Spellbook"; image = ItemSpriteSheet.ARTIFACT_SPELLBOOK; - level = 0; levelCap = 10; - charge = ((level/2)+3); + charge = ((level()/2)+3); partialCharge = 0; - chargeCap = ((level/2)+3); + chargeCap = ((level()/2)+3); defaultAction = AC_READ; } @@ -87,7 +86,7 @@ public class UnstableSpellbook extends Artifact { ArrayList actions = super.actions( hero ); if (isEquipped( hero ) && charge > 0 && !cursed) actions.add(AC_READ); - if (isEquipped( hero ) && level < levelCap && !cursed) + if (isEquipped( hero ) && level() < levelCap && !cursed) actions.add(AC_ADD); return actions; } @@ -129,10 +128,10 @@ public class UnstableSpellbook extends Artifact { @Override public Item upgrade() { - chargeCap = (((level+1)/2)+3); + chargeCap = (((level()+1)/2)+3); //for artifact transmutation. - while (scrolls.size() > (levelCap-1-level)) + while (scrolls.size() > (levelCap-1-level())) scrolls.remove(0); return super.upgrade(); @@ -142,9 +141,9 @@ public class UnstableSpellbook extends Artifact { public String desc() { String desc = "This Tome is in surprising good condition given its age. "; - if (level < 3) + if (level() < 3) desc += "It emanates a strange chaotic energy. "; - else if (level < 7) + else if (level() < 7) desc += "It glows with a strange chaotic energy. "; else desc += "It fizzes and crackles as you move the pages, surging with unstable energy. "; @@ -165,7 +164,7 @@ public class UnstableSpellbook extends Artifact { } - if (level < levelCap) + if (level() < levelCap) if (scrolls.size() > 1) desc += "The book's index points to some pages which are blank. " + "Those pages are listed as: " + scrolls.get(0) + " and " diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java index 26cde2147..02b07fe9a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java @@ -61,12 +61,20 @@ public class Pickaxe extends Weapon { defaultAction = AC_MINE; STR = 14; - MIN = 3; - MAX = 12; } public boolean bloodStained = false; - + + @Override + public int min() { + return 3; + } + + @Override + public int max() { + return 12; + } + @Override public ArrayList actions( Hero hero ) { ArrayList actions = super.actions( hero ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java index 59af25966..bebd53a75 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/Ring.java @@ -283,10 +283,10 @@ public class Ring extends KindofMisc { } if (Random.Float() < 0.3f) { - level = -n; + level(-n); cursed = true; } else - level = n; + level(n); return this; } @@ -302,10 +302,10 @@ public class Ring extends KindofMisc { price /= 2; } if (levelKnown) { - if (level > 0) { - price *= (level + 1); - } else if (level < 0) { - price /= (1 - level); + if (level() > 0) { + price *= (level() + 1); + } else if (level() < 0) { + price /= (1 - level()); } } if (price < 1) { @@ -340,7 +340,7 @@ public class Ring extends KindofMisc { public int level; public RingBuff() { - level = Ring.this.level; + level = Ring.this.level(); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java index eaf34b1d2..13088b4ed 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java @@ -43,7 +43,7 @@ public class RingOfForce extends Ring { "When unarmed, at your current strength, "; int str = Dungeon.hero.STR() - 8; desc += levelKnown ? - "average damage with this ring is " + (str/2+level + (int)(str*0.5f*level) + str*2)/2 + " points per hit.": + "average damage with this ring is " + (str/2+level() + (int)(str*0.5f*level()) + str*2)/2 + " points per hit.": "typical average damage with this ring is" + (str/2+1 + (int)(str*0.5f) + str*2)/2 + " points per hit."; desc += " Wearing a second ring of force would enhance this."; return desc; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java index cf1043a19..95dc9851a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/InventoryScroll.java @@ -79,7 +79,7 @@ public abstract class InventoryScroll extends Scroll { if (item != null) { ((InventoryScroll)curItem).onItemSelected( item ); - curUser.spendAndNext( TIME_TO_READ ); + ((InventoryScroll)curItem).readAnimation(); Sample.INSTANCE.play( Assets.SND_READ ); Invisibility.dispel(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java index dff71a016..aecfb7901 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/Scroll.java @@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellbook; +import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.utils.Bundle; @@ -143,6 +144,12 @@ public abstract class Scroll extends Item { } abstract protected void doRead(); + + protected void readAnimation() { + curUser.spend( TIME_TO_READ ); + curUser.busy(); + ((HeroSprite)curUser.sprite).read(); + } public boolean isKnown() { return handler.isKnown( this ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java index 5e78f70cd..98daeeac9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfLullaby.java @@ -57,8 +57,8 @@ public class ScrollOfLullaby extends Scroll { GLog.i( "The scroll utters a soothing melody. You feel very sleepy." ); setKnown(); - - curUser.spendAndNext( TIME_TO_READ ); + + readAnimation(); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicMapping.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicMapping.java index 25ef601ab..ba35aa3aa 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicMapping.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicMapping.java @@ -83,8 +83,8 @@ public class ScrollOfMagicMapping extends Scroll { Invisibility.dispel(); setKnown(); - - curUser.spendAndNext( TIME_TO_READ ); + + readAnimation(); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicalInfusion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicalInfusion.java index 74ff35439..4ca367801 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicalInfusion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMagicalInfusion.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.scrolls; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.effects.Enchanting; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; @@ -46,7 +47,7 @@ public class ScrollOfMagicalInfusion extends InventoryScroll { @Override protected void onItemSelected( Item item ) { - ScrollOfRemoveCurse.uncurse( Dungeon.hero, item ); + ScrollOfRemoveCurse.uncurse(Dungeon.hero, item); if (item instanceof Weapon) ((Weapon)item).upgrade(true); else @@ -54,9 +55,10 @@ public class ScrollOfMagicalInfusion extends InventoryScroll { GLog.p( TXT_INFUSE, item.name() ); - Badges.validateItemLevelAquired( item ); - - curUser.sprite.emitter().start( Speck.factory( Speck.UP ), 0.2f, 3 ); + Badges.validateItemLevelAquired(item); + + curUser.sprite.emitter().start(Speck.factory(Speck.UP), 0.2f, 3); + Enchanting.show(curUser, item); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMirrorImage.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMirrorImage.java index d1be36bab..9856db05f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMirrorImage.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfMirrorImage.java @@ -71,8 +71,8 @@ public class ScrollOfMirrorImage extends Scroll { Sample.INSTANCE.play( Assets.SND_READ ); Invisibility.dispel(); - - curUser.spendAndNext( TIME_TO_READ ); + + readAnimation(); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java index dae15471b..010464100 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfPsionicBlast.java @@ -64,8 +64,8 @@ public class ScrollOfPsionicBlast extends Scroll { Dungeon.observe(); setKnown(); - - curUser.spendAndNext( TIME_TO_READ ); + + curUser.spendAndNext( TIME_TO_READ ); //no animation here, the flash interrupts it anyway. if (!curUser.isAlive()) { Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name )); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRage.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRage.java index b09139a5c..ae7be8b86 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRage.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRage.java @@ -66,8 +66,8 @@ public class ScrollOfRage extends Scroll { curUser.sprite.centerEmitter().start( Speck.factory( Speck.SCREAM ), 0.3f, 3 ); Sample.INSTANCE.play( Assets.SND_CHALLENGE ); Invisibility.dispel(); - - curUser.spendAndNext( TIME_TO_READ ); + + readAnimation(); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java index cecf70b65..e0ae79f0b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRecharging.java @@ -52,8 +52,8 @@ public class ScrollOfRecharging extends Scroll { GLog.i( "a surge of energy courses through your body, invigorating your wands."); SpellSprite.show( curUser, SpellSprite.CHARGE ); setKnown(); - - curUser.spendAndNext( TIME_TO_READ ); + + readAnimation(); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java index 4652930b0..b12afc96e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfRemoveCurse.java @@ -66,8 +66,8 @@ public class ScrollOfRemoveCurse extends Scroll { } setKnown(); - - curUser.spendAndNext( TIME_TO_READ ); + + readAnimation(); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java index 565972a7d..38fe9ddeb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTeleportation.java @@ -51,8 +51,8 @@ public class ScrollOfTeleportation extends Scroll { teleportHero( curUser ); setKnown(); - - curUser.spendAndNext( TIME_TO_READ ); + + readAnimation(); } public static void teleportHero( Hero hero ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTerror.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTerror.java index cb44aa484..c944e0fd0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTerror.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/scrolls/ScrollOfTerror.java @@ -69,8 +69,8 @@ public class ScrollOfTerror extends Scroll { GLog.i( "The scroll emits a brilliant flash of red light and the monsters flee!" ); } setKnown(); - - curUser.spendAndNext( TIME_TO_READ ); + + readAnimation(); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java index 511949a75..44a879af3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/CursedWand.java @@ -389,7 +389,7 @@ public class CursedWand { do { reward = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR, Generator.Category.RING, Generator.Category.WAND)); - } while (reward.level < 2 && !(reward instanceof MissileWeapon)); + } while (reward.level() < 2 && !(reward instanceof MissileWeapon)); Sample.INSTANCE.play(Assets.SND_MIMIC, 1, 1, 0.5f); mimic.items.clear(); mimic.items.add(reward); @@ -426,7 +426,7 @@ public class CursedWand { do { result = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR, Generator.Category.RING, Generator.Category.ARTIFACT)); - } while (result.level < 0 && !(result instanceof MissileWeapon)); + } while (result.level() < 0 && !(result instanceof MissileWeapon)); if (result.isUpgradable()) result.upgrade(); result.cursed = result.cursedKnown = true; GLog.w("your wand transmogrifies into a different item!"); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java index 6651378ba..6b7e8c4c9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/Wand.java @@ -55,11 +55,7 @@ public abstract class Wand extends Item { private static final int USAGES_TO_KNOW = 20; public static final String AC_ZAP = "ZAP"; - - private static final String TXT_WOOD = "This thin %s wand is warm to the touch. Who knows what it will do when used?"; - private static final String TXT_DAMAGE = "When this wand is used as a melee weapon, its average damage is %d points per hit."; - private static final String TXT_WEAPON = "You can use this wand as a melee weapon."; - + private static final String TXT_FIZZLES = "your wand fizzles; it must not have enough charge."; private static final String TXT_SELF_TARGET = "You can't target yourself"; @@ -78,7 +74,6 @@ public abstract class Wand extends Item { protected int usagesToKnow = USAGES_TO_KNOW; protected int collisionProperties = Ballistica.MAGIC_BOLT; - { defaultAction = AC_ZAP; @@ -139,7 +134,7 @@ public abstract class Wand extends Item { protected void processSoulMark(Char target, int chargesUsed){ if (target != Dungeon.hero && Dungeon.hero.subClass == HeroSubClass.WARLOCK && - Random.Float() < .15f + (level*chargesUsed*0.03f)){ + Random.Float() < .15f + (level()*chargesUsed*0.03f)){ SoulMark.prolong(target, SoulMark.class, SoulMark.DURATION); } } @@ -156,13 +151,9 @@ public abstract class Wand extends Item { } } - public int level() { - if (charger != null) { - Magic magic = charger.target.buff( Magic.class ); - return magic == null ? level : Math.max( level + magic.level, 0 ); - } else { - return level; - } + public void level( int value) { + super.level( value ); + updateLevel(); } @Override @@ -233,7 +224,7 @@ public abstract class Wand extends Item { } public void updateLevel() { - maxCharges = Math.min( initialCharges() + level, 10 ); + maxCharges = Math.min( initialCharges() + level(), 10 ); curCharges = Math.min( curCharges, maxCharges ); } @@ -299,10 +290,10 @@ public abstract class Wand extends Item { price /= 2; } if (levelKnown) { - if (level > 0) { - price *= (level + 1); - } else if (level < 0) { - price /= (1 - level); + if (level() > 0) { + price *= (level() + 1); + } else if (level() < 0) { + price /= (1 - level()); } } if (price < 1) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java index 53d9be7aa..4c49d12d3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java @@ -63,7 +63,7 @@ public class WandOfBlastWave extends Wand { Sample.INSTANCE.play( Assets.SND_BLAST ); BlastWave.blast(bolt.collisionPos); - int damage = Random.NormalIntRange(1, 6+(int)(level*level/4f)); + int damage = Random.NormalIntRange(1, 6+(int)(level()*level()/4f)); //presses all tiles in the AOE first for (int i : Level.NEIGHBOURS9){ @@ -80,7 +80,7 @@ public class WandOfBlastWave extends Wand { if (ch.isAlive()) { Ballistica trajectory = new Ballistica(ch.pos, ch.pos + i, Ballistica.MAGIC_BOLT); - int strength = 1 + ((level + 1) / 3); + int strength = 1 + ((level() + 1) / 3); throwChar(ch, trajectory, strength); } } @@ -94,7 +94,7 @@ public class WandOfBlastWave extends Wand { if (ch.isAlive() && bolt.path.size() > bolt.dist+1) { Ballistica trajectory = new Ballistica(ch.pos, bolt.path.get(bolt.dist + 1), Ballistica.MAGIC_BOLT); - int strength = level + 3; + int strength = level() + 3; throwChar(ch, trajectory, strength); } } @@ -139,7 +139,7 @@ public class WandOfBlastWave extends Wand { @Override //a weaker knockback, not dissimilar to the glyph of bounce, but a fair bit stronger. public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { - int level = Math.max(0, staff.level); + int level = Math.max(0, staff.level()); // lvl 0 - 25% // lvl 1 - 40% diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java index a0938b9cf..a966b6203 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfCorruption.java @@ -76,7 +76,7 @@ public class WandOfCorruption extends Wand { return; } - int basePower = 10 + 2*level; + int basePower = 10 + 2*level(); int mobPower = Random.IntRange(0, ch.HT) + ch.HP*2; for ( Buff buff : ch.buffs()){ if (buff.type == Buff.buffType.NEGATIVE){ @@ -89,7 +89,7 @@ public class WandOfCorruption extends Wand { //try to use extra charges to overpower the mob while (basePower <= mobPower){ extraCharges++; - basePower += 5 + level; + basePower += 5 + level(); } //if we fail, lose all charges, remember we have 1 left to lose from using the wand. @@ -114,8 +114,8 @@ public class WandOfCorruption extends Wand { // lvl 0 - 25% // lvl 1 - 40% // lvl 2 - 50% - if (Random.Int( level + 4 ) >= 3){ - Buff.prolong( defender, Amok.class, 3+level); + if (Random.Int( level() + 4 ) >= 3){ + Buff.prolong( defender, Amok.class, 3+level()); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java index cac8afb0a..a0f2ff364 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfDisintegration.java @@ -74,8 +74,8 @@ public class WandOfDisintegration extends Wand { } if (Level.flamable[c]) { - - Level.set( c, Terrain.EMBERS ); + + Dungeon.level.destroy( c ); GameScene.updateMap( c ); terrainAffected = true; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java index 811f03381..a432b1c75 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFireblast.java @@ -68,7 +68,7 @@ public class WandOfFireblast extends Wand { Char ch = Actor.findChar( cell ); if (ch != null) { - ch.damage(Random.NormalIntRange(1, (int) (8 + (level * level * (1 + chargesPerCast()) / 6f))), this); + ch.damage(Random.NormalIntRange(1, (int) (8 + (level() * level() * (1 + chargesPerCast()) / 6f))), this); Buff.affect( ch, Burning.class ).reignite( ch ); switch(chargesPerCast()){ case 1: diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java index 065997262..986b123fa 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfFrost.java @@ -57,7 +57,7 @@ public class WandOfFrost extends Wand { Char ch = Actor.findChar(bolt.collisionPos); if (ch != null){ - int damage = Random.NormalIntRange(5+level, 10+(level*level/3)); + int damage = Random.NormalIntRange(5+level(), 10+(level()*level()/3)); if (ch.buff(Frost.class) != null){ return; //do nothing, can't affect a frozen target @@ -65,7 +65,7 @@ public class WandOfFrost extends Wand { if (ch.buff(Chill.class) != null){ damage = Math.round(damage * ch.buff(Chill.class).speedFactor()); } else { - ch.sprite.burst( 0xFF99CCFF, level / 2 + 2 ); + ch.sprite.burst( 0xFF99CCFF, level() / 2 + 2 ); } processSoulMark(ch, chargesPerCast()); @@ -74,12 +74,12 @@ public class WandOfFrost extends Wand { if (ch.isAlive()){ if (Level.water[ch.pos]){ //20+(10*level)% chance - if (Random.Int(10) >= 8-level ) + if (Random.Int(10) >= 8-level() ) Buff.affect(ch, Frost.class, Frost.duration(ch)*Random.Float(2f, 4f)); else - Buff.prolong(ch, Chill.class, 6+level); + Buff.prolong(ch, Chill.class, 6+level()); } else { - Buff.prolong(ch, Chill.class, 4+level); + Buff.prolong(ch, Chill.class, 4+level()); } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java index 5b4f54f48..3c7fd7185 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfLightning.java @@ -60,8 +60,8 @@ public class WandOfLightning extends Wand { float multipler = 0.4f + (0.6f/affected.size()); if (Level.water[bolt.collisionPos]) multipler *= 1.5f; - int min = 5+level; - int max = Math.round(10 + (level * level / 4f)); + int min = 5+level(); + int max = Math.round(10 + (level() * level() / 4f)); for (Char ch : affected){ processSoulMark(ch, chargesPerCast()); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java index 85edae8b3..66f0ae8a7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfMagicMissile.java @@ -42,13 +42,11 @@ public class WandOfMagicMissile extends Wand { Char ch = Actor.findChar( bolt.collisionPos ); if (ch != null) { - - int level = level(); processSoulMark(ch, chargesPerCast()); - ch.damage(Random.NormalIntRange(4 , 6 + level * 2), this); + ch.damage(Random.NormalIntRange(4 , 6 + level() * 2), this); - ch.sprite.burst(0xFFFFFFFF, level / 2 + 2); + ch.sprite.burst(0xFFFFFFFF, level() / 2 + 2); } } @@ -56,8 +54,8 @@ public class WandOfMagicMissile extends Wand { @Override public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { //gain 1 turn of recharging buff per level of the wand. - if (level > 0) { - Buff.prolong( attacker, ScrollOfRecharging.Recharging.class, (float)staff.level); + if (level() > 0) { + Buff.prolong( attacker, ScrollOfRecharging.Recharging.class, (float)staff.level()); SpellSprite.show(attacker, SpellSprite.CHARGE); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java index a1cb7421c..033e81ce2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfPrismaticLight.java @@ -90,25 +90,25 @@ public class WandOfPrismaticLight extends Wand { affectMap(beam); if (curUser.viewDistance < 4) - Buff.prolong( curUser, Light.class, 10f+level*5); + Buff.prolong( curUser, Light.class, 10f+level()*5); } private void affectTarget(Char ch){ - int dmg = Random.NormalIntRange(level, (int) (8+(level*(level/5f)))); + int dmg = Random.NormalIntRange(level(), (int) (8+(level()*(level()/5f)))); //three in (5+lvl) chance of failing - if (Random.Int(5+level) >= 3) { - Buff.prolong(ch, Blindness.class, 2f + (level * 0.34f)); + if (Random.Int(5+level()) >= 3) { + Buff.prolong(ch, Blindness.class, 2f + (level() * 0.34f)); ch.sprite.emitter().burst(Speck.factory(Speck.LIGHT), 6 ); } if (evilMobs.contains(ch.getClass())){ - ch.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10+level ); + ch.sprite.emitter().start( ShadowParticle.UP, 0.05f, 10+level() ); Sample.INSTANCE.play(Assets.SND_BURNING); ch.damage((int)(dmg*1.5), this); } else { - ch.sprite.centerEmitter().burst( RainbowParticle.BURST, 10+level ); + ch.sprite.centerEmitter().burst( RainbowParticle.BURST, 10+level() ); ch.damage(dmg, this); } @@ -156,7 +156,7 @@ public class WandOfPrismaticLight extends Wand { @Override public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { //cripples enemy - Buff.prolong( defender, Cripple.class, 1f+staff.level); + Buff.prolong( defender, Cripple.class, 1f+staff.level()); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java index 493939c67..5cb00e773 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfRegrowth.java @@ -168,7 +168,7 @@ public class WandOfRegrowth extends Wand { public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { //like vampiric enchantment, except with herbal healing buff - int level = Math.max( 0, staff.level ); + int level = Math.max( 0, staff.level() ); // lvl 0 - 33% // lvl 1 - 43% diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java index 83a86ebe3..5f001f964 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfTransfusion.java @@ -109,24 +109,24 @@ public class WandOfTransfusion extends Wand { int missingHP = ch.HT - ch.HP; //heals 30%+3%*lvl missing HP. - int healing = (int)Math.ceil((missingHP * (0.30f+(0.03f*level)))); + int healing = (int)Math.ceil((missingHP * (0.30f+(0.03f*level())))); ch.HP += healing; - ch.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1 + level / 2); + ch.sprite.emitter().burst(Speck.factory(Speck.HEALING), 1 + level() / 2); ch.sprite.showStatus(CharSprite.POSITIVE, "+%dHP", healing); //harms the undead } else if (undeadMobs.contains(ch.getClass())){ //deals 30%+5%*lvl total HP. - int damage = (int) Math.ceil(ch.HT*(0.3f+(0.05f*level))); + int damage = (int) Math.ceil(ch.HT*(0.3f+(0.05f*level()))); ch.damage(damage, this); - ch.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10 + level); + ch.sprite.emitter().start(ShadowParticle.UP, 0.05f, 10 + level()); Sample.INSTANCE.play(Assets.SND_BURNING); //charms an enemy } else { - float duration = 5+level; + float duration = 5+level(); Buff.affect(ch, Charm.class, Charm.durationFactor(ch) * duration).object = curUser.id(); duration *= Random.Float(0.75f, 1f); @@ -143,14 +143,14 @@ public class WandOfTransfusion extends Wand { Item item = heap.peek(); //30% + 10%*lvl chance to uncurse the item and reset it to base level if degraded. - if (item != null && Random.Float() <= 0.3f+level*0.1f){ + if (item != null && Random.Float() <= 0.3f+level()*0.1f){ if (item.cursed){ item.cursed = false; CellEmitter.get(cell).start( ShadowParticle.UP, 0.05f, 10 ); Sample.INSTANCE.play(Assets.SND_BURNING); } - int lvldiffFromBase = item.level - (item instanceof Ring ? 1 : 0); + int lvldiffFromBase = item.level() - (item instanceof Ring ? 1 : 0); if (lvldiffFromBase < 0){ item.upgrade(-lvldiffFromBase); CellEmitter.get(cell).start(Speck.factory(Speck.UP), 0.2f, 3); @@ -170,7 +170,7 @@ public class WandOfTransfusion extends Wand { } else if (Dungeon.level.map[cell] == Terrain.EMBERS) { //30% + 3%*lvl chance to grow a random plant, or just regrow grass. - if (Random.Float() <= 0.3f+level*0.03f) { + if (Random.Float() <= 0.3f+level()*0.03f) { Dungeon.level.plant((Plant.Seed) Generator.random(Generator.Category.SEED), cell); CellEmitter.get( cell ).burst(LeafParticle.LEVEL_SPECIFIC, 8); GameScene.updateMap(cell); @@ -213,7 +213,7 @@ public class WandOfTransfusion extends Wand { // lvl 0 - 10% // lvl 1 - 18% // lvl 2 - 25% - if (Random.Int( level + 10 ) >= 9){ + if (Random.Int( level() + 10 ) >= 9){ //grants a free use of the staff freeCharge = true; GLog.p("Your staff is charged with the life energy of your enemy!"); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java index 567b44e13..c595a95d3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfVenom.java @@ -45,8 +45,8 @@ public class WandOfVenom extends Wand { @Override protected void onZap(Ballistica bolt) { - Blob venomGas = Blob.seed(bolt.collisionPos, 50 + 10 * level, VenomGas.class); - ((VenomGas)venomGas).setStrength(level+1); + Blob venomGas = Blob.seed(bolt.collisionPos, 50 + 10 * level(), VenomGas.class); + ((VenomGas)venomGas).setStrength(level()+1); GameScene.add(venomGas); Char ch = Actor.findChar(bolt.collisionPos); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index 666385d39..b4fc84ccc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -39,7 +39,7 @@ import com.watabou.utils.Bundlable; import com.watabou.utils.Bundle; import com.watabou.utils.Random; -public class Weapon extends KindOfWeapon { +abstract public class Weapon extends KindOfWeapon { private static final int HITS_TO_KNOW = 20; @@ -165,7 +165,7 @@ public class Weapon extends KindOfWeapon { public Item upgrade( boolean enchant ) { if (enchantment != null) { - if (!enchant && Random.Int( level ) > 0) { + if (!enchant && Random.Int( level() ) > 0) { GLog.w( TXT_INCOMPATIBLE ); enchant( null ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Death.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Death.java index abf78227f..e1bc79ae9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Death.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Death.java @@ -31,7 +31,7 @@ import com.watabou.utils.Random; public class Death extends Weapon.Enchantment { - private static final String TXT_GRIM = "Grim %s"; + private static final String TXT_GRIM = "grim %s"; private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 ); @@ -40,7 +40,7 @@ public class Death extends Weapon.Enchantment { // lvl 0 - 8% // lvl 1 ~ 9% // lvl 2 ~ 10% - int level = Math.max( 0, weapon.level ); + int level = Math.max( 0, weapon.level() ); if (Random.Int( level + 100 ) >= 92) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Fire.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Fire.java index 92ecd01a2..88a6aab12 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Fire.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Fire.java @@ -31,7 +31,7 @@ import com.watabou.utils.Random; public class Fire extends Weapon.Enchantment { - private static final String TXT_BLAZING = "Blazing %s"; + private static final String TXT_BLAZING = "blazing %s"; private static ItemSprite.Glowing ORANGE = new ItemSprite.Glowing( 0xFF4400 ); @@ -40,7 +40,7 @@ public class Fire extends Weapon.Enchantment { // lvl 0 - 33% // lvl 1 - 50% // lvl 2 - 60% - int level = Math.max( 0, weapon.level ); + int level = Math.max( 0, weapon.level() ); if (Random.Int( level + 3 ) >= 2) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Horror.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Horror.java index 51549ac55..e106e7e89 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Horror.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Horror.java @@ -32,7 +32,7 @@ import com.watabou.utils.Random; public class Horror extends Weapon.Enchantment { - private static final String TXT_ELDRITCH = "Eldritch %s"; + private static final String TXT_ELDRITCH = "eldritch %s"; private static ItemSprite.Glowing GREY = new ItemSprite.Glowing( 0x222222 ); @@ -41,7 +41,7 @@ public class Horror extends Weapon.Enchantment { // lvl 0 - 20% // lvl 1 - 33% // lvl 2 - 43% - int level = Math.max( 0, weapon.level ); + int level = Math.max( 0, weapon.level() ); if (Random.Int( level + 5 ) >= 4) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Instability.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Instability.java index 536a6c8e4..6e491c46b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Instability.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Instability.java @@ -27,7 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang; public class Instability extends Weapon.Enchantment { - private static final String TXT_UNSTABLE = "Unstable %s"; + private static final String TXT_UNSTABLE = "unstable %s"; @Override public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Leech.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Leech.java index 5432a87a8..1368cd10d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Leech.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Leech.java @@ -30,14 +30,14 @@ import com.watabou.utils.Random; public class Leech extends Weapon.Enchantment { - private static final String TXT_VAMPIRIC = "Vampiric %s"; + private static final String TXT_VAMPIRIC = "vampiric %s"; private static ItemSprite.Glowing RED = new ItemSprite.Glowing( 0x660022 ); @Override public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) { - int level = Math.max( 0, weapon.level ); + int level = Math.max( 0, weapon.level() ); // lvl 0 - 33% // lvl 1 - 43% diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Luck.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Luck.java index 0b307a3de..5a61bf9bc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Luck.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Luck.java @@ -27,13 +27,13 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing; public class Luck extends Weapon.Enchantment { - private static final String TXT_LUCKY = "Lucky %s"; + private static final String TXT_LUCKY = "lucky %s"; private static ItemSprite.Glowing GREEN = new ItemSprite.Glowing( 0x00FF00 ); @Override public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) { - int level = Math.max( 0, weapon.level ); + int level = Math.max( 0, weapon.level() ); int dmg = damage; for (int i=1; i <= level+1; i++) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Paralysis.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Paralysis.java index 2f9f39ea8..e3f22316d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Paralysis.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Paralysis.java @@ -29,7 +29,7 @@ import com.watabou.utils.Random; public class Paralysis extends Weapon.Enchantment { - private static final String TXT_STUNNING = "Stunning %s"; + private static final String TXT_STUNNING = "stunning %s"; private static ItemSprite.Glowing YELLOW = new ItemSprite.Glowing( 0xCCAA44 ); @@ -38,7 +38,7 @@ public class Paralysis extends Weapon.Enchantment { // lvl 0 - 13% // lvl 1 - 22% // lvl 2 - 30% - int level = Math.max( 0, weapon.level ); + int level = Math.max( 0, weapon.level() ); if (Random.Int( level + 8 ) >= 7) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Poison.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Poison.java index a5c6e019a..396c453c9 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Poison.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Poison.java @@ -29,7 +29,7 @@ import com.watabou.utils.Random; public class Poison extends Weapon.Enchantment { - private static final String TXT_VENOMOUS = "Venomous %s"; + private static final String TXT_VENOMOUS = "venomous %s"; private static ItemSprite.Glowing PURPLE = new ItemSprite.Glowing( 0x4400AA ); @@ -38,7 +38,7 @@ public class Poison extends Weapon.Enchantment { // lvl 0 - 33% // lvl 1 - 50% // lvl 2 - 60% - int level = Math.max( 0, weapon.level ); + int level = Math.max( 0, weapon.level() ); if (Random.Int( level + 3 ) >= 2) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Shock.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Shock.java index 302d80f31..cb807a837 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Shock.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Shock.java @@ -34,14 +34,14 @@ import com.watabou.utils.Random; public class Shock extends Weapon.Enchantment { - private static final String TXT_SHOCKING = "Shocking %s"; + private static final String TXT_SHOCKING = "shocking %s"; @Override public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) { // lvl 0 - 25% // lvl 1 - 40% // lvl 2 - 50% - int level = Math.max( 0, weapon.level ); + int level = Math.max( 0, weapon.level() ); if (Random.Int( level + 4 ) >= 3) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Slow.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Slow.java index 814cddaa8..09faf31fc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Slow.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Slow.java @@ -30,7 +30,7 @@ import com.watabou.utils.Random; public class Slow extends Weapon.Enchantment { - private static final String TXT_CHILLING = "Chilling %s"; + private static final String TXT_CHILLING = "chilling %s"; private static ItemSprite.Glowing BLUE = new ItemSprite.Glowing( 0x0044FF ); @@ -39,7 +39,7 @@ public class Slow extends Weapon.Enchantment { // lvl 0 - 25% // lvl 1 - 40% // lvl 2 - 50% - int level = Math.max( 0, weapon.level ); + int level = Math.max( 0, weapon.level() ); if (Random.Int( level + 4 ) >= 3) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java index 2dd4405ec..1a7ebbc06 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java @@ -69,14 +69,16 @@ public class MagesStaff extends MeleeWeapon { public MagesStaff() { - //tier 1 weapon with poor base stats. super(1, 1f, 1f); - MIN = 1; - MAX = 6; wand = null; } + @Override + protected int maxBase() { + return 6; //6 base damage instead of 10 + } + public MagesStaff(Wand wand){ this(); wand.identify(); @@ -156,15 +158,15 @@ public class MagesStaff extends MeleeWeapon { } //syncs the level of the two items. - int targetLevel = Math.max(this.level, wand.level); + int targetLevel = Math.max(this.level(), wand.level()); - int staffLevelDiff = targetLevel - this.level; + int staffLevelDiff = targetLevel - this.level(); if (staffLevelDiff > 0) this.upgrade(staffLevelDiff); else if (staffLevelDiff < 0) this.degrade(Math.abs(staffLevelDiff)); - int wandLevelDiff = targetLevel - wand.level; + int wandLevelDiff = targetLevel - wand.level(); if (wandLevelDiff > 0) wand.upgrade(wandLevelDiff); else if (wandLevelDiff < 0) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java index 178492eba..7c8919bbc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java @@ -39,19 +39,27 @@ public class MeleeWeapon extends Weapon { DLY = dly; STR = typicalSTR(); - - MIN = min(); - MAX = max(); + } - private int min() { + protected int minBase() { return tier; } - - private int max() { + + protected int maxBase() { return (int)((tier * tier - tier + 10) / ACU * DLY); } - + + @Override + public int min() { + return minBase() + level(); + } + + @Override + public int max() { + return maxBase() + level() * tier; + } + @Override public Item upgrade() { return upgrade( false ); @@ -59,8 +67,6 @@ public class MeleeWeapon extends Weapon { public Item upgrade( boolean enchant ) { STR--; - MIN++; - MAX += tier; return super.upgrade( enchant ); } @@ -72,8 +78,6 @@ public class MeleeWeapon extends Weapon { @Override public Item degrade() { STR++; - MIN--; - MAX -= tier; return super.degrade(); } @@ -88,18 +92,22 @@ public class MeleeWeapon extends Weapon { StringBuilder info = new StringBuilder( desc() ); - String quality = levelKnown && level != 0 ? (level > 0 ? "upgraded" : "degraded") : ""; + 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. " ); - + 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))) + Math.round((min + (max - min) / 2)*(imbue == Imbue.LIGHT ? 0.7f : (imbue == Imbue.HEAVY ? 1.5f : 1))) + " points per hit. " ); } else { + int min = minBase(); + int max = maxBase(); 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 " + "and usually it requires " + typicalSTR() + " points of strength. " ); if (typicalSTR() > Dungeon.hero.STR()) { info.append( "Probably this weapon is too heavy for you. " ); @@ -173,10 +181,10 @@ public class MeleeWeapon extends Weapon { price /= 2; } if (levelKnown) { - if (level > 0) { - price *= (level + 1); - } else if (level < 0) { - price /= (1 - level); + if (level() > 0) { + price *= (level() + 1); + } else if (level() < 0) { + price /= (1 - level()); } } if (price < 1) { @@ -189,7 +197,7 @@ public class MeleeWeapon extends Weapon { public Item random() { super.random(); - if (Random.Int( 10 + level ) == 0) { + if (Random.Int( 10 + level() ) == 0) { enchant(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/ShortSword.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/ShortSword.java index c8b511224..b2d2a71ef 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/ShortSword.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/ShortSword.java @@ -61,13 +61,17 @@ public class ShortSword extends MeleeWeapon { super( 1, 1f, 1f ); STR = 11; - MAX = 12; } - + + @Override + protected int maxBase() { + return 12; + } + @Override public ArrayList actions( Hero hero ) { ArrayList actions = super.actions( hero ); - if (level > 0) { + if (level() > 0) { actions.add( AC_REFORGE ); } return actions; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Boomerang.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Boomerang.java index aaf43396e..ad2a6c590 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Boomerang.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Boomerang.java @@ -34,16 +34,23 @@ public class Boomerang extends MissileWeapon { image = ItemSpriteSheet.BOOMERANG; STR = 10; - - MIN = 1; - MAX = 5; stackable = false; unique = true; bones = false; } - + + @Override + public int min() { + return 1 + level(); + } + + @Override + public int max() { + return 5 + 2 * level(); + } + @Override public boolean isUpgradable() { return true; @@ -56,8 +63,6 @@ public class Boomerang extends MissileWeapon { @Override public Item upgrade( boolean enchant ) { - MIN += 1; - MAX += 2; super.upgrade( enchant ); updateQuickslot(); @@ -67,8 +72,6 @@ public class Boomerang extends MissileWeapon { @Override public Item degrade() { - MIN -= 1; - MAX -= 2; return super.degrade(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/CurareDart.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/CurareDart.java index cae4afd23..06a01b639 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/CurareDart.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/CurareDart.java @@ -36,11 +36,18 @@ public class CurareDart extends MissileWeapon { image = ItemSpriteSheet.CURARE_DART; STR = 14; - - MIN = 1; - MAX = 3; } - + + @Override + public int min() { + return 1; + } + + @Override + public int max() { + return 3; + } + public CurareDart() { this( 1 ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Dart.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Dart.java index 3262f77b1..71be2549c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Dart.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Dart.java @@ -29,13 +29,20 @@ public class Dart extends MissileWeapon { { name = "dart"; image = ItemSpriteSheet.DART; - - MIN = 1; - MAX = 4; bones = false; //Finding them in bones would be semi-frequent and disappointing. } - + + @Override + public int min() { + return 1; + } + + @Override + public int max() { + return 4; + } + public Dart() { this( 1 ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java index 4f33ac944..ecf1b14be 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java @@ -41,11 +41,18 @@ public class IncendiaryDart extends MissileWeapon { image = ItemSpriteSheet.INCENDIARY_DART; STR = 12; - - MIN = 1; - MAX = 2; } - + + @Override + public int min() { + return 1; + } + + @Override + public int max() { + return 2; + } + public IncendiaryDart() { this( 1 ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Javelin.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Javelin.java index cc04ba63b..14d40583b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Javelin.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Javelin.java @@ -34,11 +34,18 @@ public class Javelin extends MissileWeapon { image = ItemSpriteSheet.JAVELIN; STR = 15; - - MIN = 2; - MAX = 15; } - + + @Override + public int min() { + return 2; + } + + @Override + public int max() { + return 15; + } + public Javelin() { this( 1 ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java index 78b9c587f..a54edffe2 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java @@ -36,7 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.watabou.utils.Random; -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"; @@ -150,7 +150,7 @@ public class MissileWeapon extends Weapon { StringBuilder info = new StringBuilder( desc() ); - info.append( "\n\nAverage damage of this weapon equals to " + (MIN + (MAX - MIN) / 2) + " points per hit. " ); + info.append( "\n\nAverage damage of this weapon equals to " + (min() + (max() - min()) / 2) + " points per hit. " ); if (Dungeon.hero.belongings.backpack.items.contains( this )) { if (STR > Dungeon.hero.STR()) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Shuriken.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Shuriken.java index 35b14bb18..0fec1bf2f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Shuriken.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Shuriken.java @@ -31,13 +31,20 @@ public class Shuriken extends MissileWeapon { image = ItemSpriteSheet.SHURIKEN; STR = 13; - - MIN = 2; - MAX = 6; - + DLY = 0.5f; } - + + @Override + public int min() { + return 2; + } + + @Override + public int max() { + return 6; + } + public Shuriken() { this( 1 ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tamahawk.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tamahawk.java index 177029012..66a9dcb31 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tamahawk.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tamahawk.java @@ -34,11 +34,18 @@ public class Tamahawk extends MissileWeapon { image = ItemSpriteSheet.TOMAHAWK; STR = 17; - - MIN = 4; - MAX = 20; } - + + @Override + public int min() { + return 4; + } + + @Override + public int max() { + return 20; + } + public Tamahawk() { this( 1 ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java index e90f258c9..ceec78572 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/features/HighGrass.java @@ -36,7 +36,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush; -import com.shatteredpixel.shatteredpixeldungeon.plants.Plant; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.watabou.utils.Random; @@ -54,7 +53,7 @@ public class HighGrass { SandalsOfNature.Naturalism naturalism = ch.buff( SandalsOfNature.Naturalism.class ); if (naturalism != null) { if (!naturalism.isCursed()) { - naturalismLevel = naturalism.level() + 1; + naturalismLevel = naturalism.itemLevel() + 1; naturalism.charge(); } else { naturalismLevel = -1; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java index 21de3bc55..24e866c6f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/plants/Plant.java @@ -81,7 +81,7 @@ public abstract class Plant implements Bundlable { int naturalismLevel = 0; SandalsOfNature.Naturalism naturalism = Dungeon.hero.buff( SandalsOfNature.Naturalism.class ); if (naturalism != null) { - naturalismLevel = naturalism.level()+1; + naturalismLevel = naturalism.itemLevel()+1; } if (Random.Int( 5 - (naturalismLevel/2) ) == 0) {