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

            .tick((entity, entry, holder, enabled) => {
                if (enabled) {
                    let username = entity.getGameProfile().getName();
                    let scoreboard = Utils.server.scoreboard;
					let power_max = global.power_amount;
					
					let itemE = entity.block.createEntity('minecraft:item')
					itemE.item = Item.of('heroes:brain',`{Ability_User: 1b}`).withName(Text.yellow(username + "'s Brain").italic(false))
				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 != 'Catalyst' && power != 'Intuitive_Aptitude') {
						let ability_id = 'Powers.' + power;
						

							let scoreboard_obj_temp = scoreboard.getObjective('Powers.' + power);
							if (scoreboard_obj_temp != null) {
							let score_temp = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj_temp);
							let value_temp = score_temp.getScore();
							
					if (value_temp >= 1) {
					itemE.item.orCreateTag.merge(`{${ability_id}: 1b}`);
					if (power == 'Ability_Replication') {
							let scoreboard_obj_hold = scoreboard.getObjective('Heroes.Replication.Slots.True');
							if (scoreboard_obj_hold != null) {
							let score_hold = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj_hold);
							let value_hold = score_hold.getScore();
						itemE.item.orCreateTag.merge(`{Replication_Slots: ${value_hold}b}`);
						}
					}
					
					if (power == 'Levitation') {
						let scoreboard_obj_hold = scoreboard.getObjective('Heroes.Levitation.Speed.Base');
							if (scoreboard_obj_hold != null) {
							let score_hold = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj_hold);
							let value_hold = score_hold.getScore();
						itemE.item.orCreateTag.merge(`{Levitation_Speed: ${value_hold}b}`);
						}
					}
					if (power == 'Bone_Protrusion') {
						let scoreboard_obj_hold = scoreboard.getObjective('Heroes.Bone.Var.Base');
							if (scoreboard_obj_hold != null) {
							let score_hold = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj_hold);
							let value_hold = score_hold.getScore();
						itemE.item.orCreateTag.merge(`{Bone_Var: ${value_hold}b}`);
									}
								}
								}
							}
							let scoreboard_obj_temp1 = scoreboard.getObjective('Powers.Empathic.' + power);
							if (scoreboard_obj_temp1 != null) {
							let score_temp = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj_temp1);
							let value_temp = score_temp.getScore();
					if (value_temp >= 2) {
						itemE.item.orCreateTag.merge(`{${ability_id}: 1b}`);
					if (power == 'Ability_Replication') {
							let scoreboard_obj_hold = scoreboard.getObjective('Heroes.Replication.Slots.Empathic');
							if (scoreboard_obj_hold != null) {
							let score_hold = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj_hold);
							let value_hold = score_hold.getScore();
						itemE.item.orCreateTag.merge(`{Empathic_Replication_Slots: ${value_hold}b}`);
						}
					}
					
					if (power == 'Levitation') {
						let scoreboard_obj_hold = scoreboard.getObjective('Heroes.Levitation.Speed.Empathic');
							if (scoreboard_obj_hold != null) {
							let score_hold = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj_hold);
							let value_hold = score_hold.getScore();
						itemE.item.orCreateTag.merge(`{Empathic_Levitation_Speed: ${value_hold}b}`);
						}
					}
					if (power == 'Bone_Protrusion') {
						let scoreboard_obj_hold = scoreboard.getObjective('Heroes.Bone.Var.Base');
							if (scoreboard_obj_hold != null) {
							let score_hold = scoreboard.getOrCreatePlayerScore(username, scoreboard_obj_hold);
							let value_hold = score_hold.getScore();
						itemE.item.orCreateTag.merge(`{Empathic_Bone_Var: ${value_hold}b}`);
										}
									}
								}
							}
						}
					}
					entity.server.runCommandSilent("execute as " + username + " at @s run tag @s remove Heroes.Regen.Death.Brain");
					entity.server.runCommandSilent("execute as " + username + " at @s run tag @s remove Heroes.Alive");
					itemE.spawn() 
			}
            });
    });