
    StartupEvents.registry('palladium:abilities', (event) => {
        event.create('heroes:ability_registry')
            .icon(palladium.createItemIcon('palladium:vibranium_circuit'))

            .tick((entity, entry, holder, enabled) => {
                if (enabled) {
                    let username = entity.getGameProfile().getName();
					let username_true = username.toLowerCase();
                    let scoreboard = Utils.server.scoreboard;
					
					
					let power_max = global.power_amount;
					palladium.setProperty(entity, "heroes:ability_amount", 0);
					palladium.setProperty(entity, "heroes:genetic_stability", 100);
					if (abilityUtil.isEnabled(entity, 'heroes:base_power', 'Genetic_Booster')) {
						palladium.setProperty(entity, "heroes:genetic_stability", 120);
					}
					if (abilityUtil.isEnabled(entity, 'heroes:base_power', 'genetic_marker')) {
					for (let power_list = 0; power_list <= power_max; power_list++) {
						let power_cap = global['ability_' + power_list];
						let power = power_cap.toString().toLowerCase();
						if (power == 'nightvision' || power == 'waterwalk' || power == 'luminescent' || power == 'string_generation' || power == 'water_breathing' || power == 'suffocation_immunity' || power == 'attraction_of_small_objects' || power == 'wall_climbing' || power == 'bone_protrusion' || power == 'age_shifting' || power == 'chromatic_synthesis' || power == 'gold_mimicry') {
							power = 'single_ability_power';
						}
						if (power == 'ability_absorption' || power == 'ability_transferal' || power == 'interplay') {
							power = 'ability_movement';
						}
						if (power == 'ocular_psychogenesis_control' || power == 'ocular_psychogenesis_emission') {
							power = 'ocular_psychogenesis';
						}
						if (power == 'pocket_reality') {
							power = 'pocket_dimension';
						}
						if (power == 'regenerative_segmentation') {
							power = 'rapid_cellular_regeneration';
						}
					let scoreboard_check_1 = scoreboard.getObjective("Powers." + power_cap);
					if (scoreboard_check_1 == null) {
					entity.server.runCommandSilent("execute as " + username + " at @s run scoreboard objectives add Powers." + power_cap + " dummy");
					}
					let scoreboard_check_2 = scoreboard.getObjective("Powers.Fake." + power_cap);
					if (scoreboard_check_2 == null) {
					entity.server.runCommandSilent("execute as " + username + " at @s run scoreboard objectives add Powers.Fake." + power_cap + " dummy");
					}
					let scoreboard_check_3 = scoreboard.getObjective("Powers.Empathic." + power_cap);
					if (scoreboard_check_3 == null) {
					entity.server.runCommandSilent("execute as " + username + " at @s run scoreboard objectives add Powers.Empathic." + power_cap + " dummy");
					}
					let scoreboard_check_4 = scoreboard.getObjective("Powers.Intuitive." + power_cap);
					if (scoreboard_check_4 == null) {
					entity.server.runCommandSilent("execute as " + username + " at @s run scoreboard objectives add Powers.Intuitive." + power_cap + " dummy");
					}
					
					
					let scoreboard_hold_1 = scoreboard.getObjective("Powers.Fake." + power_cap);
					if (scoreboard_hold_1 != null) {
                    let score_hold_1 = scoreboard.getOrCreatePlayerScore(username, scoreboard_hold_1);
                    let value_hold_1 = score_hold_1.getScore();
					if (value_hold_1 >= 1) {
					entity.server.runCommandSilent("execute as " + username + " at @s run scoreboard players set @s Powers.Fake." + power_cap + " 0");
						}
					}
					
					if (abilityUtil.isEnabled(entity, 'heroes:ocular_psychogenesis', 'genetic_marker')) {
					let scoreboard_hold_2 = scoreboard.getObjective("Heroes.Ocular_Psychogenesis.Power");
					if (scoreboard_hold_2 != null) {
                    let score_hold_2 = scoreboard.getOrCreatePlayerScore(username, scoreboard_hold_2);
                    let value_hold_2 = score_hold_2.getScore();
					if (value_hold_2 == power_list) {
					entity.server.runCommandSilent("execute as " + username + " at @s run scoreboard players set @s Powers.Fake." + power_cap + " 1");
							}
						}
					}
					
					if (power_cap != 'Ability_Replication') {
					if (abilityUtil.isEnabled(entity, 'heroes:ability_replication', 'genetic_marker')) {
					let scoreboard_hold_3 = scoreboard.getObjective("Heroes.ReplicationPower");
					if (scoreboard_hold_3 != null) {
                    let score_hold_3 = scoreboard.getOrCreatePlayerScore(username, scoreboard_hold_3);
                    let value_hold_3 = score_hold_3.getScore();
					if (value_hold_3 == power_list) {
					let power_cost = global['ability_cost_' + power_list].toString();
					let current_genetic = palladium.getProperty(entity, "heroes:genetic_stability")
					let true_cost = parseFloat(power_cost)
					if (abilityUtil.isEnabled(entity, 'heroes:ability_movement', 'ability_absorption_dummy')) {
						power_cost = power_cost / 2
					}
					if (abilityUtil.isEnabled(entity, 'heroes:ability_movement', 'ability_transferal_dummy')) {
						power_cost = power_cost / 1.5
					}
					palladium.setProperty(entity, "heroes:genetic_stability", current_genetic + (true_cost / 1.25));
					entity.server.runCommandSilent("execute as " + username + " at @s run scoreboard players set @s Powers.Fake." + power_cap + " 1");
								}
							}
						}
					}
					
					if (abilityUtil.isEnabled(entity, 'heroes:empathic_mimicry', 'genetic_marker')) {
					let scoreboard_hold_4 = scoreboard.getObjective("Powers.Empathic." + power_cap);
					if (scoreboard_hold_4 != null) {
                    let score_hold_4 = scoreboard.getOrCreatePlayerScore(username, scoreboard_hold_4);
                    let value_hold_4 = score_hold_4.getScore();
					if (value_hold_4 >= 2) {
					entity.server.runCommandSilent("execute as " + username + " at @s run scoreboard players set @s Powers.Fake." + power_cap + " 1");
							}
						}
					}
					
					if (abilityUtil.isEnabled(entity, 'heroes:intuitive_aptitude', 'genetic_marker')) {
					let scoreboard_hold_5 = scoreboard.getObjective("Powers.Intuitive." + power_cap);
					if (scoreboard_hold_5 != null) {
                    let score_hold_5 = scoreboard.getOrCreatePlayerScore(username, scoreboard_hold_5);
                    let value_hold_5 = score_hold_5.getScore();
					if (value_hold_5 >= 1) {
					let power_cost = global['ability_cost_' + power_list].toString();
					let current_genetic = palladium.getProperty(entity, "heroes:genetic_stability")
					let true_cost = parseFloat(power_cost)
					palladium.setProperty(entity, "heroes:genetic_stability", current_genetic + (true_cost / 4));
					entity.server.runCommandSilent("execute as " + username + " at @s run scoreboard players set @s Powers.Fake." + power_cap + " 1");
							}
						}
					}
					
					let scoreboard_hold_6 = scoreboard.getObjective("Powers.Fake." + power_cap);
					if (scoreboard_hold_6 != null) {
                    let score_hold_6 = scoreboard.getOrCreatePlayerScore(username, scoreboard_hold_6);
                    let value_hold_6 = score_hold_6.getScore();
					if (value_hold_6 >= 1) {
					entity.server.runCommandSilent("execute as " + username + " at @s run superpower add heroes:" + power + " @s");
							}
						}
						
					let scoreboard_hold_7 = scoreboard.getObjective("Powers." + power_cap);
					if (scoreboard_hold_7 != null) {
                    let score_hold_7 = scoreboard.getOrCreatePlayerScore(username, scoreboard_hold_7);
                    let value_hold_7 = score_hold_7.getScore();
					if (value_hold_7 >= 1) {
					palladium.setProperty(entity, "heroes:ability_amount", palladium.getProperty(entity, "heroes:ability_amount") + 1);
					
					let power_cost = global['ability_cost_' + power_list].toString();
					if (power_cap != "Catalyst") {
					if (abilityUtil.isEnabled(entity, 'heroes:ability_movement', 'ability_absorption_dummy')) {
						power_cost = power_cost / 2
					}
					if (abilityUtil.isEnabled(entity, 'heroes:ability_movement', 'ability_transferal_dummy')) {
						power_cost = power_cost / 1.5
						}
					}
					if (power_cap == "Stockpile") {
					if (abilityUtil.isEnabled(entity, 'heroes:stockpile', 'genetic_marker')) {
					let scoreboard_hold_stock = scoreboard.getObjective("Heroes.Stockpile.Energy");
					if (scoreboard_hold_stock != null) {
                    let score_hold_stock = scoreboard.getOrCreatePlayerScore(username, scoreboard_hold_stock);
                    let value_hold_stock = score_hold_stock.getScore();
					if (value_hold_stock > 1000000) {
						value_hold_stock = 1000000
					}
					if (value_hold_stock >= 1) {
						power_cost = parseFloat(power_cost) + (parseFloat((value_hold_stock / -41666.6667)))
							}
						}
					}
					}
					let current_genetic = palladium.getProperty(entity, "heroes:genetic_stability")
					let true_cost = parseFloat(power_cost)
					palladium.setProperty(entity, "heroes:genetic_stability", current_genetic + true_cost);
					entity.server.runCommandSilent("execute as " + username + " at @s run superpower add heroes:" + power + " @s");
							}
						}
					
					}
					entity.server.runCommandSilent("execute as " + username + " at @s run tag @s remove Heroes.Prock");
					}
                }
            });
    });