From 6c4399a7f18e909d740cdb221cb3ff212660f295 Mon Sep 17 00:00:00 2001
From: chimchooree
A skill is defined as a JSON file housed at res://res/text/skills/. Its filename is its base id, and all data and keywords are expressed through JSON.
A skill is defined as a JSON file housed at res://res/text/skills/. Its filename is its base id, and all data and keywords are expressed through JSON.
A skill's JSON array contains a...
Every skill's functionality is built from keywords read from that list. Each keyword is a dictionary containing its "type" (keyword's category) and some optional data.
Right-click on an tangible entity or inventory item to open a popup inspect menu with all relevant inspect options. Selecting one will execute a method. Examples are 'follow Chloe' (pathfind after Chloe wherever she moves until action is cancelled), 'pick up clover' (item pickup), and 'examine button' (write a descriptive line about her in Helia's thought bubble)
relevant
Every tangible entity has an exported dictionary of inspect_options: {index: ['tr_key', 'method']}. For example, {0:['tr_pick up','pickup'],1:['tr_extinguish','extinguish']}. Every tangible appends 'examine' at ready.
The Clickable has a _ready input event signal looking for "right-click."
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.
A skill is defined as a JSON file housed at res://res/text/skills/. Its filename is its base id, and all data and keywords are expressed through JSON.
A SkillEquip contains a skill's base id. SkillEquips are housed at Skillbar/Skill SlotX's skill variable and the entity's arsenal.
A SkillEquip contains a DMV. A DMV handles the flow of the skill and collects skill data, including its tags.
Every skill is built from a JSON dictionary, and its functionality is built from a list of nested dictionaries.
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.
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.
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.
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.
If it doesn't fail, the SkillEquip creates a cooldown timer and sets cooling to true and sets up and enters its DMV.
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.
Skill registry at the DMV involves registering each keyword and its activation requisites.
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.
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.
'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.
If the keyword is 'expire', it frees the relevant keyword.
If the keyword is 'refresh', it resets the relevant keyword.
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.
Skill stuff -> character level but maybe should be entity level
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?
rL-qaKY^YV~w=m(9wm%&fHGEhB=S1W9-d4r1>(``!RS03<+=dGA_x
zfd;s^W}oluZ=cV^EZRES{^S4tAKgn#_G yJK5N4oc*||lr*&b2+Y0b%LFG&u+pM53$Ag%
zKLrrcQ?Kr!e(aY95yY%ye-(V4ZIFj#P&umOvZX)5>tdVd6pp{3!lT6x+r6KeCRV+%
zx)_1Ew;REdmWR4+O$xYxj<{9A>#&R(kHHoSwGM!~+xckm?=ei<&I-HQ$gcs!thAX3
zabBmeoW}0J_%R&QQX5Vn<1iBPny}7fMqMP~y`>WvS>`?g+Qb5}8Bf@vjR456V+xL&
z&n$V`DVUp_Lt6MaL3tK4!94ypVZq8tWwC$>0Xd`p+Bjmj82+ZvPx*$>!Ib&J$
z(PyGEjALqD2LQP0wgfA((Sl;M0y6`OVzR(c5j~sVPdQHe`Y|kXmE7MgQ{!_v;lQj#
z9TO@C;!0DsaWAQ~dLlj!XK_|=y
z?oXL7A4VCEZ7jN;xp2KJ$W+N+lZ9zy(psGvjQ+L|+z$
zbQrk}>|7QMofplXs!r#H6L)bW8d(M4)2k4-zlKG96JO2}0CZf&0PHh3(a%8{ST7<2
zO7Rm|^%?UeXWj9C3ot*lE((AjlA=KlxCM*&vh9PU-G@OCj$