From 256cca2e7e146119804dd683267f4de8b1bcfee0 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 28 May 2016 20:06:09 -0400 Subject: [PATCH] v0.4.0: rebalanced ring of force around new equipment also some refactoring to it --- .../actors/hero/Hero.java | 2 +- .../items/rings/RingOfForce.java | 42 ++++++++++++++----- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 6b1a9749a..6efeed316 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -319,7 +319,7 @@ public class Hero extends Char { dmg = wep.damageRoll( this ) + bonus; } else { if (bonus != 0){ - dmg = Random.NormalIntRange( RingOfForce.min(bonus, STR()), RingOfForce.max(bonus, STR()) ); + dmg = RingOfForce.damageRoll(this); } else { dmg = Random.NormalIntRange(1, Math.max(STR()-8, 1)); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java index 821dcf8ff..f8242046b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfForce.java @@ -21,7 +21,10 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.watabou.utils.Random; public class RingOfForce extends Ring { @@ -30,26 +33,43 @@ public class RingOfForce extends Ring { return new Force(); } - public static int min(int bonus, int herostr){ - if (bonus < 0) return 0; - int STR = herostr-8; - return Math.max(STR/2+bonus, 0); + private static float tier(int str){ + return Math.max(1, (str - 8)/2f); } - public static int max(int bonus, int herostr){ - if (bonus < 0) return 0; - int STR = herostr-8; - return Math.max((int)(STR*0.5f*bonus) + STR*2, bonus); + public static int damageRoll( Hero hero ){ + int level = 0; + for (Buff buff : hero.buffs( RingOfForce.Force.class )) { + level += ((RingOfForce.Force)buff).level; + } + float tier = tier(hero.STR()); + return Random.NormalIntRange(min(level, tier), max(level, tier)); + } + + //same as equivalent tier weapon + private static int min(int lvl, float tier){ + return Math.round( + tier + //base + lvl //level scaling + ); + } + + //20% reduced from equivalent tier weapon + private static int max(int lvl, float tier){ + return Math.round( + 4*(tier+1) + //base, 20% reduced from equivalent tier + lvl*(tier) //level scaling, 1 reduced from equivalent tier + ); } @Override public String desc() { String desc = super.desc(); - int str = Dungeon.hero.STR(); + float tier = tier(Dungeon.hero.STR()); if (levelKnown) { - desc += "\n\n" + Messages.get(this, "avg_dmg", (min(level(), str) + max(level(), str))/2); + desc += "\n\n" + Messages.get(this, "avg_dmg", (min(level(), tier) + max(level(), tier))/2); } else { - desc += "\n\n" + Messages.get(this, "typical_avg_dmg", (min(1, str) + max(1, str))/2); + desc += "\n\n" + Messages.get(this, "typical_avg_dmg", (min(1, tier) + max(1, tier))/2); } return desc;