fix IsImmune function

This commit is contained in:
guiyomu-dev
2026-01-06 00:29:32 +01:00
parent 2b87b5f555
commit 691d8f7e84

View File

@@ -99,8 +99,9 @@ func (m Monsters) FindByID(id UnitID) (Monster, bool) {
func (m Monster) IsImmune(resist stat.Resist) bool { func (m Monster) IsImmune(resist stat.Resist) bool {
for st, value := range m.Stats { for st, value := range m.Stats {
// Only consider immunity threshold (>= 100). // We only want max resistance
if value < 100 { // Need to cast to int32 because type is uint32 and negative values are possible (e.g. -50 for Andariel)
if int32(value) < 100 {
continue continue
} }
if resist == stat.ColdImmune && st == stat.ColdResist { if resist == stat.ColdImmune && st == stat.ColdResist {
@@ -151,7 +152,7 @@ func (m Monster) IsPet() bool {
func (m Monster) IsGoodNPC() bool { func (m Monster) IsGoodNPC() bool {
switch m.Name { switch m.Name {
case 146, 154, 147, 150, 155, 148, 244, 210, 175, 199, 198, 177, 178, 201, 202, 200, 331, 245, 264, 255, 176, case 146, 154, 147, 150, 155, 148, 244, 210, 175, 199, 198, 177, 178, 201, 202, 200, 331, 245, 264, 255, 176,
252, 254, 253, 297, 246, 251, 367, 521, 257, 405, 265, 520, 512, 518, 527, 515, 513, 511, 514, 266, 408, 406, 252, 254, 253, 297, 246, 251, 367, 521, 257, 405, 265, 520, 512, 518, 527, 515, 513, 511, 514, 266, 408, 406,
543: // Baal Throne 543: // Baal Throne
return true return true