From 2c92332563d0fae9f098822fb22f49df16cf2b4d Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 7 May 2019 22:05:14 -0400 Subject: [PATCH] v0.7.3: Balance adjustments around magical resistance effects: - magical resistances no longer apply to the melee attacks of magic users - ring of elements buffed to 20% reduction per level from 16% - antimagic glyph rebalanced, no longer depends on armor DR --- .../src/main/java/com/watabou/utils/Bundle.java | 2 +- .../shatteredpixeldungeon/actors/hero/Hero.java | 2 +- .../shatteredpixeldungeon/actors/mobs/Eye.java | 5 ++++- .../shatteredpixeldungeon/actors/mobs/Shaman.java | 5 ++++- .../actors/mobs/Warlock.java | 5 ++++- .../shatteredpixeldungeon/actors/mobs/Yog.java | 5 ++++- .../items/armor/glyphs/AntiMagic.java | 13 +++++++++---- .../items/artifacts/DriedRose.java | 2 +- .../items/rings/RingOfElements.java | 15 +++++++-------- 9 files changed, 35 insertions(+), 19 deletions(-) diff --git a/SPD-classes/src/main/java/com/watabou/utils/Bundle.java b/SPD-classes/src/main/java/com/watabou/utils/Bundle.java index 185ac8d1f..744e9f6ec 100644 --- a/SPD-classes/src/main/java/com/watabou/utils/Bundle.java +++ b/SPD-classes/src/main/java/com/watabou/utils/Bundle.java @@ -93,7 +93,7 @@ public class Bundle { public Class getClass( String key ) { String clName = getString(key).replace("class ", "");; - if (clName != null){ + if (!clName.equals("")){ if (aliases.containsKey( clName )) { clName = aliases.get( clName ); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 205fde24a..7e47dc26f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -1034,7 +1034,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, this) && AntiMagic.RESISTS.contains(src.getClass())){ - dmg -= Random.NormalIntRange(belongings.armor.DRMin(), belongings.armor.DRMax())/3; + dmg -= AntiMagic.drRoll(belongings.armor.level()); } super.damage( dmg, src ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java index 18e4dc770..3e07b2e74 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Eye.java @@ -144,6 +144,9 @@ public class Eye extends Mob { if (beamCharged) dmg /= 4; super.damage(dmg, src); } + + //used so resistances can differentiate between melee and magical attacks + public static class DeathGaze{} public void deathGaze(){ if (!beamCharged || beamCooldown > 0 || beam == null) @@ -170,7 +173,7 @@ public class Eye extends Mob { } if (hit( this, ch, true )) { - ch.damage( Random.NormalIntRange( 30, 50 ), this ); + ch.damage( Random.NormalIntRange( 30, 50 ), new DeathGaze() ); if (Dungeon.level.heroFOV[pos]) { ch.sprite.flash(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java index de4861c25..c0860ead0 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Shaman.java @@ -73,6 +73,9 @@ public class Shaman extends Mob implements Callback { return new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT).collisionPos == enemy.pos; } + //used so resistances can differentiate between melee and magical attacks + public static class LightningBolt{} + @Override protected boolean doAttack( Char enemy ) { @@ -94,7 +97,7 @@ public class Shaman extends Mob implements Callback { if (Dungeon.level.water[enemy.pos] && !enemy.flying) { dmg *= 1.5f; } - enemy.damage( dmg, this ); + enemy.damage( dmg, new LightningBolt() ); enemy.sprite.centerEmitter().burst( SparkParticle.FACTORY, 3 ); enemy.sprite.flash(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java index edede557e..386c58c3d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Warlock.java @@ -95,6 +95,9 @@ public class Warlock extends Mob implements Callback { } } + //used so resistances can differentiate between melee and magical attacks + public static class DarkBolt{} + private void zap() { spend( TIME_TO_ZAP ); @@ -104,7 +107,7 @@ public class Warlock extends Mob implements Callback { } int dmg = Random.Int( 12, 18 ); - enemy.damage( dmg, this ); + enemy.damage( dmg, new DarkBolt() ); if (!enemy.isAlive() && enemy == Dungeon.hero) { Dungeon.fail( getClass() ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java index 43e70e75a..a5e492b12 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Yog.java @@ -311,6 +311,9 @@ public class Yog extends Mob { return new Ballistica( pos, enemy.pos, Ballistica.MAGIC_BOLT).collisionPos == enemy.pos; } + //used so resistances can differentiate between melee and magical attacks + public static class DarkBolt{} + @Override public boolean attack( Char enemy ) { @@ -320,7 +323,7 @@ public class Yog extends Mob { if (hit( this, enemy, true )) { int dmg = damageRoll(); - enemy.damage( dmg, this ); + enemy.damage( dmg, new DarkBolt() ); enemy.sprite.bloodBurstA( sprite.center(), dmg ); enemy.sprite.flash(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/AntiMagic.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/AntiMagic.java index 876793b54..38dcf0c2a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/AntiMagic.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/armor/glyphs/AntiMagic.java @@ -32,6 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.DisintegrationTrap; import com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrimTrap; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; +import com.watabou.utils.Random; import java.util.HashSet; @@ -47,10 +48,10 @@ public class AntiMagic extends Armor.Glyph { RESISTS.add( DisintegrationTrap.class ); RESISTS.add( GrimTrap.class ); - RESISTS.add( Shaman.class ); - RESISTS.add( Warlock.class ); - RESISTS.add( Eye.class ); - RESISTS.add( Yog.BurningFist.class ); + RESISTS.add( Shaman.LightningBolt.class ); + RESISTS.add( Warlock.DarkBolt.class ); + RESISTS.add( Eye.DeathGaze.class ); + RESISTS.add( Yog.BurningFist.DarkBolt.class ); } @Override @@ -58,6 +59,10 @@ public class AntiMagic extends Armor.Glyph { //no proc effect, see Hero.damage return damage; } + + public static int drRoll( int level ){ + return Random.NormalIntRange(2+level, 4 + (level*2)); + } @Override public ItemSprite.Glowing glowing() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index d4693b94a..da5559226 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -568,7 +568,7 @@ public class DriedRose extends Artifact { //TODO improve this when I have proper damage source logic if (rose != null && rose.armor != null && rose.armor.hasGlyph(AntiMagic.class, this) && AntiMagic.RESISTS.contains(src.getClass())){ - dmg -= Random.NormalIntRange(rose.armor.DRMin(), rose.armor.DRMax())/3; + dmg -= AntiMagic.drRoll(rose.armor.level()); } super.damage( dmg, src ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfElements.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfElements.java index e9865b0ff..591f3f525 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfElements.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfElements.java @@ -48,9 +48,9 @@ public class RingOfElements extends Ring { public String statsInfo() { if (isIdentified()){ - return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (1f - Math.pow(0.84f, soloBonus())))); + return Messages.get(this, "stats", new DecimalFormat("#.##").format(100f * (1f - Math.pow(0.80f, soloBonus())))); } else { - return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(16f)); + return Messages.get(this, "typical_stats", new DecimalFormat("#.##").format(20f)); } } @@ -77,11 +77,10 @@ public class RingOfElements extends Ring { RESISTS.add( ToxicGas.class ); RESISTS.add( Electricity.class ); - //FIXME currently this affects all attacks, not just longranged magic - RESISTS.add( Shaman.class ); - RESISTS.add( Warlock.class ); - RESISTS.add( Eye.class ); - RESISTS.add( Yog.BurningFist.class ); + RESISTS.add( Shaman.LightningBolt.class ); + RESISTS.add( Warlock.DarkBolt.class ); + RESISTS.add( Eye.DeathGaze.class ); + RESISTS.add( Yog.BurningFist.DarkBolt.class ); } public static float resist( Char target, Class effect ){ @@ -89,7 +88,7 @@ public class RingOfElements extends Ring { for (Class c : RESISTS){ if (c.isAssignableFrom(effect)){ - return (float)Math.pow(0.84, getBonus(target, Resistance.class)); + return (float)Math.pow(0.80, getBonus(target, Resistance.class)); } }