Feats¶
-
GetFeatIsFirstLevelOnly
(feat)¶ Determine is first level feat only.
Parameters: - feat (int) – FEAT_*
-
GetFeatName
(feat)¶ Get feat name.
Parameters: - feat (int) – FEAT_*
-
GetFeatSuccessors
(feat)¶ Get array of feats successors.
Parameters: - feat (int) – FEAT_*
Return type: Array of FEAT_* constants.
-
GetIsClassBonusFeat
(feat, class)¶ Determine if feat is class bonus feat.
Parameters: - feat (int) – FEAT_*
- class (int) – CLASS_TYPE_*
-
GetIsClassGeneralFeat
(feat, class)¶ Determine if feat is class general feat.
Parameters: - feat (int) – FEAT_*
- class (int) – CLASS_TYPE_*
-
GetIsClassGrantedFeat
(feat, class)¶ Determine if feat is class granted feat.
Parameters: - feat (int) – FEAT_*
- class (int) – CLASS_TYPE_*
-
GetMaximumFeatUses
(feat[, cre])¶ Determines a creatures maximum feat uses.
Parameters: - feat (int) – FEAT_*
- cre (
Creature
) – Creature instance.
-
GetMasterFeatName
(master)¶ Get Master Feat Name
Parameters: - master (int) – Master feat.
-
SetMaximumFeatUsesOverride
(func, ...)¶ Register a function to determine maximum feat uses.
Parameters: - func (function) – A function taking two arguments, a Creature instance and and a FEAT_* constant and returns an integer. Note that returning 100 is equivalent to infinite uses.
- ... – FEAT_* constants.
Example
-- Let the Champion of Torm have a couple more uses of Divine Wrath Rules.RegisterFeatUses( function(feat, cre) local uses = 1 local level = cre:GetLevelByClass(CLASS_TYPE_DIVINE_CHAMPION) if level >= 30 then uses = 3 elseif level >= 20 then uses = 2 end return uses end, FEAT_DIVINE_WRATH)
-
SetUseFeatOverride
(func, ...)¶ Registers a function to be called when a feat is used.
Note
The feat use handler will be called immediately, as such it has limited applicability to feats that require an action.
Parameters: - func (function) – A function taking four arguments, FEAT_* constant, the user, a target, and a position. To bypass the engines UseFeat function return
true
. - ... – FEAT_* constants.
Example
local function feat_handler(feat, user, target, position) if target:GetIsValid() and target:GetIsPC() then target:SendMessage("Hello there. This is %s", user:GetName()) end -- The game engine doesn't need to handle this. return true end Rules.SetUseFeatOverride(feat_handler, FEAT_HELLO_THERE)
- func (function) – A function taking four arguments, FEAT_* constant, the user, a target, and a position. To bypass the engines UseFeat function return