Elite monsters have ~20% spawn chance with Venomous, Burning, Freezing, Bleeding, or Vampiric prefixes. Each prefix scales HP/ATK and applies on-hit status effects (or life drain for Vampiric). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package entity
|
|
|
|
import "math/rand"
|
|
|
|
type ElitePrefixType int
|
|
|
|
const (
|
|
PrefixVenomous ElitePrefixType = iota // poison on hit
|
|
PrefixBurning // burn on hit
|
|
PrefixFreezing // freeze on hit
|
|
PrefixBleeding // bleed on hit
|
|
PrefixVampiric // heals self on hit
|
|
)
|
|
|
|
type ElitePrefixDef struct {
|
|
Name string
|
|
HPMult float64
|
|
ATKMult float64
|
|
OnHit StatusEffect // -1 for vampiric (special)
|
|
}
|
|
|
|
// ElitePrefixDefs is exported so game/turn.go can access for on-hit effects.
|
|
var ElitePrefixDefs = map[ElitePrefixType]ElitePrefixDef{
|
|
PrefixVenomous: {"Venomous", 1.3, 1.0, StatusPoison},
|
|
PrefixBurning: {"Burning", 1.2, 1.1, StatusBurn},
|
|
PrefixFreezing: {"Freezing", 1.2, 1.0, StatusFreeze},
|
|
PrefixBleeding: {"Bleeding", 1.1, 1.2, StatusBleed},
|
|
PrefixVampiric: {"Vampiric", 1.4, 1.1, StatusEffect(-1)},
|
|
}
|
|
|
|
func (p ElitePrefixType) String() string {
|
|
return ElitePrefixDefs[p].Name
|
|
}
|
|
|
|
func RandomPrefix() ElitePrefixType {
|
|
return ElitePrefixType(rand.Intn(5))
|
|
}
|
|
|
|
func ApplyPrefix(m *Monster, prefix ElitePrefixType) {
|
|
def := ElitePrefixDefs[prefix]
|
|
m.IsElite = true
|
|
m.ElitePrefix = prefix
|
|
m.Name = def.Name + " " + m.Name
|
|
m.HP = int(float64(m.HP) * def.HPMult)
|
|
m.MaxHP = m.HP
|
|
m.ATK = int(float64(m.ATK) * def.ATKMult)
|
|
}
|