// priority: 8
//禁疗效果实现
NativeEvents.onEvent($LivingHealEvent, event => {
    let player = event.entity;
    if (player.isPlayer()) {
        let effect = $PropertyHelper.getPlayerEffectLevel(player, 'forbidden_treatment')
        if (effect > 0) {
            event.setCanceled(true);
        }
    }
})

//驱役效果实现
NativeEvents.onEvent($LivingHurtEvent, event => {
    let entity = event.source.actual;
    if (!entity)return
    if ( !entity.persistentData.contains('owner') && !entity.nbt.Owner) return;

    let player;
    if (entity.nbt.Owner && entity.getOwner()) {
        player = entity.getOwner();
    } else if (entity.persistentData.contains('owner')) {
        player = entity.level.getPlayerByUUID(entity.persistentData.getString('owner'));
    }

    if (!player) return;
    let drive = get_specific_effect(player, 'drive').level || 0
    if (drive > 0) {
        event.amount = event.amount * (1 + drive / 100);
    }
});