// attribute.c
// From ES2
// Modified by Xiang for XKX (12/15/95)

#include <dbase.h>
#include <skill.h>

varargs int query_str(int post)
{
	int improve, tmp;

	improve = query_skill("claw", 1) / 10;
	tmp = query_skill("cuff", 1) / 10;
	if (tmp > improve) improve = tmp;
	tmp = query_skill("finger", 1) / 10;
	if (tmp > improve) improve = tmp;
	tmp = query_skill("hand", 1) / 10;
	if (tmp > improve) improve = tmp;
	tmp = query_skill("strike", 1) / 10;
	if (tmp > improve) improve = tmp;
	tmp = query_skill("leg", 1) / 10;
	if (tmp > improve) improve = tmp;
	tmp = query_skill("unarmed", 1) / 10;
	if (tmp > improve) improve = tmp;
       improve += query_skill("yijin-jing", 1) / 10;
	
	return query("str") + (post?0:query_temp("apply/strength")) + improve;
}

varargs int query_int(int post)
{
	return query("int") + (post?0:query_temp("apply/intelligence")) + query_skill("literate", 1) / 10;
}

varargs int query_con(int post)
{
      int tmp1,tmp2;
       tmp1 = query_skill("jiuyang-shengong", 1) /10 ;
       tmp2 = query_skill("yijin-jing", 1) / 10;
	if (tmp2 > tmp1) tmp1 = tmp2;
	return query("con") + (post?0:query_temp("apply/constitution")) + query_skill("force", 1) / 10 + tmp1;
}

varargs int query_dex(int post)
{
       int tmp1,tmp2;
        tmp1 = query_skill("lingbo-weibu", 1) /10 ;
       tmp2 = query_skill("pixie-jian", 1) / 10;
	if (tmp2 > tmp1) tmp1 = tmp2;
	return query("dex") + (post?0:query_temp("apply/dexerity")) +	tmp1 + query_skill("dodge", 1) / 10;
}

varargs int query_kar(int post)
{
	return query("kar") + (post?0:query_temp("apply/karma"));
}

varargs int query_per(int post)
{
	return query("per") + (post?0:query_temp("apply/personality"))
		+ (query("gender") == "男性"?0:query_skill("beauty", 1) / 20)
		- query("age")/10 + 2; // 20 以后才开始减per, 所以加2.
}
