| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
#include "global.h" |
| 15 |
|
| 16 |
#include <stdlib.h> |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
static void bitstostring(long bits, int num, char *str) { |
| 40 |
int i, j = 0; |
| 41 |
|
| 42 |
if (num > 32) |
| 43 |
num = 32; |
| 44 |
|
| 45 |
for (i = 0; i < num; i++) { |
| 46 |
if (i && (i%3) == 0) { |
| 47 |
str[i+j] = ' '; |
| 48 |
j++; |
| 49 |
} |
| 50 |
if (bits&1) |
| 51 |
str[i+j] = '1'; |
| 52 |
else |
| 53 |
str[i+j] = '0'; |
| 54 |
bits >>= 1; |
| 55 |
} |
| 56 |
str[i+j] = '\0'; |
| 57 |
return; |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
void dump_abilities(void) { |
| 64 |
archetype *at; |
| 65 |
char *name; |
| 66 |
|
| 67 |
for (at = first_archetype; at; at = at->next) { |
| 68 |
const char *gen_name = ""; |
| 69 |
archetype *gen; |
| 70 |
|
| 71 |
if (!QUERY_FLAG(&at->clone, FLAG_MONSTER)) |
| 72 |
continue; |
| 73 |
|
| 74 |
|
| 75 |
if (QUERY_FLAG(&at->clone, FLAG_CHANGING)) |
| 76 |
continue; |
| 77 |
|
| 78 |
for (gen = first_archetype; gen; gen = gen->next) { |
| 79 |
if (gen->clone.other_arch && gen->clone.other_arch == at) { |
| 80 |
gen_name = gen->name; |
| 81 |
break; |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
name = stringbuffer_finish(describe_item(&at->clone, NULL, 0, NULL)); |
| 86 |
printf("%-16s|%6"FMT64"|%4d|%3d|%s|%s|%s\n", at->clone.name, at->clone.stats.exp, |
| 87 |
at->clone.stats.hp, at->clone.stats.ac, name, at->name, gen_name); |
| 88 |
free(name); |
| 89 |
} |
| 90 |
} |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
void print_monsters(void) { |
| 96 |
archetype *at; |
| 97 |
object *op; |
| 98 |
char attbuf[34]; |
| 99 |
int i; |
| 100 |
|
| 101 |
printf(" | | | | | attack | resistances |\n"); |
| 102 |
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"); |
| 103 |
printf("---------------------------------------------------------------------------------------------------------------------------------------------------\n"); |
| 104 |
for (at = first_archetype; at != NULL; at = at->next) { |
| 105 |
op = arch_to_object(at); |
| 106 |
if (QUERY_FLAG(op, FLAG_MONSTER)) { |
| 107 |
bitstostring((long)op->attacktype, NROFATTACKS, attbuf); |
| 108 |
printf("%-15s|%5d|%3d|%4d|%4d|%s|", |
| 109 |
op->arch->name, op->stats.maxhp, op->stats.dam, op->stats.ac, |
| 110 |
op->stats.wc, attbuf); |
| 111 |
for (i = 0; i < NROFATTACKS; i++) |
| 112 |
printf("%4d", op->resist[i]); |
| 113 |
printf("|%8"FMT64"|%9"FMT64"|\n", op->stats.exp, new_exp(op)); |
| 114 |
} |
| 115 |
object_free_drop_inventory(op); |
| 116 |
} |
| 117 |
} |