From cc527dc8e042423ab4225cc4024969d082752075 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 10 Feb 2023 13:22:33 -0500 Subject: [PATCH] v2.0.0: fixed various crash bugs --- core/src/main/assets/interfaces/buffs.png | Bin 1585 -> 1613 bytes .../shatteredpixeldungeon/Bones.java | 3 ++- .../abilities/duelist/ElementalStrike.java | 12 ++++++++---- .../scenes/GameScene.java | 12 +++++++----- .../shatteredpixeldungeon/ui/HeroIcon.java | 2 +- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/core/src/main/assets/interfaces/buffs.png b/core/src/main/assets/interfaces/buffs.png index 8a283f13b2b5e8763ae507b386a992ef80351fac..221feb02191f678943d96e3e3c8c63120a767926 100644 GIT binary patch delta 1090 zcmV-I1ikyQ49yIX7YaZK0{{R3Smz!;BU2pjnT0weE7 zcm$)Pr~se;XY5~`>v;oa_RFKdI2%Yl(|}t+ z0YkhepPzpLCum^62OK0=5E#Rv04vB(Ab$b^1@NgE=(`2E9A|(t^$oW`1{C1ZEzl5t z`4+gC6jNealtfwNMMYGFyVtPmq9JBPQ~V$d_^i2j5*R3w0ff&{V4h4(FDy`vQ}0qXJx+fQ(O=T3;9bh@a5Ur*=4VPSBF8p-68E6usYKdSl{S&yBq6n=2*75 z>24MUVgqxePXMwIC~vU=3B(4LNVQg*#i~6DbQ%r5ls|*~H5ee@VPLb)4x+#>t|Q>* z$L@bMKm*PI^J4@2{1hOZfp^#vc-BC@&ITIo1{+|$1Y!gF{N69X3I?J83^atuk2Am_ z$S{P=hX4!E5%kRf&!8P=V2$)|;^2KsJ+i;{4Wrs*iQ3llCT zgo$57LAWT0rf}ggD8(*_Adn=9dnqfmuzi0FUqoXN*iJ!Wgzx@LUwDPY=_i5xAYdM_Adp%LfrGY{N=I z857}=5CwFY{Jy7v@9yoo>+x4${_zO}WUqV3{46aMPR~wHC17EdS{V3NDOW7=m5zUI zZ^NM1fYTssI86LQCTxk=FOC%jd~ff3Z_gipwbX1Pzv*Tg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IYy<}7?`ePFR7ZgP zjzBhc%7=h0FC)tkm<#AgnW item.trueLevel()){ + if (hero.belongings.secondWep != null && + (item == null || hero.belongings.secondWep.trueLevel() > item.trueLevel())){ item = hero.belongings.secondWep; break; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/ElementalStrike.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/ElementalStrike.java index e3c8a74de..2af06a4b6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/ElementalStrike.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/ElementalStrike.java @@ -166,7 +166,10 @@ public class ElementalStrike extends ArmorAbility { Ballistica.STOP_SOLID | Ballistica.STOP_TARGET); KindOfWeapon w = hero.belongings.weapon(); - Weapon.Enchantment enchantment = ((MeleeWeapon) w).enchantment; + Weapon.Enchantment enchantment = null; + if (w instanceof MeleeWeapon) { + enchantment = ((MeleeWeapon) w).enchantment; + } Class enchCls = null; if (enchantment != null){ enchCls = enchantment.getClass(); @@ -182,6 +185,7 @@ public class ElementalStrike extends ArmorAbility { ); } + Weapon.Enchantment finalEnchantment = enchantment; hero.sprite.attack(target, new Callback() { @Override public void call() { @@ -198,7 +202,7 @@ public class ElementalStrike extends ArmorAbility { } } - preAttackEffect(cone, hero, enchantment); + preAttackEffect(cone, hero, finalEnchantment); if (enemy != null){ AttackIndicator.target(enemy); @@ -207,9 +211,9 @@ public class ElementalStrike extends ArmorAbility { } } - perCellEffect(cone, enchantment); + perCellEffect(cone, finalEnchantment); - perCharEffect(cone, hero, enemy, enchantment); + perCharEffect(cone, hero, enemy, finalEnchantment); Invisibility.dispel(); hero.spendAndNext(hero.attackDelay()); 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 2caa34368..35f64adef 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -1271,11 +1271,13 @@ public class GameScene extends PixelScene { } public static void flash( int color, boolean lightmode ) { - //greater than 0 to account for negative values (which have the first bit set to 1) - if (color > 0 && color < 0x01000000) { - scene.fadeIn(0xFF000000 | color, lightmode); - } else { - scene.fadeIn(color, lightmode); + if (scene != null) { + //greater than 0 to account for negative values (which have the first bit set to 1) + if (color > 0 && color < 0x01000000) { + scene.fadeIn(0xFF000000 | color, lightmode); + } else { + scene.fadeIn(color, lightmode); + } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/HeroIcon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/HeroIcon.java index 557b017e7..84d829cfc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/HeroIcon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/HeroIcon.java @@ -64,7 +64,7 @@ public class HeroIcon extends Image { public static final int CHALLENGE = 28; public static final int ELEMENTAL_STRIKE= 29; public static final int DUELIST_3 = 30; - public static final int RATMOGRIFY = 33; + public static final int RATMOGRIFY = 31; public HeroIcon(HeroSubClass subCls){ super( Assets.Interfaces.HERO_ICONS );