v0.3.5: some code cleanup & bugfixes to pincushion
This commit is contained in:
parent
fae5fc7c6c
commit
bc463a0a7c
|
@ -27,14 +27,19 @@ import com.watabou.utils.Bundle;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
public class PinCushion extends Buff {
|
public class PinCushion extends Buff {
|
||||||
|
|
||||||
private ArrayList<MissileWeapon> items = new ArrayList<MissileWeapon>();
|
private ArrayList<MissileWeapon> items = new ArrayList<MissileWeapon>();
|
||||||
|
|
||||||
public void stick(MissileWeapon item){
|
public void stick(MissileWeapon projectile){
|
||||||
items.add(item);
|
for (Item item : items){
|
||||||
|
if (item.isSimilar(projectile)){
|
||||||
|
item.quantity(item.quantity() + projectile.quantity());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
items.add(projectile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
*/
|
*/
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles;
|
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
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.rings.RingOfSharpshooting;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions;
|
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
abstract public class MissileWeapon extends Weapon {
|
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)
|
if (curUser.heroClass == HeroClass.HUNTRESS && enemy.buff(PinCushion.class) == null)
|
||||||
bonus += 3;
|
bonus += 3;
|
||||||
|
|
||||||
if (Random.Float() > Math.pow(0.7, bonus))
|
if (Random.Float() > Math.pow(0.7, bonus)){
|
||||||
|
if (enemy.isAlive())
|
||||||
Buff.affect(enemy, PinCushion.class).stick(this);
|
Buff.affect(enemy, PinCushion.class).stick(this);
|
||||||
|
else
|
||||||
|
Dungeon.level.drop( this, enemy.pos).sprite.drop();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user