From 3dae7bf2cf939aca19c8e237ebf69ab1c6dc5a64 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 9 Jul 2020 14:28:39 -0400 Subject: [PATCH] v0.8.2: Fixed various smaller issues: - Bees refusing to retarget when target is invulnerable - Potion splashes cleaning fire/ooze from enemies - Blast wave attempting to throw enemies that move after being damaged - Corrupting enchant attempting to corrupt dead enemies - Magic missile charge buff not visually applying to the mage's staff - Specific cases where using an item wouldn't cancel the current cell selector - Large enemies rarely appearing in enclosed spaces due to levelgen - Lotus vfx persisting after the sprite is destroyed in rare case --- .../shatteredpixeldungeon/actors/mobs/Bee.java | 3 ++- .../shatteredpixeldungeon/items/Item.java | 3 ++- .../items/potions/Potion.java | 2 +- .../items/wands/WandOfBlastWave.java | 4 ++-- .../items/weapon/enchantments/Corrupting.java | 7 ++++--- .../items/weapon/melee/MagesStaff.java | 14 ++++++++++++++ .../shatteredpixeldungeon/levels/RegularLevel.java | 6 ++++-- .../shatteredpixeldungeon/scenes/GameScene.java | 2 +- .../shatteredpixeldungeon/sprites/LotusSprite.java | 12 ++++++++++++ 9 files changed, 42 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java index 8bac5dc41..87da1c31c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Bee.java @@ -149,7 +149,8 @@ public class Bee extends Mob { //try to find a new enemy in these circumstances if (enemy == null || !enemy.isAlive() || !Actor.chars().contains(enemy) || state == WANDERING || Dungeon.level.distance(enemy.pos, potPos) > 3 - || (alignment == Alignment.ALLY && enemy.alignment == Alignment.ALLY)){ + || (alignment == Alignment.ALLY && enemy.alignment == Alignment.ALLY) + || (buff( Amok.class ) == null && enemy.isInvulnerable(getClass()))){ //find all mobs near the pot HashSet enemies = new HashSet<>(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java index b015f2b0e..500ca7532 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Item.java @@ -130,7 +130,8 @@ public class Item implements Bundlable { } public void execute( Hero hero, String action ) { - + + GameScene.cancel(); curUser = hero; curItem = this; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java index 6fc043b2f..503a6f94f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/potions/Potion.java @@ -416,7 +416,7 @@ public class Potion extends Item { final int color = splashColor(); Char ch = Actor.findChar(cell); - if (ch != null) { + if (ch != null && ch.alignment == Char.Alignment.ALLY) { Buff.detach(ch, Burning.class); Buff.detach(ch, Ooze.class); Splash.at( ch.sprite.center(), color, 5 ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java index 45ad594a2..272091ff7 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/wands/WandOfBlastWave.java @@ -84,7 +84,7 @@ public class WandOfBlastWave extends DamageWand { processSoulMark(ch, chargesPerCast()); if (ch.alignment != Char.Alignment.ALLY) ch.damage(damageRoll(), this); - if (ch.isAlive()) { + if (ch.isAlive() && ch.pos == bolt.collisionPos + i) { Ballistica trajectory = new Ballistica(ch.pos, ch.pos + i, Ballistica.MAGIC_BOLT); int strength = 1 + Math.round(buffedLvl() / 2f); throwChar(ch, trajectory, strength); @@ -101,7 +101,7 @@ public class WandOfBlastWave extends DamageWand { processSoulMark(ch, chargesPerCast()); ch.damage(damageRoll(), this); - if (ch.isAlive() && bolt.path.size() > bolt.dist+1) { + if (ch.isAlive() && bolt.path.size() > bolt.dist+1 && ch.pos == bolt.collisionPos) { Ballistica trajectory = new Ballistica(ch.pos, bolt.path.get(bolt.dist + 1), Ballistica.MAGIC_BOLT); int strength = buffedLvl() + 3; throwChar(ch, trajectory, strength); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Corrupting.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Corrupting.java index 72ac0938e..190eaa482 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Corrupting.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/enchantments/Corrupting.java @@ -43,16 +43,17 @@ public class Corrupting extends Weapon.Enchantment { @Override public int proc(Weapon weapon, Char attacker, Char defender, int damage) { - if (defender.buff(Corruption.class) != null || !(defender instanceof Mob)) return damage; - int level = Math.max( 0, weapon.buffedLvl() ); // lvl 0 - 20% // lvl 1 ~ 23% // lvl 2 ~ 26% if (damage >= defender.HP + && Random.Int( level + 25 ) >= 20 && !defender.isImmune(Corruption.class) - && Random.Int( level + 25 ) >= 20){ + && defender.buff(Corruption.class) == null + && defender instanceof Mob + && defender.isAlive()){ Mob enemy = (Mob) defender; Hero hero = (attacker instanceof Hero) ? (Hero) attacker : Dungeon.hero; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java index 2c6303884..079a5aec5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MagesStaff.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass; +import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; @@ -36,6 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfCorrosion; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfCorruption; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfDisintegration; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLivingEarth; +import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfMagicMissile; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfRegrowth; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -134,6 +136,18 @@ public class MagesStaff extends MeleeWeapon { } } + @Override + public int buffedLvl() { + int lvl = super.buffedLvl(); + if (curUser != null && !(wand instanceof WandOfMagicMissile)) { + WandOfMagicMissile.MagicCharge buff = curUser.buff(WandOfMagicMissile.MagicCharge.class); + if (buff != null && buff.level() > lvl){ + return buff.level(); + } + } + return lvl; + } + @Override public int proc(Char attacker, Char defender, int damage) { if (wand != null && diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java index ef9dab89e..28a5a9703 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java @@ -195,7 +195,8 @@ public abstract class RegularLevel extends Level { do { mob.pos = pointToCell(roomToSpawn.random()); tries--; - } while (tries >= 0 && (findMob(mob.pos) != null || !passable[mob.pos] || mob.pos == exit)); + } while (tries >= 0 && (findMob(mob.pos) != null || !passable[mob.pos] || mob.pos == exit + || (!openSpace[mob.pos] && mob.properties().contains(Char.Property.LARGE)))); if (tries >= 0) { mobsToSpawn--; @@ -209,7 +210,8 @@ public abstract class RegularLevel extends Level { do { mob.pos = pointToCell(roomToSpawn.random()); tries--; - } while (tries >= 0 && findMob(mob.pos) != null || !passable[mob.pos] || mob.pos == exit); + } while (tries >= 0 && findMob(mob.pos) != null || !passable[mob.pos] || mob.pos == exit + || (!openSpace[mob.pos] && mob.properties().contains(Char.Property.LARGE))); if (tries >= 0) { mobsToSpawn--; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index f4a69459b..2446a4374 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -1025,7 +1025,7 @@ public class GameScene extends PixelScene { return wnd; } - static boolean cancel() { + public static boolean cancel() { if (Dungeon.hero != null && (Dungeon.hero.curAction != null || Dungeon.hero.resting)) { Dungeon.hero.curAction = null; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/LotusSprite.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/LotusSprite.java index d4e328a1e..7ccff4975 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/LotusSprite.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/sprites/LotusSprite.java @@ -108,4 +108,16 @@ public class LotusSprite extends MobSprite { grassVfx = null; } } + + @Override + public void kill() { + super.kill(); + + if (grassVfx != null){ + for (Emitter e : grassVfx){ + e.on = false; + } + grassVfx = null; + } + } }