
    StartupEvents.registry('palladium:abilities', (event) => {
        event.create('heroes:ocular_tags')
            .icon(palladium.createItemIcon('palladium:vibranium_circuit'))
			.addProperty('reach_range', 'integer', 20, 'Range the ability can reach')

            .tick((entity, entry, holder, enabled) => {
                if (enabled) {
                    let username = entity.getGameProfile().getName();
					let username_true = username.toLowerCase();
                    let scoreboard = Utils.server.scoreboard;
					const reach_range = entry.getPropertyByName('reach_range');
					
					let scoreboard_obj = scoreboard.getObjective('Heroes.Power.Icon');
                    let score = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj);
                    let value = score.getScore();

					let target_entity = entity.rayTrace(reach_range).entity
					let entity_target_true = 0
					if (target_entity != null && target_entity.type != "minecraft:item" && target_entity.type != "minecraft:item_frame" && target_entity.type != "minecraft:glow_item_frame" && target_entity.type != "minecraft:armor_stand" && target_entity.type != "palladium:suit_stand") {
					if (!target_entity.isPlayer()) {
					entity_target_true = target_entity.uuid;
						} else {
								entity_target_true = target_entity.getGameProfile().getName();
						}

					if (target_entity != null && target_entity.type != "minecraft:item" && target_entity.type != "minecraft:item_frame" && target_entity.type != "minecraft:glow_item_frame" && target_entity.type != "minecraft:armor_stand" && target_entity.type != "palladium:suit_stand") {
					
						let power_max = global.power_amount;
					for (let power_list = 0; power_list <= power_max; power_list++) {
						let power = global['ability_' + power_list];
						if (power != 'Ability_Absorption' && power != 'Ability_Transferal' && power != 'Interplay' && power != 'Empathic_Mimicry' && power != 'Intuitive_Aptitude' && power != 'Ability_Replication' && power != 'Ocular_Psychogenesis_Control' && power != 'Ocular_Psychogenesis_Emission' && power != 'Catalyst') {
					
					if (power == 'Levitation') {
					entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Levitation.Speed.Base.Hold 0");
						
					entity.server.runCommandSilent("execute as " + entity_target_true + " at @s[tag=Heroes.Enabled,tag=!Heroes.Spatial.Barrier,tag=!Heroes.Invalid.Target] unless score @s Powers.Suppresed matches 1.. if score @s Powers." + power + " matches 1.. run scoreboard players operation .IntuitiveHold_1 Powers.Ability_Replication = " + entity_target_true + " Heroes.Levitation.Speed.Base.Intuitive");
					entity.server.runCommandSilent("execute as " + entity_target_true + " at @s[tag=Heroes.Enabled,tag=!Heroes.Spatial.Barrier,tag=!Heroes.Invalid.Target] unless score @s Powers.Suppresed matches 1.. if score @s Powers." + power + " matches 1.. run scoreboard players operation .IntuitiveHold_2 Powers.Ability_Replication = " + entity_target_true + " Heroes.Levitation.Speed.Base");
					
					
					entity.server.runCommandSilent("execute as " + username + " at @s if score .IntuitiveHold_1 Powers.Ability_Replication > @s Heroes.Levitation.Speed.Base.Hold run scoreboard players operation @s Heroes.Levitation.Speed.Base.Hold = .IntuitiveHold_1 Powers.Ability_Replication");
					entity.server.runCommandSilent("execute as " + username + " at @s if score .IntuitiveHold_2 Powers.Ability_Replication > @s Heroes.Levitation.Speed.Base.Hold run scoreboard players operation @s Heroes.Levitation.Speed.Base.Hold = .IntuitiveHold_2 Powers.Ability_Replication");
					
					entity.server.runCommandSilent("scoreboard players reset .IntuitiveHold_1 Powers.Ability_Replication");
					entity.server.runCommandSilent("scoreboard players reset .IntuitiveHold_2 Powers.Ability_Replication");
					}
					if (power == 'Bone_Protrusion') {
					entity.server.runCommandSilent("scoreboard players set " + username + " Heroes.Bone.Var.Hold 0");
						
					entity.server.runCommandSilent("execute as " + entity_target_true + " at @s[tag=Heroes.Enabled,tag=!Heroes.Spatial.Barrier,tag=!Heroes.Invalid.Target] unless score @s Powers.Suppresed matches 1.. if score @s Powers." + power + " matches 1.. run scoreboard players operation .IntuitiveHold_1 Powers.Ability_Replication = " + entity_target_true + " Heroes.Bone.Var.Intuitive");
					entity.server.runCommandSilent("execute as " + entity_target_true + " at @s[tag=Heroes.Enabled,tag=!Heroes.Spatial.Barrier,tag=!Heroes.Invalid.Target] unless score @s Powers.Suppresed matches 1.. if score @s Powers." + power + " matches 1.. run scoreboard players operation .IntuitiveHold_2 Powers.Ability_Replication = " + entity_target_true + " Heroes.Bone.Var.Base");
					
					
					entity.server.runCommandSilent("execute as " + username + " at @s if score .IntuitiveHold_1 Powers.Ability_Replication > @s Heroes.Bone.Var.Hold run scoreboard players operation @s Heroes.Bone.Var.Hold = .IntuitiveHold_1 Powers.Ability_Replication");
					entity.server.runCommandSilent("execute as " + username + " at @s if score .IntuitiveHold_2 Powers.Ability_Replication > @s Heroes.Bone.Var.Hold run scoreboard players operation @s Heroes.Bone.Var.Hold = .IntuitiveHold_2 Powers.Ability_Replication");
					
					entity.server.runCommandSilent("scoreboard players reset .IntuitiveHold_1 Powers.Ability_Replication");
					entity.server.runCommandSilent("scoreboard players reset .IntuitiveHold_2 Powers.Ability_Replication");
					}
					
					entity.server.runCommandSilent("execute as " + entity_target_true + " at @s[tag=Heroes.Enabled,tag=!Heroes.Spatial.Barrier,tag=!Heroes.Invalid.Target] unless score @s Powers.Suppresed matches 1.. if score @s Powers." + power + " matches 1.. run tag " + username + " add Powers.Ocular.Ability");
					
					entity.server.runCommandSilent("execute as " + entity_target_true + " at @s[tag=Heroes.Enabled,tag=!Heroes.Spatial.Barrier,tag=!Heroes.Invalid.Target] unless score @s Powers.Suppresed matches 1.. if score @s Powers." + power + " matches 1.. run tag " + username + " add Powers.Ocular." + power + "");
					entity.server.runCommandSilent("execute as " + entity_target_true + " at @s[tag=Heroes.Enabled,tag=!Heroes.Spatial.Barrier,tag=!Heroes.Invalid.Target] unless score @s Powers.Suppresed matches 1.. if score @s Powers.Intuitive." + power + " matches 1.. run tag " + username + " add Powers.Ocular." + power + "");
	


								}
							}
						}
					}
				}
            });
    });