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

            .tick((entity, entry, holder, enabled) => {
                if (enabled) {
                    let username = entity.getGameProfile().getName();
                    let scoreboard = Utils.server.scoreboard;
					let item = entity.mainHandItem.nbt;
						let power_max = global.power_amount;
						
					let scoreboard_test_1 = scoreboard.getObjective('Heroes.Replication.Slots.Intuitive.Hold');
					if (scoreboard_test_1 == null) {
					entity.server.runCommandSilent("execute as " + username + " at @s run scoreboard objectives add Heroes.Replication.Slots.Intuitive.Hold dummy");
					}
					let scoreboard_test_2 = scoreboard.getObjective('Heroes.Levitation.Speed.Base.Intuitive.Hold');
					if (scoreboard_test_2 == null) {
					entity.server.runCommandSilent("execute as " + username + " at @s run scoreboard objectives add Heroes.Levitation.Speed.Base.Intuitive.Hold dummy");
					}
					let scoreboard_test_3 = scoreboard.getObjective('Heroes.Bone.Var.Intuitive.Hold');
					if (scoreboard_test_3 == null) {
					entity.server.runCommandSilent("execute as " + username + " at @s run scoreboard objectives add Heroes.Bone.Var.Intuitive.Hold dummy");
					}
					
					
					for (let power_list = 0; power_list <= power_max; power_list++) {
						let power = global['ability_' + power_list];
						if (power != 'Absorption' && power != 'Transferal' && power != 'Interplay' && power != 'Catalyst' && power != 'Intuitive_Aptitude') {
						let ability_id = 'Powers.' + power;
						let scoreboard_obj_temp = scoreboard.getObjective('Powers.Empathic.' + power);
							if (scoreboard_obj_temp != null) {
							let score_temp = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj_temp);
							let value_temp = score_temp.getScore();
							if (item != null) {
								let haspower = item.toString().contains(`${ability_id}:1b`)
								if (haspower == true) {
									entity.server.runCommandSilent("execute as " + username + " at @s run tag @s add Powers.Intuitive." + power + "");
									
								}
							}
				
					if (power == 'Ability_Replication') {
					entity.server.runCommandSilent("execute as " + username + " at @s store result score .IntuitiveHold_1 Heroes.Intuitive.Study run data get entity @s SelectedItem.tag.Replication_Slots");
					entity.server.runCommandSilent("execute as " + username + " at @s store result score .IntuitiveHold_2 Heroes.Intuitive.Study run data get entity @s SelectedItem.tag.Empathic_Replication_Slots");
					
					entity.server.runCommandSilent("execute as " + username + " at @s if score .IntuitiveHold_1 Heroes.Intuitive.Study > @s Heroes.Replication.Slots.Intuitive run scoreboard players operation @s Heroes.Replication.Slots.Intuitive.Hold = .IntuitiveHold_1 Heroes.Intuitive.Study");
					entity.server.runCommandSilent("execute as " + username + " at @s if score .IntuitiveHold_2 Heroes.Intuitive.Study > @s Heroes.Replication.Slots.Intuitive run scoreboard players operation @s Heroes.Replication.Slots.Intuitive.Hold = .IntuitiveHold_2 Heroes.Intuitive.Study");
					
					entity.server.runCommandSilent("scoreboard players reset .IntuitiveHold_1 Heroes.Intuitive.Study");
					entity.server.runCommandSilent("scoreboard players reset .IntuitiveHold_2 Heroes.Intuitive.Study");
					}
					
					if (power == 'Levitation') {
					entity.server.runCommandSilent("execute as " + username + " at @s store result score .IntuitiveHold_1 Heroes.Intuitive.Study run data get entity @s SelectedItem.tag.Levitation_Speed");
					entity.server.runCommandSilent("execute as " + username + " at @s store result score .IntuitiveHold_2 Heroes.Intuitive.Study run data get entity @s SelectedItem.tag.Empathic_Levitation_Speed");
					entity.server.runCommandSilent("execute as " + username + " at @s if score .IntuitiveHold_1 Heroes.Intuitive.Study > @s Heroes.Levitation.Speed.Base.Intuitive run scoreboard players operation @s Heroes.Levitation.Speed.Base.Intuitive.Hold = .IntuitiveHold_1 Heroes.Intuitive.Study");
					entity.server.runCommandSilent("execute as " + username + " at @s if score .IntuitiveHold_2 Heroes.Intuitive.Study > @s Heroes.Levitation.Speed.Base.Intuitive run scoreboard players operation @s Heroes.Levitation.Speed.Base.Intuitive.Hold = .IntuitiveHold_2 Heroes.Intuitive.Study");
					
					entity.server.runCommandSilent("scoreboard players reset .IntuitiveHold_1 Heroes.Intuitive.Study");
					entity.server.runCommandSilent("scoreboard players reset .IntuitiveHold_2 Heroes.Intuitive.Study");
					}
					if (power == 'Bone_Protrusion') {
					entity.server.runCommandSilent("execute as " + username + " at @s store result score .IntuitiveHold_1 Heroes.Intuitive.Study run data get entity @s SelectedItem.tag.Bone_Var");
					entity.server.runCommandSilent("execute as " + username + " at @s store result score .IntuitiveHold_2 Heroes.Intuitive.Study run data get entity @s SelectedItem.tag.Empathic_Bone_Var");
					entity.server.runCommandSilent("execute as " + username + " at @s if score .IntuitiveHold_1 Heroes.Intuitive.Study > @s Heroes.Bone.Var.Intuitive run scoreboard players operation @s Heroes.Bone.Var.Intuitive.Hold = .IntuitiveHold_1 Heroes.Intuitive.Study");
					entity.server.runCommandSilent("execute as " + username + " at @s if score .IntuitiveHold_2 Heroes.Intuitive.Study > @s Heroes.Bone.Var.Intuitive run scoreboard players operation @s Heroes.Bone.Var.Intuitive.Hold = .IntuitiveHold_2 Heroes.Intuitive.Study");
					
					entity.server.runCommandSilent("scoreboard players reset .IntuitiveHold_1 Heroes.Intuitive.Study");
					entity.server.runCommandSilent("scoreboard players reset .IntuitiveHold_2 Heroes.Intuitive.Study");
								}
							}
						}
					}
					entity.server.runCommandSilent("execute as " + username + " at @s run item replace entity @s weapon.mainhand with heroes:mangled_brain");
					entity.server.runCommandSilent("execute as " + username + " at @s run tag @s add Heroes.Intuitive.Select");
			}
            });
    });