In the Melvor Idle 2 combat triangle, Melee beats Ranged, Ranged beats Magic, and Magic beats Melee. A favorable matchup raises your maximum hit by 10% and your resistance by 15%, while an unfavorable matchup lowers those stats by the same percentages. Open Area Info before a fight to check the enemy's style and choose your counter.

What happens in a same-style matchup?
When you and the enemy use the same style, the triangle gives you no bonus or penalty. For example, if you're planning to fight a Magic enemy with Melee, switching to Magic removes the penalty, while switching to Ranged gives you the advantage. The triangle applies these modifiers to your character's maximum hit and resistance.
Which combat style should you train next?
If your best-trained style is weak against the enemy you want to fight, use that matchup to decide what to train next. Train the counter and get gear for it so you can use it in the fight. Over time, build up all three styles so you have a counter ready when you move to an area with a different enemy style.
How to prepare for a dungeon boss
A dungeon sends you through a series of encounters before you reach its boss, so cook and stock food for the full run. Check the dungeon's enemy styles in Area Info and use the boss's style to help decide which gear and combat style to bring. Bring gear suited to the dungeon's tier, since later dungeons demand higher combat levels and better equipment. If you keep failing with the favorable matchup, improve your gear or train the combat skill you're using before you try again.