diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index bb319870f..d832c11e6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -55,6 +55,7 @@ import com.watabou.utils.Bundle; import com.watabou.utils.GameMath; import com.watabou.utils.Random; +import java.util.ArrayList; import java.util.HashSet; public abstract class Mob extends Char { @@ -570,9 +571,9 @@ public abstract class Mob extends Char { int rolls = 1; if (properties.contains(Property.BOSS)) rolls = 15; else if (properties.contains(Property.MINIBOSS)) rolls = 5; - Item bonus = RingOfWealth.tryRareDrop(Dungeon.hero, rolls); + ArrayList bonus = RingOfWealth.tryRareDrop(Dungeon.hero, rolls); if (bonus != null){ - Dungeon.level.drop( bonus , pos ).sprite.drop(); + for (Item b : bonus) Dungeon.level.drop( b , pos ).sprite.drop(); new Flare(8, 32).color(0xFFFF00, true).show(sprite, 2f); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java index 6cabcbd1c..5c97af703 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Heap.java @@ -65,6 +65,7 @@ import com.watabou.utils.Bundlable; import com.watabou.utils.Bundle; import com.watabou.utils.Random; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.LinkedList; @@ -151,9 +152,9 @@ public class Heap implements Bundlable { if (type != Type.MIMIC) { type = Type.HEAP; - Item bonus = RingOfWealth.tryRareDrop(hero, 1); + ArrayList bonus = RingOfWealth.tryRareDrop(hero, 1); if (bonus != null){ - items.addFirst(bonus); + items.addAll(0, bonus); new Flare(8, 32).color(0xFFFF00, true).show(sprite, 2f); } sprite.link(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java index 483f8355d..df1d8968a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java @@ -22,10 +22,14 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.items.Bomb; +import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Gold; +import com.shatteredpixel.shatteredpixeldungeon.items.Honeypot; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.watabou.utils.Random; +import java.util.ArrayList; import java.util.HashSet; public class RingOfWealth extends Ring { @@ -41,7 +45,7 @@ public class RingOfWealth extends Ring { return (float)Math.pow(1.15, getBonus(target, Wealth.class)); } - public static Item tryRareDrop(Char target, int tries ){ + public static ArrayList tryRareDrop(Char target, int tries ){ if (getBonus(target, Wealth.class) <= 0) return null; HashSet buffs = target.buffs(Wealth.class); @@ -63,14 +67,57 @@ public class RingOfWealth extends Ring { //now handle reward logic if (triesToDrop <= 0){ - //TODO more drops, gold is very boring - return new Gold().random(); + return generateRareDrop(); } else { return null; } } + //TODO this is a start, but i'm sure this could be made more interesting... + private static ArrayList generateRareDrop(){ + float roll = Random.Float(); + ArrayList items = new ArrayList<>(); + if (roll < 0.6f){ + switch (Random.Int(3)){ + case 0: + items.add(new Gold().random()); + break; + case 1: + items.add(Generator.random(Generator.Category.POTION)); + break; + case 2: + items.add(Generator.random(Generator.Category.SCROLL)); + break; + } + } else if (roll < 0.9f){ + switch (Random.Int(3)){ + case 0: + items.add(Generator.random(Generator.Category.SEED)); + items.add(Generator.random(Generator.Category.SEED)); + items.add(Generator.random(Generator.Category.SEED)); + items.add(Generator.random(Generator.Category.SEED)); + items.add(Generator.random(Generator.Category.SEED)); + break; + case 1: + items.add(Generator.random(Random.Int(2) == 0 ? Generator.Category.POTION : Generator.Category.SCROLL )); + items.add(Generator.random(Random.Int(2) == 0 ? Generator.Category.POTION : Generator.Category.SCROLL )); + items.add(Generator.random(Random.Int(2) == 0 ? Generator.Category.POTION : Generator.Category.SCROLL )); + break; + case 2: + items.add(new Bomb().random()); + items.add(new Honeypot()); + break; + } + } else { + Gold g = new Gold(); + g.random(); + g.quantity(g.quantity()*5); + items.add(g); + } + return items; + } + //caps at a 50% bonus private static float dropProgression( Char target, int tries ){ return tries * (float)Math.pow(1.25f, getBonus(target, Wealth.class) -1 );