From 14ca6ddbf04565530b9a14553d5383b4f290f17c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Gim=C3=A9nez?= Date: Mon, 16 Oct 2023 21:41:53 +0900 Subject: [PATCH] add immunity checks --- pkg/data/npc.go | 12 ++++++++++++ pkg/data/stat/immune.go | 1 + 2 files changed, 13 insertions(+) diff --git a/pkg/data/npc.go b/pkg/data/npc.go index 7eba095..d33eeeb 100644 --- a/pkg/data/npc.go +++ b/pkg/data/npc.go @@ -102,6 +102,18 @@ func (m Monster) IsImmune(resist stat.Resist) bool { if resist == stat.ColdImmune && st == stat.ColdResist { return true } + if resist == stat.FireImmune && st == stat.FireResist { + return true + } + if resist == stat.LightImmune && st == stat.LightningResist { + return true + } + if resist == stat.PoisonImmune && st == stat.PoisonResist { + return true + } + if resist == stat.MagicImmune && st == stat.MagicResist { + return true + } } return false } diff --git a/pkg/data/stat/immune.go b/pkg/data/stat/immune.go index f5fd58b..604575d 100644 --- a/pkg/data/stat/immune.go +++ b/pkg/data/stat/immune.go @@ -7,4 +7,5 @@ const ( FireImmune Resist = "fire" LightImmune Resist = "light" PoisonImmune Resist = "poison" + MagicImmune Resist = "magic" )