Merging 1.9.1 source: item changes

This commit is contained in:
Evan Debenham 2015-11-11 02:01:25 -05:00
parent bc1e3ee17a
commit 366dce1610
86 changed files with 409 additions and 352 deletions

View File

@ -48,7 +48,7 @@ public class Regeneration extends Buff {
if (regenBuff.isCursed()) if (regenBuff.isCursed())
spend( REGENERATION_DELAY * 1.5f ); spend( REGENERATION_DELAY * 1.5f );
else else
spend( REGENERATION_DELAY - regenBuff.level()*0.9f ); spend( REGENERATION_DELAY - regenBuff.itemLevel()*0.9f );
else else
spend( REGENERATION_DELAY ); spend( REGENERATION_DELAY );

View File

@ -141,7 +141,7 @@ public class Thief extends Mob {
Item item = hero.belongings.randomUnequipped(); 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() ); GLog.w( TXT_STOLE, this.name, item.name() );
Dungeon.quickslot.clearItem( item ); Dungeon.quickslot.clearItem( item );

View File

@ -338,11 +338,11 @@ public class Ghost extends NPC {
do { do {
another = Generator.randomWeapon(10+i); another = Generator.randomWeapon(10+i);
} while (another instanceof MissileWeapon); } while (another instanceof MissileWeapon);
if (another.level >= weapon.level) { if (another.level() >= weapon.level()) {
weapon = (Weapon) another; weapon = (Weapon) another;
} }
another = Generator.randomArmor(10+i); another = Generator.randomArmor(10+i);
if (another.level >= armor.level) { if (another.level() >= armor.level()) {
armor = (Armor) another; armor = (Armor) another;
} }
} }

View File

