diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FlavourBuff.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FlavourBuff.java index 4b96a7062..d788cfcf8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FlavourBuff.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/FlavourBuff.java @@ -17,7 +17,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; -//buff which does not need to act, used as a flag for other logic. +//buff whose only logic is to wait and detach after a time. public class FlavourBuff extends Buff { @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java new file mode 100644 index 000000000..a000282d5 --- /dev/null +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java @@ -0,0 +1,43 @@ +package com.shatteredpixel.shatteredpixeldungeon.actors.buffs; + +import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; +import com.watabou.utils.Bundle; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.LinkedList; + +/** + * Created by debenhame on 06/02/2015. + */ +public class PinCushion extends Buff { + + private ArrayList items = new ArrayList(); + + public void stick(MissileWeapon item){ + items.add(item); + } + + @Override + public void detach() { + for (Item item : items) + Dungeon.level.drop( item, target.pos).sprite.drop(); + super.detach(); + } + + private static final String ITEMS = "items"; + + @Override + public void storeInBundle(Bundle bundle) { + bundle.put( ITEMS , items ); + super.storeInBundle(bundle); + } + + @Override + public void restoreFromBundle(Bundle bundle) { + items = new ArrayList((Collection)((Collection)bundle.getCollection( ITEMS ))); + super.restoreFromBundle( bundle ); + } +} diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java index 62083a49e..3f7c00bfd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/HeroClass.java @@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.TomeOfMastery; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClothArmor; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.CloakOfShadows; import com.shatteredpixel.shatteredpixeldungeon.items.food.Food; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMindVision; import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfStrength; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfIdentify; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping; @@ -75,9 +76,11 @@ public enum HeroClass { public static final String[] HUN_PERKS = { "Huntresses start with 15 points of Health.", "Huntresses start with a unique upgradeable boomerang.", - "Huntresses are proficient with missile weapons and get damage bonus for excessive strength when using them.", + "Huntresses are proficient with missile weapons, getting bonus damage from excess strength.", + "Huntresses are able to recover a single used missile weapon from each enemy.", "Huntresses gain more health from dewdrops.", - "Huntresses sense neighbouring monsters even if they are hidden behind obstacles." + "Huntresses sense neighbouring monsters even if they are hidden behind obstacles.", + "Potions of Mind Vision are identified from the beginning." }; public void initHero( Hero hero ) { @@ -182,6 +185,8 @@ public enum HeroClass { boomerang.identify().collect(); Dungeon.quickslot.setSlot(0, boomerang); + + new PotionOfMindVision().setKnown(); } public String title() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java index 3140919ce..23165a379 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/IncendiaryDart.java @@ -55,24 +55,10 @@ public class IncendiaryDart extends MissileWeapon { @Override protected void onThrow( int cell ) { Char enemy = Actor.findChar( cell ); - if (enemy == null || enemy == curUser) { - if (Level.flamable[cell]) { - GameScene.add( Blob.seed( cell, 4, Fire.class ) ); - } else { - super.onThrow( cell ); - } - } else { - if (!curUser.shoot( enemy, this )) { - Dungeon.level.drop( this, cell ).sprite.drop(); - } else { - int bonus = 0; - for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) { - bonus += ((RingOfSharpshooting.Aim)buff).level; - } - if (Random.Float() > Math.pow(0.7, bonus)) - Dungeon.level.drop( this, cell ).sprite.drop(); - } - } + if ((enemy == null || enemy == curUser) && Level.flamable[cell]) + GameScene.add( Blob.seed( cell, 4, Fire.class ) ); + else + super.onThrow( cell ); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java index b83e05420..30f088481 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java @@ -23,6 +23,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PinCushion; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.items.Item; @@ -69,11 +70,15 @@ public class MissileWeapon extends Weapon { miss( cell ); } else if (!(this instanceof Boomerang)){ int bonus = 0; - for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) { + + for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) bonus += ((RingOfSharpshooting.Aim)buff).level; - } + + if (curUser.heroClass == HeroClass.HUNTRESS && enemy.buff(PinCushion.class) == null) + bonus += 4; + if (Random.Float() > Math.pow(0.7, bonus)) - Dungeon.level.drop( this, cell ).sprite.drop(); + Buff.affect(enemy, PinCushion.class).stick(this); } } } @@ -84,6 +89,7 @@ public class MissileWeapon extends Weapon { bonus += ((RingOfSharpshooting.Aim)buff).level; } + //degraded ring of sharpshooting will even make missed shots break. if (Random.Float() < Math.pow(0.6, -bonus)) super.onThrow( cell ); }