//requires irons_spells_js
PlayerEvents.changeMana(event => {
    let player = event.entity
    // 仅对通过法术书,施放的法术生效
    if (event.getMagicData().getCastSource() == 'SPELLBOOK' ||
        event.getMagicData().getCastSource() == 'SWORD'
    ){
        if (!player) return;
        let effects = get_all_effect(player)
        effects.forEach(effect => {
            let strategy = all_effect_change_mana_strategies[effect.name] || all_effect_change_mana_strategies.default;
            strategy(event, player, effect.level, effect.name, effect.efficiency);
        });
    }
})
const all_effect_change_mana_strategies = {
    //耗蓝降低
    'reduced_mana_cost': function (event, player, effectLevel, effectname, efficiency) {
        event.setNewMana(event.getOldMana() - effectLevel)
    },
    'default': function (event, player, effectLevel, effectname, efficiency) {
        return;
    }
};