diff --git a/cmd/txttocode/templates.go b/cmd/txttocode/templates.go index cdb98b5..3e855dc 100644 --- a/cmd/txttocode/templates.go +++ b/cmd/txttocode/templates.go @@ -109,26 +109,6 @@ func MonStatsFlagsForID(id ID) (MonStatsFlags, bool) { flags, ok := MonStatsFlagsByID[id] return flags, ok } - -func IsUndead(id ID) bool { - flags, ok := MonStatsFlagsForID(id) - return ok && (flags.IsLUndead || flags.IsHUndead) -} - -func IsDemon(id ID) bool { - flags, ok := MonStatsFlagsForID(id) - return ok && flags.IsDemon -} - -func IsBeast(id ID) bool { - flags, ok := MonStatsFlagsForID(id) - return ok && !flags.IsLUndead && !flags.IsHUndead && !flags.IsDemon -} - -func IsUndeadOrDemon(id ID) bool { - flags, ok := MonStatsFlagsForID(id) - return ok && (flags.IsLUndead || flags.IsHUndead || flags.IsDemon) -} ` const templateEntrances = `// Code generated by cmd/txttocode. DO NOT EDIT. diff --git a/pkg/data/npc.go b/pkg/data/npc.go index 4ee95a0..1edcca3 100644 --- a/pkg/data/npc.go +++ b/pkg/data/npc.go @@ -203,3 +203,23 @@ func (m Monster) IsEscapingType() bool { } return false } + +func (m Monster) IsUndead() bool { + flags, ok := npc.MonStatsFlagsForID(m.Name) + return ok && (flags.IsLUndead || flags.IsHUndead) +} + +func (m Monster) IsDemon() bool { + flags, ok := npc.MonStatsFlagsForID(m.Name) + return ok && flags.IsDemon +} + +func (m Monster) IsBeast() bool { + flags, ok := npc.MonStatsFlagsForID(m.Name) + return ok && !flags.IsLUndead && !flags.IsHUndead && !flags.IsDemon +} + +func (m Monster) IsUndeadOrDemon() bool { + flags, ok := npc.MonStatsFlagsForID(m.Name) + return ok && (flags.IsLUndead || flags.IsHUndead || flags.IsDemon) +} diff --git a/pkg/data/npc/monstats.go b/pkg/data/npc/monstats.go index 9248fe3..4fccdc4 100644 --- a/pkg/data/npc/monstats.go +++ b/pkg/data/npc/monstats.go @@ -771,23 +771,3 @@ func MonStatsFlagsForID(id ID) (MonStatsFlags, bool) { flags, ok := MonStatsFlagsByID[id] return flags, ok } - -func IsUndead(id ID) bool { - flags, ok := MonStatsFlagsForID(id) - return ok && (flags.IsLUndead || flags.IsHUndead) -} - -func IsDemon(id ID) bool { - flags, ok := MonStatsFlagsForID(id) - return ok && flags.IsDemon -} - -func IsBeast(id ID) bool { - flags, ok := MonStatsFlagsForID(id) - return ok && !flags.IsLUndead && !flags.IsHUndead && !flags.IsDemon -} - -func IsUndeadOrDemon(id ID) bool { - flags, ok := MonStatsFlagsForID(id) - return ok && (flags.IsLUndead || flags.IsHUndead || flags.IsDemon) -}