v0.4.0: refactors and rebalancing to existing weapons

This commit is contained in:
Evan Debenham 2016-05-14 18:32:35 -04:00
parent 8f27e921d8
commit 56ec14e370
28 changed files with 152 additions and 106 deletions

View File

@ -261,7 +261,7 @@ public class Hero extends Char {
KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon; KindOfWeapon wep = rangedWeapon != null ? rangedWeapon : belongings.weapon;
if (wep != null) { if (wep != null) {
return (int)(attackSkill * accuracy * wep.acuracyFactor( this )); return (int)(attackSkill * accuracy * wep.accuracyFactor( this ));
} else { } else {
return (int)(attackSkill * accuracy); return (int)(attackSkill * accuracy);
} }

View File

@ -92,7 +92,7 @@ public class Statue extends Mob {
@Override @Override
public int attackSkill( Char target ) { public int attackSkill( Char target ) {
return (int)((9 + Dungeon.depth) * weapon.ACU); return (int)((9 + Dungeon.depth) * weapon.ACC);
} }
@Override @Override

View File

@ -77,14 +77,22 @@ abstract public class KindOfWeapon extends EquipableItem {
} }
} }
abstract public int min(); public int min(){
abstract public int max(); return min(level());
}
public int max(){
return max(level());
}
abstract public int min(int lvl);
abstract public int max(int lvl);
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 accuracyFactor(Hero hero ) {
return 1f; return 1f;
} }

View File

