/**
	* Adds a value to a creature's mental state.
	*
	* @param env		    Java environment
	* @param self		    class calling this function
	* @param mob	    id of creature to access
	* @param mentalState		mental state we are interested in
	* @param value			value to add to the mental state
	*
	* @return true on success, false on fail
*/
jboolean JNICALL ScriptMethodsMentalStatesNamespace::addToMentalStateTowardClampBehavior(JNIEnv *env, jobject self, jlong mob, jlong target, jint mentalState, jfloat value, jint behavior)
{
	UNREF(self);

	if (target == 0 || mentalState < 0 || mentalState >= MentalStates::NumberOfMentalStates)
		return JNI_FALSE;

	CreatureObject * creature = 0;
	if (!JavaLibrary::getObject(mob, creature))
		return JNI_FALSE;

	NetworkId targetId(target);
	if (!targetId)
		return JNI_FALSE;

	MentalStates::Value current = creature->getMentalStateToward(targetId, static_cast<MentalStates::Enumerator>(mentalState));

	LOGC(ConfigServerGame::isAiLoggingEnabled(), "debug_ai", ("ScriptMethodsMentalStates::addToMentalStateTowardClampBehavior() %s->%s state(%s) value(%.0f+%.0f) behavior(%s)", creature->getNetworkId().getValueString().c_str(), targetId.getValueString().c_str(), CreatureObject::getMentalStateString(mentalState), current, value, CreatureObject::getBehaviorString(behavior)));

	creature->setMentalStateTowardClampBehavior(targetId,
		static_cast<MentalStates::Enumerator>(mentalState),
		static_cast<MentalStates::Value>(current + value),
		static_cast<Behaviors::Enumerator>(behavior));

	return JNI_TRUE;
}	// JavaLibrary::addToMentalState
	/**
	* Sets a creatue's mental state.
	*
	* @param env		    Java environment
	* @param self		    class calling this function
	* @param target	    id of creature to access
	* @param mentalState		mental state we are interested in
	* @param value			value to set the mental state to
	*
	* @return true on success, false on fail
*/
jboolean JNICALL ScriptMethodsMentalStatesNamespace::setMentalStateTowardClampBehavior(JNIEnv *env, jobject self, jlong mob, jlong target, jint mentalState, jfloat value, jint behavior)
{
	UNREF(self);

	if (target == 0 || mentalState < 0 || mentalState >= MentalStates::NumberOfMentalStates)
		return JNI_FALSE;

	CreatureObject * creature = 0;
	if (!JavaLibrary::getObject(mob, creature))
		return JNI_FALSE;

	NetworkId targetId(target);
	if (!targetId)
		return JNI_FALSE;

	creature->setMentalStateTowardClampBehavior(targetId,
		static_cast<MentalStates::Enumerator>(mentalState),
		static_cast<MentalStates::Value>(value),
		static_cast<Behaviors::Enumerator>(behavior));

	return JNI_TRUE;
}	// JavaLibrary::setAttrib