<p>Skills are individual powers usable by entities. They can take 8 at a time on their skillbar. They can be used for combat, puzzle-solving, and roleplaying. They are acquired through exploring. <br></p>
<p>A skill is defined as a <a href="/blessfrey-gdd/docs/skill-json">JSON file</a> housed at res://res/text/skills/. Its filename is its base id, and all data and keywords are expressed through JSON. <br></p>
<br>
<p>A SkillEquip contains a skill's base id. SkillEquips are housed at Skillbar/Skill SlotX's skill variable and the entity's arsenal. <br></p>
<br>
<p>A SkillEquip contains a DMV. A DMV handles the flow of the skill and collects skill data, including its tags. <br></p>
<br>
<h2>logic </h2>
<p>Every skill is built from a JSON dictionary, and its functionality is built from a list of nested dictionaries. <br></p>
<br>
<p>At ready, the SkillBase singleton uses the JSONreader singleton to convert all the JSON files into an array of skill dictionaries, accessed using the desired skill's base id. <br></p>
<br>
<p>A character's skill library's skill_library holds an array of all the base_ids for the skills he knows. When a skill is learned, it is added to the skill_library and passes the skill and the character through the MessageBus to the LearnSkill event handler. <br></p>
<br>
<p>The LearnSkill handler instances a SkillEquip and adds it to the character. The character entity appends the SkillEquip to its skill_arsenal and adds it as a child to the SkillBase. If the character has an empty slot on his skillbar, the skill is equipped onto the character. The character's Skillbar/Skill SlotX's skill variable holds the SkillEquip. <br></p>
<br>
<p>The character decides to use a skill. The character find_skill(slot index) returns the SkillEquip, whose use method takes the skill's dealer and taker. <br></p>
<br>
<p>If it doesn't fail, the SkillEquip creates a cooldown timer and sets cooling to true and sets up and enters its DMV. <br></p>
<br>
<p>The DMV publishes 'skill_used' along with {id,dealer,taker}. Then it runs the activation time, consumes the skill cost, adds its tags, then registers the skill. <br></p>
<br>
<p>Skill registry at the DMV involves registering each keyword and its activation requisites. <br></p>
<br>
<p>If the keyword is an 'if', it parses the keyword's conditional statement, it registers the accompanying "then" keyword. Ifs are one-time conditionals, so if it's not true at registry, the whole keyword chunk misses its chance. <br></p>
<br>
<p>If the keyword is 'when', it generates a 'when' event handler from res://skills/keyword/when/when.tscn and connects the 'happened' signal to registering the accompanying then keyword. Tags are added for the 'when', support for removal by tag is set up, and the 'when' is entered. <br></p>
<br>
<p>'When' has a 'repeat', so it can trigger as many times as desired. Once is the assumed 'repeat', and -1 is an infinite repeat. The 'when' subscribes to its signal and provides itself as the handler. If it's conditional signal is just 'duration', a timer is set up and publishes to 'duration'. When the desired signal triggers, it verifies whether the full conditions of the 'when' are satisfied and should emit a 'happened' (and the DMV should register 'then'). If 'repeat' - 1 isn't 0, it goes around again. <br></p>
<br>
<p>If the keyword is 'expire', it frees the relevant keyword. <br></p>
<br>
<p>If the keyword is 'refresh', it resets the relevant keyword. <br></p>
<br>
<p>If the keyword is just a 'keyword', it instances the relevant keyword object, tags it, sets up removal by tag, adds it as a child, then enters it, doing whatever special code the keyword does. <br></p>
<br>
<h2>challenges/known issues </h2>
<p>Skill stuff -> character level but maybe should be entity level <br></p>
<br>
<p>I think every character has a skill equip for every known skill in his arsenal. Is that too many? Should one copy be on the SkillBase? <br></p>
<br>
<h2>works for...</h2>
<ul>
<li>skill autoequip from save✗ </li>
<li>skill equip new skill/empty slot/rearrange skillbar✗ </li>
<li>skill use by click/keyboard/AI selection✗ </li>
<li>skill range✗ </li>
<li>skill move into range✗ </li>
<li>skill activation✓ </li>
<li>skill cooldown✓ </li>
<li>skill cost/insuffient funds✗ </li>
<li>skill interrupt✗ </li>
<li>skill removal✗ </li>
<li>room/equipment skill✗ </li>
<li>Skill. (20 seconds) Gain 5 spirit every time you use a skill.✗ </li>
<li>If character has over 50% health, deal 75 damage.✗ </li>
<li>Blessing. (2 seconds) Removal: heal 80 life. No effect if ends early.✗ </li>
<li>Blessing. When character is moving, heal for 5 life every 1 second.✗ </li>
<li>Remove all blessings and poisons. Heal for 10 life for each blessing removed. Gain 10 spirit for each poison removed.✗ </li>
<li>Poison. If target is Blessed, Reduce Max Health by 25% (20 seconds). If poison ends early, target takes 50 damage.✗ </li>
<li>Blessing. Increase effectiveness of Disciple skills.✗ </li>
<li>Miracle. Remove 1 blessing. Disable skill on source's bar (5 seconds).✗ </li>