Пример #1
0
// Default chat function: Let the npc exert his/her enabled force
int exert_function(string func)
{
	string force_skill;

	if( stringp(force_skill = query_skill_mapped("force")))
		SKILL_D(force_skill)->exert_function(this_object(), func);
}
Пример #2
0
// Default chat function: Let the npc cast his/her enabled spells
void cast_spell(string spell)
{
	string spell_skill;

	if( stringp(spell_skill = query_skill_mapped("spells")))
		SKILL_D(spell_skill)->cast_spell(this_object(), spell);
}
Пример #3
0
// Default chat function: Let the npc perform special action with 
// his/her enabled martial art
int perform_action(string action) {
        object weapon;
        string martial_skill, act; 
        if(sscanf(action, "%s.%s", martial_skill, act) != 2 ) {
                return 0;
        }
        if(!stringp(martial_skill)) {
                return 0;
        }
        
   if(martial_skill == "axe" || martial_skill == "blade" 
                        || martial_skill == "dagger" || martial_skill == "fork" 
                        || martial_skill == "hammer" || martial_skill == "parry" 
                        || martial_skill == "staff" 
                        || martial_skill == "sword" || martial_skill == "throwing" 
                        || martial_skill == "spear" || martial_skill == "whip" ) {
                weapon = this_object()->query_temp("weapon");
                if(!objectp(weapon) || martial_skill != weapon->query("skill_type")) {
                        weapon = this_object()->query_temp("secondary_weapon");
                        if(!objectp(weapon) || martial_skill != weapon->query("skill_type")) {
                                return 0;               
                        }
                }       
        }
                        
        martial_skill = query_skill_mapped(martial_skill);
        return SKILL_D(martial_skill)->perform_action(this_object(), act);              
} 
Пример #4
0
// Default chat function: Let the npc perform special action with 
// his/her enabled martial art
int perform_action(string action)
{
	object weapon;
	string martial_skill, act;

	if( sscanf(action, "%s.%s", martial_skill, act) != 2 )
		return 0;
	martial_skill = query_skill_mapped(martial_skill);
	if( stringp(martial_skill) )
		return SKILL_D(martial_skill)->perform_action(this_object(), act);		
}
Пример #5
0
int update_sex_status()
{
    mapping my;
    string dodge, force, spells;
    int sex_per, update_flag, sex_affair;

    update_flag = 0;

    my = query_entire_dbase();

    if (!mapp(my)) return 0;

    if (my["want"] > 0 && my["want"] > my["eff_want"]) {
        my["want"] -= 1; update_flag++;
    }
    if (my["enjoy"] > 0) { my["enjoy"] -= 1; update_flag++; }

    sex_per = my["per"] + query_temp("apply/personality");

    dodge = query_skill_mapped("dodge");
    force = query_skill_mapped("force");
    spells = query_skill_mapped("spells");
    sex_affair = 0;
    if (dodge) {
        sex_affair += SKILL_D(dodge)->query_sex_affair();
        if (sex_affair == 0)
            ;
        else if (sex_affair < 0) {
            my["want"] += sex_affair;
            update_flag++;
        }
        else if (sex_affair > 0) {
            sex_per += sex_affair;
        }
    }
    if (force) {
        sex_affair += SKILL_D(force)->query_sex_affair();
        if (sex_affair == 0)
            ;
        else if (sex_affair < 0) {
            my["want"] += sex_affair;
            update_flag++;
        }
        else if (sex_affair > 0) {
            sex_per += sex_affair;
        }
    }
    if (spells) {
        sex_affair += SKILL_D(spells)->query_sex_affair();
         if (sex_affair == 0)
            ;
        else if (sex_affair < 0) {
            my["want"] += sex_affair;
            update_flag++;
        }
        else if (sex_affair > 0) {
            sex_per += sex_affair;
        }
    }

    sex_per += query_temp("apply/sex_personality");

    if (sex_affair > 0)
    {
        object env = environment();
        if (environment()) {
            object ob = first_inventory(environment());
            while (ob) {
                if (living(ob)) {
                    ob->add("want", sex_per);
                    update_flag++;
                }
                ob = next_inventory(ob);
            }
        }
    }

    return update_flag;
}