UNPKG

@screeps/engine

Version:

This is a module for Screeps standalone server. See [main repository](https://github.com/screeps/screeps) for more info.

36 lines (28 loc) 1.08 kB
'use strict'; var _ = require('lodash'), utils = require('../../../utils'), driver = utils.getDriver(), C = driver.constants; module.exports = function (object, intent, roomObjects, roomTerrain, bulk, bulkUsers, roomController, stats, gameTime) { if (object.type != 'creep') { return; } if (object.spawning) { return; } var target = roomObjects[intent.id]; if (!target || target.type != 'creep' || target.spawning) { return; } if (Math.abs(target.x - object.x) > 1 || Math.abs(target.y - object.y) > 1) { return; } if (roomController && roomController.user != object.user && roomController.safeMode > gameTime) { return; } var healPower = utils.calcBodyEffectiveness(object.body, C.HEAL, 'heal', C.HEAL_POWER); target._healToApply = (target._healToApply || 0) + healPower; object.actionLog.heal = { x: target.x, y: target.y }; target.actionLog.healed = { x: object.x, y: object.y }; }; //# sourceMappingURL=../../../sourcemaps/processor/intents/creeps/heal.js.map