00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <global.h>
00030
00040 void dump_abilities(void) {
00041 archetype *at;
00042 char name[VERY_BIG_BUF];
00043
00044 for (at = first_archetype; at; at = at->next) {
00045 const char *gen_name = "";
00046 archetype *gen;
00047
00048 if (!QUERY_FLAG(&at->clone, FLAG_MONSTER))
00049 continue;
00050
00051
00052 if (QUERY_FLAG(&at->clone, FLAG_CHANGING))
00053 continue;
00054
00055 for (gen = first_archetype; gen; gen = gen->next) {
00056 if (gen->clone.other_arch && gen->clone.other_arch == at) {
00057 gen_name = gen->name;
00058 break;
00059 }
00060 }
00061
00062 describe_item(&at->clone, NULL, name, VERY_BIG_BUF);
00063 printf("%-16s|%6"FMT64"|%4d|%3d|%s|%s|%s\n", at->clone.name, at->clone.stats.exp,
00064 at->clone.stats.hp, at->clone.stats.ac, name, at->name, gen_name);
00065 }
00066 }
00067
00071 void print_monsters(void) {
00072 archetype *at;
00073 object *op;
00074 char attbuf[34];
00075 int i;
00076
00077 printf(" | | | | | attack | resistances |\n");
00078 printf("monster | hp |dam| ac | wc |pmf ecw adw gpd ptf|phy mag fir ele cld cfs acd drn wmg ght poi slo par tud fer cnc dep dth chs csp gpw hwd bln int | exp | new exp |\n");
00079 printf("---------------------------------------------------------------------------------------------------------------------------------------------------\n");
00080 for (at = first_archetype; at != NULL; at = at->next) {
00081 op = arch_to_object(at);
00082 if (QUERY_FLAG(op, FLAG_MONSTER)) {
00083 bitstostring((long)op->attacktype, NROFATTACKS, attbuf);
00084 printf("%-15s|%5d|%3d|%4d|%4d|%s|",
00085 op->arch->name, op->stats.maxhp, op->stats.dam, op->stats.ac,
00086 op->stats.wc, attbuf);
00087 for (i = 0; i < NROFATTACKS; i++)
00088 printf("%4d", op->resist[i]);
00089 printf("|%8"FMT64"|%9"FMT64"|\n", op->stats.exp, new_exp(op));
00090 }
00091 free_object(op);
00092 }
00093 }
00094
00110 void bitstostring(long bits, int num, char *str) {
00111 int i, j = 0;
00112
00113 if (num > 32)
00114 num = 32;
00115
00116 for (i = 0; i < num; i++) {
00117 if (i && (i%3) == 0) {
00118 str[i+j] = ' ';
00119 j++;
00120 }
00121 if (bits&1)
00122 str[i+j] = '1';
00123 else
00124 str[i+j] = '0';
00125 bits >>= 1;
00126 }
00127 str[i+j] = '\0';
00128 return;
00129 }