diff --git a/core/src/main/assets/items.png b/core/src/main/assets/items.png index a460e5204..5b83e5cbe 100644 Binary files a/core/src/main/assets/items.png and b/core/src/main/assets/items.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index 33f4db642..60ff3bfe3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -60,6 +60,11 @@ public class ShatteredPixelDungeon extends Game { public ShatteredPixelDungeon() { super( WelcomeScene.class ); + //v0.6.3 + com.watabou.utils.Bundle.addAlias( + com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Tomahawk.class, + "com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Tamahawk" ); + //v0.6.0 com.watabou.utils.Bundle.addAlias( com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.MassGraveRoom.Bones.class, diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index b5281d015..053654f0d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -450,6 +450,7 @@ public class Hero extends Char { @Override public void spend( float time ) { + justMoved = false; TimekeepersHourglass.timeFreeze buff = buff(TimekeepersHourglass.timeFreeze.class); if (buff != null){ buff.processTime(time); @@ -596,9 +597,14 @@ public class Hero extends Char { next(); } + //FIXME this is a fairly crude way to track this, really it would be nice to have a short + //history of hero actions + public boolean justMoved = false; + private boolean actMove( HeroAction.Move action ) { if (getCloser( action.dst )) { + justMoved = true; return true; } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java index 95c328f92..a6bffe327 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java @@ -40,6 +40,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.WornShortsword; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Dart; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingKnife; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.watabou.utils.Bundle; @@ -106,8 +107,8 @@ public enum HeroClass { private static void initWarrior( Hero hero ) { (hero.belongings.weapon = new WornShortsword()).identify(); - Dart darts = new Dart( 8 ); - darts.identify().collect(); + Dart darts = new Dart(); + darts.identify().quantity(3).collect(); if ( Badges.isUnlocked(Badges.Badge.TUTORIAL_WARRIOR) ){ if (!Dungeon.isChallenged(Challenges.NO_ARMOR)) @@ -150,11 +151,11 @@ public enum HeroClass { (hero.belongings.misc1 = cloak).identify(); hero.belongings.misc1.activate( hero ); - Dart darts = new Dart( 8 ); - darts.identify().collect(); + ThrowingKnife knives = new ThrowingKnife(); + knives.quantity(3).collect(); Dungeon.quickslot.setSlot(0, cloak); - Dungeon.quickslot.setSlot(1, darts); + Dungeon.quickslot.setSlot(1, knives); new ScrollOfMagicMapping().identify(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java index f23dc723d..50f50a7a1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java @@ -123,13 +123,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Sword; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.WarHammer; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Whip; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.WornShortsword; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.CurareDart; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Dart; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.IncendiaryDart; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Javelin; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Tamahawk; import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush; import com.shatteredpixel.shatteredpixeldungeon.plants.Blindweed; import com.shatteredpixel.shatteredpixeldungeon.plants.Dreamfoil; @@ -253,21 +246,18 @@ public class Generator { WornShortsword.class, Knuckles.class, Dagger.class, - MagesStaff.class, - Boomerang.class, - Dart.class + MagesStaff.class }; - WEP_T1.probs = new float[]{ 1, 1, 1, 0, 0, 1 }; + WEP_T1.probs = new float[]{ 1, 1, 1, 0 }; WEP_T2.classes = new Class[]{ Shortsword.class, HandAxe.class, Spear.class, Quarterstaff.class, - Dirk.class, - IncendiaryDart.class + Dirk.class }; - WEP_T2.probs = new float[]{ 6, 5, 5, 4, 4, 6 }; + WEP_T2.probs = new float[]{ 6, 5, 5, 4, 4 }; WEP_T3.classes = new Class[]{ Sword.class, @@ -275,31 +265,27 @@ public class Generator { Scimitar.class, RoundShield.class, Sai.class, - Whip.class, - Shuriken.class, - CurareDart.class + Whip.class }; - WEP_T3.probs = new float[]{ 6, 5, 5, 4, 4, 4, 6, 6 }; + WEP_T3.probs = new float[]{ 6, 5, 5, 4, 4, 4 }; WEP_T4.classes = new Class[]{ Longsword.class, BattleAxe.class, Flail.class, RunicBlade.class, - AssassinsBlade.class, - Javelin.class + AssassinsBlade.class }; - WEP_T4.probs = new float[]{ 6, 5, 5, 4, 4, 6 }; + WEP_T4.probs = new float[]{ 6, 5, 5, 4, 4 }; WEP_T5.classes = new Class[]{ Greatsword.class, WarHammer.class, Glaive.class, Greataxe.class, - Greatshield.class, - Tamahawk.class + Greatshield.class }; - WEP_T5.probs = new float[]{ 6, 5, 5, 4, 4, 6 }; + WEP_T5.probs = new float[]{ 6, 5, 5, 4, 4 }; //see Generator.randomArmor ARMOR.classes = new Class[]{ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Bolas.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Bolas.java new file mode 100644 index 000000000..acbd7e54b --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Bolas.java @@ -0,0 +1,74 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2017 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; + +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.watabou.utils.Random; + +public class Bolas extends MissileWeapon { + + { + image = ItemSpriteSheet.BOLAS; + + } + + @Override + public int min(int lvl) { + return 4; + } + + @Override + public int max(int lvl) { + return 8; + } + + @Override + public int STRReq(int lvl) { + return 15; + } + + @Override + public int proc( Char attacker, Char defender, int damage ) { + Buff.prolong( defender, Cripple.class, Cripple.DURATION ); + return super.proc( attacker, defender, damage ); + } + + @Override + protected float durabilityPerUse() { + return super.durabilityPerUse()*2f; + } + + @Override + public Item random() { + quantity = Random.Int( 2, 4 ); + return this; + } + + @Override + public int price() { + return 12 * quantity; + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/CurareDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/CurareDart.java index 140cf19b1..007fcc845 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/CurareDart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/CurareDart.java @@ -24,31 +24,15 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; -import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; -import com.watabou.utils.Random; -public class CurareDart extends Dart { +public class CurareDart extends TippedDart { public static final float DURATION = 3f; { image = ItemSpriteSheet.CURARE_DART; } - - @Override - public int STRReq(int lvl) { - return 14; - } - - public CurareDart() { - this( 1 ); - } - - public CurareDart( int number ) { - super(); - quantity = number; - } @Override public int proc( Char attacker, Char defender, int damage ) { @@ -56,14 +40,4 @@ public class CurareDart extends Dart { return super.proc( attacker, defender, damage ); } - @Override - public Item random() { - quantity = Random.Int( 2, 5 ); - return this; - } - - @Override - public int price() { - return 8 * quantity; - } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Dart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Dart.java index b8bd14e17..de273d752 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Dart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Dart.java @@ -21,10 +21,6 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; -import com.shatteredpixel.shatteredpixeldungeon.Dungeon; -import com.shatteredpixel.shatteredpixeldungeon.actors.Char; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PinCushion; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.utils.Random; @@ -35,7 +31,6 @@ public class Dart extends MissileWeapon { image = ItemSpriteSheet.DART; bones = false; //Finding them in bones would be semi-frequent and disappointing. - } @Override @@ -45,12 +40,12 @@ public class Dart extends MissileWeapon { @Override public int max(int lvl) { - return 4; + return 3; } @Override public int STRReq(int lvl) { - return 10; + return 9; } @Override @@ -58,31 +53,14 @@ public class Dart extends MissileWeapon { return 0; } - @Override - protected void rangedHit(Char enemy) { - if (enemy.isAlive()) - Buff.affect(enemy, PinCushion.class).stick(new Dart()); - else - Dungeon.level.drop( new Dart(), enemy.pos).sprite.drop(); - } - - public Dart() { - this( 1 ); - } - - public Dart( int number ) { - super(); - quantity = number; - } - @Override public Item random() { - quantity = Random.Int( 5, 15 ); + quantity = Random.Int( 5, 10 ); return this; } @Override public int price() { - return quantity * 2; + return quantity * 4; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/FishingSpear.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/FishingSpear.java new file mode 100644 index 000000000..cfd17e677 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/FishingSpear.java @@ -0,0 +1,60 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2017 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; + +import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.watabou.utils.Random; + +public class FishingSpear extends MissileWeapon { + + { + image = ItemSpriteSheet.FISHING_SPEAR; + } + + @Override + public int min(int lvl) { + return 6; + } + + @Override + public int max(int lvl) { + return 18; + } + + @Override + public int STRReq(int lvl) { + return 13; + } + + @Override + public Item random() { + quantity = Random.Int( 2, 4 ); + return this; + } + + @Override + public int price() { + return 12 * quantity; + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java index 0700f9aa7..5b362deaf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java @@ -28,30 +28,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning; -import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; -import com.watabou.utils.Random; -public class IncendiaryDart extends Dart { +public class IncendiaryDart extends TippedDart { { image = ItemSpriteSheet.INCENDIARY_DART; } - - @Override - public int STRReq(int lvl) { - return 12; - } - - public IncendiaryDart() { - this( 1 ); - } - - public IncendiaryDart( int number ) { - super(); - quantity = number; - } @Override protected void onThrow( int cell ) { @@ -70,14 +54,4 @@ public class IncendiaryDart extends Dart { return super.proc( attacker, defender, damage ); } - @Override - public Item random() { - quantity = Random.Int( 3, 6 ); - return this; - } - - @Override - public int price() { - return 5 * quantity; - } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Javelin.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Javelin.java index 70eaa921f..4266180c1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Javelin.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Javelin.java @@ -21,9 +21,6 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; -import com.shatteredpixel.shatteredpixeldungeon.actors.Char; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.utils.Random; @@ -36,42 +33,27 @@ public class Javelin extends MissileWeapon { @Override public int min(int lvl) { - return 2; + return 8; } @Override public int max(int lvl) { - return 15; + return 24; } @Override public int STRReq(int lvl) { return 15; } - - public Javelin() { - this( 1 ); - } - - public Javelin( int number ) { - super(); - quantity = number; - } - - @Override - public int proc( Char attacker, Char defender, int damage ) { - Buff.prolong( defender, Cripple.class, Cripple.DURATION ); - return super.proc( attacker, defender, damage ); - } @Override public Item random() { - quantity = Random.Int( 5, 15 ); + quantity = Random.Int( 2, 4 ); return this; } @Override public int price() { - return 12 * quantity; + return 16 * quantity; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Shuriken.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Shuriken.java index 6776f22c4..59ed0a57b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Shuriken.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Shuriken.java @@ -21,6 +21,8 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.utils.Random; @@ -29,42 +31,37 @@ public class Shuriken extends MissileWeapon { { image = ItemSpriteSheet.SHURIKEN; - - DLY = 0.5f; } @Override public int min(int lvl) { - return 2; + return 3; } @Override public int max(int lvl) { - return 6; + return 8; } @Override public int STRReq(int lvl) { - return 13; - } - - public Shuriken() { - this( 1 ); + return 11; } - public Shuriken( int number ) { - super(); - quantity = number; + @Override + public float speedFactor(Char owner) { + if (owner instanceof Hero && ((Hero) owner).justMoved) return 0; + else return super.speedFactor(owner); } @Override public Item random() { - quantity = Random.Int( 5, 15 ); + quantity = Random.NormalIntRange( 2, 4 ); return this; } @Override public int price() { - return 6 * quantity; + return 8 * quantity; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ThrowingHammer.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ThrowingHammer.java new file mode 100644 index 000000000..080282c36 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ThrowingHammer.java @@ -0,0 +1,64 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2017 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; + +import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.watabou.utils.Random; + +public class ThrowingHammer extends MissileWeapon { + + { + image = ItemSpriteSheet.THROWING_HAMMER; + } + + @Override + public int min(int lvl) { + return 8; + } + + @Override + public int max(int lvl) { + return 20; + } + + @Override + public int STRReq(int lvl) { + return 17; + } + + @Override + protected float durabilityPerUse() { + return super.durabilityPerUse()/2f; + } + + @Override + public Item random() { + quantity = Random.Int( 2, 4 ); + return this; + } + + @Override + public int price() { + return 20 * quantity; + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ThrowingKnife.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ThrowingKnife.java new file mode 100644 index 000000000..172045c6c --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ThrowingKnife.java @@ -0,0 +1,101 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2017 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; + +import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.watabou.utils.Random; + +public class ThrowingKnife extends MissileWeapon { + + { + image = ItemSpriteSheet.THROWING_KNIFE; + + bones = false; + + } + + @Override + public int min(int lvl) { + return 2; + } + + @Override + public int max(int lvl) { + return 6; + } + + @Override + public int STRReq(int lvl) { + return 9; + } + + private Char enemy; + + @Override + protected void onThrow(int cell) { + enemy = Actor.findChar(cell); + super.onThrow(cell); + } + + @Override + public int damageRoll(Char owner) { + if (owner instanceof Hero) { + Hero hero = (Hero)owner; + if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) { + //deals 75% toward max to max on surprise, instead of min to max. + int diff = max() - min(); + int damage = Random.NormalIntRange( + min() + Math.round(diff*0.75f), + max()); + int exStr = hero.STR() - STRReq(); + if (exStr > 0 && hero.heroClass == HeroClass.HUNTRESS) { + damage += Random.IntRange(0, exStr); + } + return (int)(imbue.damageFactor(damage) * RingOfSharpshooting.damageMultiplier( hero )); + } + } + return super.damageRoll(owner); + } + + @Override + protected float durabilityPerUse() { + return super.durabilityPerUse()*2f; + } + + @Override + public Item random() { + quantity = Random.NormalIntRange( 2, 4 ); + return this; + } + + @Override + public int price() { + return 4 * quantity; + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/TippedDart.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/TippedDart.java new file mode 100644 index 000000000..92a6c47e3 --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/TippedDart.java @@ -0,0 +1,60 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2017 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; + +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PinCushion; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.watabou.utils.Random; + +public abstract class TippedDart extends Dart { + + { + bones = true; + } + + @Override + public int STRReq(int lvl) { + return 11; + } + + @Override + protected void rangedHit(Char enemy) { + if (enemy.isAlive()) + Buff.affect(enemy, PinCushion.class).stick(new Dart()); + else + Dungeon.level.drop( new Dart(), enemy.pos).sprite.drop(); + } + + @Override + public Item random() { + quantity = Random.Int( 3, 5 ); + return this; + } + + @Override + public int price() { + return quantity * 8; + } +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tamahawk.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tomahawk.java similarity index 87% rename from core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tamahawk.java rename to core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tomahawk.java index 322880a38..cc726130a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tamahawk.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Tomahawk.java @@ -28,7 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.watabou.utils.Random; -public class Tamahawk extends MissileWeapon { +public class Tomahawk extends MissileWeapon { { image = ItemSpriteSheet.TOMAHAWK; @@ -37,26 +37,17 @@ public class Tamahawk extends MissileWeapon { @Override public int min(int lvl) { - return 4; + return 8; } @Override public int max(int lvl) { - return 20; + return 16; } @Override public int STRReq(int lvl) { - return 17; - } - - public Tamahawk() { - this( 1 ); - } - - public Tamahawk( int number ) { - super(); - quantity = number; + return 15; } @Override @@ -65,14 +56,19 @@ public class Tamahawk extends MissileWeapon { return super.proc( attacker, defender, damage ); } + @Override + protected float durabilityPerUse() { + return super.durabilityPerUse()*2f; + } + @Override public Item random() { - quantity = Random.Int( 5, 12 ); + quantity = Random.Int( 2, 4 ); return this; } @Override public int price() { - return 15 * quantity; + return 16 * quantity; } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Trident.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Trident.java new file mode 100644 index 000000000..0de93788b --- /dev/null +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/Trident.java @@ -0,0 +1,60 @@ +/* + * Pixel Dungeon + * Copyright (C) 2012-2015 Oleg Dolya + * + * Shattered Pixel Dungeon + * Copyright (C) 2014-2017 Evan Debenham + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + */ + +package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; + +import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; +import com.watabou.utils.Random; + +public class Trident extends MissileWeapon { + + { + image = ItemSpriteSheet.TRIDENT; + } + + @Override + public int min(int lvl) { + return 10; + } + + @Override + public int max(int lvl) { + return 30; + } + + @Override + public int STRReq(int lvl) { + return 17; + } + + @Override + public Item random() { + quantity = Random.Int( 2, 4 ); + return this; + } + + @Override + public int price() { + return 20 * quantity; + } + +} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/ShopRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/ShopRoom.java index 54e345043..1bdb46172 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/ShopRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/ShopRoom.java @@ -65,7 +65,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.CurareDart import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.IncendiaryDart; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Javelin; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Tamahawk; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Tomahawk; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; @@ -190,7 +190,7 @@ public class ShopRoom extends SpecialRoom { itemsToSpawn.add( Random.Int( 2 ) == 0 ? new Greatsword().identify() : new WarHammer().identify() ); itemsToSpawn.add( Random.Int(2) == 0 ? new Javelin().quantity(Random.NormalIntRange(4, 7)) : - new Tamahawk().quantity(Random.NormalIntRange(4, 7))); + new Tomahawk().quantity(Random.NormalIntRange(4, 7))); itemsToSpawn.add( new PlateArmor().identify() ); itemsToSpawn.add( new Torch() ); itemsToSpawn.add( new Torch() ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java index d3913a2d2..fbaa1ef6f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/ItemSpriteSheet.java @@ -206,25 +206,59 @@ public class ItemSpriteSheet { //8 free slots - private static final int MISSILE_WEP = xy(1, 10); //16 slots - public static final int DART = MISSILE_WEP+0; - public static final int BOOMERANG = MISSILE_WEP+1; - public static final int INCENDIARY_DART = MISSILE_WEP+2; - public static final int SHURIKEN = MISSILE_WEP+3; - public static final int CURARE_DART = MISSILE_WEP+4; - public static final int JAVELIN = MISSILE_WEP+5; - public static final int TOMAHAWK = MISSILE_WEP+6; + private static final int MISSILE_WEP = xy(1, 10); //16 slots. 3 per tier + boomerang + public static final int BOOMERANG = MISSILE_WEP+0; + + public static final int DART = MISSILE_WEP+1; + public static final int THROWING_KNIFE = MISSILE_WEP+2; + + public static final int SHURIKEN = MISSILE_WEP+4; + + public static final int FISHING_SPEAR = MISSILE_WEP+7; + public static final int BOLAS = MISSILE_WEP+8; + + public static final int JAVELIN = MISSILE_WEP+10; + public static final int TOMAHAWK = MISSILE_WEP+11; + + public static final int TRIDENT = MISSILE_WEP+13; + public static final int THROWING_HAMMER = MISSILE_WEP+14; + static{ - assignItemRect(DART, 15, 15); assignItemRect(BOOMERANG, 14, 14); - assignItemRect(INCENDIARY_DART, 15, 15); + + assignItemRect(DART, 15, 15); + assignItemRect(THROWING_KNIFE, 12, 13); + assignItemRect(SHURIKEN, 12, 12); - assignItemRect(CURARE_DART, 15, 15); + + assignItemRect(FISHING_SPEAR, 13, 13); + assignItemRect(BOLAS, 15, 14); + assignItemRect(JAVELIN, 16, 16); assignItemRect(TOMAHAWK, 13, 13); + + assignItemRect(TRIDENT, 16, 16); + assignItemRect(THROWING_HAMMER, 12, 12); } - - private static final int ARMOR = xy(1, 11); //16 slots + + public static final int TIPPED_DARTS = xy(1, 11); //16 slots + public static final int ADRENALINE_DART = TIPPED_DARTS+0; + public static final int INCENDIARY_DART = TIPPED_DARTS+1; + public static final int HOLY_DART = TIPPED_DARTS+2; + public static final int BLINDING_DART = TIPPED_DARTS+3; + public static final int HEALING_DART = TIPPED_DARTS+4; + public static final int FREEZING_DART = TIPPED_DARTS+5; + public static final int VERTIGO_DART = TIPPED_DARTS+6; + public static final int POISON_DART = TIPPED_DARTS+7; + public static final int SLEEP_DART = TIPPED_DARTS+8; + public static final int CURARE_DART = TIPPED_DARTS+9; + public static final int WARPING_DART = TIPPED_DARTS+10; + static { + for (int i = TIPPED_DARTS; i < TIPPED_DARTS+16; i++) + assignItemRect(i, 15, 15); + } + + private static final int ARMOR = xy(1, 12); //16 slots public static final int ARMOR_CLOTH = ARMOR+0; public static final int ARMOR_LEATHER = ARMOR+1; public static final int ARMOR_MAIL = ARMOR+2; @@ -246,7 +280,7 @@ public class ItemSpriteSheet { assignItemRect(ARMOR_HUNTRESS, 13, 15); } - //32 free slots + //16 free slots private static final int WANDS = xy(1, 14); //16 slots public static final int WAND_MAGIC_MISSILE = WANDS+0; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/MissileSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/MissileSprite.java index f882182ed..fb4a0b29a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/MissileSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/MissileSprite.java @@ -29,6 +29,8 @@ import com.watabou.noosa.tweeners.Tweener; import com.watabou.utils.Callback; import com.watabou.utils.PointF; +import java.util.HashMap; + public class MissileSprite extends ItemSprite implements Tweener.Listener { private static final float SPEED = 240f; @@ -63,7 +65,30 @@ public class MissileSprite extends ItemSprite implements Tweener.Listener { image, listener ); } + + private static final int DEFAULT_ANGULAR_SPEED = 720; + + private static final HashMap ANGULAR_SPEEDS = new HashMap<>(); + static { + ANGULAR_SPEEDS.put(ItemSpriteSheet.DART, 0); + ANGULAR_SPEEDS.put(ItemSpriteSheet.THROWING_KNIFE, 0); + ANGULAR_SPEEDS.put(ItemSpriteSheet.FISHING_SPEAR, 0); + ANGULAR_SPEEDS.put(ItemSpriteSheet.JAVELIN, 0); + ANGULAR_SPEEDS.put(ItemSpriteSheet.TRIDENT, 0); + + for( int i = ItemSpriteSheet.TIPPED_DARTS; i < ItemSpriteSheet.TIPPED_DARTS+16; i++){ + ANGULAR_SPEEDS.put(i, 0); + } + + //720 is default + + ANGULAR_SPEEDS.put(ItemSpriteSheet.BOOMERANG, 1440); + ANGULAR_SPEEDS.put(ItemSpriteSheet.BOLAS, 1440); + + ANGULAR_SPEEDS.put(ItemSpriteSheet.SHURIKEN, 2160); + } + //TODO it might be nice to have a source and destination angle, to improve thrown weapon visuals private void setup( PointF from, PointF to, int image, Callback listener ){ originToCenter(); @@ -75,21 +100,20 @@ public class MissileSprite extends ItemSprite implements Tweener.Listener { PointF d = PointF.diff( to, from ); speed.set( d ).normalize().scale( SPEED ); - if (image == ItemSpriteSheet.DART || image == ItemSpriteSheet.INCENDIARY_DART - || image == ItemSpriteSheet.CURARE_DART || image == ItemSpriteSheet.JAVELIN) { - - angularSpeed = 0; - angle = 135 - (float)(Math.atan2( d.x, d.y ) / 3.1415926 * 180); - - } else if (image == ItemSpriteSheet.SHURIKEN - || image == ItemSpriteSheet.BOOMERANG - || image == ItemSpriteSheet.TOMAHAWK) { - - angularSpeed = 1440; + if ( ANGULAR_SPEEDS.containsKey(image)) angularSpeed = ANGULAR_SPEEDS.get(image); + else angularSpeed = DEFAULT_ANGULAR_SPEED; + + angle = 135 - (float)(Math.atan2( d.x, d.y ) / 3.1415926 * 180); + + if (d.x >= 0){ + flipHorizontal = false; + updateFrame(); } else { - - angularSpeed = 720; + angularSpeed = -angularSpeed; + angle += 90; + flipHorizontal = true; + updateFrame(); } PosTweener tweener = new PosTweener( this, to, d.length() / SPEED ); diff --git a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index 4db49b2f0..516b88803 100644 --- a/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/core/src/main/resources/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -926,22 +926,28 @@ items.weapon.melee.wornshortsword.desc=A quite short sword, worn down through he ###missile weapons +items.weapon.missiles.bolas.name=bolas +items.weapon.missiles.bolas.desc=These unusual ranged weapons aren't very damaging, but they do an excellent job of slowing their targets. + items.weapon.missiles.boomerang.name=boomerang items.weapon.missiles.boomerang.desc=Thrown to the enemy this flat curved wooden missile will return to the hands of its thrower. items.weapon.missiles.boomerang.durability=Due it its solid construction, this boomerang will not break from use. items.weapon.missiles.curaredart.name=curare dart -items.weapon.missiles.curaredart.desc=These little evil darts don't do much damage but they can paralyze the target leaving it helpless and motionless for some time. +items.weapon.missiles.curaredart.desc=These darts are tipped with an earthroot-based compound which will paralyze their target for a short time. items.weapon.missiles.dart.name=dart -items.weapon.missiles.dart.desc=These simple metal spikes are weighted to fly true and sting their prey with a flick of the wrist. +items.weapon.missiles.dart.desc=These simple shafts of spike-tipped wood are weighted to fly true and sting their prey with a flick of the wrist. items.weapon.missiles.dart.durability=Due to their size and simple construction, darts will never break from use. However specially tipped darts will lose their effect after one use. +items.weapon.missiles.fishingspear.name=fishing spear +items.weapon.missiles.fishingspear.desc=Lightweight throwing spears designed for fishing. They work well as an improvised weapon too. + items.weapon.missiles.incendiarydart.name=incendiary dart -items.weapon.missiles.incendiarydart.desc=The spike on each of these darts is designed to pin it to its target while the unstable compounds strapped to its length burst into brilliant flames. +items.weapon.missiles.incendiarydart.desc=These darts are tipped with a firebloom-based compound which will burst into brilliant flames on impact. items.weapon.missiles.javelin.name=javelin -items.weapon.missiles.javelin.desc=This length of metal is weighted to keep the spike at its tip foremost as it sails through the air. +items.weapon.missiles.javelin.desc=These larger throwing spears are weighted to keep the spike at their tip foremost as they sail through the air. items.weapon.missiles.missileweapon.stats=This missile weapon deals _%1$d-%2$d damage_ and requires _%3$d strength_ to use properly. items.weapon.missiles.missileweapon.distance=This weapon is designed to be used at a distance, it is much less accurate at melee range. @@ -949,10 +955,19 @@ items.weapon.missiles.missileweapon.durability=Missile weapons will wear out and items.weapon.missiles.missileweapon.uses_left=This stack of weapons has _%d/%d_ uses left before one breaks. items.weapon.missiles.shuriken.name=shuriken -items.weapon.missiles.shuriken.desc=Star-shaped pieces of metal with razor-sharp blades do significant damage when they hit a target. They can be thrown at very high rate. +items.weapon.missiles.shuriken.desc=Star-shaped pieces of metal with razor-sharp blades. They are lightweight and easy to use on the move. A single shuriken can be thrown instantly after moving. -items.weapon.missiles.tamahawk.name=tomahawk -items.weapon.missiles.tamahawk.desc=This throwing axe is not that heavy, but it still requires significant strength to be used effectively. +items.weapon.missiles.throwinghammer.name=throwing hammer +items.weapon.missiles.throwinghammer.desc=These hefty hammers are designed to be thrown at an enemy. While they are a bit lacking in damage, their all-metal construction makes them quite durable. + +items.weapon.missiles.throwingknife.name=throwing knife +items.weapon.missiles.throwingknife.desc=These lightweight knives are balanced to arc through the air right into their target. They are most effective against unaware enemies. + +items.weapon.missiles.tomahawk.name=tomahawk +items.weapon.missiles.tomahawk.desc=These throwing axes have a serrated edge that makes using them tricky to use. However, a solid blow with this weapon will cause an enemy to bleed. + +items.weapon.missiles.trident.name=Trident +items.weapon.missiles.trident.desc=Massive throwing spears with three deadly prongs on the end. They are powerful, but quite heavy. items.weapon.weapon.identify=You are now familiar enough with your weapon to identify it.