If you're familiar with javascript, then why not using "Unity Game Engine"? You can code in javascript with Unity. What kind of battle system that you wanted to implement? Is it a turn-based, real-time-strategy? And for the NPC, you can create a system that already builds inside the Unity called the Nav Mesh Agent, they can handle pathfinding, object recognition, initiate dialog system, and some other stuff that you want to implement. For the last thing defined delay function that you write above, is it for waiting on the turn, or something else? My suggestion is, use the game engine for the first time whether it's Unreal, Unity, or any game engine that you familiar with. After you get the hang of it, you can try to create an engine with whatever language you like. I build this game using Unity on the WebGL platform so they can play it on the browser. I hope this can give you some more views of your game development.