Module: Lich::Common::CreatureBase Private

Included in:
DragonRealms::CreatureInstance, Gemstone::CreatureInstance
Defined in:
documented/common/creature/creature_base.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Shared creature behaviour mixed into each game's CreatureInstance.

Include this into a concrete creature-instance class. The included hook extends the class with ClassMethods (registry/roster/target queries) and includes InstanceMethods (status/flag tracking). The class must define a new(id, noun, name) constructor, call InstanceMethods#initialize_status_tracking from its own initialize, and expose a valid_target? predicate (used by ClassMethods#targets). InstanceMethods#initialize_status_tracking stamps last_seen_at, which ClassMethods#cleanup_old ages against.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Constant Summary collapse

STATUS_DURATIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Status-effect lifetimes, in seconds, used for automatic cleanup.

A nil value means the status has a reliable server-sent removal message and therefore must not be auto-expired on a timer.

Returns:

{
  'breeze'       => 6,   # 6 seconds roundtime
  'bind'         => 10,  # 10 seconds typical
  'web'          => 8,   # 8 seconds typical
  'entangle'     => 10,  # 10 seconds typical
  'hypnotism'    => 12,  # 12 seconds typical
  'calm'         => 15,  # 15 seconds typical
  'mass_calm'    => 15,  # 15 seconds typical
  'sleep'        => 8,   # 8 seconds typical (can wake early)
  # Crit-derived states. 'roundtime' is set with an explicit duration by
  # the combat processor (critical tables report it in seconds); these
  # defaults apply when a source supplies no duration of its own.
  'roundtime'    => 5,
  'dazed'        => 10,
  # Statuses with reliable removal messages - no duration needed.
  'stunned'      => nil,
  # Reachable from many sources (Silence 210, silencing flares, UCS
  # crits / Slow 506, ensorcell) with no single reliable duration, so
  # they are message-cleared rather than timer-expired.
  'silenced'     => nil,
  'slowed'       => nil,
  'crippled'     => nil,
  'limb_favored' => nil,
  'amputated'    => nil,
  'immobilized'  => nil,
  'prone'        => nil,
  'blind'        => nil,
  'sunburst'     => nil,
  'webbed'       => nil,
  'poisoned'     => nil,
  'hidden'       => nil
}.freeze
CRTR_STATUS_FLAGS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Maps <crtrStatus> transient XML flags to canonical status names.

The XML feed and the message parser use slightly different terms for the same state (e.g. "immobile" versus "immobilized"). Keeping this mapping explicit lets XML- and message-based detection reconcile into the same status entries.

Returns:

{
  'immobile'    => 'immobilized',
  'webbed'      => 'webbed',
  'sleeping'    => 'sleeping',
  'disoriented' => 'disoriented',
  'stunned'     => 'stunned',
  'rooted'      => 'rooted',
  'calmed'      => 'calm',
  'kneeling'    => 'kneeling',
  'prone'       => 'prone',
  'sitting'     => 'sitting',
  'flying'      => 'flying',
  'hovering'    => 'hovering',
  'hidden'      => 'hidden'
}.freeze
CRTR_CLASSIFICATION_FLAGS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Maps <crtrStatus> classification XML flags to predicate keys.

These are relationship or classification facts rather than transient combat statuses, so they are stored separately and read via InstanceMethods#crtr_flag?.

Returns:

{
  'hostile'       => :hostile,
  'disengaged'    => :disengaged,
  'dead'          => :dead,
  'sympathetic'   => :sympathetic,
  'ascended'      => :ascended,
  'inferior'      => :inferior,
  'AscensionBoss' => :ascension_boss,
  'MiniBoss'      => :mini_boss,
  'challenging'   => :challenging,
  'rider'         => :rider,
  'mount'         => :mount
}.freeze
ALL_CRTR_FLAGS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

All known <crtrStatus> attributes keyed by XML name, for debug snapshots.

Returns:

CRTR_STATUS_FLAGS.merge(CRTR_CLASSIFICATION_FLAGS).freeze
KNOWN_FLAG_NAMES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Every filter name ClassMethods#targets and ClassMethods#in_room can match: the canonical status vocabulary (both the <crtrStatus> status spellings and the timer-based message statuses in STATUS_DURATIONS) plus the classification keys. A filter outside this set is "unknown" and, per the query contract, matches no candidates - even when negated with a not_ prefix.

Returns:

(
  CRTR_STATUS_FLAGS.values +
  STATUS_DURATIONS.keys +
  CRTR_CLASSIFICATION_FLAGS.values.map(&:to_s)
).uniq.freeze

Class Method Summary collapse

Class Method Details

.included(base) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Wires the shared behaviour into the including class, matching the MapBase convention.

Parameters:

  • base (Class) —

    the including creature-instance class.



76
77
78
79
# File 'documented/common/creature/creature_base.rb', line 76

def self.included(base)
  base.extend(ClassMethods)
  base.include(InstanceMethods)
end