| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#include <global.h> |
| 29 |
#include <ob_methods.h> |
| 30 |
#include <ob_types.h> |
| 31 |
#include <sounds.h> |
| 32 |
#include <sproto.h> |
| 33 |
|
| 34 |
static method_ret skillscroll_type_apply(ob_methods *context, object *lighter, object *applier, int aflags); |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
void init_type_skillscroll(void) { |
| 40 |
register_apply(SKILLSCROLL, skillscroll_type_apply); |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
static method_ret skillscroll_type_apply(ob_methods *context, object *scroll, object *applier, int aflags) { |
| 58 |
char name[MAX_BUF]; |
| 59 |
|
| 60 |
|
| 61 |
if (applier->type == PLAYER) { |
| 62 |
switch ((int)learn_skill(applier, scroll)) { |
| 63 |
case 0: |
| 64 |
query_name(scroll, name, MAX_BUF); |
| 65 |
draw_ext_info_format(NDI_UNIQUE, 0, applier, MSG_TYPE_APPLY, MSG_TYPE_APPLY_ERROR, |
| 66 |
"You already possess the knowledge held within the %s.", |
| 67 |
name); |
| 68 |
return METHOD_OK; |
| 69 |
|
| 70 |
case 1: |
| 71 |
draw_ext_info_format(NDI_UNIQUE, 0, applier, MSG_TYPE_APPLY, MSG_TYPE_APPLY_SUCCESS, |
| 72 |
"You succeed in learning %s", |
| 73 |
scroll->skill); |
| 74 |
draw_ext_info_format(NDI_UNIQUE, 0, applier, MSG_TYPE_APPLY, MSG_TYPE_APPLY_SUCCESS, |
| 75 |
"Type 'bind ready_skill %s to store the skill in a key.", |
| 76 |
scroll->skill); |
| 77 |
object_decrease_nrof_by_one(scroll); |
| 78 |
return METHOD_OK; |
| 79 |
|
| 80 |
default: |
| 81 |
query_name(scroll, name, MAX_BUF); |
| 82 |
draw_ext_info_format(NDI_UNIQUE, 0, applier, MSG_TYPE_APPLY, MSG_TYPE_APPLY_FAILURE, |
| 83 |
"You fail to learn the knowledge of the %s.\n", |
| 84 |
name); |
| 85 |
object_decrease_nrof_by_one(scroll); |
| 86 |
return METHOD_OK; |
| 87 |
} |
| 88 |
} |
| 89 |
return METHOD_OK; |
| 90 |
} |