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
@@ -39,7 +39,7 @@ import com.watabou.utils.Bundlable;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class Weapon extends KindOfWeapon {
abstract public class Weapon extends KindOfWeapon {
private static final int HITS_TO_KNOW = 20;
@@ -165,7 +165,7 @@ public class Weapon extends KindOfWeapon {
public Item upgrade( boolean enchant ) {
if (enchantment != null) {
if (!enchant && Random.Int( level ) > 0) {
if (!enchant && Random.Int( level() ) > 0) {
GLog.w( TXT_INCOMPATIBLE );
enchant( null );
}
@@ -31,7 +31,7 @@ import com.watabou.utils.Random;
public class Death extends Weapon.Enchantment {
private static final String TXT_GRIM = "Grim %s";
private static final String TXT_GRIM = "grim %s";
private static ItemSprite.Glowing BLACK = new ItemSprite.Glowing( 0x000000 );
@@ -40,7 +40,7 @@ public class Death extends Weapon.Enchantment {
// lvl 0 - 8%
// lvl 1 ~ 9%
// lvl 2 ~ 10%
int level = Math.max( 0, weapon.level );
int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 100 ) >= 92) {
@@ -31,7 +31,7 @@ import com.watabou.utils.Random;
public class Fire extends Weapon.Enchantment {
private static final String TXT_BLAZING = "Blazing %s";
private static final String TXT_BLAZING = "blazing %s";
private static ItemSprite.Glowing ORANGE = new ItemSprite.Glowing( 0xFF4400 );
@@ -40,7 +40,7 @@ public class Fire extends Weapon.Enchantment {
// lvl 0 - 33%
// lvl 1 - 50%
// lvl 2 - 60%
int level = Math.max( 0, weapon.level );
int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 3 ) >= 2) {
@@ -32,7 +32,7 @@ import com.watabou.utils.Random;
public class Horror extends Weapon.Enchantment {
private static final String TXT_ELDRITCH = "Eldritch %s";
private static final String TXT_ELDRITCH = "eldritch %s";
private static ItemSprite.Glowing GREY = new ItemSprite.Glowing( 0x222222 );
@@ -41,7 +41,7 @@ public class Horror extends Weapon.Enchantment {
// lvl 0 - 20%
// lvl 1 - 33%
// lvl 2 - 43%
int level = Math.max( 0, weapon.level );
int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 5 ) >= 4) {
@@ -27,7 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang;
public class Instability extends Weapon.Enchantment {
private static final String TXT_UNSTABLE = "Unstable %s";
private static final String TXT_UNSTABLE = "unstable %s";
@Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
@@ -30,14 +30,14 @@ import com.watabou.utils.Random;
public class Leech extends Weapon.Enchantment {
private static final String TXT_VAMPIRIC = "Vampiric %s";
private static final String TXT_VAMPIRIC = "vampiric %s";
private static ItemSprite.Glowing RED = new ItemSprite.Glowing( 0x660022 );
@Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
int level = Math.max( 0, weapon.level );
int level = Math.max( 0, weapon.level() );
// lvl 0 - 33%
// lvl 1 - 43%
@@ -27,13 +27,13 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite.Glowing;
public class Luck extends Weapon.Enchantment {
private static final String TXT_LUCKY = "Lucky %s";
private static final String TXT_LUCKY = "lucky %s";
private static ItemSprite.Glowing GREEN = new ItemSprite.Glowing( 0x00FF00 );
@Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
int level = Math.max( 0, weapon.level );
int level = Math.max( 0, weapon.level() );
int dmg = damage;
for (int i=1; i <= level+1; i++) {
@@ -29,7 +29,7 @@ import com.watabou.utils.Random;
public class Paralysis extends Weapon.Enchantment {
private static final String TXT_STUNNING = "Stunning %s";
private static final String TXT_STUNNING = "stunning %s";
private static ItemSprite.Glowing YELLOW = new ItemSprite.Glowing( 0xCCAA44 );
@@ -38,7 +38,7 @@ public class Paralysis extends Weapon.Enchantment {
// lvl 0 - 13%
// lvl 1 - 22%
// lvl 2 - 30%
int level = Math.max( 0, weapon.level );
int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 8 ) >= 7) {
@@ -29,7 +29,7 @@ import com.watabou.utils.Random;
public class Poison extends Weapon.Enchantment {
private static final String TXT_VENOMOUS = "Venomous %s";
private static final String TXT_VENOMOUS = "venomous %s";
private static ItemSprite.Glowing PURPLE = new ItemSprite.Glowing( 0x4400AA );
@@ -38,7 +38,7 @@ public class Poison extends Weapon.Enchantment {
// lvl 0 - 33%
// lvl 1 - 50%
// lvl 2 - 60%
int level = Math.max( 0, weapon.level );
int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 3 ) >= 2) {
@@ -34,14 +34,14 @@ import com.watabou.utils.Random;
public class Shock extends Weapon.Enchantment {
private static final String TXT_SHOCKING = "Shocking %s";
private static final String TXT_SHOCKING = "shocking %s";
@Override
public boolean proc( Weapon weapon, Char attacker, Char defender, int damage ) {
// lvl 0 - 25%
// lvl 1 - 40%
// lvl 2 - 50%
int level = Math.max( 0, weapon.level );
int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 4 ) >= 3) {
@@ -30,7 +30,7 @@ import com.watabou.utils.Random;
public class Slow extends Weapon.Enchantment {
private static final String TXT_CHILLING = "Chilling %s";
private static final String TXT_CHILLING = "chilling %s";
private static ItemSprite.Glowing BLUE = new ItemSprite.Glowing( 0x0044FF );
@@ -39,7 +39,7 @@ public class Slow extends Weapon.Enchantment {
// lvl 0 - 25%
// lvl 1 - 40%
// lvl 2 - 50%
int level = Math.max( 0, weapon.level );
int level = Math.max( 0, weapon.level() );
if (Random.Int( level + 4 ) >= 3) {
@@ -69,14 +69,16 @@ public class MagesStaff extends MeleeWeapon {
public MagesStaff() {
//tier 1 weapon with poor base stats.
super(1, 1f, 1f);
MIN = 1;
MAX = 6;
wand = null;
}
@Override
protected int maxBase() {
return 6; //6 base damage instead of 10
}
public MagesStaff(Wand wand){
this();
wand.identify();
@@ -156,15 +158,15 @@ public class MagesStaff extends MeleeWeapon {
}
//syncs the level of the two items.
int targetLevel = Math.max(this.level, wand.level);
int targetLevel = Math.max(this.level(), wand.level());
int staffLevelDiff = targetLevel - this.level;
int staffLevelDiff = targetLevel - this.level();
if (staffLevelDiff > 0)
this.upgrade(staffLevelDiff);
else if (staffLevelDiff < 0)
this.degrade(Math.abs(staffLevelDiff));
int wandLevelDiff = targetLevel - wand.level;
int wandLevelDiff = targetLevel - wand.level();
if (wandLevelDiff > 0)
wand.upgrade(wandLevelDiff);
else if (wandLevelDiff < 0)
@@ -39,19 +39,27 @@ public class MeleeWeapon extends Weapon {
DLY = dly;
STR = typicalSTR();
MIN = min();
MAX = max();
}
private int min() {
protected int minBase() {
return tier;
}
private int max() {
protected int maxBase() {
return (int)((tier * tier - tier + 10) / ACU * DLY);
}
@Override
public int min() {
return minBase() + level();
}
@Override
public int max() {
return maxBase() + level() * tier;
}
@Override
public Item upgrade() {
return upgrade( false );
@@ -59,8 +67,6 @@ public class MeleeWeapon extends Weapon {
public Item upgrade( boolean enchant ) {
STR--;
MIN++;
MAX += tier;
return super.upgrade( enchant );
}
@@ -72,8 +78,6 @@ public class MeleeWeapon extends Weapon {
@Override
public Item degrade() {
STR++;
MIN--;
MAX -= tier;
return super.degrade();
}
@@ -88,18 +92,22 @@ public class MeleeWeapon extends Weapon {
StringBuilder info = new StringBuilder( desc() );
String quality = levelKnown && level != 0 ? (level > 0 ? "upgraded" : "degraded") : "";
String quality = levelKnown && level() != 0 ? (level() > 0 ? "upgraded" : "degraded") : "";
info.append( p );
info.append( "This " + name + " is " + Utils.indefinite( quality ) );
info.append( " tier-" + tier + " melee weapon. " );
if (levelKnown) {
int min = min();
int max = max();
info.append( "Its average damage is " +
Math.round((MIN + (MAX - MIN) / 2)*(imbue == Imbue.LIGHT ? 0.7f : (imbue == Imbue.HEAVY ? 1.5f : 1)))
Math.round((min + (max - min) / 2)*(imbue == Imbue.LIGHT ? 0.7f : (imbue == Imbue.HEAVY ? 1.5f : 1)))
+ " points per hit. " );
} else {
int min = minBase();
int max = maxBase();
info.append(
"Its typical average damage is " + (min() + (max() - min()) / 2) + " points per hit " +
"Its typical average damage is " + (min + (max - min) / 2) + " points per hit " +
"and usually it requires " + typicalSTR() + " points of strength. " );
if (typicalSTR() > Dungeon.hero.STR()) {
info.append( "Probably this weapon is too heavy for you. " );
@@ -173,10 +181,10 @@ public class MeleeWeapon extends Weapon {
price /= 2;
}
if (levelKnown) {
if (level > 0) {
price *= (level + 1);
} else if (level < 0) {
price /= (1 - level);
if (level() > 0) {
price *= (level() + 1);
} else if (level() < 0) {
price /= (1 - level());
}
}
if (price < 1) {
@@ -189,7 +197,7 @@ public class MeleeWeapon extends Weapon {
public Item random() {
super.random();
if (Random.Int( 10 + level ) == 0) {
if (Random.Int( 10 + level() ) == 0) {
enchant();
}
@@ -61,13 +61,17 @@ public class ShortSword extends MeleeWeapon {
super( 1, 1f, 1f );
STR = 11;
MAX = 12;
}
@Override
protected int maxBase() {
return 12;
}
@Override
public ArrayList<String> actions( Hero hero ) {
ArrayList<String> actions = super.actions( hero );
if (level > 0) {
if (level() > 0) {
actions.add( AC_REFORGE );
}
return actions;
@@ -34,16 +34,23 @@ public class Boomerang extends MissileWeapon {
image = ItemSpriteSheet.BOOMERANG;
STR = 10;
MIN = 1;
MAX = 5;
stackable = false;
unique = true;
bones = false;
}
@Override
public int min() {
return 1 + level();
}
@Override
public int max() {
return 5 + 2 * level();
}
@Override
public boolean isUpgradable() {
return true;
@@ -56,8 +63,6 @@ public class Boomerang extends MissileWeapon {
@Override
public Item upgrade( boolean enchant ) {
MIN += 1;
MAX += 2;
super.upgrade( enchant );
updateQuickslot();
@@ -67,8 +72,6 @@ public class Boomerang extends MissileWeapon {
@Override
public Item degrade() {
MIN -= 1;
MAX -= 2;
return super.degrade();
}
@@ -36,11 +36,18 @@ public class CurareDart extends MissileWeapon {
image = ItemSpriteSheet.CURARE_DART;
STR = 14;
MIN = 1;
MAX = 3;
}
@Override
public int min() {
return 1;
}
@Override
public int max() {
return 3;
}
public CurareDart() {
this( 1 );
}
@@ -29,13 +29,20 @@ public class Dart extends MissileWeapon {
{
name = "dart";
image = ItemSpriteSheet.DART;
MIN = 1;
MAX = 4;
bones = false; //Finding them in bones would be semi-frequent and disappointing.
}
@Override
public int min() {
return 1;
}
@Override
public int max() {
return 4;
}
public Dart() {
this( 1 );
}
@@ -41,11 +41,18 @@ public class IncendiaryDart extends MissileWeapon {
image = ItemSpriteSheet.INCENDIARY_DART;
STR = 12;
MIN = 1;
MAX = 2;
}
@Override
public int min() {
return 1;
}
@Override
public int max() {
return 2;
}
public IncendiaryDart() {
this( 1 );
}
@@ -34,11 +34,18 @@ public class Javelin extends MissileWeapon {
image = ItemSpriteSheet.JAVELIN;
STR = 15;
MIN = 2;
MAX = 15;
}
@Override
public int min() {
return 2;
}
@Override
public int max() {
return 15;
}
public Javelin() {
this( 1 );
}
@@ -36,7 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
import com.watabou.utils.Random;
public class MissileWeapon extends Weapon {
abstract public class MissileWeapon extends Weapon {
private static final String TXT_MISSILES = "Missile weapon";
private static final String TXT_YES = "Yes, I know what I'm doing";
@@ -150,7 +150,7 @@ public class MissileWeapon extends Weapon {
StringBuilder info = new StringBuilder( desc() );
info.append( "\n\nAverage damage of this weapon equals to " + (MIN + (MAX - MIN) / 2) + " points per hit. " );
info.append( "\n\nAverage damage of this weapon equals to " + (min() + (max() - min()) / 2) + " points per hit. " );
if (Dungeon.hero.belongings.backpack.items.contains( this )) {
if (STR > Dungeon.hero.STR()) {
@@ -31,13 +31,20 @@ public class Shuriken extends MissileWeapon {
image = ItemSpriteSheet.SHURIKEN;
STR = 13;
MIN = 2;
MAX = 6;
DLY = 0.5f;
}
@Override
public int min() {
return 2;
}
@Override
public int max() {
return 6;
}
public Shuriken() {
this( 1 );
}
@@ -34,11 +34,18 @@ public class Tamahawk extends MissileWeapon {
image = ItemSpriteSheet.TOMAHAWK;
STR = 17;
MIN = 4;
MAX = 20;
}
@Override
public int min() {
return 4;
}
@Override
public int max() {
return 20;
}
public Tamahawk() {
this( 1 );
}