let EnergyBarReference = Java.loadClass('net.threetag.palladium.power.energybar.EnergyBarReference');
let DAMAGE_BOOST_BAR_REF = new EnergyBarReference('arrzenhanced:soul_fire_magic', 'damage_boost');

EntityEvents.hurt(event => {
    var { entity, source } = event
    let attackingEntity = source.player
    if (!attackingEntity) return

    // let powers = abilityUtil.getEntries(attackingEntity, "arrzenhanced:soul_fire_magic")
    let allsuperpowers = palladium.superpowers.hasSuperpower(attackingEntity, "arrzenhanced:soul_fire_magic")

    if (allsuperpowers == true) {
        // lil cooldown
        if (attackingEntity.persistentData['soulFireDamageCooldown'] > 0) {return}

        // attackingEntity.tell(attackingEntity.persistentData)
        attackingEntity.persistentData['soulFireCooldown'] = 80;
        attackingEntity.persistentData['soulFireDamageCooldown'] = 10;

        var attackerBar = DAMAGE_BOOST_BAR_REF.getEntry(attackingEntity)
        if (attackerBar.get() == attackerBar.getMax()) {return}
        attackerBar.add(300)
    }
})