[Package Index | Mudlib Index | Effect Index]
See also:
help::tasks
.c
Written by Deutha
varargs mixed attempt_task(int difficulty, int bonus, int upper, mixed extra, int degree)
varargs mixed attempt_task_e(int difficulty, int bonus, int upper, int half, int degree)
varargs mixed compare_skills(object offob, string offskill, object defob, string defskill, int modifier, int off_tm_type, int def_tm_type, int degree, int offperc, int defperc)
This is an example of the simpler, binary success/failure behaviour.
switch(TASKER->compare_skills(attacker, "fighting.melee.sword",
defender, "fighting.defence.parry",
25, TM_COMMAND, TM_FREE) {
case OFFAWARD:
tell_object(attacker, "%^@tm%^You manage to grasp one of the "
"principles of slicing people up more firmly."
"%^RESET%^\n");
case OFFWIN:
say(defender->one_short() + " loses an arm!\n");
break;
case DEFAWARD:
tell_object(defender, "%^@tm%^You feel better able to keep your arms "
"attached when parrying unarmed.%^RESET%^\n");
case DEFWIN:
say(defender->one_short() + " keeps " + defender->query_possesive() +
" arm attached.\n");
break;
}
This is an example of the finer grained degree-of-success behaviour.
class tasker_result tr;
tr = (class tasker_result)TASKER->compare_skills(
attacker, "fighting.melee.sword",
defender, "fighting.defence.parry",
25, TM_COMMAND, TM_FREE, 1 );
switch( tr->result ) {
case OFFAWARD:
tell_object(attacker, "%^@tm%^You manage to grasp one of the "
"principles of slicing people up more firmly."
"%^RESET%^\n");
case OFFWIN:
switch( tr->degree ) {
case TASKER_MARGINAL:
say( "You just barely scrape your opponent's hand.\n" );
break;
case TASKER_NORMAL:
say( "You slice into your opponent's arm.\n" );
break;
case TASKER_EXCEPTIONAL:
say( "You slice deeply into your opponent's muscle and sinew, and "
"he screams in pain!\n" );
break;
case TASKER_CRITICAL:
say( "You slice your opponent's arm clean off. Blood spurts "
"everywhere like a cherry slurpee machine gone insane!\n" );
break;
}
break;
case DEFAWARD:
tell_object(defender, "%^@tm%^You feel better able to keep your arms "
"attached when parrying unarmed.%^RESET%^\n");
case DEFWIN:
switch( tr->degree ) {
...
similar code in here...
...
}
break;
}
int is_critical(int margin)
void load_me()
void lucky_achievements(object player, int level)
varargs mixed perform_task(object person, string skill, int difficulty, int tm_type, int degree, int gp_cost)
This is an example of the simpler, binary success/failure behaviour.
switch(TASKER->perform_task( person, "covert.manipulation.stealing",
300, TM_COMMAND ) ) {
case AWARD :
tell_object( person, "%^@tm%^You manage to grasp the principles "
"of stealing more firmly.%^RESET%^\n" );
// Note, no break;
case SUCCEED :
// Whatever happens when it succeeds
break;
default :
// Whatever happens when it fails
}
This is an example of the finer grained degree-of-success behaviour.
class tasker_result tr;
tr = (class tasker_result)TASKER->perform_task( person,
"other.direction", 300, TM_FREE, 1, 50 );
switch( tr->result ) {
case AWARD:
tell_object(attacker, "%^@tm%^You feel very aligned!%^RESET%^\n" );
case SUCCEED:
switch( tr->degree ) {
case TASKER_MARGINAL:
say( "You think he went thataway. Maybe.\n" );
break;
case TASKER_NORMAL:
say( "You're pretty sure he went that way.\n" );
break;
case TASKER_EXCEPTIONAL:
say( "He definitely went thataway!\n" );
break;
case TASKER_CRITICAL:
say( "Your surity that he went thataway is so powerful that even "
"if he didn't go thataway, he'll be in that direction.\n" );
break;
}
break;
case FAIL:
switch( tr->degree ) {
...
Boy, it's a good thing I've already explained this, or I'd be
pretty hard-pressed to think of an example of a critical failure
for other.direction. You get the idea.
...
}
break;
}
varargs void save_me(int now)
void set_control(mixed * args)
int success_probability(int difficulty, int bonus, int tm_type)
void write_back_trace(string skill, string trace)