V0.2.0: Fully implemented Ring of Wealth

This commit is contained in:
Evan Debenham 2014-09-14 19:31:31 -04:00
parent 6e9cc9dd69
commit 96d5f1000f
3 changed files with 24 additions and 2 deletions

View File

@ -4,7 +4,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings;
* Created by debenhame on 10/09/2014. * Created by debenhame on 10/09/2014.
*/ */
public class RingOfWealth extends Ring { 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"; name = "Ring of Wealth";
} }

View File

@ -24,6 +24,9 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import com.shatteredpixel.shatteredpixeldungeon.items.food.Blandfruit; 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.shatteredpixel.shatteredpixeldungeon.plants.BlandfruitBush;
import com.watabou.noosa.Scene; import com.watabou.noosa.Scene;
import com.watabou.noosa.audio.Sample; import com.watabou.noosa.audio.Sample;
@ -168,6 +171,17 @@ public abstract class Level implements Bundlable {
addItemToSpawn( new Stylus() ); addItemToSpawn( new Stylus() );
Dungeon.arcaneStyli++; 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) { if (Dungeon.depth > 1) {
switch (Random.Int( 10 )) { switch (Random.Int( 10 )) {

View File

@ -25,11 +25,13 @@ import java.util.List;
import com.shatteredpixel.shatteredpixeldungeon.Bones; import com.shatteredpixel.shatteredpixeldungeon.Bones;
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.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bestiary; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bestiary;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator; 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.RingOfWealth;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade;
import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type; import com.shatteredpixel.shatteredpixeldungeon.levels.Room.Type;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.*; import com.shatteredpixel.shatteredpixeldungeon.levels.painters.*;
@ -590,7 +592,13 @@ public abstract class RegularLevel extends Level {
protected void createItems() { protected void createItems() {
int nItems = 3; 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++; nItems++;
} }