158 lines
3.1 KiB
GDScript
158 lines
3.1 KiB
GDScript
class_name InputResolver
|
|
extends RefCounted
|
|
|
|
const SKILLS := {
|
|
"W": {
|
|
"type": "skill",
|
|
"id": "skill_w",
|
|
"animation": "warrior_w",
|
|
"clear_window": false,
|
|
},
|
|
"A": {
|
|
"type": "skill",
|
|
"id": "skill_a",
|
|
"animation": "warrior_a",
|
|
"displacement": "left",
|
|
"clear_window": false,
|
|
},
|
|
"D": {
|
|
"type": "skill",
|
|
"id": "skill_d",
|
|
"animation": "warrior_a",
|
|
"displacement": "right",
|
|
"clear_window": false,
|
|
},
|
|
"WA": {
|
|
"type": "skill",
|
|
"id": "skill_wa",
|
|
"animation": "warrior_wa",
|
|
"displacement": "left",
|
|
"clear_window": false,
|
|
},
|
|
"WD": {
|
|
"type": "skill",
|
|
"id": "skill_wd",
|
|
"animation": "warrior_wa",
|
|
"displacement": "right",
|
|
"clear_window": false,
|
|
},
|
|
"AA": {
|
|
"type": "skill",
|
|
"id": "skill_aa",
|
|
"animation": "warrior_aa",
|
|
"displacement": "left",
|
|
"clear_window": false,
|
|
},
|
|
"DD": {
|
|
"type": "skill",
|
|
"id": "skill_dd",
|
|
"animation": "warrior_aa",
|
|
"displacement": "right",
|
|
"clear_window": false,
|
|
},
|
|
"AAA": {
|
|
"type": "skill",
|
|
"id": "skill_aaa",
|
|
"animation": "warrior_aaa",
|
|
"displacement": "left",
|
|
"clear_window": false,
|
|
},
|
|
"DDD": {
|
|
"type": "skill",
|
|
"id": "skill_ddd",
|
|
"animation": "warrior_aaa",
|
|
"displacement": "right",
|
|
"clear_window": false,
|
|
},
|
|
"ASP": {
|
|
"type": "skill",
|
|
"id": "skill_a_space",
|
|
"animation": "warrior_a_space",
|
|
"displacement": "left",
|
|
"clear_window": true,
|
|
},
|
|
"DSP": {
|
|
"type": "skill",
|
|
"id": "skill_d_space",
|
|
"animation": "warrior_a_space",
|
|
"displacement": "right",
|
|
"clear_window": true,
|
|
},
|
|
"ASPSP": {
|
|
"type": "skill",
|
|
"id": "skill_a_space_space",
|
|
"animation": "warrior_a_space_space",
|
|
"displacement": "left",
|
|
"clear_window": true,
|
|
},
|
|
"DSPSP": {
|
|
"type": "skill",
|
|
"id": "skill_d_space_space",
|
|
"animation": "warrior_a_space_space",
|
|
"displacement": "right",
|
|
"clear_window": true,
|
|
},
|
|
"AASP": {
|
|
"type": "skill",
|
|
"id": "skill_aa_space",
|
|
"animation": "warrior_a_space_space",
|
|
"displacement": "left",
|
|
"clear_window": true,
|
|
},
|
|
"ADSP": {
|
|
"type": "skill",
|
|
"id": "skill_ad_space",
|
|
"animation": "warrior_a_space_space",
|
|
"displacement": "right",
|
|
"clear_window": true,
|
|
},
|
|
"DASP": {
|
|
"type": "skill",
|
|
"id": "skill_da_space",
|
|
"animation": "warrior_a_space_space",
|
|
"displacement": "left",
|
|
"clear_window": true,
|
|
},
|
|
"DDSP": {
|
|
"type": "skill",
|
|
"id": "skill_dd_space",
|
|
"animation": "warrior_a_space_space",
|
|
"displacement": "right",
|
|
"clear_window": true,
|
|
},
|
|
"SSP": {
|
|
"type": "skill",
|
|
"id": "skill_s_projectile_1",
|
|
"animation": "warrior_s_projectile",
|
|
"projectile": true,
|
|
"energy_cost": 3,
|
|
"clear_window": false,
|
|
},
|
|
"SSPSP": {
|
|
"type": "skill",
|
|
"id": "skill_s_projectile_2",
|
|
"animation": "warrior_s_projectile",
|
|
"projectile": true,
|
|
"energy_cost": 2,
|
|
"clear_window": false,
|
|
},
|
|
"SSPSPSP": {
|
|
"type": "skill",
|
|
"id": "skill_s_projectile_3",
|
|
"animation": "warrior_s_projectile",
|
|
"projectile": true,
|
|
"energy_cost": 1,
|
|
"clear_window": false,
|
|
},
|
|
}
|
|
|
|
|
|
static func resolve(window: ComboWindow) -> Dictionary:
|
|
return resolve_pattern(window.get_contiguous_pattern())
|
|
|
|
|
|
static func resolve_pattern(pattern: String) -> Dictionary:
|
|
if not SKILLS.has(pattern):
|
|
return {}
|
|
return SKILLS[pattern].duplicate()
|