v0.6.3: redesigned all ranged weapons and added new ones

Still need to adjust generation logic
This commit is contained in:
Evan Debenham 2018-01-02 20:59:37 -05:00
parent f8b4607638
commit 9816333fd7
21 changed files with 587 additions and 196 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -60,6 +60,11 @@ public class ShatteredPixelDungeon extends Game {
public ShatteredPixelDungeon() { public ShatteredPixelDungeon() {
super( WelcomeScene.class ); 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 //v0.6.0
com.watabou.utils.Bundle.addAlias( com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.MassGraveRoom.Bones.class, com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.MassGraveRoom.Bones.class,

View File

@ -450,6 +450,7 @@ public class Hero extends Char {
@Override @Override
public void spend( float time ) { public void spend( float time ) {
justMoved = false;
TimekeepersHourglass.timeFreeze buff = buff(TimekeepersHourglass.timeFreeze.class); TimekeepersHourglass.timeFreeze buff = buff(TimekeepersHourglass.timeFreeze.class);
if (buff != null){ if (buff != null){
buff.processTime(time); buff.processTime(time);
@ -596,9 +597,14 @@ public class Hero extends Char {
next(); 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 ) { private boolean actMove( HeroAction.Move action ) {
if (getCloser( action.dst )) { if (getCloser( action.dst )) {
justMoved = true;
return true; return true;
} else { } else {

View File

@ -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.melee.WornShortsword;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Boomerang;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Dart; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Dart;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.ThrowingKnife;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.watabou.utils.Bundle; import com.watabou.utils.Bundle;
@ -106,8 +107,8 @@ public enum HeroClass {
private static void initWarrior( Hero hero ) { private static void initWarrior( Hero hero ) {
(hero.belongings.weapon = new WornShortsword()).identify(); (hero.belongings.weapon = new WornShortsword()).identify();
Dart darts = new Dart( 8 ); Dart darts = new Dart();
darts.identify().collect(); darts.identify().quantity(3).collect();
if ( Badges.isUnlocked(Badges.Badge.TUTORIAL_WARRIOR) ){ if ( Badges.isUnlocked(Badges.Badge.TUTORIAL_WARRIOR) ){
if (!Dungeon.isChallenged(Challenges.NO_ARMOR)) if (!Dungeon.isChallenged(Challenges.NO_ARMOR))
@ -150,11 +151,11 @@ public enum HeroClass {
(hero.belongings.misc1 = cloak).identify(); (hero.belongings.misc1 = cloak).identify();
hero.belongings.misc1.activate( hero ); hero.belongings.misc1.activate( hero );
Dart darts = new Dart( 8 ); ThrowingKnife knives = new ThrowingKnife();
darts.identify().collect(); knives.quantity(3).collect();
Dungeon.quickslot.setSlot(0, cloak); Dungeon.quickslot.setSlot(0, cloak);
Dungeon.quickslot.setSlot(1, darts); Dungeon.quickslot.setSlot(1, knives);
new ScrollOfMagicMapping().identify(); new ScrollOfMagicMapping().identify();
} }

View File

@ -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.WarHammer;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Whip; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Whip;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.WornShortsword; 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.BlandfruitBush;
import com.shatteredpixel.shatteredpixeldungeon.plants.Blindweed; import com.shatteredpixel.shatteredpixeldungeon.plants.Blindweed;
import com.shatteredpixel.shatteredpixeldungeon.plants.Dreamfoil; import com.shatteredpixel.shatteredpixeldungeon.plants.Dreamfoil;
@ -253,21 +246,18 @@ public class Generator {
WornShortsword.class, WornShortsword.class,
Knuckles.class, Knuckles.class,
Dagger.class, Dagger.class,
MagesStaff.class, MagesStaff.class
Boomerang.class,
Dart.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<?>[]{ WEP_T2.classes = new Class<?>[]{
Shortsword.class, Shortsword.class,
HandAxe.class, HandAxe.class,
Spear.class, Spear.class,
Quarterstaff.class, Quarterstaff.class,
Dirk.class, Dirk.class
IncendiaryDart.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<?>[]{ WEP_T3.classes = new Class<?>[]{
Sword.class, Sword.class,
@ -275,31 +265,27 @@ public class Generator {
Scimitar.class, Scimitar.class,
RoundShield.class, RoundShield.class,
Sai.class, Sai.class,
Whip.class, Whip.class
Shuriken.class,
CurareDart.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<?>[]{ WEP_T4.classes = new Class<?>[]{
Longsword.class, Longsword.class,
BattleAxe.class, BattleAxe.class,
Flail.class, Flail.class,
RunicBlade.class, RunicBlade.class,
AssassinsBlade.class, AssassinsBlade.class
Javelin.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<?>[]{ WEP_T5.classes = new Class<?>[]{
Greatsword.class, Greatsword.class,
WarHammer.class, WarHammer.class,
Glaive.class, Glaive.class,
Greataxe.class, Greataxe.class,
Greatshield.class, Greatshield.class
Tamahawk.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 //see Generator.randomArmor
ARMOR.classes = new Class<?>[]{ ARMOR.classes = new Class<?>[]{

View File

@ -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 <http://www.gnu.org/licenses/>
*/
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;
}
}

View File

@ -24,31 +24,15 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; 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; public static final float DURATION = 3f;
{ {
image = ItemSpriteSheet.CURARE_DART; image = ItemSpriteSheet.CURARE_DART;
} }
@Override
public int STRReq(int lvl) {
return 14;
}
public CurareDart() {
this( 1 );
}
public CurareDart( int number ) {
super();
quantity = number;
}
@Override @Override
public int proc( Char attacker, Char defender, int damage ) { public int proc( Char attacker, Char defender, int damage ) {
@ -56,14 +40,4 @@ public class CurareDart extends Dart {
return super.proc( attacker, defender, damage ); return super.proc( attacker, defender, damage );
} }
@Override
public Item random() {
quantity = Random.Int( 2, 5 );
return this;
}
@Override
public int price() {
return 8 * quantity;
}
} }

View File

@ -21,10 +21,6 @@
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; 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.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random; import com.watabou.utils.Random;
@ -35,7 +31,6 @@ public class Dart extends MissileWeapon {
image = ItemSpriteSheet.DART; image = ItemSpriteSheet.DART;
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 @Override
@ -45,12 +40,12 @@ public class Dart extends MissileWeapon {
@Override @Override
public int max(int lvl) { public int max(int lvl) {
return 4; return 3;
} }
@Override @Override
public int STRReq(int lvl) { public int STRReq(int lvl) {
return 10; return 9;
} }
@Override @Override
@ -58,31 +53,14 @@ public class Dart extends MissileWeapon {
return 0; 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 @Override
public Item random() { public Item random() {
quantity = Random.Int( 5, 15 ); quantity = Random.Int( 5, 10 );
return this; return this;
} }
@Override @Override
public int price() { public int price() {
return quantity * 2; return quantity * 4;
} }
} }

View File

@ -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 <http://www.gnu.org/licenses/>
*/
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;
}
}

View File

@ -28,30 +28,14 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Fire;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
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.Random;
public class IncendiaryDart extends Dart { public class IncendiaryDart extends TippedDart {
{ {
image = ItemSpriteSheet.INCENDIARY_DART; image = ItemSpriteSheet.INCENDIARY_DART;
} }
@Override
public int STRReq(int lvl) {
return 12;
}
public IncendiaryDart() {
this( 1 );
}
public IncendiaryDart( int number ) {
super();
quantity = number;
}
@Override @Override
protected void onThrow( int cell ) { protected void onThrow( int cell ) {
@ -70,14 +54,4 @@ public class IncendiaryDart extends Dart {
return super.proc( attacker, defender, damage ); return super.proc( attacker, defender, damage );
} }
@Override
public Item random() {
quantity = Random.Int( 3, 6 );
return this;
}
@Override
public int price() {
return 5 * quantity;
}
} }

View File

@ -21,9 +21,6 @@
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; 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.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random; import com.watabou.utils.Random;
@ -36,42 +33,27 @@ public class Javelin extends MissileWeapon {
@Override @Override
public int min(int lvl) { public int min(int lvl) {
return 2; return 8;
} }
@Override @Override
public int max(int lvl) { public int max(int lvl) {
return 15; return 24;
} }
@Override @Override
public int STRReq(int lvl) { public int STRReq(int lvl) {
return 15; 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 @Override
public Item random() { public Item random() {
quantity = Random.Int( 5, 15 ); quantity = Random.Int( 2, 4 );
return this; return this;
} }
@Override @Override
public int price() { public int price() {
return 12 * quantity; return 16 * quantity;
} }
} }

View File

@ -21,6 +21,8 @@
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; 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.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random; import com.watabou.utils.Random;
@ -29,42 +31,37 @@ public class Shuriken extends MissileWeapon {
{ {
image = ItemSpriteSheet.SHURIKEN; image = ItemSpriteSheet.SHURIKEN;
DLY = 0.5f;
} }
@Override @Override
public int min(int lvl) { public int min(int lvl) {
return 2; return 3;
} }
@Override @Override
public int max(int lvl) { public int max(int lvl) {
return 6; return 8;
} }
@Override @Override
public int STRReq(int lvl) { public int STRReq(int lvl) {
return 13; return 11;
}
public Shuriken() {
this( 1 );
} }
public Shuriken( int number ) { @Override
super(); public float speedFactor(Char owner) {
quantity = number; if (owner instanceof Hero && ((Hero) owner).justMoved) return 0;
else return super.speedFactor(owner);
} }
@Override @Override
public Item random() { public Item random() {
quantity = Random.Int( 5, 15 ); quantity = Random.NormalIntRange( 2, 4 );
return this; return this;
} }
@Override @Override
public int price() { public int price() {
return 6 * quantity; return 8 * quantity;
} }
} }

View File

@ -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 <http://www.gnu.org/licenses/>
*/
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;
}
}

View File

@ -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 <http://www.gnu.org/licenses/>
*/
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;
}
}

View File

@ -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 <http://www.gnu.org/licenses/>
*/
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;
}
}

View File

@ -28,7 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.watabou.utils.Random; import com.watabou.utils.Random;
public class Tamahawk extends MissileWeapon { public class Tomahawk extends MissileWeapon {
{ {
image = ItemSpriteSheet.TOMAHAWK; image = ItemSpriteSheet.TOMAHAWK;
@ -37,26 +37,17 @@ public class Tamahawk extends MissileWeapon {
@Override @Override
public int min(int lvl) { public int min(int lvl) {
return 4; return 8;
} }
@Override @Override
public int max(int lvl) { public int max(int lvl) {
return 20; return 16;
} }
@Override @Override
public int STRReq(int lvl) { public int STRReq(int lvl) {
return 17; return 15;
}
public Tamahawk() {
this( 1 );
}
public Tamahawk( int number ) {
super();
quantity = number;
} }
@Override @Override
@ -65,14 +56,19 @@ public class Tamahawk extends MissileWeapon {
return super.proc( attacker, defender, damage ); return super.proc( attacker, defender, damage );
} }
@Override
protected float durabilityPerUse() {
return super.durabilityPerUse()*2f;
}
@Override @Override
public Item random() { public Item random() {
quantity = Random.Int( 5, 12 ); quantity = Random.Int( 2, 4 );
return this; return this;
} }
@Override @Override
public int price() { public int price() {
return 15 * quantity; return 16 * quantity;
} }
} }

View File

@ -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 <http://www.gnu.org/licenses/>
*/
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;
}
}

View File

@ -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.IncendiaryDart;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Javelin; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Javelin;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Shuriken; 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.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter; 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 Greatsword().identify() : new WarHammer().identify() );
itemsToSpawn.add( Random.Int(2) == 0 ? itemsToSpawn.add( Random.Int(2) == 0 ?
new Javelin().quantity(Random.NormalIntRange(4, 7)) : 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 PlateArmor().identify() );
itemsToSpawn.add( new Torch() ); itemsToSpawn.add( new Torch() );
itemsToSpawn.add( new Torch() ); itemsToSpawn.add( new Torch() );

View File

@ -206,25 +206,59 @@ public class ItemSpriteSheet {
//8 free slots //8 free slots
private static final int MISSILE_WEP = xy(1, 10); //16 slots private static final int MISSILE_WEP = xy(1, 10); //16 slots. 3 per tier + boomerang
public static final int DART = MISSILE_WEP+0; public static final int BOOMERANG = MISSILE_WEP+0;
public static final int BOOMERANG = MISSILE_WEP+1;
public static final int INCENDIARY_DART = MISSILE_WEP+2; public static final int DART = MISSILE_WEP+1;
public static final int SHURIKEN = MISSILE_WEP+3; public static final int THROWING_KNIFE = MISSILE_WEP+2;
public static final int CURARE_DART = MISSILE_WEP+4;
public static final int JAVELIN = MISSILE_WEP+5; public static final int SHURIKEN = MISSILE_WEP+4;
public static final int TOMAHAWK = MISSILE_WEP+6;
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{ static{
assignItemRect(DART, 15, 15);
assignItemRect(BOOMERANG, 14, 14); assignItemRect(BOOMERANG, 14, 14);
assignItemRect(INCENDIARY_DART, 15, 15);
assignItemRect(DART, 15, 15);
assignItemRect(THROWING_KNIFE, 12, 13);
assignItemRect(SHURIKEN, 12, 12); assignItemRect(SHURIKEN, 12, 12);
assignItemRect(CURARE_DART, 15, 15);
assignItemRect(FISHING_SPEAR, 13, 13);
assignItemRect(BOLAS, 15, 14);
assignItemRect(JAVELIN, 16, 16); assignItemRect(JAVELIN, 16, 16);
assignItemRect(TOMAHAWK, 13, 13); 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_CLOTH = ARMOR+0;
public static final int ARMOR_LEATHER = ARMOR+1; public static final int ARMOR_LEATHER = ARMOR+1;
public static final int ARMOR_MAIL = ARMOR+2; public static final int ARMOR_MAIL = ARMOR+2;
@ -246,7 +280,7 @@ public class ItemSpriteSheet {
assignItemRect(ARMOR_HUNTRESS, 13, 15); assignItemRect(ARMOR_HUNTRESS, 13, 15);
} }
//32 free slots //16 free slots
private static final int WANDS = xy(1, 14); //16 slots private static final int WANDS = xy(1, 14); //16 slots
public static final int WAND_MAGIC_MISSILE = WANDS+0; public static final int WAND_MAGIC_MISSILE = WANDS+0;

View File

@ -29,6 +29,8 @@ import com.watabou.noosa.tweeners.Tweener;
import com.watabou.utils.Callback; import com.watabou.utils.Callback;
import com.watabou.utils.PointF; import com.watabou.utils.PointF;
import java.util.HashMap;
public class MissileSprite extends ItemSprite implements Tweener.Listener { public class MissileSprite extends ItemSprite implements Tweener.Listener {
private static final float SPEED = 240f; private static final float SPEED = 240f;
@ -63,7 +65,30 @@ public class MissileSprite extends ItemSprite implements Tweener.Listener {
image, image,
listener ); listener );
} }
private static final int DEFAULT_ANGULAR_SPEED = 720;
private static final HashMap<Integer, Integer> 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 ){ private void setup( PointF from, PointF to, int image, Callback listener ){
originToCenter(); originToCenter();
@ -75,21 +100,20 @@ public class MissileSprite extends ItemSprite implements Tweener.Listener {
PointF d = PointF.diff( to, from ); PointF d = PointF.diff( to, from );
speed.set( d ).normalize().scale( SPEED ); speed.set( d ).normalize().scale( SPEED );
if (image == ItemSpriteSheet.DART || image == ItemSpriteSheet.INCENDIARY_DART if ( ANGULAR_SPEEDS.containsKey(image)) angularSpeed = ANGULAR_SPEEDS.get(image);
|| image == ItemSpriteSheet.CURARE_DART || image == ItemSpriteSheet.JAVELIN) { else angularSpeed = DEFAULT_ANGULAR_SPEED;
angularSpeed = 0; angle = 135 - (float)(Math.atan2( d.x, d.y ) / 3.1415926 * 180);
angle = 135 - (float)(Math.atan2( d.x, d.y ) / 3.1415926 * 180);
if (d.x >= 0){
} else if (image == ItemSpriteSheet.SHURIKEN flipHorizontal = false;
|| image == ItemSpriteSheet.BOOMERANG updateFrame();
|| image == ItemSpriteSheet.TOMAHAWK) {
angularSpeed = 1440;
} else { } else {
angularSpeed = -angularSpeed;
angularSpeed = 720; angle += 90;
flipHorizontal = true;
updateFrame();
} }
PosTweener tweener = new PosTweener( this, to, d.length() / SPEED ); PosTweener tweener = new PosTweener( this, to, d.length() / SPEED );

View File

@ -926,22 +926,28 @@ items.weapon.melee.wornshortsword.desc=A quite short sword, worn down through he
###missile weapons ###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.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.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.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.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.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.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.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.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.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. 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.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.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.throwinghammer.name=throwing hammer
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.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. items.weapon.weapon.identify=You are now familiar enough with your weapon to identify it.