@ -63,18 +63,18 @@ public class Pickaxe extends Weapon {
public boolean bloodStained = false; public boolean bloodStained = false;
@Override @Override
public int min() { public int min(int lvl) {
return 3; return 2; //tier 2
} }
@Override @Override
public int max() { public int max(int lvl) {
return 12; return 15; //tier 2
} }
@Override @Override
public int STRReq(int lvl) { public int STRReq(int lvl) {
return 14; return 14; //tier 3
} }
@Override @Override
@ -89,7 +89,7 @@ public class Pickaxe extends Weapon {
super.execute( hero, action ); super.execute( hero, action );
if (action == AC_MINE) { if (action.equals(AC_MINE)) {
if (Dungeon.depth < 11 || Dungeon.depth > 15) { if (Dungeon.depth < 11 || Dungeon.depth > 15) {
GLog.w( Messages.get(this, "no_vein") ); GLog.w( Messages.get(this, "no_vein") );

View File

@ -54,7 +54,7 @@ abstract public class Weapon extends KindOfWeapon {
private static final String TXT_TO_STRING = "%s :%d"; private static final String TXT_TO_STRING = "%s :%d";
public float ACU = 1; // Accuracy modifier public float ACC = 1; // Accuracy modifier
public float DLY = 1f; // Speed modifier public float DLY = 1f; // Speed modifier
public enum Imbue { public enum Imbue {
@ -105,11 +105,11 @@ abstract public class Weapon extends KindOfWeapon {
} }
@Override @Override
public float acuracyFactor( Hero hero ) { public float accuracyFactor( Hero hero ) {
int encumbrance = STRReq() - hero.STR(); int encumbrance = STRReq() - hero.STR();
float ACU = this.ACU; float ACC = this.ACC;
if (this instanceof MissileWeapon) { if (this instanceof MissileWeapon) {
if (hero.heroClass == HeroClass.HUNTRESS) { if (hero.heroClass == HeroClass.HUNTRESS) {
@ -119,10 +119,10 @@ abstract public class Weapon extends KindOfWeapon {
for (Buff buff : hero.buffs(RingOfSharpshooting.Aim.class)) { for (Buff buff : hero.buffs(RingOfSharpshooting.Aim.class)) {
bonus += ((RingOfSharpshooting.Aim)buff).level; bonus += ((RingOfSharpshooting.Aim)buff).level;
} }
ACU *= (float)(Math.pow(1.1, bonus)); ACC *= (float)(Math.pow(1.1, bonus));
} }
return encumbrance > 0 ? (float)(ACU / Math.pow( 1.5, encumbrance )) : ACU; return encumbrance > 0 ? (float)(ACC / Math.pow( 1.5, encumbrance )) : ACC;
} }
@Override @Override

View File

@ -26,10 +26,15 @@ public class BattleAxe extends MeleeWeapon {
{ {
image = ItemSpriteSheet.BATTLE_AXE; image = ItemSpriteSheet.BATTLE_AXE;
tier = 4;
ACC = 1.175f; //17.5% boost to accuracy
} }
public BattleAxe() { @Override
super( 4, 1.2f, 1f ); public int max(int lvl) {
return 20 + //20 base, down from 25
lvl*(tier+1); //scaling unchanged
} }
} }

View File

@ -26,10 +26,15 @@ public class Dagger extends MeleeWeapon {
{ {
image = ItemSpriteSheet.DAGGER; image = ItemSpriteSheet.DAGGER;
tier = 1;
ACC = 1.25f; //25% boost to accuracy
} }
public Dagger() { @Override
super( 1, 1.2f, 1f ); public int max(int lvl) {
return 8 + //8 base, down from 10
lvl*(tier+1); //scaling unchanged
} }
} }

View File

@ -20,16 +20,33 @@
*/ */
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
public class Glaive extends MeleeWeapon { public class Glaive extends MeleeWeapon {
{ {
image = ItemSpriteSheet.GLAIVE; image = ItemSpriteSheet.GLAIVE;
tier = 5;
DLY = 1.5f; //0.67x speed
} }
public Glaive() { @Override
super( 5, 1f, 1f ); public int reachFactor(Hero hero) {
return 2; //extra reach
}
@Override
public int min(int lvl) {
return tier + //base unchanged
2*lvl; //+2 per level, up from +1
}
@Override
public int max(int lvl) {
return 40 + //40 base, up from 30
lvl*8; //+8 per level, up from +6
} }
} }

View File

@ -6,10 +6,8 @@ public class Greatsword extends MeleeWeapon {
{ {
image = ItemSpriteSheet.GREATSWORD; image = ItemSpriteSheet.GREATSWORD;
}
public Greatsword() { tier=5;
super( 5, 1f, 1f );
} }
} }

View File

@ -26,10 +26,15 @@ public class Knuckles extends MeleeWeapon {
{ {
image = ItemSpriteSheet.KNUCKLEDUSTER; image = ItemSpriteSheet.KNUCKLEDUSTER;
tier = 1;
DLY = 0.5f; //2x speed
} }
public Knuckles() { @Override
super( 1, 1f, 0.5f ); public int max(int lvl) {
return 6 + //6 base, down from 10
lvl*2; //+1 per level, down from +2
} }
} }

View File

@ -26,10 +26,8 @@ public class Longsword extends MeleeWeapon {
{ {
image = ItemSpriteSheet.LONGSWORD; image = ItemSpriteSheet.LONGSWORD;
}
public Longsword() { tier = 4;
super( 4, 1f, 1f );
} }
} }

View File

@ -26,10 +26,15 @@ public class Mace extends MeleeWeapon {
{ {
image = ItemSpriteSheet.MACE; image = ItemSpriteSheet.MACE;
tier = 3;
ACC = 1.2f; //20% boost to accuracy
} }
public Mace() { @Override
super( 3, 1f, 0.8f ); public int max(int lvl) {
return 16 + //16 base, down from 20
lvl*(tier+1); //scaling unchanged
} }
} }

View File

@ -61,6 +61,8 @@ public class MagesStaff extends MeleeWeapon {
{ {
image = ItemSpriteSheet.MAGES_STAFF; image = ItemSpriteSheet.MAGES_STAFF;
tier = 1;
defaultAction = AC_ZAP; defaultAction = AC_ZAP;
usesTargeting = true; usesTargeting = true;
@ -69,15 +71,13 @@ public class MagesStaff extends MeleeWeapon {
} }
public MagesStaff() { public MagesStaff() {
super(1, 1f, 1f);
wand = null; wand = null;
} }
@Override @Override
protected int maxBase() { public int max(int lvl) {
return 6; //6 base damage instead of 10 return 6 + //6 base damage, down from 10
lvl*(tier+1); //scaling unaffected
} }
public MagesStaff(Wand wand){ public MagesStaff(Wand wand){

View File

@ -28,33 +28,18 @@ import com.watabou.utils.Random;
public class MeleeWeapon extends Weapon { public class MeleeWeapon extends Weapon {
private int tier; protected int tier;
public MeleeWeapon( int tier, float acu, float dly ) { @Override
super(); public int min(int lvl) {
return tier + //base
this.tier = tier; lvl; //level scaling
ACU = acu;
DLY = dly;
}
protected int minBase() {
return tier;
}
protected int maxBase() {
return (int)((tier + 1) * 5 / ACU * DLY);
} }
@Override @Override
public int min() { public int max(int lvl) {
return minBase() + level(); return 5*(tier+1) + //base
} lvl*(tier+1); //level scaling
@Override
public int max() {
return maxBase() + level() * (tier + 1);
} }
@Override @Override
@ -86,8 +71,8 @@ public class MeleeWeapon extends Weapon {
float dmgfactor = (imbue == Imbue.LIGHT ? 0.7f : imbue == Imbue.HEAVY ? 1.5f : 1); float dmgfactor = (imbue == Imbue.LIGHT ? 0.7f : imbue == Imbue.HEAVY ? 1.5f : 1);
info += " " + Messages.get(Weapon.class, "avg_dmg", Math.round((min + (max - min) / 2)*dmgfactor)); info += " " + Messages.get(Weapon.class, "avg_dmg", Math.round((min + (max - min) / 2)*dmgfactor));
} else { } else {
int min = minBase(); int min = min(0);
int max = maxBase(); int max = max(0);
info += " " + Messages.get(MeleeWeapon.class, "unknown", (min + (max - min) / 2), STRReq(0)); info += " " + Messages.get(MeleeWeapon.class, "unknown", (min + (max - min) / 2), STRReq(0));
if (STRReq(0) > Dungeon.hero.STR()) { if (STRReq(0) > Dungeon.hero.STR()) {
info += " " + Messages.get(MeleeWeapon.class, "probably_too_heavy"); info += " " + Messages.get(MeleeWeapon.class, "probably_too_heavy");

View File

@ -27,10 +27,8 @@ public class NewShortsword extends MeleeWeapon {
{ {
image = ItemSpriteSheet.SHORTSWORD; image = ItemSpriteSheet.SHORTSWORD;
}
public NewShortsword() { tier = 2;
super( 2, 1f, 1f );
} }
} }

View File

@ -26,10 +26,16 @@ public class Quarterstaff extends MeleeWeapon {
{ {
image = ItemSpriteSheet.QUARTERSTAFF; image = ItemSpriteSheet.QUARTERSTAFF;
tier = 2;
} }
public Quarterstaff() { @Override
super( 2, 1f, 1f ); public int max(int lvl) {
return 12 + //12 base, down from 15
lvl*(tier+1); //scaling unchanged
} }
//TODO add defence bonus code
} }

View File

@ -27,15 +27,26 @@ public class Spear extends MeleeWeapon {
{ {
image = ItemSpriteSheet.SPEAR; image = ItemSpriteSheet.SPEAR;
tier = 2;
DLY = 1.5f; //0.67x speed
} }
@Override @Override
public int reachFactor(Hero hero) { public int reachFactor(Hero hero) {
return 2; return 2; //extra reach
} }
public Spear() { @Override
super( 2, 1f, 1.5f ); public int min(int lvl) {
return tier + //base unchanged
2*lvl; //+2 per level, up from +1
}
@Override
public int max(int lvl) {
return 20 + //20 base, up from 15
lvl*4; //+4 per level, up from +3
} }
} }

View File

@ -26,10 +26,8 @@ public class Sword extends MeleeWeapon {
{ {
image = ItemSpriteSheet.SWORD; image = ItemSpriteSheet.SWORD;
}
public Sword() { tier = 3;
super( 3, 1f, 1f );
} }
} }

View File

@ -26,10 +26,15 @@ public class WarHammer extends MeleeWeapon {
{ {
image = ItemSpriteSheet.WAR_HAMMER; image = ItemSpriteSheet.WAR_HAMMER;
tier = 5;
ACC = 1.15f; //15% boost to accuracy
} }
public WarHammer() { @Override
super( 5, 1.2f, 1f ); public int max(int lvl) {
return 24 + //24 base, down from 30
lvl*(tier+1); //scaling unchanged
} }
} }

View File

@ -26,10 +26,8 @@ public class WornShortsword extends MeleeWeapon {
{ {
image = ItemSpriteSheet.WORN_SHORTSWORD; image = ItemSpriteSheet.WORN_SHORTSWORD;
}
public WornShortsword() { tier = 1;
super( 1, 1f, 1f );
} }
} }

View File

@ -50,18 +50,21 @@ public class Boomerang extends MissileWeapon {
} }
@Override @Override
public int min() { public int min(int lvl) {
return 1 + level(); return 1 +
lvl;
} }
@Override @Override
public int max() { public int max(int lvl) {
return 5 + 2 * level(); return 5 + //half the base damage of a tier-1 weapon
2 * lvl;//scales the same as a tier 1 weapon
} }
@Override @Override
public int STRReq(int lvl) { public int STRReq(int lvl) {
lvl = Math.max(0, lvl); lvl = Math.max(0, lvl);
//strength req decreases at +1,+3,+6,+10,etc.
return 10 - (int)(Math.sqrt(8 * lvl + 1) - 1)/2; return 10 - (int)(Math.sqrt(8 * lvl + 1) - 1)/2;
} }

View File

@ -36,12 +36,12 @@ public class CurareDart extends MissileWeapon {
} }
@Override @Override
public int min() { public int min(int lvl) {
return 1; return 1;
} }
@Override @Override
public int max() { public int max(int lvl) {
return 3; return 3;
} }

View File

@ -33,12 +33,12 @@ public class Dart extends MissileWeapon {
} }
@Override @Override
public int min() { public int min(int lvl) {
return 1; return 1;
} }
@Override @Override
public int max() { public int max(int lvl) {
return 4; return 4;
} }

View File

@ -39,12 +39,12 @@ public class IncendiaryDart extends MissileWeapon {
} }
@Override @Override
public int min() { public int min(int lvl) {
return 1; return 1;
} }
@Override @Override
public int max() { public int max(int lvl) {
return 2; return 2;
} }

View File

@ -34,12 +34,12 @@ public class Javelin extends MissileWeapon {
} }
@Override @Override
public int min() { public int min(int lvl) {
return 2; return 2;
} }
@Override @Override
public int max() { public int max(int lvl) {
return 15; return 15;
} }

View File

@ -33,12 +33,12 @@ public class Shuriken extends MissileWeapon {
} }
@Override @Override
public int min() { public int min(int lvl) {
return 2; return 2;
} }
@Override @Override
public int max() { public int max(int lvl) {
return 6; return 6;
} }

View File

@ -35,12 +35,12 @@ public class Tamahawk extends MissileWeapon {
} }
@Override @Override
public int min() { public int min(int lvl) {
return 4; return 4;
} }
@Override @Override
public int max() { public int max(int lvl) {
return 20; return 20;
} }

View File

@ -690,7 +690,8 @@ items.weapon.melee.dagger.stats_desc=This is a rather accurate weapon.
items.weapon.melee.dagger.desc=A simple iron dagger with a well worn wooden handle. items.weapon.melee.dagger.desc=A simple iron dagger with a well worn wooden handle.
items.weapon.melee.glaive.name=glaive items.weapon.melee.glaive.name=glaive
items.weapon.melee.glaive.desc=A polearm consisting of a sword blade on the end of a pole. items.weapon.melee.glaive.stats_desc=This is a rather slow weapon.\nThis weapon has extra reach.
items.weapon.melee.glaive.desc=A massive polearm consisting of a sword blade on the end of a pole.
items.weapon.melee.greatsword.name=greatsword items.weapon.melee.greatsword.name=greatsword
items.weapon.melee.greatsword.desc=This towering blade inflicts heavy damage by investing its heft into every swing. items.weapon.melee.greatsword.desc=This towering blade inflicts heavy damage by investing its heft into every swing.
@ -703,7 +704,7 @@ items.weapon.melee.longsword.name=longsword
items.weapon.melee.longsword.desc=This sword's long razor-sharp steel blade shines reassuringly, though its size does make it quite heavy. items.weapon.melee.longsword.desc=This sword's long razor-sharp steel blade shines reassuringly, though its size does make it quite heavy.
items.weapon.melee.mace.name=mace items.weapon.melee.mace.name=mace
items.weapon.melee.mace.stats_desc=This is a slightly fast weapon. items.weapon.melee.mace.stats_desc=This is a rather accurate weapon.
items.weapon.melee.mace.desc=The iron head of this weapon inflicts substantial damage. items.weapon.melee.mace.desc=The iron head of this weapon inflicts substantial damage.
items.weapon.melee.magesstaff.name=mage's staff items.weapon.melee.magesstaff.name=mage's staff