Skip to content

Nisugi/Creature-Module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Lich::Gemstone::Creature

Gemstone IV Bestiary Creature Data System

This module provides a flexible, extensible framework for managing creature definitions, behaviors, and messaging for Lich scripting in Gemstone IV. It supports structured creature data, advanced templating for combat/emote messages, and a singleton-backed registry for efficient lookup.


✨ Features

  • Structured creature data: levels, areas, loot, messaging, stats, spells, etc.
  • Template-driven message systems with regex-ready placeholders and optional randomization.
  • Boon adjective normalization for automatic creature name matching.
  • Status and injury tracking for combat-state management.
  • Singleton registry for efficient lookup by name or instance ID.

🧱 Core Classes

Lich::Gemstone::Creature

Main data structure for creatures. Holds combat stats, messaging, treasure, abilities, and injuries.

Lich::Gemstone::Creature::Messaging

Structured message manager for events like spell prep, arrival, fleeing, death, etc.

Lich::Gemstone::Creature::Registry

Singleton registry to track creatures by name or instance ID.

Lich::Gemstone::Creature::Template

Handles loading, caching, and normalization of creature templates from the /creatures/ folder.


⚡ Quick Usage

Register or Look Up a Creature

creature = Lich::Gemstone::Creature.register_creature("Kobold", 12345)
creature = Lich::Gemstone::Creature[12345] # by ID
creature = Lich::Gemstone::Creature["immense gold-bristled hinterboar"] # by name

Access Creature Data

creature.level
creature.treasure.has_gems?
creature.defense_attributes.asg

Work with Messaging

msg = creature.messaging.flee
puts msg.to_display(direction: "north") # Fill in placeholders
regex = msg.to_regex

💬 Placeholder Templating

Placeholders like {pronoun}, {direction}, or {weapon} can appear in message templates.

  • Use .to_display(substitutions) to convert to a readable string.
  • Use .to_regex to match against game output and extract values.

Multiple templates (arrays) are supported for random selection or regex union.

Example match:

if (match = creature.messaging.flee.to_regex.match("The wendigo flees north."))
  puts match[:direction] # => "north"
end

🧠 Status and Injury Tracking

Creatures can maintain multiple active statuses and injuries, tracked by body location and severity.

Status

creature.add_status("poisoned")
creature.add_status("webbed")
creature.status
# => ["poisoned", "webbed"]

creature.remove_status("poisoned")
  • status is an array of unique strings.
  • Adding the same status twice has no effect.

Injuries

creature.append_injury("leftArm", 2)
creature.append_injury("rightLeg", 3)

creature.injured?("leftArm", 2)
# => true

creature.injured_locations(3)
# => [:rightLeg]
  • Injury values are integers.
  • Overwrites unless manually incremented.

✅ Notes

  • Regex templates use named capture groups ((?<name>...))
  • Randomized message arrays supported
  • Case-insensitive name handling
  • Safe for real-time use during hunts

About

Persistant creature tracking able to keep states of status, wounds, health, ect.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages