v3.0.0: fixed rare crashes caused by glyphLevel during load

This commit is contained in:
Evan Debenham
2025-01-21 14:07:14 -05:00
parent 5e8bae8cfe
commit 5e08b09124

View File

@@ -699,7 +699,8 @@ public abstract class Char extends Actor {
//Returns the level a glyph is at for a char, or -1 if they are not benefitting from that glyph //Returns the level a glyph is at for a char, or -1 if they are not benefitting from that glyph
//This function is needed as (unlike enchantments) many glyphs trigger in a variety of cases //This function is needed as (unlike enchantments) many glyphs trigger in a variety of cases
public int glyphLevel(Class<? extends Armor.Glyph> cls){ public int glyphLevel(Class<? extends Armor.Glyph> cls){
if (Dungeon.hero != null && this != Dungeon.hero && Dungeon.hero.alignment == alignment if (Dungeon.hero != null && Dungeon.level != null
&& this != Dungeon.hero && Dungeon.hero.alignment == alignment
&& Dungeon.level.distance(pos, Dungeon.hero.pos) <= 2 && Dungeon.level.distance(pos, Dungeon.hero.pos) <= 2
&& Dungeon.hero.buff(AuraOfProtection.AuraBuff.class) != null) { && Dungeon.hero.buff(AuraOfProtection.AuraBuff.class) != null) {
return Dungeon.hero.glyphLevel(cls); return Dungeon.hero.glyphLevel(cls);