Excellent! So, if I were to write a C function to do the same thing, it would look like this:
#include <stdio.h>
//define the constants
#define FIGHT = 0;
#define FLIGHT = 1;
//define the variables
unsigned char combat morale, morale, intelligence;
int monsterhealth, monsterhealthmax, grouphealth, grouphealthmax;
//define the function
unsigned char moralecheck(combat morale, morale, intelligence, monsterhealth, monsterhealthmax, grouphealth, grouphealthmax);
//function text
unsigned char moralecheck(combat morale, morale, intelligence, monsterhealth, monsterhealthmax, grouphealth, grouphealthmax)
{
if (intelligence <= 5)
{
return FIGHT;
}
if (grouphealth / grouphealthmax * 100 > combatmorale)
{
if (monsterhealth / monsterhealthmax *100 > morale * 2)
{
return FLIGHT;
}
}
else return FIGHT;
}
/*Where combat morale = monster morale (from Combat Event screen), morale = Morale (from Monster database),
intelligence = Intelligence (from monster database), monsterhealthmax = hit points (at beginning of combat),
monsterhealth = hit points (current), grouphealth = hit points (group total, calculated at beginning of
combat), and grouphealthmax = hit points (group total, best calculated at the beginning of the monster's turn)*/
From there, one could call the function that determines if the monster surrenders or flees if FLIGHT is returned. I'm not sure how that translates into GPDL.
Please feel free to use and modify this if it proves useful.