v0.8.1a: fixed a variety of rare crashes caused by:
- shields rarely failing to apply (having no target) - ghouls dieing while over pits - Tengu having nowhere to jump in rare cases - multiplicity when the attacker is the hero - talisman buffs not always respecting floor differences - null pointers in reflection
This commit is contained in:
parent
b3783295bf
commit
bc757ed57b
|
@ -39,7 +39,7 @@ public class Reflection {
|
|||
public static <T> T newInstance( Class<T> cls ){
|
||||
try {
|
||||
return ClassReflection.newInstance(cls);
|
||||
} catch (ReflectionException e) {
|
||||
} catch (Exception e) {
|
||||
Game.reportException(e);
|
||||
return null;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class Reflection {
|
|||
public static Class forName( String name ){
|
||||
try {
|
||||
return ClassReflection.forName( name );
|
||||
} catch (ReflectionException e) {
|
||||
} catch (Exception e) {
|
||||
Game.reportException(e);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -801,6 +801,7 @@ public class Dungeon {
|
|||
}
|
||||
|
||||
for (TalismanOfForesight.CharAwareness c : hero.buffs(TalismanOfForesight.CharAwareness.class)){
|
||||
if (Dungeon.depth != c.depth) continue;
|
||||
Char ch = (Char) Actor.findById(c.charID);
|
||||
if (ch == null) continue;
|
||||
BArray.or( level.visited, level.heroFOV, ch.pos - 1 - level.width(), 3, level.visited );
|
||||
|
@ -810,6 +811,7 @@ public class Dungeon {
|
|||
}
|
||||
|
||||
for (TalismanOfForesight.HeapAwareness h : hero.buffs(TalismanOfForesight.HeapAwareness.class)){
|
||||
if (Dungeon.depth != h.depth) continue;
|
||||
BArray.or( level.visited, level.heroFOV, h.pos - 1 - level.width(), 3, level.visited );
|
||||
BArray.or( level.visited, level.heroFOV, h.pos - 1, 3, level.visited );
|
||||
BArray.or( level.visited, level.heroFOV, h.pos - 1 + level.width(), 3, level.visited );
|
||||
|
|
|
@ -50,7 +50,7 @@ public abstract class ShieldBuff extends Buff {
|
|||
|
||||
public void setShield( int shield ) {
|
||||
this.shielding = shield;
|
||||
target.needsShieldUpdate = true;
|
||||
if (target != null) target.needsShieldUpdate = true;
|
||||
}
|
||||
|
||||
public void incShield(){
|
||||
|
@ -59,7 +59,7 @@ public abstract class ShieldBuff extends Buff {
|
|||
|
||||
public void incShield( int amt ){
|
||||
shielding += amt;
|
||||
target.needsShieldUpdate = true;
|
||||
if (target != null) target.needsShieldUpdate = true;
|
||||
}
|
||||
|
||||
public void decShield(){
|
||||
|
@ -68,7 +68,7 @@ public abstract class ShieldBuff extends Buff {
|
|||
|
||||
public void decShield( int amt ){
|
||||
shielding -= amt;
|
||||
target.needsShieldUpdate = true;
|
||||
if (target != null) target.needsShieldUpdate = true;
|
||||
}
|
||||
|
||||
//returns the amount of damage leftover
|
||||
|
@ -83,7 +83,7 @@ public abstract class ShieldBuff extends Buff {
|
|||
if (shielding == 0){
|
||||
detach();
|
||||
}
|
||||
target.needsShieldUpdate = true;
|
||||
if (target != null) target.needsShieldUpdate = true;
|
||||
return dmg;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ public class Ghoul extends Mob {
|
|||
|
||||
@Override
|
||||
public void die(Object cause) {
|
||||
if (cause != Chasm.class && cause != GhoulLifeLink.class){
|
||||
if (cause != Chasm.class && cause != GhoulLifeLink.class && !Dungeon.level.pit[pos]){
|
||||
Ghoul nearby = GhoulLifeLink.searchForHost(this);
|
||||
if (nearby != null){
|
||||
beingLifeLinked = true;
|
||||
|
|
|
@ -868,13 +868,10 @@ public abstract class Mob extends Char {
|
|||
} else {
|
||||
|
||||
//if moving towards an enemy isn't possible, try to switch targets to another enemy that is closer
|
||||
Char oldEnemy = enemy;
|
||||
enemy = null;
|
||||
enemy = chooseEnemy();
|
||||
if (enemy != null && enemy != oldEnemy){
|
||||
Char newEnemy = chooseEnemy();
|
||||
if (newEnemy != null && enemy != newEnemy){
|
||||
enemy = newEnemy;
|
||||
return act(enemyInFOV, justAlerted);
|
||||
} else {
|
||||
enemy = oldEnemy;
|
||||
}
|
||||
|
||||
spend( TICK );
|
||||
|
|
|
@ -244,8 +244,8 @@ public class NewTengu extends Mob {
|
|||
|
||||
do {
|
||||
newPos = ((NewPrisonBossLevel)Dungeon.level).randomTenguCellPos();
|
||||
} while ( level.trueDistance(newPos, enemy.pos) <= 4
|
||||
|| level.trueDistance(newPos, Dungeon.hero.pos) <= 4
|
||||
} while ( level.trueDistance(newPos, enemy.pos) <= 3.5f
|
||||
|| level.trueDistance(newPos, Dungeon.hero.pos) <= 3.5f
|
||||
|| Actor.findChar(newPos) != null);
|
||||
|
||||
if (level.heroFOV[pos]) CellEmitter.get( pos ).burst( Speck.factory( Speck.WOOL ), 6 );
|
||||
|
|
|
@ -114,7 +114,7 @@ public class Warlock extends Mob implements Callback {
|
|||
int dmg = Random.NormalIntRange( 12, 18 );
|
||||
enemy.damage( dmg, new DarkBolt() );
|
||||
|
||||
if (!enemy.isAlive() && enemy == Dungeon.hero) {
|
||||
if (enemy == Dungeon.hero && !enemy.isAlive()) {
|
||||
Dungeon.fail( getClass() );
|
||||
GLog.n( Messages.get(this, "bolt_kill") );
|
||||
}
|
||||
|
|
|
@ -68,7 +68,8 @@ public class Multiplicity extends Armor.Glyph {
|
|||
|
||||
} else {
|
||||
//FIXME should probably have a mob property for this
|
||||
if (attacker.properties().contains(Char.Property.BOSS) || attacker.properties().contains(Char.Property.MINIBOSS)
|
||||
if (!(attacker instanceof Mob)
|
||||
|| attacker.properties().contains(Char.Property.BOSS) || attacker.properties().contains(Char.Property.MINIBOSS)
|
||||
|| attacker instanceof Mimic || attacker instanceof Statue){
|
||||
m = Dungeon.level.createMob();
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue
Block a user