About the adaptability.. I think its probably impossible to fully achieve, but you can come close.. Music is not something thats random there are rules and I guarantee there are certain things people want to hear (Johnny Cash was so successful by utilizing the 1-4-5 combo.. its the most pleasant combination of sounds to the human ear)...
There are all sorts of rules and styles of mood setting music:
if you want sad - play a slow tempo minor arpegio or diminshed chord progression with a quiet downbeat solo over top, a bassline that utilizes a lots of "pull-offs" and "slide downs" in minor scales and have a really off-time drum beat thats very light
happy - play aggressive major chords with standard walking bassline and timed drums
Theres tuns of them out there.. using these rules you could easily program a game to create the music for you, just by sending it the mood, and key you want.. you'd have to use a control structure to analyze every possible scenario and the mood associated with it..
Using the specific examples:
Is the player winning?
if user.getHP() > enemy.getHP() then playMusic(Happy, G)
else playMusic(Desperate, Eb)
If you have more hp then the enemy, play a happy tune in G, if the enemy has more then you, play a desperate tune in E flat.
How many orcs are left?
if enemy.getCurrentCount() < enemy.getMaxCount * 0.6 then playMusic(Epic, A)
else if enemy.getCurrentCount() = enemy.getMaxCount then playMusic(BloodPumping, E)
else playMusic(Happy, B)
Thats the closest way I can conceive to experiment with adaptability..