diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java index 4219896e2..18ea4a842 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/PinCushion.java @@ -27,14 +27,19 @@ import com.watabou.utils.Bundle; import java.util.ArrayList; import java.util.Collection; -import java.util.LinkedList; public class PinCushion extends Buff { private ArrayList items = new ArrayList(); - public void stick(MissileWeapon item){ - items.add(item); + public void stick(MissileWeapon projectile){ + for (Item item : items){ + if (item.isSimilar(projectile)){ + item.quantity(item.quantity() + projectile.quantity()); + return; + } + } + items.add(projectile); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java index 7670bfe25..c9a325602 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java @@ -20,8 +20,6 @@ */ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles; -import java.util.ArrayList; - import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; @@ -33,10 +31,10 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; -import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.watabou.utils.Random; +import java.util.ArrayList; + abstract public class MissileWeapon extends Weapon { { @@ -74,8 +72,13 @@ abstract public class MissileWeapon extends Weapon { if (curUser.heroClass == HeroClass.HUNTRESS && enemy.buff(PinCushion.class) == null) bonus += 3; - if (Random.Float() > Math.pow(0.7, bonus)) - Buff.affect(enemy, PinCushion.class).stick(this); + if (Random.Float() > Math.pow(0.7, bonus)){ + if (enemy.isAlive()) + Buff.affect(enemy, PinCushion.class).stick(this); + else + Dungeon.level.drop( this, enemy.pos).sprite.drop(); + } + } } }