UNPKG

md5-fight-plus

Version:

31 lines (30 loc) 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.initBuffFrostbite = initBuffFrostbite; const utils_1 = require("../../utils"); function initBuffFrostbite(battleField) { const { player1, player2 } = (0, utils_1.getPlayers)(battleField); run(player1); run(player2); function run(player) { player.hooks.onUnderAttack.tap("increase buff_frostbite onUnderAttack", (props) => { const { damage } = props; const frostbite = player.runtimeProperty.frostbite; if (frostbite > 0 && damage > 0) { player.hooks.onAdjustFrostbite.call(2); } return props; }); player.hooks.afterAttack.tap("release buff_frostbite on roundEnd", (props) => { const { player1: attacker } = (0, utils_1.getPlayers)(battleField); const buff_frostbite = Math.floor(attacker.runtimeProperty.frostbite * 0.5) || attacker.runtimeProperty.frostbite; if (buff_frostbite > 0) { attacker.hooks.onAdjustFrostbite.call(-buff_frostbite); attacker.hooks.onAdjustHp.call(-buff_frostbite); battleField.logger.addInfo(`${attacker.name}受到${buff_frostbite}点【霜蚀】伤害,当前霜蚀层数${attacker.runtimeProperty.frostbite}`); } return props; }); } }