Exemple #1
0
static int ActionUtility(const struct Agent* _Agent, int* _Min, int* _Max, struct WorldState* _State, void* _Data) {
	const struct BigGuy* _Guy = _Agent->Agent;
	struct BigGuy* _Leader =  _Agent->Blackboard.Target;
	struct BigGuyRelation* _Relation = BigGuyGetRelation(_Guy, _Leader);
	int _Utility = 0;

	*_Min = 0;
	*_Max = 255;
	if(_Guy->Stats[BGSKILL_COMBAT] < _Leader->Stats[BGSKILL_COMBAT] || (_Relation != NULL && _Relation->Relation == BGREL_LOVE))
		return 0;
	_Utility = _Utility + ((_Guy->Stats[BGSKILL_COMBAT] - _Leader->Stats[BGSKILL_COMBAT]) * 5);
	if(_Relation != NULL)
		_Utility = _Utility + ((-_Relation->Modifier) * 2);
	return (_Utility >= 255) ? (255) : (_Utility);
}
Exemple #2
0
static int ActionUtility(const struct Agent* _Agent, int* _Min, int* _Max, struct WorldState* _State, void* _Data) {
	const struct Settlement* _Settlement = PersonHome(_Agent->Agent->Person);
	struct Retinue* _Retinue = NULL;
	struct BigGuy* _Actor = NULL;
	int _TotalBG = 0;
	double _PartUtiliy = 0.0f;
	int _Utility = 0;

	for(struct LnkLst_Node* _Itr = _Settlement->BigGuys.Front; _Itr != NULL; _Itr = _Itr->Next) {
		struct BigGuy* _Guy = _Itr->Data;

		if(BigGuyRelAtLeast(BigGuyGetRelation(_Actor, _Guy), BGREL_LIKE) == 0)
			++_TotalBG;
	}
	_Retinue = BigGuyRetinue(_Actor, PersonHome(_Actor->Person));
	_PartUtiliy += _TotalBG / _Settlement->BigGuys.Size * 128;
	_PartUtiliy += _Retinue->Warriors.Size / (_Settlement->MaxWarriors) * 128;
	_Utility = _PartUtiliy;
	*_Min = 0;
	*_Max = 255;
	return _Utility;
}