V0.2.0: Added last bit of Ring of Wealth logic

This commit is contained in:
Evan Debenham 2014-09-14 19:40:59 -04:00
parent efef1e65c9
commit 63696cb502

View File

@ -36,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfAccuracy; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfAccuracy;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
@ -467,6 +468,14 @@ public abstract class Mob extends Char {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected void dropLoot() { protected void dropLoot() {
float lootChance = this.lootChance;
int bonus = 0;
for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) {
bonus += ((RingOfWealth.Wealth) buff).level;
}
lootChance *= Math.pow(1.1, bonus);
if (loot != null && Random.Float() < lootChance) { if (loot != null && Random.Float() < lootChance) {
Item item = null; Item item = null;
if (loot instanceof Generator.Category) { if (loot instanceof Generator.Category) {