add immunity checks
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -7,4 +7,5 @@ const (
|
||||
FireImmune Resist = "fire"
|
||||
LightImmune Resist = "light"
|
||||
PoisonImmune Resist = "poison"
|
||||
MagicImmune Resist = "magic"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user