diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java index f9b7632fb..42ff725a4 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/Char.java @@ -127,7 +127,7 @@ public abstract class Char extends Actor { // FIXME int dr = this instanceof Hero && ((Hero)this).rangedWeapon != null && ((Hero)this).subClass == - HeroSubClass.SNIPER ? 0 : Random.IntRange( 0, enemy.dr() ); + HeroSubClass.SNIPER ? 0 : enemy.drRoll(); int dmg = damageRoll(); int effectiveDamage = Math.max( dmg - dr, 0 ); @@ -210,7 +210,7 @@ public abstract class Char extends Actor { return Messages.get(this, "def_verb"); } - public int dr() { + public int drRoll() { return 0; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java index 9a19840c5..946994537 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java @@ -221,7 +221,7 @@ public class Combo extends Buff implements ActionIndicator.Action { break; } - dmg -= Random.IntRange( 0, enemy.dr() ); + dmg -= enemy.drRoll(); dmg = target.attackProc(enemy, dmg); dmg = enemy.defenseProc(target, dmg); enemy.damage( dmg, this ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 939a497f3..f389853ad 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -298,11 +298,17 @@ public class Hero extends Char { } @Override - public int dr() { + public int drRoll() { int dr = 0; Barkskin bark = buff(Barkskin.class); - if (belongings.armor != null) dr += Math.max( belongings.armor.DR(), 0); + if (belongings.armor != null) { + dr += Random.NormalIntRange( belongings.armor.DRMin(), belongings.armor.DRMax()); + if (STR() < belongings.armor.STRReq()){ + dr -= 2*(belongings.armor.STRReq() - STR()); + dr = Math.max(dr, 0); + } + } if (belongings.weapon != null) dr += Math.max( belongings.weapon.defenceFactor( this ), 0 ); if (bark != null) dr += bark.level(); @@ -368,13 +374,9 @@ public class Hero extends Char { } } - public boolean encumbered(){ - return (belongings.weapon != null - && belongings.weapon instanceof Weapon - && STR() < ((Weapon)belongings.weapon).STRReq()) - || - (belongings.armor != null - && STR() < belongings.armor.STRReq()); + public boolean canSurpriseAttack(){ + return !(belongings.weapon != null && belongings.weapon instanceof Weapon + && STR() < ((Weapon)belongings.weapon).STRReq()); } public boolean canAttack(Char enemy){ @@ -942,7 +944,7 @@ public class Hero extends Char { //TODO improve this when I have proper damage source logic if (belongings.armor != null && belongings.armor.hasGlyph(AntiMagic.class) && RingOfElements.FULL.contains(src.getClass())){ - dmg -= Random.IntRange(0, belongings.armor.DR()/2); + dmg -= Random.NormalIntRange(belongings.armor.DRMin(), belongings.armor.DRMax())/2; } super.damage( dmg, src ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bat.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bat.java index 7cb5d849c..bd5c122ec 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bat.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bat.java @@ -51,7 +51,7 @@ public class Bat extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 6, 12 ); + return Random.NormalIntRange( 8, 15 ); } @Override @@ -60,8 +60,8 @@ public class Bat extends Mob { } @Override - public int dr() { - return 4; + public int drRoll() { + return Random.NormalIntRange(0, 4); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Brute.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Brute.java index 51d5e0ae8..abb96ccf3 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Brute.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Brute.java @@ -59,8 +59,8 @@ public class Brute extends Mob { @Override public int damageRoll() { return enraged ? - Random.NormalIntRange( 10, 40 ) : - Random.NormalIntRange( 8, 18 ); + Random.NormalIntRange( 20, 40 ) : + Random.NormalIntRange( 10, 20 ); } @Override @@ -69,8 +69,8 @@ public class Brute extends Mob { } @Override - public int dr() { - return 8; + public int drRoll() { + return Random.NormalIntRange(0, 8); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Crab.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Crab.java index 32b4f039c..0677e1f58 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Crab.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Crab.java @@ -52,7 +52,7 @@ public class Crab extends Mob { } @Override - public int dr() { - return 4; + public int drRoll() { + return Random.NormalIntRange(0, 4); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java index e169ebd70..600b02111 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/DM300.java @@ -70,7 +70,7 @@ public class DM300 extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 18, 24 ); + return Random.NormalIntRange( 20, 25 ); } @Override @@ -79,8 +79,8 @@ public class DM300 extends Mob { } @Override - public int dr() { - return 10; + public int drRoll() { + return Random.NormalIntRange(0, 10); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Elemental.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Elemental.java index 7ccfeceb5..e7eeeb434 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Elemental.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Elemental.java @@ -56,7 +56,7 @@ public class Elemental extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 16, 20 ); + return Random.NormalIntRange( 18, 24 ); } @Override @@ -65,8 +65,8 @@ public class Elemental extends Mob { } @Override - public int dr() { - return 5; + public int drRoll() { + return Random.NormalIntRange(0, 5); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java index 401c660f4..b7cab341f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java @@ -61,8 +61,8 @@ public class Eye extends Mob { } @Override - public int dr() { - return 10; + public int drRoll() { + return Random.NormalIntRange(0, 10); } private Ballistica beam; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/FetidRat.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/FetidRat.java index 741d1d91f..2663f68f1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/FetidRat.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/FetidRat.java @@ -54,8 +54,8 @@ public class FetidRat extends Rat { } @Override - public int dr() { - return 2; + public int drRoll() { + return Random.NormalIntRange(0, 2); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Gnoll.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Gnoll.java index 7397e7862..29c97f311 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Gnoll.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Gnoll.java @@ -51,7 +51,7 @@ public class Gnoll extends Mob { } @Override - public int dr() { - return 2; + public int drRoll() { + return Random.NormalIntRange(0, 2); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java index e0ab3d086..e89ed078f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Golem.java @@ -44,7 +44,7 @@ public class Golem extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 20, 40 ); + return Random.NormalIntRange( 25, 40 ); } @Override @@ -58,8 +58,8 @@ public class Golem extends Mob { } @Override - public int dr() { - return 12; + public int drRoll() { + return Random.NormalIntRange(0, 12); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java index 286715ca4..4d5e4bc08 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Goo.java @@ -100,8 +100,8 @@ public class Goo extends Mob { } @Override - public int dr() { - return 2; + public int drRoll() { + return Random.NormalIntRange(0, 2); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java index c0aa98061..e7c82786f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Guard.java @@ -59,7 +59,7 @@ public class Guard extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange(4, 10); + return Random.NormalIntRange(5, 10); } @Override @@ -130,8 +130,8 @@ public class Guard extends Mob { } @Override - public int dr() { - return 9; + public int drRoll() { + return Random.NormalIntRange(0, 8); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java index 438cfd3e6..3687dc69e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/King.java @@ -89,7 +89,7 @@ public class King extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 20, 38 ); + return Random.NormalIntRange( 25, 40 ); } @Override @@ -98,8 +98,8 @@ public class King extends Mob { } @Override - public int dr() { - return 14; + public int drRoll() { + return Random.NormalIntRange(0, 14); } @Override @@ -283,7 +283,7 @@ public class King extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 12, 16 ); + return Random.NormalIntRange( 16, 20 ); } @Override @@ -318,8 +318,8 @@ public class King extends Mob { } @Override - public int dr() { - return 5; + public int drRoll() { + return Random.NormalIntRange(0, 5); } private static final HashSet> IMMUNITIES = new HashSet<>(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 100b2340a..ec4620904 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -339,7 +339,7 @@ public abstract class Mob extends Char { @Override public int defenseSkill( Char enemy ) { - boolean seen = enemySeen || (enemy == Dungeon.hero && Dungeon.hero.encumbered()); + boolean seen = enemySeen || (enemy == Dungeon.hero && !Dungeon.hero.canSurpriseAttack()); if (seen && paralysed == 0) { int defenseSkill = this.defenseSkill; int penalty = RingOfAccuracy.getBonus(enemy, RingOfAccuracy.Accuracy.class); @@ -353,7 +353,7 @@ public abstract class Mob extends Char { @Override public int defenseProc( Char enemy, int damage ) { - if (!enemySeen && enemy == Dungeon.hero && !Dungeon.hero.encumbered()) { + if (!enemySeen && enemy == Dungeon.hero && Dungeon.hero.canSurpriseAttack()) { if (((Hero)enemy).subClass == HeroSubClass.ASSASSIN) { damage *= 1.25f; Wound.hit(this); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Monk.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Monk.java index aa96864cb..56476c115 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Monk.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Monk.java @@ -56,7 +56,7 @@ public class Monk extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 12, 16 ); + return Random.NormalIntRange( 16, 20 ); } @Override @@ -70,8 +70,8 @@ public class Monk extends Mob { } @Override - public int dr() { - return 2; + public int drRoll() { + return Random.NormalIntRange(0, 2); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewbornElemental.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewbornElemental.java index ce9c64183..41810a39d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewbornElemental.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/NewbornElemental.java @@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Chill; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Frost; import com.shatteredpixel.shatteredpixeldungeon.items.quest.Embers; import com.shatteredpixel.shatteredpixeldungeon.sprites.NewbornElementalSprite; +import com.watabou.utils.Random; public class NewbornElemental extends Elemental { @@ -44,8 +45,8 @@ public class NewbornElemental extends Elemental { @Override public int damageRoll() { - return super.damageRoll()/2; - } //8-10 + return Random.NormalIntRange(10, 15); + } @Override public void add(Buff buff) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java index 6c9cefbaf..3f9fd4f7a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Piranha.java @@ -91,8 +91,8 @@ public class Piranha extends Mob { } @Override - public int dr() { - return Dungeon.depth; + public int drRoll() { + return Random.NormalIntRange(0, Dungeon.depth); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Rat.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Rat.java index 3b5505eee..61d8051cb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Rat.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Rat.java @@ -46,7 +46,7 @@ public class Rat extends Mob { } @Override - public int dr() { - return 1; + public int drRoll() { + return Random.NormalIntRange(0, 1); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotHeart.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotHeart.java index 45ff9799d..75b693a8a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotHeart.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotHeart.java @@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Terror; import com.shatteredpixel.shatteredpixeldungeon.plants.Rotberry; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.RotHeartSprite; +import com.watabou.utils.Random; import java.util.HashSet; @@ -103,8 +104,8 @@ public class RotHeart extends Mob { } @Override - public int dr() { - return 5; + public int drRoll() { + return Random.NormalIntRange(0, 5); } private static final HashSet> IMMUNITIES = new HashSet<>(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotLasher.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotLasher.java index 0ffe40974..5f9742b41 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotLasher.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/RotLasher.java @@ -86,7 +86,7 @@ public class RotLasher extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange(4, 12); + return Random.NormalIntRange(6, 12); } @Override @@ -95,8 +95,8 @@ public class RotLasher extends Mob { } @Override - public int dr() { - return 8; + public int drRoll() { + return Random.NormalIntRange(0, 8); } private static final HashSet> IMMUNITIES = new HashSet<>(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Scorpio.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Scorpio.java index 66a8b6faf..c4489cd1b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Scorpio.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Scorpio.java @@ -57,7 +57,7 @@ public class Scorpio extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 20, 32 ); + return Random.NormalIntRange( 26, 36 ); } @Override @@ -66,8 +66,8 @@ public class Scorpio extends Mob { } @Override - public int dr() { - return 16; + public int drRoll() { + return Random.NormalIntRange(0, 16); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Senior.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Senior.java index 7e9d47e18..34ccdc456 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Senior.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Senior.java @@ -35,7 +35,7 @@ public class Senior extends Monk { @Override public int damageRoll() { - return Random.NormalIntRange( 12, 20 ); + return Random.NormalIntRange( 16, 24 ); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java index e0054c40c..e222dce92 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java @@ -56,7 +56,7 @@ public class Shaman extends Mob implements Callback { @Override public int damageRoll() { - return Random.NormalIntRange( 2, 6 ); + return Random.NormalIntRange( 4, 6 ); } @Override @@ -65,8 +65,8 @@ public class Shaman extends Mob implements Callback { } @Override - public int dr() { - return 4; + public int drRoll() { + return Random.NormalIntRange(0, 4); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shielded.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shielded.java index 0f61a30d0..7953da152 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shielded.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shielded.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.mobs; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.sprites.ShieldedSprite; +import com.watabou.utils.Random; public class Shielded extends Brute { @@ -32,8 +33,8 @@ public class Shielded extends Brute { } @Override - public int dr() { - return 10; + public int drRoll() { + return Random.NormalIntRange(0, 10); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java index 91cda7081..ba408752f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Skeleton.java @@ -68,7 +68,7 @@ public class Skeleton extends Mob { for (int i=0; i < Level.NEIGHBOURS8.length; i++) { Char ch = findChar( pos + Level.NEIGHBOURS8[i] ); if (ch != null && ch.isAlive()) { - int damage = Math.max( 0, damageRoll() - Random.IntRange( 0, ch.dr() / 2 ) ); + int damage = Math.max( 0, damageRoll() - (ch.drRoll() / 2) ); ch.damage( damage, this ); if (ch == Dungeon.hero && !ch.isAlive()) { heroKilled = true; @@ -104,8 +104,8 @@ public class Skeleton extends Mob { } @Override - public int dr() { - return 5; + public int drRoll() { + return Random.NormalIntRange(0, 5); } private static final HashSet> IMMUNITIES = new HashSet<>(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java index b10a5e55c..4835f19c4 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Spinner.java @@ -53,7 +53,7 @@ public class Spinner extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange(12, 16); + return Random.NormalIntRange(14, 18); } @Override @@ -62,8 +62,8 @@ public class Spinner extends Mob { } @Override - public int dr() { - return 6; + public int drRoll() { + return Random.NormalIntRange(0, 6); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java index 401da8681..4cfab09d1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java @@ -107,8 +107,8 @@ public class Statue extends Mob { } @Override - public int dr() { - return Dungeon.depth + weapon.defenceFactor(null); + public int drRoll() { + return Random.NormalIntRange(0, Dungeon.depth + weapon.defenceFactor(null)); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Succubus.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Succubus.java index d77a2bd50..bd94a4386 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Succubus.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Succubus.java @@ -64,7 +64,7 @@ public class Succubus extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 15, 25 ); + return Random.NormalIntRange( 22, 30 ); } @Override @@ -131,8 +131,8 @@ public class Succubus extends Mob { } @Override - public int dr() { - return 10; + public int drRoll() { + return Random.NormalIntRange(0, 10); } private static final HashSet> RESISTANCES = new HashSet<>(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java index b0817555c..ea9d47dd8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Tengu.java @@ -76,7 +76,7 @@ public class Tengu extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 8, 15 ); + return Random.NormalIntRange( 10, 16 ); } @Override @@ -85,8 +85,8 @@ public class Tengu extends Mob { } @Override - public int dr() { - return 5; + public int drRoll() { + return Random.NormalIntRange(0, 5); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java index 26c948352..45cded134 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Thief.java @@ -82,7 +82,7 @@ public class Thief extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 1, 7 ); + return Random.NormalIntRange( 1, 8 ); } @Override @@ -117,8 +117,8 @@ public class Thief extends Mob { } @Override - public int dr() { - return 3; + public int drRoll() { + return Random.NormalIntRange(0, 3); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java index f64755b6c..0dbc5b124 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java @@ -60,7 +60,7 @@ public class Warlock extends Mob implements Callback { @Override public int damageRoll() { - return Random.NormalIntRange( 12, 20 ); + return Random.NormalIntRange( 14, 24 ); } @Override @@ -69,8 +69,8 @@ public class Warlock extends Mob implements Callback { } @Override - public int dr() { - return 8; + public int drRoll() { + return Random.NormalIntRange(0, 8); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Wraith.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Wraith.java index 137ea8eab..b47f761cb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Wraith.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Wraith.java @@ -69,7 +69,7 @@ public class Wraith extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 1, 3 + level ); + return Random.NormalIntRange( 1 + level/2, 2 + level ); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java index 33270471d..01e03f1ef 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java @@ -230,12 +230,12 @@ public class Yog extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 24, 36 ); + return Random.NormalIntRange( 30, 40 ); } @Override - public int dr() { - return 15; + public int drRoll() { + return Random.NormalIntRange(0, 15); } @Override @@ -316,12 +316,12 @@ public class Yog extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 20, 32 ); + return Random.NormalIntRange( 26, 32 ); } @Override - public int dr() { - return 15; + public int drRoll() { + return Random.NormalIntRange(0, 15); } @Override @@ -426,12 +426,12 @@ public class Yog extends Mob { @Override public int damageRoll() { - return Random.NormalIntRange( 15, 20 ); + return Random.NormalIntRange( 24, 28 ); } @Override - public int dr() { - return 8; + public int drRoll() { + return Random.NormalIntRange(0, 8); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java index 545e3cbc1..ca8cb992c 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Bomb.java @@ -143,7 +143,7 @@ public class Bomb extends Item { int minDamage = c == cell ? Dungeon.depth+5 : 1; int maxDamage = 10 + Dungeon.depth * 2; - int dmg = Random.NormalIntRange( minDamage, maxDamage ) - Random.Int( ch.dr() ); + int dmg = Random.NormalIntRange( minDamage, maxDamage ) - ch.drRoll(); if (dmg > 0) { ch.damage( dmg, this ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java index c18a7b95c..449ef8433 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/Armor.java @@ -211,13 +211,29 @@ public class Armor extends EquipableItem { public boolean isEquipped( Hero hero ) { return hero.belongings.armor == this; } - - public int DR(){ + + public final int DRMax(){ + return DRMax(level()); + } + + public int DRMax(int lvl){ int effectiveTier = tier; if (glyph != null) effectiveTier += glyph.tierDRAdjust(); effectiveTier = Math.max(0, effectiveTier); - return effectiveTier * (2 + level()); + return effectiveTier * (2 + lvl); + } + + public final int DRMin(){ + return DRMin(level()); + } + + public int DRMin(int lvl){ + int effectiveTier = tier; + if (glyph != null) effectiveTier += glyph.tierDRAdjust(); + effectiveTier = Math.max(0, effectiveTier); + + return (effectiveTier-1)/2 + lvl; } @Override @@ -267,7 +283,7 @@ public class Armor extends EquipableItem { String info = desc(); if (levelKnown) { - info += "\n\n" + Messages.get(Armor.class, "curr_absorb", DR(), STRReq()); + info += "\n\n" + Messages.get(Armor.class, "curr_absorb", DRMin(), DRMax(), STRReq()); if (STRReq() > Dungeon.hero.STR()) { info += " " + Messages.get(Armor.class, "too_heavy"); @@ -275,7 +291,7 @@ public class Armor extends EquipableItem { info += " " + Messages.get(Armor.class, "excess_str"); } } else { - info += "\n\n" + Messages.get(Armor.class, "avg_absorb", typicalDR(), STRReq(0)); + info += "\n\n" + Messages.get(Armor.class, "avg_absorb", DRMin(0), DRMax(0), STRReq(0)); if (STRReq(0) > Dungeon.hero.STR()) { info += " " + Messages.get(Armor.class, "probably_too_heavy"); @@ -347,10 +363,6 @@ public class Armor extends EquipableItem { return (8 + effectiveTier * 2) - (int)(Math.sqrt(8 * lvl + 1) - 1)/2; } - public int typicalDR() { - return tier * 2; - } - @Override public int price() { int price = 10 * (1 << (tier - 1)); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java index f965b1f36..1e921d694 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/armor/ClassArmor.java @@ -149,12 +149,21 @@ abstract public class ClassArmor extends Armor { } @Override - public int DR(){ + public int DRMax(int lvl){ int effectiveTier = armorTier; if (glyph != null) effectiveTier += glyph.tierDRAdjust(); effectiveTier = Math.max(0, effectiveTier); - return effectiveTier * (2 + level()); + return effectiveTier * (2 + lvl); + } + + @Override + public int DRMin(int lvl){ + int effectiveTier = armorTier; + if (glyph != null) effectiveTier += glyph.tierDRAdjust(); + effectiveTier = Math.max(0, effectiveTier); + + return (effectiveTier-1)/2 + lvl; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java index 364a7efb6..eb253c5e8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/ChaliceOfBlood.java @@ -33,7 +33,6 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndOptions; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Bundle; -import com.watabou.utils.Random; import java.util.ArrayList; @@ -92,7 +91,7 @@ public class ChaliceOfBlood extends Artifact { damage = armor.absorb(damage); } - damage -= Random.IntRange(0, hero.dr()); + damage -= hero.drRoll(); hero.sprite.operate( hero.pos ); hero.busy(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index 7e276e34c..ed797b0bd 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -377,9 +377,9 @@ public class DriedRose extends Artifact { } @Override - public int dr() { + public int drRoll() { //defence is equal to the level of rose. - return (HT-10)/3; + return Random.NormalIntRange(0, (HT-10)/3); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Lucky.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Lucky.java index 0e0de3ed1..9cc8ddc9d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Lucky.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Lucky.java @@ -38,9 +38,9 @@ public class Lucky extends Weapon.Enchantment { if (Random.Int(100) < (50 + level)){ int exStr = 0; if (attacker == Dungeon.hero) exStr = Math.max(0, Dungeon.hero.STR() - weapon.STRReq()); - damage = weapon.imbue.damageFactor(weapon.max()) + exStr - Random.IntRange(0, defender.dr()); + damage = weapon.imbue.damageFactor(weapon.max()) + exStr - defender.drRoll(); } else { - damage = weapon.imbue.damageFactor(weapon.min()) - Random.IntRange(0, defender.dr()); + damage = weapon.imbue.damageFactor(weapon.min()) - defender.drRoll(); } return Math.max(0, damage); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GrippingTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GrippingTrap.java index 4f6dd2f19..df26111e7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GrippingTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/GrippingTrap.java @@ -29,7 +29,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Cripple; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Roots; import com.shatteredpixel.shatteredpixeldungeon.effects.Wound; import com.shatteredpixel.shatteredpixeldungeon.sprites.TrapSprite; -import com.watabou.utils.Random; public class GrippingTrap extends Trap { @@ -44,7 +43,7 @@ public class GrippingTrap extends Trap { Char c = Actor.findChar( pos ); if (c != null) { - int damage = Math.max( 0, (Dungeon.depth) - Random.IntRange( 0, c.dr() / 2 ) ); + int damage = Math.max( 0, (Dungeon.depth) - ( c.drRoll() / 2 ) ); Buff.affect( c, Bleeding.class ).set( damage ); Buff.prolong( c, Cripple.class, 15f); Buff.prolong( c, Roots.class, 5f); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/RockfallTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/RockfallTrap.java index 2267707e9..3ab31b369 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/RockfallTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/RockfallTrap.java @@ -66,7 +66,7 @@ public class RockfallTrap extends Trap { if (ch != null){ int damage = Random.NormalIntRange(Dungeon.depth, Dungeon.depth*2); - damage -= Random.IntRange( 0, ch.dr()); + damage -= ch.drRoll(); ch.damage( Math.max(damage, 0) , this); Buff.prolong( ch, Paralysis.class, Paralysis.duration(ch)/2); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SpearTrap.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SpearTrap.java index 3c0bcdb48..439601b8d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SpearTrap.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/traps/SpearTrap.java @@ -61,7 +61,7 @@ public class SpearTrap extends Trap { Char ch = Actor.findChar( pos); if (ch != null && !ch.flying){ int damage = Random.NormalIntRange(Dungeon.depth, Dungeon.depth*2); - damage -= Random.IntRange( 0, ch.dr()); + damage -= ch.drRoll(); ch.damage( Math.max(damage, 0) , this); if (!ch.isAlive() && ch == Dungeon.hero){ Dungeon.fail( getClass() ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties b/src/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties index f65ce5806..86b9f3749 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties +++ b/src/com/shatteredpixel/shatteredpixeldungeon/messages/items/items.properties @@ -72,9 +72,9 @@ items.armor.armor.detach_seal=You detach the seal from your armor. items.armor.armor.equip_cursed=The armor constricts around you painfully. items.armor.armor.identify=You are now familiar enough with your armor to identify it. items.armor.armor.incompatible=Interaction of different types of magic has erased the glyph on this armor! -items.armor.armor.curr_absorb=This armor blocks up to _%d damage_ and requires _%d strength_ to use properly. -items.armor.armor.avg_absorb=Typically this armor blocks up to _%d damage_ and requires _%d strength_ to use properly. -items.armor.armor.too_heavy=Because of your inadequate strength wearing this armor will decrease your ability to move and evade. +items.armor.armor.curr_absorb=This armor blocks _%d-%d damage_ and requires _%d strength_ to use properly. +items.armor.armor.avg_absorb=Typically this armor blocks _%d-%d damage_ and requires _%d strength_ to use properly. +items.armor.armor.too_heavy=Because of your inadequate strength wearing this armor will decrease your ability to move, evade, and defend. items.armor.armor.probably_too_heavy=Probably this armor is too heavy for you. items.armor.armor.excess_str=Because of your excess strength, you are _more evasive_ while wearing this armor. items.armor.armor.inscribed=It is inscribed with a _%s._ @@ -903,7 +903,7 @@ items.weapon.missiles.tamahawk.desc=This throwing axe is not that heavy, but it items.weapon.weapon.identify=You are now familiar enough with your weapon to identify it. -items.weapon.weapon.too_heavy=Because of your inadequate strength you will use this weapon with decreased attack speed and accuracy. +items.weapon.weapon.too_heavy=Because of your inadequate strength this weapon will hinder your attack speed, accuracy, and ability to surprise attack. items.weapon.weapon.excess_str=Because of your excess strength, you will deal up to _%d bonus damage_ with this weapon. items.weapon.weapon.incompatible=Interaction of different types of magic has negated the enchantment on this weapon! items.weapon.weapon.cursed_worn=Because this weapon is cursed, you are powerless to remove it.