Add ranged combat area effects and admin-authored mobs

This commit is contained in:
dingo
2026-09-09 05:26:31 -04:00
parent 7a4c6c9e9b
commit 0b4eaa153c
29 changed files with 2220 additions and 181 deletions
+53
View File
@@ -35,6 +35,18 @@ func (d *DB) PreviewCatalog(ctx context.Context, change CatalogChange) (CatalogP
}
// Preview validates a provisional identity but does not reserve or expose it.
if !change.HasDefinitionID() {
if resolved.Attack != nil {
resolved.Attack.ID = ""
}
if resolved.Mob != nil {
resolved.Mob.ID = ""
}
if resolved.Loot != nil {
resolved.Loot.ID = ""
}
if resolved.Spawn != nil {
resolved.Spawn.ID = ""
}
if resolved.GatheringSkill != nil {
resolved.GatheringSkill.ID = ""
}
@@ -85,7 +97,48 @@ func buildCatalog(c content.Catalog, change CatalogChange) (content.Catalog, str
}
gathering := *c.Gathering
c.Gathering = &gathering
if c.Combat == nil {
b, e := content.Load()
if e != nil {
return invalid(e)
}
c.Combat = b.Combat
}
combat := *c.Combat
c.Combat = &combat
switch change.Op {
case "create-attack":
v := *change.Attack
if v.ID == "" {
v.ID = "attack_" + game.ID()
}
resolved.Attack = &v
c.Combat.Attacks = append(slices.Clone(c.Combat.Attacks), v)
target = v.ID
case "create-mob":
v := *change.Mob
if v.ID == "" {
v.ID = "mob_" + game.ID()
}
resolved.Mob = &v
c.Combat.Mobs = append(slices.Clone(c.Combat.Mobs), v)
target = v.ID
case "create-loot":
v := *change.Loot
if v.ID == "" {
v.ID = "loot_" + game.ID()
}
resolved.Loot = &v
c.Combat.Loot = append(slices.Clone(c.Combat.Loot), v)
target = v.ID
case "create-spawn":
v := *change.Spawn
if v.ID == "" {
v.ID = "spawn_" + game.ID()
}
resolved.Spawn = &v
c.Combat.Spawns = append(slices.Clone(c.Combat.Spawns), v)
target = v.ID
case "create-gathering-skill":
v := *change.GatheringSkill
if v.ID == "" {