Skip to content
Snippets Groups Projects
Forked from tome / Tales of MajEyal
Source project has a limited visibility.
  • Hachem_Muche's avatar
    687f983e
    Allows NPC's to use activatable objects by giving them special talents that... · 687f983e
    Hachem_Muche authored
    Allows NPC's to use activatable objects by giving them special talents that serve as an interface for the AI.
    Adds mod.class.interface.ActorObjectUse class (in mod.class.Actor)
    
    When a usable object is added to an Actor inventory, the Actor may get a talent that can be activated to use the power.
    This talent is similar to normal talents, but translates the object definition as needed for NPC use.
    objects with a .use_power (most uniquely defined powers) are usable unless the .no_npc_use flag is set.
    objects with a .use_simple field (mostly consumables) are not usable unless the .allow_npc_use flag is set or the .tactical field is defined.
    objects with a .use_talent field (many charms and artifacts) are usable so long as the talent definition does not have the .no_npc_use flag set.
    Energy use matches the object (based on standard action speed)
    the new talent .on_pre_use function handles checking for object cooldowns, inventory access and a t.on_pre_use function (for talent-based powers)
    
    Important fields defined within object.use_simple or object.use_power:
    	.tactical = tactics table for interpretation by the tactical ai, subfields may be functions(who, t, aitarget) where who = object user, t = talent used (defined here), aitarget = who's (actor) target
    	This should be defined for NPC's to use the object intelligently
    	.on_pre_use = function(obj, who) that must return true for the object to be useable
    	.range = range of the ability (defaults to 1, may be a function(self, t))
     	.radius = radius of ability (defaults to 0, may be a function(self, t))
    	.target = targeting parameters (table, may be a function(self, t)), interpreted by engine.Target:getType
    	.requires_target, if true, don't use the object if the target is beyond radius + range
    
    Updated charms(amulet, belt, boots, cloak, light-armor, mindstars, ranged, staves, torques, totems, wands, weapons and some fixed arts) with the required fields to use the items.
    
    engine:
    
    updated ActorInventory functions to pass inventory and slot information as appropriate.
    
    tactical AI
    
    Updated the tactical AI and the talented_ai_tactic resolver to accept a function(self, t) for a talent tactical table.
    
    Adds a charm resolver to randombosses and several NPC's (with tactical AI)
    
    Equipping a useable item resets it's charges when it's equipped by any party member.
    Updated the UseTalents dialog to use getTalentDisplayName for its list
    687f983e
    History
    Allows NPC's to use activatable objects by giving them special talents that...
    Hachem_Muche authored
    Allows NPC's to use activatable objects by giving them special talents that serve as an interface for the AI.
    Adds mod.class.interface.ActorObjectUse class (in mod.class.Actor)
    
    When a usable object is added to an Actor inventory, the Actor may get a talent that can be activated to use the power.
    This talent is similar to normal talents, but translates the object definition as needed for NPC use.
    objects with a .use_power (most uniquely defined powers) are usable unless the .no_npc_use flag is set.
    objects with a .use_simple field (mostly consumables) are not usable unless the .allow_npc_use flag is set or the .tactical field is defined.
    objects with a .use_talent field (many charms and artifacts) are usable so long as the talent definition does not have the .no_npc_use flag set.
    Energy use matches the object (based on standard action speed)
    the new talent .on_pre_use function handles checking for object cooldowns, inventory access and a t.on_pre_use function (for talent-based powers)
    
    Important fields defined within object.use_simple or object.use_power:
    	.tactical = tactics table for interpretation by the tactical ai, subfields may be functions(who, t, aitarget) where who = object user, t = talent used (defined here), aitarget = who's (actor) target
    	This should be defined for NPC's to use the object intelligently
    	.on_pre_use = function(obj, who) that must return true for the object to be useable
    	.range = range of the ability (defaults to 1, may be a function(self, t))
     	.radius = radius of ability (defaults to 0, may be a function(self, t))
    	.target = targeting parameters (table, may be a function(self, t)), interpreted by engine.Target:getType
    	.requires_target, if true, don't use the object if the target is beyond radius + range
    
    Updated charms(amulet, belt, boots, cloak, light-armor, mindstars, ranged, staves, torques, totems, wands, weapons and some fixed arts) with the required fields to use the items.
    
    engine:
    
    updated ActorInventory functions to pass inventory and slot information as appropriate.
    
    tactical AI
    
    Updated the tactical AI and the talented_ai_tactic resolver to accept a function(self, t) for a talent tactical table.
    
    Adds a charm resolver to randombosses and several NPC's (with tactical AI)
    
    Equipping a useable item resets it's charges when it's equipped by any party member.
    Updated the UseTalents dialog to use getTalentDisplayName for its list