"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.dealDamageToHero = void 0;
const card_interface_1 = require("../cards/card.interface");
const _card_mappings_1 = require("../cards/impl/_card-mappings");
const dealDamageToHero = (source, hero, board, damage, gameState) => {
    var _a;
    for (const entity of board) {
        const afterHeroDamagedImpl = _card_mappings_1.cardMappings[entity.cardId];
        if ((0, card_interface_1.hasAfterHeroDamaged)(afterHeroDamagedImpl)) {
            afterHeroDamagedImpl.afterHeroDamaged(entity, {
                damage: damage,
                board: board,
                hero: hero,
                gameState,
            });
        }
        const afterDealDamageImpl = _card_mappings_1.cardMappings[entity.cardId];
        if ((0, card_interface_1.hasAfterDealDamage)(afterDealDamageImpl)) {
            afterDealDamageImpl.afterDealDamage(entity, {
                damagedEntity: hero,
                damageDealer: source,
                damage: damage,
                board: board,
                hero: hero,
                gameState,
            });
        }
    }
    for (const trinket of (_a = hero.trinkets) !== null && _a !== void 0 ? _a : []) {
        const afterHeroDamagedImpl = _card_mappings_1.cardMappings[trinket.cardId];
        if ((0, card_interface_1.hasAfterHeroDamaged)(afterHeroDamagedImpl)) {
            afterHeroDamagedImpl.afterHeroDamaged(trinket, {
                damage: damage,
                board: board,
                hero: hero,
                gameState,
            });
        }
    }
};
exports.dealDamageToHero = dealDamageToHero;
//# sourceMappingURL=damage-to-hero.js.map