// eAthena TODO for Monster AI
// -----------------------------------------
// The idea of this file is to write a system to use for mob AI because
// to put it bluntly, our mobs are stupid. If we can pull off some sweet
// AI, we will own the other emulators.
//
// What we have here are 2 columns. I describe them below...
// - 'mode' : Mode is when the monster can attack, like, can it move? can it 
//            attack first? can it assist other monsters?
// 
// - 'AI'   : AI is the smart part of the monster. This is how the monster
//            will actully go about attacking something. For example we 
//            could make archer skeletons fire an arrow or 2, then flee
//            and fire a few more arrows. Or we could have them avoid other
//            classes with range (archers, mages). We could also have mobs
//            run when being sniped off cliffs by archers/mages (wont they
//            hate that, but in reality, thats what they would do).
//
// The mode flags will be given an ID to the power of 2, (binary style, like
// job id's in the item_db) and added together to make the mode. But before
// the system can be written we need a nice file to explain it. That would be
// this file. So add away, when it looks done, begin the implementation.
//
// Also, if possible, new config file in /conf/. 'mob_ai_athena.conf'. This is
// where mob AI is enabled/disable. And options can be set to allow and dis-
// allow certin modes. Ex: People like the AI, but dont like one options, can 
// simply disable THAT AI feature rather then rewriting mob_db to remove it.
//
// I wrote the first modes, C devs, move them around as you see fit for programming.
//
//	-Ancyker
//
// (check bottom for more AI ideas)
// 


'mode'
Immobile		- Monster can not move, can not be moved (like by archers knockback skills)
Agressive		- Monster can attack first (doesn't mean it will, decided in 'AI')
Detect cast		- Monster will detect if someone is casting on it, and attack back
Assist			- Monster will help other monsters (what monsters it will assist is decided in 'AI')
Looter			- Monster will loot items (if 'Agressive' flag is set, it will attack before looting)
No Target Change	- Monster will not start attacking another target until the first target is dead or out of range
Passive			- Monster will not attack back (ever, unless 'Agressive' flag is also set?)
Detects Hidden		- Monster can see hidden players

'ai'
NoAI			- Doesn't do anything (plants)
NoSnipe			- Monster will run away if being 'sniped' from a clif by archer, mage, etc.
AttackFlee		- Monster will attack, then flee, attack, then flee, etc (Archer Skels, run away, shoot arrow, etc)
AttackRange1		- Will only attack if player is in a set range [0-3] (It's like the player is close, its a threat now)
AttackRange2		- Will only attack if player is in a set range [4-6]
ClassFlee1		- Will run from any player with range (archers, mages, thiefs with bows)
NoviceNoFlee		- Will not run if a player is a novice
LevelFlee		- Wlll run if player is of a higher level (porings would run from level 99s, AHH DONT KILL ME!)
AvoidPlayer		- Will run if it sees any player (So it cancels 'Agressive' flag)
AttackMostDamage	- Will attack the player doing the overall most damage
AttackLessDamage	- Will attack the player doing the overall least damage
AttackLowestLevel	- Will attack the lowest level first
AttackHighestLevel	- Will attack the highest level first
WarpLowHP		- Will warp if HP is low (how low is low?)
NeverStop		- Monster will always be on the move, never stop walking. (Is over-ridden by 'Immobile' flag)


//
// Again, more stuff...
//
// The monster spawns sripts need some more params. some examples...
// 
// We have: map,x,y,offsetx,offsety, ...
// What if we added more? To only let the monster move so far off from
//  where it was spawned. It could 'guard' an arena, an exit/enterance
//  an npc, whatever =). 
// 
// .... ID,time,time,blah...,mode,WAP
// Have monsters walk a certin path. Waypoint files are your friend.
//  If a monster has a WAP (optional) it will walk this path. 
//  Guardians on patrol? Could be interesting.
//
// Add more if you think of any =)
//
// If you don't like an idea, comment why, dont remove it.
// example: (using this one cuz not sure about it)
//
// // NeverStop - Will/Could cause lag, don't think its a good idea -name
// NeverStop - ...
//

Lupus: (guys, rearrange my ideas or move them as u want)
Some memory - speed optimizations:

There'a big "for cycle" when u look up for a place to mob spawn.
It could be made quite fast:
On server .GAT loading you should make an array with OFFSETS (not even X,Y) of right
places for future mob spawns.
If the waypoints aren't found for the loadied map then you should make at least 1-2 waypoints automatically.

About AI:
EACH map has defined mobs. Your mob should have a flag "healer", "supporter" etc. "weak", "ranged attacker"
and each map should contain an attached list of mobs with their types
when one MVP is hurt it'd look for "helpers", "healers".
And if a mob is almost 0 HP it should look for helpers or look for other mobs ranged attackers
defence. Etc.

Mobs AI should be WRITTEN IN SPECIAL SCRIPTS. 
Some default mobs will use the same script.
And some advanced ones will use their own.

MOB-scripts are quite interesting. (remember Robot-Wars game?)

Gulid Wars:
I think guardians should be able to warp from room to room using WARPS like common Players.


Aria's Ideas: (do whatever u want)

We can make aggressive monsters make ambushes, where one attacks and runs away to a huge group of the same monster

instead of dropping 2 x1 items, just drop 1 x2 item

make AI vary inside of a group of monsters (IE 1/2 porings do 1 thing, and the other half do another)

aggressive monsters sould surround enemies, not just blindly attack them

we should also make monsters look as player-like as possible. There should be groups traveling together, or 2 monsters
next to eachother, chatting.

we shouldn't let mobs spawn right infront of people, like in anime or manga. they always walk towards you, or you walk
towards them.

let mob stats vary a little bit - every mob shouldn't be the exact same. if it's stronger it gives more exp, and vice
versa.

have a monster be able to use its drops, and not drop it. like a poring using an apple.