@ -20,12 +20,10 @@
*/ */
package com.shatteredpixel.shatteredpixeldungeon.items; package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; 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.BlastParticle;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SmokeParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.SmokeParticle;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
import com.watabou.utils.Random; import com.watabou.utils.Random;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
public class Bomb extends Item { public class Bomb extends Item {
@ -131,7 +126,7 @@ public class Bomb extends Item {
} }
if (Level.flamable[c]) { if (Level.flamable[c]) {
Level.set( c, Terrain.EMBERS ); Dungeon.level.destroy( c );
GameScene.updateMap( c ); GameScene.updateMap( c );
terrainAffected = true; terrainAffected = true;
} }

View File

@ -292,7 +292,7 @@ public class Heap implements Bundlable {
return; return;
//unique and upgraded items can endure the blast //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 ); 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 //alchemists toolkit gives a chance to cook a potion in two or even one seeds
AlchemistsToolkit.alchemy alchemy = Dungeon.hero.buff(AlchemistsToolkit.alchemy.class); 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) { if (bonus != -1 ? alchemy.tryCook(count) : count >= SEEDS_TO_POTION) {

View File

@ -74,7 +74,8 @@ public class Item implements Bundlable {
public boolean stackable = false; public boolean stackable = false;
protected int quantity = 1; protected int quantity = 1;
public int level = 0; private int level = 0;
public boolean levelKnown = false; public boolean levelKnown = false;
public boolean cursed; public boolean cursed;
@ -264,6 +265,14 @@ public class Item implements Bundlable {
protected void onDetach(){} protected void onDetach(){}
public int level(){
return level;
}
public void level( int value ){
level = value;
}
public Item upgrade() { public Item upgrade() {
cursed = false; cursed = false;

View File

@ -28,19 +28,16 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Random; 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"; 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; protected static final float TIME_TO_EQUIP = 1f;
public int MIN = 0;
public int MAX = 1;
@Override @Override
public ArrayList<String> actions( Hero hero ) { public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
actions.add( isEquipped( hero ) ? AC_UNEQUIP : AC_EQUIP ); actions.add(isEquipped(hero) ? AC_UNEQUIP : AC_EQUIP);
return actions; return actions;
} }
@ -94,8 +91,11 @@ public class KindOfWeapon extends EquipableItem {
public void activate( Hero hero ) { public void activate( Hero hero ) {
} }
abstract public int min();
abstract public int max();
public int damageRoll( Hero owner ) { public int damageRoll( Hero owner ) {
return Random.NormalIntRange( MIN, MAX ); return Random.NormalIntRange( min(), max() );
} }
public float acuracyFactor( Hero hero ) { public float acuracyFactor( Hero hero ) {

View File

@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items;
import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.effects.Enchanting;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PurpleParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.PurpleParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@ -34,7 +35,7 @@ import java.util.ArrayList;
public class Stylus extends Item { 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 String TXT_INSCRIBED = "you inscribed your %s with the stylus";
private static final float TIME_TO_INSCRIBE = 2; private static final float TIME_TO_INSCRIBE = 2;
@ -83,17 +84,18 @@ public class Stylus extends Item {
private void inscribe( Armor armor ) { 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(); armor.inscribe();
curUser.sprite.operate( curUser.pos ); curUser.sprite.operate(curUser.pos);
curUser.sprite.centerEmitter().start( PurpleParticle.BURST, 0.05f, 10 ); curUser.sprite.centerEmitter().start(PurpleParticle.BURST, 0.05f, 10);
Sample.INSTANCE.play( Assets.SND_BURNING ); Enchanting.show(curUser, armor);
Sample.INSTANCE.play(Assets.SND_BURNING);
curUser.spend( TIME_TO_INSCRIBE ); curUser.spend(TIME_TO_INSCRIBE);
curUser.busy(); curUser.busy();
} }

View File

@ -54,7 +54,6 @@ public class Armor extends EquipableItem {
public int tier; public int tier;
public int STR; public int STR;
public int DR;
private int hitsToKnow = HITS_TO_KNOW; private int hitsToKnow = HITS_TO_KNOW;
@ -65,7 +64,6 @@ public class Armor extends EquipableItem {
this.tier = tier; this.tier = tier;
STR = typicalSTR(); STR = typicalSTR();
DR = typicalDR();
} }
private static final String UNFAMILIRIARITY = "unfamiliarity"; private static final String UNFAMILIRIARITY = "unfamiliarity";
@ -79,24 +77,24 @@ public class Armor extends EquipableItem {
@Override @Override
public void restoreFromBundle( Bundle bundle ) { public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle ); super.restoreFromBundle(bundle);
if ((hitsToKnow = bundle.getInt( UNFAMILIRIARITY )) == 0) { if ((hitsToKnow = bundle.getInt( UNFAMILIRIARITY )) == 0) {
hitsToKnow = HITS_TO_KNOW; hitsToKnow = HITS_TO_KNOW;
} }
inscribe( (Glyph)bundle.get( GLYPH ) ); inscribe((Glyph) bundle.get(GLYPH));
} }
@Override @Override
public ArrayList<String> actions( Hero hero ) { public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
actions.add( isEquipped( hero ) ? AC_UNEQUIP : AC_EQUIP ); actions.add(isEquipped(hero) ? AC_UNEQUIP : AC_EQUIP);
return actions; return actions;
} }
@Override @Override
public boolean doEquip( Hero hero ) { 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 )) { 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; return hero.belongings.armor == this;
} }
public int DR(){
return tier * (2 + level() + (glyph == null ? 0 : 1));
}
@Override @Override
public Item upgrade() { public Item upgrade() {
return upgrade( false ); return upgrade( false );
@ -155,7 +157,7 @@ public class Armor extends EquipableItem {
public Item upgrade( boolean inscribe ) { public Item upgrade( boolean inscribe ) {
if (glyph != null) { if (glyph != null) {
if (!inscribe && Random.Int( level ) > 0) { if (!inscribe && Random.Int( level() ) > 0) {
GLog.w( TXT_INCOMPATIBLE ); GLog.w( TXT_INCOMPATIBLE );
inscribe( null ); inscribe( null );
} }
@ -165,7 +167,6 @@ public class Armor extends EquipableItem {
} }
}; };
DR += tier;
STR--; STR--;
return super.upgrade(); return super.upgrade();
@ -173,7 +174,6 @@ public class Armor extends EquipableItem {
@Override @Override
public Item degrade() { public Item degrade() {
DR -= tier;
STR++; STR++;
return super.degrade(); return super.degrade();
@ -214,7 +214,7 @@ public class Armor extends EquipableItem {
if (levelKnown) { if (levelKnown) {
info.append( info.append(
"\n\nThis " + name + " provides damage absorption up to " + "\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()) { if (STR > Dungeon.hero.STR()) {
@ -297,10 +297,10 @@ public class Armor extends EquipableItem {
price /= 2; price /= 2;
} }
if (levelKnown) { if (levelKnown) {
if (level > 0) { if (level() > 0) {
price *= (level + 1); price *= (level() + 1);
} else if (level < 0) { } else if (level() < 0) {
price /= (1 - level); price /= (1 - level());
} }
} }
if (price < 1) { if (price < 1) {
@ -310,13 +310,6 @@ public class Armor extends EquipableItem {
} }
public Armor inscribe( Glyph glyph ) { 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; this.glyph = glyph;
return this; return this;

View File

@ -40,6 +40,8 @@ abstract public class ClassArmor extends Armor {
bones = false; bones = false;
} }
private int DR;
public ClassArmor() { public ClassArmor() {
super( 6 ); super( 6 );
} }
@ -64,7 +66,7 @@ abstract public class ClassArmor extends Armor {
} }
classArmor.STR = armor.STR; classArmor.STR = armor.STR;
classArmor.DR = armor.DR; classArmor.DR = armor.DR();
classArmor.inscribe( armor.glyph ); classArmor.inscribe( armor.glyph );
@ -119,6 +121,11 @@ abstract public class ClassArmor extends Armor {
abstract public String special(); abstract public String special();
abstract public void doSpecial(); abstract public void doSpecial();
@Override
public int DR(){
return DR;
}
@Override @Override
public boolean isUpgradable() { public boolean isUpgradable() {
return false; return false;

View File

@ -41,7 +41,7 @@ public class Affection extends Glyph {
@Override @Override
public int proc( Armor armor, Char attacker, Char defender, int damage) { 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) { if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level / 2 + 5 ) >= 4) {

View File

@ -43,7 +43,7 @@ public class AntiEntropy extends Glyph {
@Override @Override
public int proc( Armor armor, Char attacker, Char defender, int damage) { 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) { if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 6 ) >= 5) {

View File

@ -37,7 +37,7 @@ public class Bounce extends Glyph {
@Override @Override
public int proc( Armor armor, Char attacker, Char defender, int damage) { 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) { if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 5) >= 4) {

View File

@ -44,7 +44,7 @@ public class Displacement extends Glyph {
return damage; 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++) { for (int i=0; i < nTries; i++) {
int pos = Random.Int( Level.LENGTH ); int pos = Random.Int( Level.LENGTH );
if (Dungeon.visible[pos] && Level.passable[pos] && Actor.findChar( pos ) == null) { if (Dungeon.visible[pos] && Level.passable[pos] && Actor.findChar( pos ) == null) {

View File

@ -42,7 +42,7 @@ public class Entanglement extends Glyph {
@Override @Override
public int proc( Armor armor, Char attacker, Char defender, int damage ) { 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) { if (Random.Int( 4 ) == 0) {

View File

@ -40,7 +40,7 @@ public class Metabolism extends Glyph {
@Override @Override
public int proc( Armor armor, Char attacker, Char defender, int damage) { 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) { if (Random.Int( level / 2 + 5 ) >= 4) {
int healing = Math.min( defender.HT - defender.HP, Random.Int( 1, defender.HT / 5 ) ); int healing = Math.min( defender.HT - defender.HP, Random.Int( 1, defender.HT / 5 ) );

View File

@ -44,7 +44,7 @@ public class Multiplicity extends Glyph {
@Override @Override
public int proc( Armor armor, Char attacker, Char defender, int damage) { 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) { if (Random.Int( level / 2 + 6 ) >= 5) {

View File

@ -41,7 +41,7 @@ public class Potential extends Glyph {
@Override @Override
public int proc( Armor armor, Char attacker, Char defender, int damage) { 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) { if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 7 ) >= 6) {

View File

@ -40,7 +40,7 @@ public class Stench extends Glyph {
@Override @Override
public int proc( Armor armor, Char attacker, Char defender, int damage) { 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) { if (Level.adjacent( attacker.pos, defender.pos ) && Random.Int( level + 5 ) >= 4) {

View File

@ -49,7 +49,7 @@ public class Viscosity extends Glyph {
return 0; return 0;
} }
int level = Math.max( 0, armor.level ); int level = Math.max( 0, armor.level() );
if (Random.Int( level + 7 ) >= 6) { if (Random.Int( level + 7 ) >= 6) {

View File

@ -43,7 +43,6 @@ public class AlchemistsToolkit extends Artifact {
name = "Alchemists Toolkit"; name = "Alchemists Toolkit";
image = ItemSpriteSheet.ARTIFACT_TOOLKIT; image = ItemSpriteSheet.ARTIFACT_TOOLKIT;
level = 0;
levelCap = 10; levelCap = 10;
} }
@ -79,7 +78,7 @@ public class AlchemistsToolkit extends Artifact {
@Override @Override
public ArrayList<String> actions( Hero hero ) { public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
if (isEquipped( hero ) && level < levelCap && !cursed) if (isEquipped( hero ) && level() < levelCap && !cursed)
actions.add(AC_BREW); actions.add(AC_BREW);
return actions; 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. " + 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."); "The brew is useless, you throw it away.");
} else if (score > level) { } else if (score > level()) {
level = score; level(score);
seedsToPotion = 0; seedsToPotion = 0;
bstGuess = curGuess; bstGuess = curGuess;
this.numRight = numRight; this.numRight = numRight;
this.numWrongPlace = numWrongPlace; this.numWrongPlace = numWrongPlace;
if (level == 10){ if (level() == 10){
bstGuess = new ArrayList<String>(); bstGuess = new ArrayList<String>();
GLog.p("The mixture you've created seems perfect, you don't think there is any way to improve it!"); GLog.p("The mixture you've created seems perfect, you don't think there is any way to improve it!");
} else { } else {
@ -174,10 +173,10 @@ public class AlchemistsToolkit extends Artifact {
else else
result += "The toolkit rests on your hip, the various tools inside make a light jingling sound as you move.\n\n"; 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 " + 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."; "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."; result += "The mixture you have created seems perfect, and the toolkit is working at maximum efficiency.";
} else if (!bstGuess.isEmpty()) { } else if (!bstGuess.isEmpty()) {
result += "Your current best mixture is made from: " + bstGuess.get(0) + ", " + bstGuess.get(1) + ", " 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. //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. //to prevent manipulation where a player could keep throwing in 1-2 seeds until they get lucky.
if (seedsToPotion == 0){ if (seedsToPotion == 0){
if (Random.Int(20) < 10+level){ if (Random.Int(20) < 10+level()){
if (Random.Int(20) < level){ if (Random.Int(20) < level()){
seedsToPotion = 1; seedsToPotion = 1;
} else } else
seedsToPotion = 2; seedsToPotion = 2;

View File

@ -188,7 +188,7 @@ public class Artifact extends KindofMisc {
@Override @Override
public int visiblyUpgraded() { public int visiblyUpgraded() {
return ((level*10)/levelCap); return ((level()*10)/levelCap);
} }
//transfers upgrades from another artifact, transfer level will equal the displayed level //transfers upgrades from another artifact, transfer level will equal the displayed level
@ -212,7 +212,7 @@ public class Artifact extends KindofMisc {
@Override @Override
public String toString() { public String toString() {
if (levelKnown && level/levelCap != 0) { if (levelKnown && level()/levelCap != 0) {
if (chargeCap > 0) { if (chargeCap > 0) {
return Utils.format( TXT_TO_STRING_LVL_CHARGE, name(), visiblyUpgraded(), charge, chargeCap ); return Utils.format( TXT_TO_STRING_LVL_CHARGE, name(), visiblyUpgraded(), charge, chargeCap );
} else { } else {
@ -273,8 +273,8 @@ public class Artifact extends KindofMisc {
@Override @Override
public int price() { public int price() {
int price = 100; int price = 100;
if (level > 0) if (level() > 0)
price += 50*((level*10)/levelCap); price += 50*((level()*10)/levelCap);
if (cursed && cursedKnown) { if (cursed && cursedKnown) {
price /= 2; price /= 2;
} }
@ -293,8 +293,8 @@ public class Artifact extends KindofMisc {
public class ArtifactBuff extends Buff { public class ArtifactBuff extends Buff {
public int level() { public int itemLevel() {
return level; return level();
} }
public boolean isCursed() { public boolean isCursed() {

View File

@ -34,7 +34,6 @@ public class CapeOfThorns extends Artifact {
name = "Cape of Thorns"; name = "Cape of Thorns";
image = ItemSpriteSheet.ARTIFACT_CAPE; image = ItemSpriteSheet.ARTIFACT_CAPE;
level = 0;
levelCap = 10; levelCap = 10;
charge = 0; charge = 0;
@ -85,10 +84,10 @@ public class CapeOfThorns extends Artifact {
public int proc(int damage, Char attacker, Char defender){ public int proc(int damage, Char attacker, Char defender){
if (cooldown == 0){ if (cooldown == 0){
charge += damage*(0.5+level*0.05); charge += damage*(0.5+level()*0.05);
if (charge >= chargeCap){ if (charge >= chargeCap){
charge = 0; charge = 0;
cooldown = 10+level; cooldown = 10+level();
GLog.p("Your Cape begins radiating energy, you feel protected!"); GLog.p("Your Cape begins radiating energy, you feel protected!");
BuffIndicator.refreshHero(); BuffIndicator.refreshHero();
} }
@ -104,8 +103,8 @@ public class CapeOfThorns extends Artifact {
exp+= deflected; exp+= deflected;
if (exp >= (level+1)*5 && level < levelCap){ if (exp >= (level()+1)*5 && level() < levelCap){
exp -= (level+1)*5; exp -= (level()+1)*5;
upgrade(); upgrade();
GLog.p("Your Cape grows stronger!"); GLog.p("Your Cape grows stronger!");
} }

View File

@ -52,7 +52,6 @@ public class ChaliceOfBlood extends Artifact {
name = "Chalice of Blood"; name = "Chalice of Blood";
image = ItemSpriteSheet.ARTIFACT_CHALICE1; image = ItemSpriteSheet.ARTIFACT_CHALICE1;
level = 0;
levelCap = 10; levelCap = 10;
} }
@ -61,7 +60,7 @@ public class ChaliceOfBlood extends Artifact {
@Override @Override
public ArrayList<String> actions( Hero hero ) { public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
if (isEquipped( hero ) && level < levelCap && !cursed) if (isEquipped( hero ) && level() < levelCap && !cursed)
actions.add(AC_PRICK); actions.add(AC_PRICK);
return actions; return actions;
} }
@ -71,7 +70,7 @@ public class ChaliceOfBlood extends Artifact {
super.execute(hero, action); super.execute(hero, action);
if (action.equals(AC_PRICK)){ if (action.equals(AC_PRICK)){
int damage = 3*(level*level); int damage = 3*(level()*level());
if (damage > hero.HP*0.75) { if (damage > hero.HP*0.75) {
@ -92,7 +91,7 @@ public class ChaliceOfBlood extends Artifact {
} }
private void prick(Hero hero){ private void prick(Hero hero){
int damage = 3*(level*level); int damage = 3*(level()*level());
Earthroot.Armor armor = hero.buff(Earthroot.Armor.class); Earthroot.Armor armor = hero.buff(Earthroot.Armor.class);
if (armor != null) { if (armor != null) {
@ -133,9 +132,9 @@ public class ChaliceOfBlood extends Artifact {
@Override @Override
public Item upgrade() { public Item upgrade() {
if (level >= 6) if (level() >= 6)
image = ItemSpriteSheet.ARTIFACT_CHALICE3; image = ItemSpriteSheet.ARTIFACT_CHALICE3;
else if (level >= 2) else if (level() >= 2)
image = ItemSpriteSheet.ARTIFACT_CHALICE2; image = ItemSpriteSheet.ARTIFACT_CHALICE2;
return super.upgrade(); return super.upgrade();
} }
@ -148,7 +147,7 @@ public class ChaliceOfBlood extends Artifact {
@Override @Override
public String desc() { public String desc() {
String desc = "This shining silver chalice is oddly adorned with sharp gems at the rim. "; 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."; desc += "The chalice is pulling your attention strangely, you feel like it wants something from you.";
else else
desc += "The chalice is full and radiating energy."; desc += "The chalice is full and radiating energy.";
@ -157,15 +156,15 @@ public class ChaliceOfBlood extends Artifact {
desc += "\n\n"; desc += "\n\n";
if (cursed) if (cursed)
desc += "The cursed chalice has bound itself to your hand, and is slowly tugging at your life energy."; 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."; 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 " + 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."; "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 " + 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."; "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 " + 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 " + "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."; "your help. Your friend knows you have limits though, it doesn't want you to die, just bleed.";

View File

@ -43,13 +43,12 @@ public class CloakOfShadows extends Artifact {
name = "Cloak of Shadows"; name = "Cloak of Shadows";
image = ItemSpriteSheet.ARTIFACT_CLOAK; image = ItemSpriteSheet.ARTIFACT_CLOAK;
level = 0;
exp = 0; exp = 0;
levelCap = 15; levelCap = 15;
charge = level+5; charge = level()+5;
partialCharge = 0; partialCharge = 0;
chargeCap = level+5; chargeCap = level()+5;
cooldown = 0; 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, " + 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"; "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."; 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."; 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."; desc += "The cloak has almost returned to full strength.";
else else
desc += "The cloak is at full potential and will work for extended durations."; 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 (turnsToCost == 0) exp += 10 + ((Hero)target).lvl;
if (exp >= (level+1)*50 && level < levelCap) { if (exp >= (level()+1)*50 && level() < levelCap) {
upgrade(); upgrade();
exp -= level*50; exp -= level()*50;
GLog.p("Your cloak grows stronger!"); GLog.p("Your cloak grows stronger!");
} }
@ -259,9 +258,9 @@ public class CloakOfShadows extends Artifact {
exp += 10 + ((Hero)target).lvl; exp += 10 + ((Hero)target).lvl;
if (exp >= (level+1)*50 && level < levelCap) { if (exp >= (level()+1)*50 && level() < levelCap) {
upgrade(); upgrade();
exp -= level*50; exp -= level()*50;
GLog.p("Your cloak grows stronger!"); GLog.p("Your cloak grows stronger!");
} }
@ -295,7 +294,7 @@ public class CloakOfShadows extends Artifact {
if (target.invisible > 0) if (target.invisible > 0)
target.invisible--; target.invisible--;
stealthed = false; stealthed = false;
cooldown = 10 - (level / 3); cooldown = 10 - (level() / 3);
updateQuickslot(); updateQuickslot();
super.detach(); super.detach();

View File

@ -55,7 +55,6 @@ public class DriedRose extends Artifact {
name = "Dried Rose"; name = "Dried Rose";
image = ItemSpriteSheet.ARTIFACT_ROSE1; image = ItemSpriteSheet.ARTIFACT_ROSE1;
level = 0;
levelCap = 10; levelCap = 10;
charge = 100; charge = 100;
@ -103,7 +102,7 @@ public class DriedRose extends Artifact {
} }
if (spawnPoints.size() > 0) { if (spawnPoints.size() > 0) {
GhostHero ghost = new GhostHero( level ); GhostHero ghost = new GhostHero( level() );
ghost.pos = Random.element(spawnPoints); ghost.pos = Random.element(spawnPoints);
GameScene.add(ghost, 1f); GameScene.add(ghost, 1f);
@ -144,10 +143,10 @@ public class DriedRose extends Artifact {
if (!cursed){ if (!cursed){
desc += "\n\nThe rose rests in your hand, it feels strangely warm."; 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 " + desc+= "\n\nThe rose has lost most of its petals. It feels extremely frail, like it " +
"could snap any moment."; "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."+ 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."; " It almost looks like it's ready to bloom.";
else else
@ -167,13 +166,13 @@ public class DriedRose extends Artifact {
@Override @Override
public Item upgrade() { public Item upgrade() {
if (level >= 9) if (level() >= 9)
image = ItemSpriteSheet.ARTIFACT_ROSE3; image = ItemSpriteSheet.ARTIFACT_ROSE3;
else if (level >= 4) else if (level() >= 4)
image = ItemSpriteSheet.ARTIFACT_ROSE2; image = ItemSpriteSheet.ARTIFACT_ROSE2;
//For upgrade transferring via well of transmutation //For upgrade transferring via well of transmutation
droppedPetals = Math.max( level, droppedPetals ); droppedPetals = Math.max( level(), droppedPetals );
return super.upgrade(); return super.upgrade();
} }
@ -261,13 +260,13 @@ public class DriedRose extends Artifact {
if (rose == null){ if (rose == null){
GLog.w("You have no rose to add this petal to."); GLog.w("You have no rose to add this petal to.");
return false; 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."); GLog.i("There is no room left for this petal, so you discard it.");
return true; return true;
} else { } else {
rose.upgrade(); rose.upgrade();
if (rose.level == rose.levelCap) { if (rose.level() == rose.levelCap) {
GLog.p("The rose is completed!"); GLog.p("The rose is completed!");
Sample.INSTANCE.play( Assets.SND_GHOST ); Sample.INSTANCE.play( Assets.SND_GHOST );
GLog.n("sad ghost: \"Thank you...\""); GLog.n("sad ghost: \"Thank you...\"");

View File

@ -49,7 +49,6 @@ public class EtherealChains extends Artifact {
name = "ethereal chains"; name = "ethereal chains";
image = ItemSpriteSheet.ARTIFACT_CHAINS; image = ItemSpriteSheet.ARTIFACT_CHAINS;
level = 0;
levelCap = 5; levelCap = 5;
exp = 0; exp = 0;
@ -207,7 +206,7 @@ public class EtherealChains extends Artifact {
@Override @Override
public boolean act() { public boolean act() {
int chargeTarget = 5+(level*2); int chargeTarget = 5+(level()*2);
LockedFloor lock = target.buff(LockedFloor.class); LockedFloor lock = target.buff(LockedFloor.class);
if (charge < chargeTarget && !cursed && (lock == null || lock.regenOn())) { if (charge < chargeTarget && !cursed && (lock == null || lock.regenOn())) {
partialCharge += 1 / (40f - (chargeTarget - charge)*2f); partialCharge += 1 / (40f - (chargeTarget - charge)*2f);
@ -233,13 +232,13 @@ public class EtherealChains extends Artifact {
exp += Math.round(levelPortion*100); exp += Math.round(levelPortion*100);
//past the soft charge cap, gaining charge from leveling is slowed. //past the soft charge cap, gaining charge from leveling is slowed.
if (charge > 5+(level*2)){ if (charge > 5+(level()*2)){
levelPortion *= (5+((float)level*2))/charge; levelPortion *= (5+((float)level()*2))/charge;
} }
partialCharge += levelPortion*10f; partialCharge += levelPortion*10f;
if (exp > 100+level*50 && level < levelCap){ if (exp > 100+level()*50 && level() < levelCap){
exp -= 100+level*50; exp -= 100+level()*50;
GLog.p("Your chains grow stronger!"); GLog.p("Your chains grow stronger!");
upgrade(); upgrade();
} }

View File

@ -49,7 +49,6 @@ public class HornOfPlenty extends Artifact {
name = "Horn of Plenty"; name = "Horn of Plenty";
image = ItemSpriteSheet.ARTIFACT_HORN1; image = ItemSpriteSheet.ARTIFACT_HORN1;
level = 0;
levelCap = 30; levelCap = 30;
charge = 0; charge = 0;
@ -74,7 +73,7 @@ public class HornOfPlenty extends Artifact {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
if (isEquipped( hero ) && charge > 0) if (isEquipped( hero ) && charge > 0)
actions.add(AC_EAT); actions.add(AC_EAT);
if (isEquipped( hero ) && level < 30 && !cursed) if (isEquipped( hero ) && level() < 30 && !cursed)
actions.add(AC_STORE); actions.add(AC_STORE);
return actions; return actions;
} }
@ -158,7 +157,7 @@ public class HornOfPlenty extends Artifact {
if (!cursed) { if (!cursed) {
desc += "\n\nThe horn rests at your side and is surprisingly lightweight, even with food in it."; 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."; desc += " Perhaps there is a way to increase the horn's power by giving it food energy.";
} else { } else {
desc += "\n\nThe cursed horn has bound itself to your side, " + 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 //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) //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. //charge is in increments of 36 food value.
if (partialCharge >= 36) { if (partialCharge >= 36) {
@ -224,8 +223,8 @@ public class HornOfPlenty extends Artifact {
hero.spend( TIME_TO_EAT ); hero.spend( TIME_TO_EAT );
curItem.upgrade(((Food)item).hornValue); curItem.upgrade(((Food)item).hornValue);
if (curItem.level >= 30){ if (curItem.level() >= 30){
curItem.level = 30; curItem.level(30);
GLog.p("your horn has consumed all the food it can!"); GLog.p("your horn has consumed all the food it can!");
} else } else
GLog.p("the horn consumes your food offering and grows in strength!"); GLog.p("the horn consumes your food offering and grows in strength!");

View File

@ -86,11 +86,10 @@ public class LloydsBeacon extends Artifact {
name = "lloyd's beacon"; name = "lloyd's beacon";
image = ItemSpriteSheet.ARTIFACT_BEACON; image = ItemSpriteSheet.ARTIFACT_BEACON;
level = 0;
levelCap = 3; levelCap = 3;
charge = 0; charge = 0;
chargeCap = 3+level; chargeCap = 3+level();
defaultAction = AC_ZAP; defaultAction = AC_ZAP;
usesTargeting = true; usesTargeting = true;

View File

@ -30,7 +30,6 @@ public class MasterThievesArmband extends Artifact {
name = "Master Thieves' Armband"; name = "Master Thieves' Armband";
image = ItemSpriteSheet.ARTIFACT_ARMBAND; image = ItemSpriteSheet.ARTIFACT_ARMBAND;
level = 0;
levelCap = 10; levelCap = 10;
charge = 0; charge = 0;
@ -84,7 +83,7 @@ public class MasterThievesArmband extends Artifact {
exp += value; exp += value;
} }
} }
while(exp >= 600 && level < levelCap) { while(exp >= 600 && level() < levelCap) {
exp -= 600; exp -= 600;
upgrade(); upgrade();
} }
@ -93,7 +92,7 @@ public class MasterThievesArmband extends Artifact {
public float stealChance(int value){ public float stealChance(int value){
//get lvl*100 gold or lvl*5% item value of free charge, whichever is less. //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); return (((float)charge + chargeBonus)/value);
} }

View File

@ -47,7 +47,6 @@ public class SandalsOfNature extends Artifact {
name = "Sandals of Nature"; name = "Sandals of Nature";
image = ItemSpriteSheet.ARTIFACT_SANDALS; image = ItemSpriteSheet.ARTIFACT_SANDALS;
level = 0;
levelCap = 3; levelCap = 3;
charge = 0; charge = 0;
@ -69,7 +68,7 @@ public class SandalsOfNature extends Artifact {
@Override @Override
public ArrayList<String> actions( Hero hero ) { public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
if (isEquipped( hero ) && level < 3 && !cursed) if (isEquipped( hero ) && level() < 3 && !cursed)
actions.add(AC_FEED); actions.add(AC_FEED);
if (isEquipped( hero ) && charge > 0) if (isEquipped( hero ) && charge > 0)
actions.add(AC_ROOT); actions.add(AC_ROOT);
@ -81,7 +80,7 @@ public class SandalsOfNature extends Artifact {
super.execute(hero, action); super.execute(hero, action);
if (action.equals(AC_FEED)){ if (action.equals(AC_FEED)){
GameScene.selectItem(itemSelector, mode, inventoryTitle); 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."); 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."); else if (charge == 0) GLog.i("They have no energy right now.");
@ -104,13 +103,13 @@ public class SandalsOfNature extends Artifact {
@Override @Override
public String desc() { public String desc() {
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 " + 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?"; "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 " + 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?"; "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" + 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 " + " 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"; "regained their strength, but perhaps they can still grow further";
@ -121,15 +120,15 @@ public class SandalsOfNature extends Artifact {
if ( isEquipped ( Dungeon.hero ) ){ if ( isEquipped ( Dungeon.hero ) ){
desc += "\n\n"; desc += "\n\n";
if (level == 0) { if (level() == 0) {
if (!cursed) if (!cursed)
desc += "The sandals wrap snugly around your feet, they seem happy to be worn."; desc += "The sandals wrap snugly around your feet, they seem happy to be worn.";
else else
desc += "The cursed sandals wrap tightly around your feet."; 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."; 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."; desc += "The boots fit snugly and add a nice heft to your step.";
else else
desc += "The greaves are thick and weighty, but very easy to move in, as if they are moving with you."; 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 else
desc += " They are blocking any attunement with nature."; 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, " + 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."; "but will need to charge up for it.";
} }
@ -159,15 +158,15 @@ public class SandalsOfNature extends Artifact {
@Override @Override
public Item upgrade() { public Item upgrade() {
if (level < 0) if (level() < 0)
image = ItemSpriteSheet.ARTIFACT_SANDALS; image = ItemSpriteSheet.ARTIFACT_SANDALS;
else if (level == 0) else if (level() == 0)
image = ItemSpriteSheet.ARTIFACT_SHOES; image = ItemSpriteSheet.ARTIFACT_SHOES;
else if (level == 1) else if (level() == 1)
image = ItemSpriteSheet.ARTIFACT_BOOTS; image = ItemSpriteSheet.ARTIFACT_BOOTS;
else if (level >= 2) else if (level() >= 2)
image = ItemSpriteSheet.ARTIFACT_GREAVES; image = ItemSpriteSheet.ARTIFACT_GREAVES;
name = NAMES[level+1]; name = NAMES[level()+1];
return super.upgrade(); return super.upgrade();
} }
@ -194,7 +193,7 @@ public class SandalsOfNature extends Artifact {
public void charge() { public void charge() {
if (charge < target.HT){ if (charge < target.HT){
//gain 1+(1*level)% of the difference between current charge and max HP. //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(); updateQuickslot();
} }
} }
@ -214,11 +213,11 @@ public class SandalsOfNature extends Artifact {
Sample.INSTANCE.play( Assets.SND_PLANT ); Sample.INSTANCE.play( Assets.SND_PLANT );
hero.busy(); hero.busy();
hero.spend( 2f ); hero.spend( 2f );
if (seeds.size() >= 5+(level*2)){ if (seeds.size() >= 5+(level()*2)){
seeds.clear(); seeds.clear();
upgrade(); upgrade();
if (level >= 1 && level <= 3) { if (level() >= 1 && level() <= 3) {
GLog.p("Your " + NAMES[level-1] + " surge in size, they are now " + NAMES[level] + "!"); GLog.p("Your " + NAMES[level()-1] + " surge in size, they are now " + NAMES[level()] + "!");
} }
} else { } else {

View File

@ -42,7 +42,6 @@ public class TalismanOfForesight extends Artifact {
name = "Talisman of Foresight"; name = "Talisman of Foresight";
image = ItemSpriteSheet.ARTIFACT_TALISMAN; image = ItemSpriteSheet.ARTIFACT_TALISMAN;
level = 0;
exp = 0; exp = 0;
levelCap = 10; 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. //fully charges in 2500 turns at lvl=0, scaling to 1000 turns at lvl = 10.
LockedFloor lock = target.buff(LockedFloor.class); LockedFloor lock = target.buff(LockedFloor.class);
if (charge < chargeCap && !cursed && (lock == null || lock.regenOn())) { 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) { if (partialCharge > 1 && charge < chargeCap) {
partialCharge--; partialCharge--;
@ -190,9 +189,9 @@ public class TalismanOfForesight extends Artifact {
} }
public void charge(){ public void charge(){
charge = Math.min(charge+(2+(level/3)), chargeCap); charge = Math.min(charge+(2+(level()/3)), chargeCap);
exp++; exp++;
if (exp >= 4 && level < levelCap) { if (exp >= 4 && level() < levelCap) {
upgrade(); upgrade();
GLog.p("Your Talisman grows stronger!"); GLog.p("Your Talisman grows stronger!");
exp -= 4; exp -= 4;

View File

@ -53,12 +53,11 @@ public class TimekeepersHourglass extends Artifact {
name = "Timekeeper's Hourglass"; name = "Timekeeper's Hourglass";
image = ItemSpriteSheet.ARTIFACT_HOURGLASS; image = ItemSpriteSheet.ARTIFACT_HOURGLASS;
level = 0;
levelCap = 5; levelCap = 5;
charge = 10+level*2; charge = 10+level()*2;
partialCharge = 0; partialCharge = 0;
chargeCap = 10+level*2; chargeCap = 10+level()*2;
defaultAction = AC_ACTIVATE; defaultAction = AC_ACTIVATE;
} }
@ -139,7 +138,7 @@ public class TimekeepersHourglass extends Artifact {
chargeCap+= 2; chargeCap+= 2;
//for artifact transmutation. //for artifact transmutation.
while (level+1 > sandBags) while (level()+1 > sandBags)
sandBags ++; sandBags ++;
return super.upgrade(); return super.upgrade();
@ -156,7 +155,7 @@ public class TimekeepersHourglass extends Artifact {
if (!cursed) { if (!cursed) {
desc += "\n\nThe hourglass rests at your side, the whisper of steadily pouring sand is reassuring."; desc += "\n\nThe hourglass rests at your side, the whisper of steadily pouring sand is reassuring.";
if (level < levelCap ) if (level() < levelCap )
desc += desc +=
"\n\nThe hourglass seems to have lost some sand with age. While there are no cracks, " + "\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..."; "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) { if (hourglass != null && !hourglass.cursed) {
hourglass.upgrade(); hourglass.upgrade();
Sample.INSTANCE.play( Assets.SND_DEWDROP ); 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!"); GLog.p("Your hourglass is filled with magical sand!");
else else
GLog.i("you add the sand to your hourglass."); GLog.i("you add the sand to your hourglass.");

View File

@ -49,12 +49,11 @@ public class UnstableSpellbook extends Artifact {
name = "Unstable Spellbook"; name = "Unstable Spellbook";
image = ItemSpriteSheet.ARTIFACT_SPELLBOOK; image = ItemSpriteSheet.ARTIFACT_SPELLBOOK;
level = 0;
levelCap = 10; levelCap = 10;
charge = ((level/2)+3); charge = ((level()/2)+3);
partialCharge = 0; partialCharge = 0;
chargeCap = ((level/2)+3); chargeCap = ((level()/2)+3);
defaultAction = AC_READ; defaultAction = AC_READ;
} }
@ -87,7 +86,7 @@ public class UnstableSpellbook extends Artifact {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
if (isEquipped( hero ) && charge > 0 && !cursed) if (isEquipped( hero ) && charge > 0 && !cursed)
actions.add(AC_READ); actions.add(AC_READ);
if (isEquipped( hero ) && level < levelCap && !cursed) if (isEquipped( hero ) && level() < levelCap && !cursed)
actions.add(AC_ADD); actions.add(AC_ADD);
return actions; return actions;
} }
@ -129,10 +128,10 @@ public class UnstableSpellbook extends Artifact {
@Override @Override
public Item upgrade() { public Item upgrade() {
chargeCap = (((level+1)/2)+3); chargeCap = (((level()+1)/2)+3);
//for artifact transmutation. //for artifact transmutation.
while (scrolls.size() > (levelCap-1-level)) while (scrolls.size() > (levelCap-1-level()))
scrolls.remove(0); scrolls.remove(0);
return super.upgrade(); return super.upgrade();
@ -142,9 +141,9 @@ public class UnstableSpellbook extends Artifact {
public String desc() { public String desc() {
String desc = "This Tome is in surprising good condition given its age. "; 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. "; desc += "It emanates a strange chaotic energy. ";
else if (level < 7) else if (level() < 7)
desc += "It glows with a strange chaotic energy. "; desc += "It glows with a strange chaotic energy. ";
else else
desc += "It fizzes and crackles as you move the pages, surging with unstable energy. "; 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) if (scrolls.size() > 1)
desc += "The book's index points to some pages which are blank. " + desc += "The book's index points to some pages which are blank. " +
"Those pages are listed as: " + scrolls.get(0) + " and " "Those pages are listed as: " + scrolls.get(0) + " and "

View File

@ -61,12 +61,20 @@ public class Pickaxe extends Weapon {
defaultAction = AC_MINE; defaultAction = AC_MINE;
STR = 14; STR = 14;
MIN = 3;
MAX = 12;
} }
public boolean bloodStained = false; public boolean bloodStained = false;
@Override
public int min() {
return 3;
}
@Override
public int max() {
return 12;
}
@Override @Override
public ArrayList<String> actions( Hero hero ) { public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );

View File

@ -283,10 +283,10 @@ public class Ring extends KindofMisc {
} }
if (Random.Float() < 0.3f) { if (Random.Float() < 0.3f) {
level = -n; level(-n);
cursed = true; cursed = true;
} else } else
level = n; level(n);
return this; return this;
} }
@ -302,10 +302,10 @@ public class Ring extends KindofMisc {
price /= 2; price /= 2;
} }
if (levelKnown) { if (levelKnown) {
if (level > 0) { if (level() > 0) {
price *= (level + 1); price *= (level() + 1);
} else if (level < 0) { } else if (level() < 0) {
price /= (1 - level); price /= (1 - level());
} }
} }
if (price < 1) { if (price < 1) {
@ -340,7 +340,7 @@ public class Ring extends KindofMisc {
public int level; public int level;
public RingBuff() { public RingBuff() {
level = Ring.this.level; level = Ring.this.level();
} }
@Override @Override

View File

@ -43,7 +43,7 @@ public class RingOfForce extends Ring {
"When unarmed, at your current strength, "; "When unarmed, at your current strength, ";
int str = Dungeon.hero.STR() - 8; int str = Dungeon.hero.STR() - 8;
desc += levelKnown ? 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."; "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."; desc += " Wearing a second ring of force would enhance this.";
return desc; return desc;

View File

@ -79,7 +79,7 @@ public abstract class InventoryScroll extends Scroll {
if (item != null) { if (item != null) {
((InventoryScroll)curItem).onItemSelected( item ); ((InventoryScroll)curItem).onItemSelected( item );
curUser.spendAndNext( TIME_TO_READ ); ((InventoryScroll)curItem).readAnimation();
Sample.INSTANCE.play( Assets.SND_READ ); Sample.INSTANCE.play( Assets.SND_READ );
Invisibility.dispel(); Invisibility.dispel();

View File

@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler; import com.shatteredpixel.shatteredpixeldungeon.items.ItemStatusHandler;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellbook; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.UnstableSpellbook;
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
@ -144,6 +145,12 @@ public abstract class Scroll extends Item {
abstract protected void doRead(); abstract protected void doRead();
protected void readAnimation() {
curUser.spend( TIME_TO_READ );
curUser.busy();
((HeroSprite)curUser.sprite).read();
}
public boolean isKnown() { public boolean isKnown() {
return handler.isKnown( this ); return handler.isKnown( this );
} }

View File

@ -58,7 +58,7 @@ public class ScrollOfLullaby extends Scroll {
setKnown(); setKnown();
curUser.spendAndNext( TIME_TO_READ ); readAnimation();
} }
@Override @Override

View File

@ -84,7 +84,7 @@ public class ScrollOfMagicMapping extends Scroll {
setKnown(); setKnown();
curUser.spendAndNext( TIME_TO_READ ); readAnimation();
} }
@Override @Override

View File

@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.scrolls;
import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.Badges;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.effects.Enchanting;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
@ -46,7 +47,7 @@ public class ScrollOfMagicalInfusion extends InventoryScroll {
@Override @Override
protected void onItemSelected( Item item ) { protected void onItemSelected( Item item ) {
ScrollOfRemoveCurse.uncurse( Dungeon.hero, item ); ScrollOfRemoveCurse.uncurse(Dungeon.hero, item);
if (item instanceof Weapon) if (item instanceof Weapon)
((Weapon)item).upgrade(true); ((Weapon)item).upgrade(true);
else else
@ -54,9 +55,10 @@ public class ScrollOfMagicalInfusion extends InventoryScroll {
GLog.p( TXT_INFUSE, item.name() ); GLog.p( TXT_INFUSE, item.name() );
Badges.validateItemLevelAquired( item ); Badges.validateItemLevelAquired(item);
curUser.sprite.emitter().start( Speck.factory( Speck.UP ), 0.2f, 3 ); curUser.sprite.emitter().start(Speck.factory(Speck.UP), 0.2f, 3);
Enchanting.show(curUser, item);
} }
@Override @Override

View File

@ -72,7 +72,7 @@ public class ScrollOfMirrorImage extends Scroll {
Sample.INSTANCE.play( Assets.SND_READ ); Sample.INSTANCE.play( Assets.SND_READ );
Invisibility.dispel(); Invisibility.dispel();
curUser.spendAndNext( TIME_TO_READ ); readAnimation();
} }
@Override @Override

View File

@ -65,7 +65,7 @@ public class ScrollOfPsionicBlast extends Scroll {
setKnown(); setKnown();
curUser.spendAndNext( TIME_TO_READ ); curUser.spendAndNext( TIME_TO_READ ); //no animation here, the flash interrupts it anyway.
if (!curUser.isAlive()) { if (!curUser.isAlive()) {
Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name )); Dungeon.fail( Utils.format(ResultDescriptions.ITEM, name ));

View File

@ -67,7 +67,7 @@ public class ScrollOfRage extends Scroll {
Sample.INSTANCE.play( Assets.SND_CHALLENGE ); Sample.INSTANCE.play( Assets.SND_CHALLENGE );
Invisibility.dispel(); Invisibility.dispel();
curUser.spendAndNext( TIME_TO_READ ); readAnimation();
} }
@Override @Override

View File

@ -53,7 +53,7 @@ public class ScrollOfRecharging extends Scroll {
SpellSprite.show( curUser, SpellSprite.CHARGE ); SpellSprite.show( curUser, SpellSprite.CHARGE );
setKnown(); setKnown();
curUser.spendAndNext( TIME_TO_READ ); readAnimation();
} }
@Override @Override

View File

@ -67,7 +67,7 @@ public class ScrollOfRemoveCurse extends Scroll {
setKnown(); setKnown();
curUser.spendAndNext( TIME_TO_READ ); readAnimation();
} }
@Override @Override

View File

@ -52,7 +52,7 @@ public class ScrollOfTeleportation extends Scroll {
teleportHero( curUser ); teleportHero( curUser );
setKnown(); setKnown();
curUser.spendAndNext( TIME_TO_READ ); readAnimation();
} }
public static void teleportHero( Hero hero ) { public static void teleportHero( Hero hero ) {

View File

@ -70,7 +70,7 @@ public class ScrollOfTerror extends Scroll {
} }
setKnown(); setKnown();
curUser.spendAndNext( TIME_TO_READ ); readAnimation();
} }
@Override @Override

View File

@ -389,7 +389,7 @@ public class CursedWand {
do { do {
reward = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR, reward = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR,
Generator.Category.RING, Generator.Category.WAND)); 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); Sample.INSTANCE.play(Assets.SND_MIMIC, 1, 1, 0.5f);
mimic.items.clear(); mimic.items.clear();
mimic.items.add(reward); mimic.items.add(reward);
@ -426,7 +426,7 @@ public class CursedWand {
do { do {
result = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR, result = Generator.random(Random.oneOf(Generator.Category.WEAPON, Generator.Category.ARMOR,
Generator.Category.RING, Generator.Category.ARTIFACT)); 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(); if (result.isUpgradable()) result.upgrade();
result.cursed = result.cursedKnown = true; result.cursed = result.cursedKnown = true;
GLog.w("your wand transmogrifies into a different item!"); GLog.w("your wand transmogrifies into a different item!");

View File

@ -56,10 +56,6 @@ public abstract class Wand extends Item {
public static final String AC_ZAP = "ZAP"; 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_FIZZLES = "your wand fizzles; it must not have enough charge.";
private static final String TXT_SELF_TARGET = "You can't target yourself"; private static final String TXT_SELF_TARGET = "You can't target yourself";
@ -79,7 +75,6 @@ public abstract class Wand extends Item {
protected int collisionProperties = Ballistica.MAGIC_BOLT; protected int collisionProperties = Ballistica.MAGIC_BOLT;
{ {
defaultAction = AC_ZAP; defaultAction = AC_ZAP;
usesTargeting = true; usesTargeting = true;
@ -139,7 +134,7 @@ public abstract class Wand extends Item {
protected void processSoulMark(Char target, int chargesUsed){ protected void processSoulMark(Char target, int chargesUsed){
if (target != Dungeon.hero && if (target != Dungeon.hero &&
Dungeon.hero.subClass == HeroSubClass.WARLOCK && 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); SoulMark.prolong(target, SoulMark.class, SoulMark.DURATION);
} }
} }
@ -156,13 +151,9 @@ public abstract class Wand extends Item {
} }
} }
public int level() { public void level( int value) {
if (charger != null) { super.level( value );
Magic magic = charger.target.buff( Magic.class ); updateLevel();
return magic == null ? level : Math.max( level + magic.level, 0 );
} else {
return level;
}
} }
@Override @Override
@ -233,7 +224,7 @@ public abstract class Wand extends Item {
} }
public void updateLevel() { public void updateLevel() {
maxCharges = Math.min( initialCharges() + level, 10 ); maxCharges = Math.min( initialCharges() + level(), 10 );
curCharges = Math.min( curCharges, maxCharges ); curCharges = Math.min( curCharges, maxCharges );
} }
@ -299,10 +290,10 @@ public abstract class Wand extends Item {
price /= 2; price /= 2;
} }
if (levelKnown) { if (levelKnown) {
if (level > 0) { if (level() > 0) {
price *= (level + 1); price *= (level() + 1);
} else if (level < 0) { } else if (level() < 0) {
price /= (1 - level); price /= (1 - level());
} }
} }
if (price < 1) { if (price < 1) {

View File

@ -63,7 +63,7 @@ public class WandOfBlastWave extends Wand {
Sample.INSTANCE.play( Assets.SND_BLAST ); Sample.INSTANCE.play( Assets.SND_BLAST );
BlastWave.blast(bolt.collisionPos); 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 //presses all tiles in the AOE first
for (int i : Level.NEIGHBOURS9){ for (int i : Level.NEIGHBOURS9){
@ -80,7 +80,7 @@ public class WandOfBlastWave extends Wand {
if (ch.isAlive()) { if (ch.isAlive()) {
Ballistica trajectory = new Ballistica(ch.pos, ch.pos + i, Ballistica.MAGIC_BOLT); 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); throwChar(ch, trajectory, strength);
} }
} }
@ -94,7 +94,7 @@ public class WandOfBlastWave extends Wand {
if (ch.isAlive() && bolt.path.size() > bolt.dist+1) { if (ch.isAlive() && bolt.path.size() > bolt.dist+1) {
Ballistica trajectory = new Ballistica(ch.pos, bolt.path.get(bolt.dist + 1), Ballistica.MAGIC_BOLT); 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); throwChar(ch, trajectory, strength);
} }
} }
@ -139,7 +139,7 @@ public class WandOfBlastWave extends Wand {
@Override @Override
//a weaker knockback, not dissimilar to the glyph of bounce, but a fair bit stronger. //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) { 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 0 - 25%
// lvl 1 - 40% // lvl 1 - 40%

View File

@ -76,7 +76,7 @@ public class WandOfCorruption extends Wand {
return; return;
} }
int basePower = 10 + 2*level; int basePower = 10 + 2*level();
int mobPower = Random.IntRange(0, ch.HT) + ch.HP*2; int mobPower = Random.IntRange(0, ch.HT) + ch.HP*2;
for ( Buff buff : ch.buffs()){ for ( Buff buff : ch.buffs()){
if (buff.type == Buff.buffType.NEGATIVE){ if (buff.type == Buff.buffType.NEGATIVE){
@ -89,7 +89,7 @@ public class WandOfCorruption extends Wand {
//try to use extra charges to overpower the mob //try to use extra charges to overpower the mob
while (basePower <= mobPower){ while (basePower <= mobPower){
extraCharges++; extraCharges++;
basePower += 5 + level; basePower += 5 + level();
} }
//if we fail, lose all charges, remember we have 1 left to lose from using the wand. //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 0 - 25%
// lvl 1 - 40% // lvl 1 - 40%
// lvl 2 - 50% // lvl 2 - 50%
if (Random.Int( level + 4 ) >= 3){ if (Random.Int( level() + 4 ) >= 3){
Buff.prolong( defender, Amok.class, 3+level); Buff.prolong( defender, Amok.class, 3+level());
} }
} }

View File

@ -75,7 +75,7 @@ public class WandOfDisintegration extends Wand {
if (Level.flamable[c]) { if (Level.flamable[c]) {
Level.set( c, Terrain.EMBERS ); Dungeon.level.destroy( c );
GameScene.updateMap( c ); GameScene.updateMap( c );
terrainAffected = true; terrainAffected = true;

View File

@ -68,7 +68,7 @@ public class WandOfFireblast extends Wand {
Char ch = Actor.findChar( cell ); Char ch = Actor.findChar( cell );
if (ch != null) { 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 ); Buff.affect( ch, Burning.class ).reignite( ch );
switch(chargesPerCast()){ switch(chargesPerCast()){
case 1: case 1:

View File

@ -57,7 +57,7 @@ public class WandOfFrost extends Wand {
Char ch = Actor.findChar(bolt.collisionPos); Char ch = Actor.findChar(bolt.collisionPos);
if (ch != null){ 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){ if (ch.buff(Frost.class) != null){
return; //do nothing, can't affect a frozen target return; //do nothing, can't affect a frozen target
@ -65,7 +65,7 @@ public class WandOfFrost extends Wand {
if (ch.buff(Chill.class) != null){ if (ch.buff(Chill.class) != null){
damage = Math.round(damage * ch.buff(Chill.class).speedFactor()); damage = Math.round(damage * ch.buff(Chill.class).speedFactor());
} else { } else {
ch.sprite.burst( 0xFF99CCFF, level / 2 + 2 ); ch.sprite.burst( 0xFF99CCFF, level() / 2 + 2 );
} }
processSoulMark(ch, chargesPerCast()); processSoulMark(ch, chargesPerCast());
@ -74,12 +74,12 @@ public class WandOfFrost extends Wand {
if (ch.isAlive()){ if (ch.isAlive()){
if (Level.water[ch.pos]){ if (Level.water[ch.pos]){
//20+(10*level)% chance //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)); Buff.affect(ch, Frost.class, Frost.duration(ch)*Random.Float(2f, 4f));
else else
Buff.prolong(ch, Chill.class, 6+level); Buff.prolong(ch, Chill.class, 6+level());
} else { } else {
Buff.prolong(ch, Chill.class, 4+level); Buff.prolong(ch, Chill.class, 4+level());
} }
} }
} }

View File

@ -60,8 +60,8 @@ public class WandOfLightning extends Wand {
float multipler = 0.4f + (0.6f/affected.size()); float multipler = 0.4f + (0.6f/affected.size());
if (Level.water[bolt.collisionPos]) multipler *= 1.5f; if (Level.water[bolt.collisionPos]) multipler *= 1.5f;
int min = 5+level; int min = 5+level();
int max = Math.round(10 + (level * level / 4f)); int max = Math.round(10 + (level() * level() / 4f));
for (Char ch : affected){ for (Char ch : affected){
processSoulMark(ch, chargesPerCast()); processSoulMark(ch, chargesPerCast());

View File

@ -43,12 +43,10 @@ public class WandOfMagicMissile extends Wand {
Char ch = Actor.findChar( bolt.collisionPos ); Char ch = Actor.findChar( bolt.collisionPos );
if (ch != null) { if (ch != null) {
int level = level();
processSoulMark(ch, chargesPerCast()); 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 @Override
public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) {
//gain 1 turn of recharging buff per level of the wand. //gain 1 turn of recharging buff per level of the wand.
if (level > 0) { if (level() > 0) {
Buff.prolong( attacker, ScrollOfRecharging.Recharging.class, (float)staff.level); Buff.prolong( attacker, ScrollOfRecharging.Recharging.class, (float)staff.level());
SpellSprite.show(attacker, SpellSprite.CHARGE); SpellSprite.show(attacker, SpellSprite.CHARGE);
} }
} }

View File

@ -90,25 +90,25 @@ public class WandOfPrismaticLight extends Wand {
affectMap(beam); affectMap(beam);
if (curUser.viewDistance < 4) 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){ 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 //three in (5+lvl) chance of failing
if (Random.Int(5+level) >= 3) { if (Random.Int(5+level()) >= 3) {
Buff.prolong(ch, Blindness.class, 2f + (level * 0.34f)); Buff.prolong(ch, Blindness.class, 2f + (level() * 0.34f));
ch.sprite.emitter().burst(Speck.factory(Speck.LIGHT), 6 ); ch.sprite.emitter().burst(Speck.factory(Speck.LIGHT), 6 );
} }
if (evilMobs.contains(ch.getClass())){ 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); Sample.INSTANCE.play(Assets.SND_BURNING);
ch.damage((int)(dmg*1.5), this); ch.damage((int)(dmg*1.5), this);
} else { } else {
ch.sprite.centerEmitter().burst( RainbowParticle.BURST, 10+level ); ch.sprite.centerEmitter().burst( RainbowParticle.BURST, 10+level() );
ch.damage(dmg, this); ch.damage(dmg, this);
} }
@ -156,7 +156,7 @@ public class WandOfPrismaticLight extends Wand {
@Override @Override
public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) {
//cripples enemy //cripples enemy
Buff.prolong( defender, Cripple.class, 1f+staff.level); Buff.prolong( defender, Cripple.class, 1f+staff.level());
} }
@Override @Override

View File

@ -168,7 +168,7 @@ public class WandOfRegrowth extends Wand {
public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) { public void onHit(MagesStaff staff, Char attacker, Char defender, int damage) {
//like vampiric enchantment, except with herbal healing buff //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 0 - 33%
// lvl 1 - 43% // lvl 1 - 43%

View File

@ -109,24 +109,24 @@ public class WandOfTransfusion extends Wand {
int missingHP = ch.HT - ch.HP; int missingHP = ch.HT - ch.HP;
//heals 30%+3%*lvl missing 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.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); ch.sprite.showStatus(CharSprite.POSITIVE, "+%dHP", healing);
//harms the undead //harms the undead
} else if (undeadMobs.contains(ch.getClass())){ } else if (undeadMobs.contains(ch.getClass())){
//deals 30%+5%*lvl total HP. //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.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); Sample.INSTANCE.play(Assets.SND_BURNING);
//charms an enemy //charms an enemy
} else { } else {
float duration = 5+level; float duration = 5+level();
Buff.affect(ch, Charm.class, Charm.durationFactor(ch) * duration).object = curUser.id(); Buff.affect(ch, Charm.class, Charm.durationFactor(ch) * duration).object = curUser.id();
duration *= Random.Float(0.75f, 1f); duration *= Random.Float(0.75f, 1f);
@ -143,14 +143,14 @@ public class WandOfTransfusion extends Wand {
Item item = heap.peek(); Item item = heap.peek();
//30% + 10%*lvl chance to uncurse the item and reset it to base level if degraded. //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){ if (item.cursed){
item.cursed = false; item.cursed = false;
CellEmitter.get(cell).start( ShadowParticle.UP, 0.05f, 10 ); CellEmitter.get(cell).start( ShadowParticle.UP, 0.05f, 10 );
Sample.INSTANCE.play(Assets.SND_BURNING); 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){ if (lvldiffFromBase < 0){
item.upgrade(-lvldiffFromBase); item.upgrade(-lvldiffFromBase);
CellEmitter.get(cell).start(Speck.factory(Speck.UP), 0.2f, 3); 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) { } else if (Dungeon.level.map[cell] == Terrain.EMBERS) {
//30% + 3%*lvl chance to grow a random plant, or just regrow grass. //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); Dungeon.level.plant((Plant.Seed) Generator.random(Generator.Category.SEED), cell);
CellEmitter.get( cell ).burst(LeafParticle.LEVEL_SPECIFIC, 8); CellEmitter.get( cell ).burst(LeafParticle.LEVEL_SPECIFIC, 8);
GameScene.updateMap(cell); GameScene.updateMap(cell);
@ -213,7 +213,7 @@ public class WandOfTransfusion extends Wand {
// lvl 0 - 10% // lvl 0 - 10%
// lvl 1 - 18% // lvl 1 - 18%
// lvl 2 - 25% // lvl 2 - 25%
if (Random.Int( level + 10 ) >= 9){ if (Random.Int( level() + 10 ) >= 9){
//grants a free use of the staff //grants a free use of the staff
freeCharge = true; freeCharge = true;
GLog.p("Your staff is charged with the life energy of your enemy!"); GLog.p("Your staff is charged with the life energy of your enemy!");

View File

@ -45,8 +45,8 @@ public class WandOfVenom extends Wand {
@Override @Override
protected void onZap(Ballistica bolt) { protected void onZap(Ballistica bolt) {
Blob venomGas = Blob.seed(bolt.collisionPos, 50 + 10 * level, VenomGas.class); Blob venomGas = Blob.seed(bolt.collisionPos, 50 + 10 * level(), VenomGas.class);
((VenomGas)venomGas).setStrength(level+1); ((VenomGas)venomGas).setStrength(level()+1);
GameScene.add(venomGas); GameScene.add(venomGas);
Char ch = Actor.findChar(bolt.collisionPos); Char ch = Actor.findChar(bolt.collisionPos);

View File

@ -39,7 +39,7 @@ import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
import com.watabou.utils.Random; import com.watabou.utils.Random;
public class Weapon extends KindOfWeapon { abstract public class Weapon extends KindOfWeapon {
private static final int HITS_TO_KNOW = 20; private static final int HITS_TO_KNOW = 20;
@ -165,7 +165,7 @@ public class Weapon extends KindOfWeapon {
public Item upgrade( boolean enchant ) { public Item upgrade( boolean enchant ) {
if (enchantment != null) { if (enchantment != null) {
if (!enchant && Random.Int( level ) > 0) { if (!enchant && Random.Int( level() ) > 0) {
GLog.w( TXT_INCOMPATIBLE ); GLog.w( TXT_INCOMPATIBLE );
enchant( null ); enchant( null );
} }

View File

@ -31,7 +31,7 @@ import com.watabou.utils.Random;
public class Death extends Weapon.Enchantment { 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 ); private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 );
@ -40,7 +40,7 @@ public class Death extends Weapon.Enchantment {
// lvl 0 - 8% // lvl 0 - 8%
// lvl 1 ~ 9% // lvl 1 ~ 9%
// lvl 2 ~ 10% // lvl 2 ~ 10%
int level = Math.max( 0, weapon.level ); int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 100 ) >= 92) { if (Random.Int( level + 100 ) >= 92) {

View File

@ -31,7 +31,7 @@ import com.watabou.utils.Random;
public class Fire extends Weapon.Enchantment { 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 ); private static ItemSprite.Glowing ORANGE = new ItemSprite.Glowing( 0xFF4400 );
@ -40,7 +40,7 @@ public class Fire extends Weapon.Enchantment {
// lvl 0 - 33% // lvl 0 - 33%
// lvl 1 - 50% // lvl 1 - 50%
// lvl 2 - 60% // lvl 2 - 60%
int level = Math.max( 0, weapon.level ); int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 3 ) >= 2) { if (Random.Int( level + 3 ) >= 2) {

View File

@ -32,7 +32,7 @@ import com.watabou.utils.Random;
public class Horror extends Weapon.Enchantment { 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 ); private static ItemSprite.Glowing GREY = new ItemSprite.Glowing( 0x222222 );
@ -41,7 +41,7 @@ public class Horror extends Weapon.Enchantment {
// lvl 0 - 20% // lvl 0 - 20%
// lvl 1 - 33% // lvl 1 - 33%
// lvl 2 - 43% // lvl 2 - 43%
int level = Math.max( 0, weapon.level ); int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 5 ) >= 4) { if (Random.Int( level + 5 ) >= 4) {

View File

@ -27,7 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang;
public class Instability extends Weapon.Enchantment { public class Instability extends Weapon.Enchantment {
private static final String TXT_UNSTABLE = "Unstable %s"; private static final String TXT_UNSTABLE = "unstable %s";
@Override @Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) { public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {

View File

@ -30,14 +30,14 @@ import com.watabou.utils.Random;
public class Leech extends Weapon.Enchantment { 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 ); private static ItemSprite.Glowing RED = new ItemSprite.Glowing( 0x660022 );
@Override @Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) { 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 0 - 33%
// lvl 1 - 43% // lvl 1 - 43%

View File

@ -27,13 +27,13 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
public class Luck extends Weapon.Enchantment { 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 ); private static ItemSprite.Glowing GREEN = new ItemSprite.Glowing( 0x00FF00 );
@Override @Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) { 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; int dmg = damage;
for (int i=1; i <= level+1; i++) { for (int i=1; i <= level+1; i++) {

View File

@ -29,7 +29,7 @@ import com.watabou.utils.Random;
public class Paralysis extends Weapon.Enchantment { 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 ); private static ItemSprite.Glowing YELLOW = new ItemSprite.Glowing( 0xCCAA44 );
@ -38,7 +38,7 @@ public class Paralysis extends Weapon.Enchantment {
// lvl 0 - 13% // lvl 0 - 13%
// lvl 1 - 22% // lvl 1 - 22%
// lvl 2 - 30% // lvl 2 - 30%
int level = Math.max( 0, weapon.level ); int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 8 ) >= 7) { if (Random.Int( level + 8 ) >= 7) {

View File

@ -29,7 +29,7 @@ import com.watabou.utils.Random;
public class Poison extends Weapon.Enchantment { 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 ); private static ItemSprite.Glowing PURPLE = new ItemSprite.Glowing( 0x4400AA );
@ -38,7 +38,7 @@ public class Poison extends Weapon.Enchantment {
// lvl 0 - 33% // lvl 0 - 33%
// lvl 1 - 50% // lvl 1 - 50%
// lvl 2 - 60% // lvl 2 - 60%
int level = Math.max( 0, weapon.level ); int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 3 ) >= 2) { if (Random.Int( level + 3 ) >= 2) {

View File

@ -34,14 +34,14 @@ import com.watabou.utils.Random;
public class Shock extends Weapon.Enchantment { public class Shock extends Weapon.Enchantment {
private static final String TXT_SHOCKING = "Shocking %s"; private static final String TXT_SHOCKING = "shocking %s";
@Override @Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) { public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
// lvl 0 - 25% // lvl 0 - 25%
// lvl 1 - 40% // lvl 1 - 40%
// lvl 2 - 50% // lvl 2 - 50%
int level = Math.max( 0, weapon.level ); int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 4 ) >= 3) { if (Random.Int( level + 4 ) >= 3) {

View File

@ -30,7 +30,7 @@ import com.watabou.utils.Random;
public class Slow extends Weapon.Enchantment { 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 ); private static ItemSprite.Glowing BLUE = new ItemSprite.Glowing( 0x0044FF );
@ -39,7 +39,7 @@ public class Slow extends Weapon.Enchantment {
// lvl 0 - 25% // lvl 0 - 25%
// lvl 1 - 40% // lvl 1 - 40%
// lvl 2 - 50% // lvl 2 - 50%
int level = Math.max( 0, weapon.level ); int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 4 ) >= 3) { if (Random.Int( level + 4 ) >= 3) {

View File

@ -69,14 +69,16 @@ public class MagesStaff extends MeleeWeapon {
public MagesStaff() { public MagesStaff() {
//tier 1 weapon with poor base stats.
super(1, 1f, 1f); super(1, 1f, 1f);
MIN = 1;
MAX = 6;
wand = null; wand = null;
} }
@Override
protected int maxBase() {
return 6; //6 base damage instead of 10
}
public MagesStaff(Wand wand){ public MagesStaff(Wand wand){
this(); this();
wand.identify(); wand.identify();
@ -156,15 +158,15 @@ public class MagesStaff extends MeleeWeapon {
} }
//syncs the level of the two items. //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) if (staffLevelDiff > 0)
this.upgrade(staffLevelDiff); this.upgrade(staffLevelDiff);
else if (staffLevelDiff < 0) else if (staffLevelDiff < 0)
this.degrade(Math.abs(staffLevelDiff)); this.degrade(Math.abs(staffLevelDiff));
int wandLevelDiff = targetLevel - wand.level; int wandLevelDiff = targetLevel - wand.level();
if (wandLevelDiff > 0) if (wandLevelDiff > 0)
wand.upgrade(wandLevelDiff); wand.upgrade(wandLevelDiff);
else if (wandLevelDiff < 0) else if (wandLevelDiff < 0)

View File

@ -40,18 +40,26 @@ public class MeleeWeapon extends Weapon {
STR = typicalSTR(); STR = typicalSTR();
MIN = min();
MAX = max();
} }
private int min() { protected int minBase() {
return tier; return tier;
} }
private int max() { protected int maxBase() {
return (int)((tier * tier - tier + 10) / ACU * DLY); return (int)((tier * tier - tier + 10) / ACU * DLY);
} }
@Override
public int min() {
return minBase() + level();
}
@Override
public int max() {
return maxBase() + level() * tier;
}
@Override @Override
public Item upgrade() { public Item upgrade() {
return upgrade( false ); return upgrade( false );
@ -59,8 +67,6 @@ public class MeleeWeapon extends Weapon {
public Item upgrade( boolean enchant ) { public Item upgrade( boolean enchant ) {
STR--; STR--;
MIN++;
MAX += tier;
return super.upgrade( enchant ); return super.upgrade( enchant );
} }
@ -72,8 +78,6 @@ public class MeleeWeapon extends Weapon {
@Override @Override
public Item degrade() { public Item degrade() {
STR++; STR++;
MIN--;
MAX -= tier;
return super.degrade(); return super.degrade();
} }
@ -88,18 +92,22 @@ public class MeleeWeapon extends Weapon {
StringBuilder info = new StringBuilder( desc() ); 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( p );
info.append( "This " + name + " is " + Utils.indefinite( quality ) ); info.append( "This " + name + " is " + Utils.indefinite( quality ) );
info.append( " tier-" + tier + " melee weapon. " ); info.append( " tier-" + tier + " melee weapon. " );
if (levelKnown) { if (levelKnown) {
int min = min();
int max = max();
info.append( "Its average damage is " + 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. " ); + " points per hit. " );
} else { } else {
int min = minBase();
int max = maxBase();
info.append( 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. " ); "and usually it requires " + typicalSTR() + " points of strength. " );
if (typicalSTR() > Dungeon.hero.STR()) { if (typicalSTR() > Dungeon.hero.STR()) {
info.append( "Probably this weapon is too heavy for you. " ); info.append( "Probably this weapon is too heavy for you. " );
@ -173,10 +181,10 @@ public class MeleeWeapon extends Weapon {
price /= 2; price /= 2;
} }
if (levelKnown) { if (levelKnown) {
if (level > 0) { if (level() > 0) {
price *= (level + 1); price *= (level() + 1);
} else if (level < 0) { } else if (level() < 0) {
price /= (1 - level); price /= (1 - level());
} }
} }
if (price < 1) { if (price < 1) {
@ -189,7 +197,7 @@ public class MeleeWeapon extends Weapon {
public Item random() { public Item random() {
super.random(); super.random();
if (Random.Int( 10 + level ) == 0) { if (Random.Int( 10 + level() ) == 0) {
enchant(); enchant();
} }

View File

@ -61,13 +61,17 @@ public class ShortSword extends MeleeWeapon {
super( 1, 1f, 1f ); super( 1, 1f, 1f );
STR = 11; STR = 11;
MAX = 12; }
@Override
protected int maxBase() {
return 12;
} }
@Override @Override
public ArrayList<String> actions( Hero hero ) { public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero ); ArrayList<String> actions = super.actions( hero );
if (level > 0) { if (level() > 0) {
actions.add( AC_REFORGE ); actions.add( AC_REFORGE );
} }
return actions; return actions;

View File

@ -35,15 +35,22 @@ public class Boomerang extends MissileWeapon {
STR = 10; STR = 10;
MIN = 1;
MAX = 5;
stackable = false; stackable = false;
unique = true; unique = true;
bones = false; bones = false;
} }
@Override
public int min() {
return 1 + level();
}
@Override
public int max() {
return 5 + 2 * level();
}
@Override @Override
public boolean isUpgradable() { public boolean isUpgradable() {
return true; return true;
@ -56,8 +63,6 @@ public class Boomerang extends MissileWeapon {
@Override @Override
public Item upgrade( boolean enchant ) { public Item upgrade( boolean enchant ) {
MIN += 1;
MAX += 2;
super.upgrade( enchant ); super.upgrade( enchant );
updateQuickslot(); updateQuickslot();
@ -67,8 +72,6 @@ public class Boomerang extends MissileWeapon {
@Override @Override
public Item degrade() { public Item degrade() {
MIN -= 1;
MAX -= 2;
return super.degrade(); return super.degrade();
} }

View File

@ -36,9 +36,16 @@ public class CurareDart extends MissileWeapon {
image = ItemSpriteSheet.CURARE_DART; image = ItemSpriteSheet.CURARE_DART;
STR = 14; STR = 14;
}
MIN = 1; @Override
MAX = 3; public int min() {
return 1;
}
@Override
public int max() {
return 3;
} }
public CurareDart() { public CurareDart() {

View File

@ -30,12 +30,19 @@ public class Dart extends MissileWeapon {
name = "dart"; name = "dart";
image = ItemSpriteSheet.DART; image = ItemSpriteSheet.DART;
MIN = 1;
MAX = 4;
bones = false; //Finding them in bones would be semi-frequent and disappointing. 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() { public Dart() {
this( 1 ); this( 1 );
} }

View File

@ -41,9 +41,16 @@ public class IncendiaryDart extends MissileWeapon {
image = ItemSpriteSheet.INCENDIARY_DART; image = ItemSpriteSheet.INCENDIARY_DART;
STR = 12; STR = 12;
}
MIN = 1; @Override
MAX = 2; public int min() {
return 1;
}
@Override
public int max() {
return 2;
} }
public IncendiaryDart() { public IncendiaryDart() {

View File

@ -34,9 +34,16 @@ public class Javelin extends MissileWeapon {
image = ItemSpriteSheet.JAVELIN; image = ItemSpriteSheet.JAVELIN;
STR = 15; STR = 15;
}
MIN = 2; @Override
MAX = 15; public int min() {
return 2;
}
@Override
public int max() {
return 15;
} }
public Javelin() { public Javelin() {

View File

@ -36,7 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.watabou.utils.Random; import com.watabou.utils.Random;
public class MissileWeapon extends Weapon { abstract public class MissileWeapon extends Weapon {
private static final String TXT_MISSILES = "Missile weapon"; private static final String TXT_MISSILES = "Missile weapon";
private static final String TXT_YES = "Yes, I know what I'm doing"; private static final String TXT_YES = "Yes, I know what I'm doing";
@ -150,7 +150,7 @@ public class MissileWeapon extends Weapon {
StringBuilder info = new StringBuilder( desc() ); 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 (Dungeon.hero.belongings.backpack.items.contains( this )) {
if (STR > Dungeon.hero.STR()) { if (STR > Dungeon.hero.STR()) {

View File

@ -32,12 +32,19 @@ public class Shuriken extends MissileWeapon {
STR = 13; STR = 13;
MIN = 2;
MAX = 6;
DLY = 0.5f; DLY = 0.5f;
} }
@Override
public int min() {
return 2;
}
@Override
public int max() {
return 6;
}
public Shuriken() { public Shuriken() {
this( 1 ); this( 1 );
} }

View File

@ -34,9 +34,16 @@ public class Tamahawk extends MissileWeapon {
image = ItemSpriteSheet.TOMAHAWK; image = ItemSpriteSheet.TOMAHAWK;
STR = 17; STR = 17;
}
MIN = 4; @Override
MAX = 20; public int min() {
return 4;
}
@Override
public int max() {
return 20;
} }
public Tamahawk() { public Tamahawk() {

View File

@ -36,7 +36,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.SandalsOfNature;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush; import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush;
import com.shatteredpixel.shatteredpixeldungeon.plants.Plant;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.watabou.utils.Random; import com.watabou.utils.Random;
@ -54,7 +53,7 @@ public class HighGrass {
SandalsOfNature.Naturalism naturalism = ch.buff( SandalsOfNature.Naturalism.class ); SandalsOfNature.Naturalism naturalism = ch.buff( SandalsOfNature.Naturalism.class );
if (naturalism != null) { if (naturalism != null) {
if (!naturalism.isCursed()) { if (!naturalism.isCursed()) {
naturalismLevel = naturalism.level() + 1; naturalismLevel = naturalism.itemLevel() + 1;
naturalism.charge(); naturalism.charge();
} else { } else {
naturalismLevel = -1; naturalismLevel = -1;

View File

@ -81,7 +81,7 @@ public abstract class Plant implements Bundlable {
int naturalismLevel = 0; int naturalismLevel = 0;
SandalsOfNature.Naturalism naturalism = Dungeon.hero.buff( SandalsOfNature.Naturalism.class ); SandalsOfNature.Naturalism naturalism = Dungeon.hero.buff( SandalsOfNature.Naturalism.class );
if (naturalism != null) { if (naturalism != null) {
naturalismLevel = naturalism.level()+1; naturalismLevel = naturalism.itemLevel()+1;
} }
if (Random.Int( 5 - (naturalismLevel/2) ) == 0) { if (Random.Int( 5 - (naturalismLevel/2) ) == 0) {