v2.0.0: fixed various crash bugs

This commit is contained in:
Evan Debenham
2023-02-10 13:22:33 -05:00
parent 8c8828d1ed
commit cc527dc8e0
5 changed files with 18 additions and 11 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -76,7 +76,8 @@ public class Bones {
case 0: case 0:
item = hero.belongings.weapon; item = hero.belongings.weapon;
//if the hero has two weapons (champion), pick the stronger one //if the hero has two weapons (champion), pick the stronger one
if (hero.belongings.secondWep != null && hero.belongings.secondWep.trueLevel() > item.trueLevel()){ if (hero.belongings.secondWep != null &&
(item == null || hero.belongings.secondWep.trueLevel() > item.trueLevel())){
item = hero.belongings.secondWep; item = hero.belongings.secondWep;
break; break;
} }
@@ -166,7 +166,10 @@ public class ElementalStrike extends ArmorAbility {
Ballistica.STOP_SOLID | Ballistica.STOP_TARGET); Ballistica.STOP_SOLID | Ballistica.STOP_TARGET);
KindOfWeapon w = hero.belongings.weapon(); KindOfWeapon w = hero.belongings.weapon();
Weapon.Enchantment enchantment = ((MeleeWeapon) w).enchantment; Weapon.Enchantment enchantment = null;
if (w instanceof MeleeWeapon) {
enchantment = ((MeleeWeapon) w).enchantment;
}
Class<?extends Weapon.Enchantment> enchCls = null; Class<?extends Weapon.Enchantment> enchCls = null;
if (enchantment != null){ if (enchantment != null){
enchCls = enchantment.getClass(); enchCls = enchantment.getClass();
@@ -182,6 +185,7 @@ public class ElementalStrike extends ArmorAbility {
); );
} }
Weapon.Enchantment finalEnchantment = enchantment;
hero.sprite.attack(target, new Callback() { hero.sprite.attack(target, new Callback() {
@Override @Override
public void call() { public void call() {
@@ -198,7 +202,7 @@ public class ElementalStrike extends ArmorAbility {
} }
} }
preAttackEffect(cone, hero, enchantment); preAttackEffect(cone, hero, finalEnchantment);
if (enemy != null){ if (enemy != null){
AttackIndicator.target(enemy); 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(); Invisibility.dispel();
hero.spendAndNext(hero.attackDelay()); hero.spendAndNext(hero.attackDelay());
@@ -1271,11 +1271,13 @@ public class GameScene extends PixelScene {
} }
public static void flash( int color, boolean lightmode ) { 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 (scene != null) {
if (color > 0 && color < 0x01000000) { //greater than 0 to account for negative values (which have the first bit set to 1)
scene.fadeIn(0xFF000000 | color, lightmode); if (color > 0 && color < 0x01000000) {
} else { scene.fadeIn(0xFF000000 | color, lightmode);
scene.fadeIn(color, lightmode); } else {
scene.fadeIn(color, lightmode);
}
} }
} }
@@ -64,7 +64,7 @@ public class HeroIcon extends Image {
public static final int CHALLENGE = 28; public static final int CHALLENGE = 28;
public static final int ELEMENTAL_STRIKE= 29; public static final int ELEMENTAL_STRIKE= 29;
public static final int DUELIST_3 = 30; public static final int DUELIST_3 = 30;
public static final int RATMOGRIFY = 33; public static final int RATMOGRIFY = 31;
public HeroIcon(HeroSubClass subCls){ public HeroIcon(HeroSubClass subCls){
super( Assets.Interfaces.HERO_ICONS ); super( Assets.Interfaces.HERO_ICONS );