Represents a character.
LuaCharacter.index | [R] The index of this character in the global characters array. |
LuaCharacter.integer_id | [R] The integer ID of this character. |
LuaCharacter.hp | [R] The character's proper name without any qualifiers. |
LuaCharacter.max_hp | [R] The character's maximum HP. |
LuaCharacter.sp | [R] The character's current stamina. |
LuaCharacter.max_sp | [R] The character's maximum stamina. |
LuaCharacter.mp | [R] The character's current MP. |
LuaCharacter.max_mp | [R] The character's maximum MP. |
LuaCharacter.god | [RW] The character's worshipped god. |
LuaCharacter.position | [RW] The character's position. |
LuaCharacter.initial_position | [RW] The character's initial position. |
LuaCharacter.shop_rank | [RW] The shop rank of this character. |
LuaCharacter.role | [RW] The role this character takes on. |
LuaCharacter.gold | [RW] The character's current gold. |
LuaCharacter.experience | [RW] The character's current experience points. |
LuaCharacter.fame | [RW] The character's current fame. |
LuaCharacter.level | [RW] The character's current level. |
LuaCharacter.talk_type | [RW] The character's current talk type. |
LuaCharacter.pv | [RW] The character's current PV. |
LuaCharacter.dv | [RW] The character's current DV. |
LuaCharacter.hit_bonus | [RW] The character's current hit bonus. |
LuaCharacter.growth_buffs | [RW] The character's current growth buffs. |
LuaCharacter.hate | [RW] The character's current hate. |
LuaCharacter.emotion_icon | [RW] The character's current emotion icon. |
LuaCharacter.karma | [RW] The character's current karma. |
LuaCharacter.enemy_id | [RW] The index of a character this character is targeting.. |
LuaCharacter.image | [RW] The character's current image. |
LuaCharacter.portrait | [RW] The character's current portrait. |
LuaCharacter.impression | [RW] The character's current impression. |
LuaCharacter.interest | [RW] The character's current interest. |
LuaCharacter.ai_calm | [RW] The character's AI calmness. |
LuaCharacter.id | [R] The new-style version prototype ID of the character. |
LuaCharacter.name | [R] The name of the character with article and title. |
LuaCharacter.basename | [R] The name of the character without article and title. |
LuaCharacter.alias | [R] The alias of the character. |
LuaCharacter.sex | [RW] The sex of the character. |
LuaCharacter.relationship | [RW] The relationship of the character to the player. |
LuaCharacter.original_relationship | [RW] The original relationship of the character to the player. |
LuaCharacter.quality | [RW] The quality of the character. |
LuaCharacter.prototype | [R] The prototype data of the character. |
LuaCharacter:damage_hp (amount[, source]) | Damages this character. |
LuaCharacter:damage_hp (amount, source) | Damages this character, with the source being set as another character. |
LuaCharacter:apply_ailment (ailment, power) | Applies a status ailment to this character. |
LuaCharacter:heal_ailment (ailment, power) | Heals a status ailment on a character. |
LuaCharacter:add_buff (buff_id, power, turns[, doer]) | Adds a buff to a character. |
LuaCharacter:set_growth_buff (index, power) | Sets a growth buff of this character. |
LuaCharacter:recruit_as_ally () | Attempts to recruit this character as an ally of the player. |
LuaCharacter:get_flag (flag) | Gets the value of a flag on this character. |
LuaCharacter:set_flag (flag, value) | Sets the value of a flag on this character. |
LuaCharacter:get_skill (skill_id) | Obtains the skill of the given ID. |
LuaCharacter:gain_skill (skill_id, initial_level[, initial_stock]) | Makes this character gain a new skill or spell. |
LuaCharacter:gain_skill_exp (skill_id, amount) | Makes this character gain experience in a skill or spell. |
LuaCharacter:modify_resistance (element, delta) | Modifies this character's resistance. |
LuaCharacter:modify_sanity (delta) | Modifies this character's sanity. |
LuaCharacter:modify_karma (delta) | Modifies this character's karma. |
LuaCharacter:modify_corruption (delta) | Modifies this character's ether corruption. |
LuaCharacter:make_pregnant () | Makes this character pregnant. |
LuaCharacter:eat_rotten_food () | Applies the effects of eating rotten food to this character. |
LuaCharacter:vanquish () | Deletes this character and removes it from the map. |
LuaCharacter:act_hostile_against (target) | Applies the effects of acting hostile towards a target character. |
LuaCharacter:refresh () | Refreshes this character, reapplying bonuses given by equipment. |
LuaCharacter:refresh_burden_state () | Refreshes the burden state of this character. |
LuaCharacter:move_to (x, y) | Moves this character to a new position. |
LuaCharacter:move_to (pos) | Moves this character to a new position. |
LuaCharacter:switch_religion (god_id) | Changes the worshipped god of this character without invoking the god switching penalty. |
LuaCharacter:get_ailment (ailment) | Returns the duration of an ailment on this character. |
[R] The index of this character in the global characters array.
[R] The integer ID of this character.
[R] The character's proper name without any qualifiers.
[R] The character's maximum HP.
[R] The character's current stamina.
[R] The character's maximum stamina.
[R] The character's current MP.
[R] The character's maximum MP.
[RW] The character's worshipped god.
[RW] The character's position.
[RW] The character's initial position.
[RW] The shop rank of this character.
Used only if they are a shopkeeper.
[RW] The role this character takes on.
[RW] The character's current gold.
[RW] The character's current experience points.
[RW] The character's current fame.
[RW] The character's current level.
[RW] The character's current talk type.
[RW] The character's current PV.
Reset on refresh.
[RW] The character's current DV.
Reset on refresh.
[RW] The character's current hit bonus.
Reset on refresh.
[RW] The character's current growth buffs.
[RW] The character's current hate.
[RW] The character's current emotion icon.
Valid values are 0-99.
[RW] The character's current karma.
Only valid if the character is the player.
[RW] The index of a character this character is targeting..
[RW] The character's current image.
[RW] The character's current portrait.
[RW] The character's current impression.
[RW] The character's current interest.
[RW] The character's AI calmness.
[R] The new-style version prototype ID of the character.
[R] The name of the character with article and title.
[R] The name of the character without article and title.
[R] The alias of the character.
[RW] The sex of the character.
[RW] The relationship of the character to the player.
[RW] The original relationship of the character to the player.
[RW] The quality of the character.
[R] The prototype data of the character.
Damages this character.
Parameters:
local chara = Chara.player()
chara:damage_hp(100)
Damages this character, with the source being set as another character.
Parameters:
local chara = Chara.player()
local other = Chara.create(0, 0, "core.putit")
chara:damage_hp(100, other)
Applies a status ailment to this character.
Parameters:
local chara = Chara.player()
chara:apply_ailment("Blinded", 100)
Heals a status ailment on a character.
Parameters:
local chara = Chara.player()
chara:heal_ailment("Blinded", 100)
Adds a buff to a character.
Parameters:
Sets a growth buff of this character.
Parameters:
Attempts to recruit this character as an ally of the player.
This will only work if the character isn't already an ally, isn't the player, is alive and the player has a free party slot.
Returns:Gets the value of a flag on this character.
Parameters:
Sets the value of a flag on this character.
Note: Currently, all
flags up to isquicktempered
are "intrinsic" and are always
reset when this character is refreshed each turn. To change these flags, you
must call this function inside a handler for
core.character_refreshed
, or the flag will be reset later.
local Event = ELONA.require("core.Event")
local function make_invisible(e)
e.chara:set_flag("is_invisible", true) -- intrinsic, reset on refresh
end
-- force this flag to be overridden after this character is refreshed.
Event.register("core.character_refreshed", make_invisible)
Event.register("core.character_created", make_invisible)
Obtains the skill of the given ID.
Parameters:
Makes this character gain a new skill or spell.
This only has an effect if the character does not already know the skill/spell.
Parameters:Makes this character gain experience in a skill or spell.
This only has an effect if the character already knows the skill/spell.
Parameters:Modifies this character's resistance.
Since the effect is permanent, once your resistance is modified, it will not be reset on refreshing.
Parameters:Modifies this character's sanity.
Parameters:
Modifies this character's karma.
Currently only has an effect if the character is the player.
Parameters:Modifies this character's ether corruption.
Currently only has an effect if the character is the player.
Parameters:Makes this character pregnant.
Only has an effect if the character is not already pregnant.
Applies the effects of eating rotten food to this character.
Deletes this character and removes it from the map.
The character will no longer be valid for use.
Applies the effects of acting hostile towards a target character.
Parameters:
Refreshes this character, reapplying bonuses given by equipment.
Refreshes the burden state of this character.
Only valid if called on the player. Call this method if the character's inventory changes so the weight can be reapplied.
Moves this character to a new position.
Parameters:
Moves this character to a new position.
Parameters:
Changes the worshipped god of this character without invoking the god switching penalty.
Parameters:
Returns the duration of an ailment on this character.
Parameters: