From 96d5f1000f4b749a5913edfbaf368214794c8279 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 14 Sep 2014 19:31:31 -0400 Subject: [PATCH] V0.2.0: Fully implemented Ring of Wealth --- .../items/rings/RingOfWealth.java | 2 +- .../shatteredpixeldungeon/levels/Level.java | 14 ++++++++++++++ .../shatteredpixeldungeon/levels/RegularLevel.java | 10 +++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java index 707c5d279..35acae328 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfWealth.java @@ -4,7 +4,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings; * Created by debenhame on 10/09/2014. */ public class RingOfWealth extends Ring { - //TODO: tie this into game logic + //TODO: monitor this one as it goes, super hard to balance so you'll need some feedback. { name = "Ring of Wealth"; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index fa9828576..daed5bdd5 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -24,6 +24,9 @@ import java.util.HashMap; import java.util.HashSet; import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; +import com.shatteredpixel.shatteredpixeldungeon.items.potions.PotionOfMight; +import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth; +import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfWeaponUpgrade; import com.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush; import com.watabou.noosa.Scene; import com.watabou.noosa.audio.Sample; @@ -168,6 +171,17 @@ public abstract class Level implements Bundlable { addItemToSpawn( new Stylus() ); Dungeon.arcaneStyli++; } + + int bonus = 0; + for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) { + bonus += ((RingOfWealth.Wealth) buff).level; + } + if (Random.Float() < Math.pow(0.95, bonus)){ + if (Random.Int(2) == 0) + addItemToSpawn( new ScrollOfWeaponUpgrade() ); + else + addItemToSpawn( new PotionOfMight() ); + } if (Dungeon.depth > 1) { switch (Random.Int( 10 )) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java index 3c6e86cfd..f6fc1122d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java @@ -25,11 +25,13 @@ import java.util.List; import com.shatteredpixel.shatteredpixeldungeon.Bones; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bestiary; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; +import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfWealth; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.*; @@ -590,7 +592,13 @@ public abstract class RegularLevel extends Level { protected void createItems() { int nItems = 3; - while (Random.Float() < 0.3f) { + int bonus = 0; + for (Buff buff : Dungeon.hero.buffs(RingOfWealth.Wealth.class)) { + bonus += ((RingOfWealth.Wealth) buff).level; + } + //just incase someone gets a ridiculous ring, cap this at 75% + bonus = Math.min(bonus, 15); + while (Random.Float() < (0.3f + bonus*0.03f)) { nItems++; }