Help: Enemy AI Pattern

Ok, so I'm currently working on my forest dungeon for my Tactical RPG which will have these Goblins as enemies, among other woodland critters. There are 2 types of Goblins: Goblin Grunt & Goblin Mystic.
1627601093683.png

The Goblin Grunts are just standard melee units.
1627601059997.png

The Goblin Mystics, however, are casters. They are given 2 spells: Stone Skin & Fireball.
~Fireball is deals Fire damage, has a chance to Burn, and has a 3-tile radius range.
~Stone Skin increases the target's DEF and makes them immune to physical Critical Hits.
~They can also do a normal/basic attack (i.e. whack a target w/ their staff)

My issue is when the Goblin Mystic eventually runs out of Mana and resorts do using their normal/basic attack. I currently have their AI set as a "ranged" unit. This means they will try to keep their distance as much as they can. This causes a weird behavior when they don't have enough Mana to cast spells. They will get into melee range to whack a target w/ their staff and then run and distance themselves again. I'm trying to decide if this AI behavior is fine, or should they switch to being "melee" units once they run out of Mana? Also, they do have a bit of MP Regen, so they'll eventually be able to cast again. If they are set as "melee" units, they will try their best to stay adjacent to a target.

So assuming the Goblin Mystic is out of Mana and can only use their normal/basic attack and is starting from a position a couple tiles away from the target...

"Ranged" AI behavior will go like this:
approach target -> attack -> retreat

"Melee" AI behavior will go like this:
approach target -> attack -> stay next to target

The "melee" behavior will let them have an easier time hitting the target w/ their normal/basic attack in future turns due to already being closer to the target. The "ranged" behavior will provide better survivability by keeping their distance as much as possible, especially since the Goblin Mystics are squishier than their Goblin Grunt counterparts.

In short, should I add in code for them to switch behaviors depending on their Mana remaining, or just let them run as a "ranged" unit all the time?
Hard to know what would be easy/hard to implement for your tactical system, but my first few thoughts were:
  • Maybe the mystic's spells don't cost Mana at all?
  • Give the mystic a 0 Mana ranged spell option?
  • Give the mystic a skill which allows them to regenerate Mana much faster?
For the mystics, you can create a MP generating skill that they use when their MP is low. (I does this with almost all enemies in the game)
In that case, should I just remove the Mystic's melee attack as well?
These are questions you must ask yourself and not us peoples on the forums! Do not seek our validation. Seek yours! Have confidence in your own ability human, for you have the ability. You haves it!

Praise be to the gam mak.
In that case, should I just remove the Mystic's melee attack as well?
I think it'd depend on how the AI works. If both the mystic's HP and MP are low (and doesn't have a 0 MP spell) a melee attack could be worthwhile so their last turn isn't "wasted" only regenerating MP.

Players probably won't feel strongly about such a minute detail, so as @lianderson suggests you should do whichever seems best to you! You could also see what play-testers think since they'd have a more grounded understanding of how the game plays out.
Interesting and pretty standard tactical rpg game design.
why not keep the mystic goblin as "ranged" unit?
~ I read it you wanted to make melee and ranged enemies right? Good job, you already determine the road you want to go. Dont waste that determination.
~I will give you this hint: MP Charge
~my suggestions for your future design: tactical rpg is a long game and complex so you need to make a decision how do you process AND make your game special
Give the mystic a sling, so when they're out of mana, they shoot stones at ya dudes?

Original thread: https://forums.rpgmakerweb.com/threads/help-enemy-ai-pattern.139067/