// Perform healing blast public void performHealingBlastSkill(int entityId, HealingBlastSkill healingBlastSkill, Vector2 target) { FactionComponent factionComponent = EntityManager.getFactionComponent(entityId); PerformingSkillsComponent performingSkillsComponent = EntityManager.getPerformingSkillsComponent(entityId); ExecuteHealingBlastSkill executeSkill = null; List<Fixture> fixtures = SystemManager.physicsSystem.world.TestPointAll(target); foreach (Fixture fixture in fixtures) { int targetEntityId; FactionComponent targetFactionComponent; // Skip bodies without any userdata if (fixture.Body.UserData == null) { continue; } targetEntityId = (int)fixture.Body.UserData; // Skip entities without a faction component if ((targetFactionComponent = EntityManager.getFactionComponent(targetEntityId)) == null) { continue; } // Skip over hostile entities if (factionComponent.faction != targetFactionComponent.faction) { continue; } // Create execute skill object executeSkill = new ExecuteHealingBlastSkill( healingBlastSkill, targetEntityId, () => { PositionComponent positionComponent = EntityManager.getPositionComponent(entityId); PositionTargetComponent positionTargetComponent = EntityManager.getPositionTargetComponent(entityId); float distance = Math.Abs(positionTargetComponent.position - positionComponent.position.X); return distance <= positionTargetComponent.tolerance + SKILL_RANGE_TOLERANCE; }); EntityManager.addComponent(entityId, new PositionTargetComponent(entityId, fixture.Body, healingBlastSkill.range)); break; } if (executeSkill != null) { performingSkillsComponent.executingSkills.Add(executeSkill); } }
// Execute healing blast private void executeHealingBlast(int entityId, ExecuteHealingBlastSkill executeHealingBlast) { PerformingSkillsComponent performingSkillsComponent = EntityManager.getPerformingSkillsComponent(entityId); HealingBlastSkill healingBlastSkill = executeHealingBlast.skill as HealingBlastSkill; int targetId = executeHealingBlast.targetId; SystemManager.combatSystem.applySpellHeal(targetId, Roller.roll(healingBlastSkill.healDie)); EntityManager.removeComponent(entityId, ComponentType.PositionTarget); resetCooldown(entityId, SkillType.HealingBlast); removeExecutedSkill(entityId, executeHealingBlast); }