static void class_help(int i, void *db, const region *l) { int j; size_t k; struct player_class *c = player_id2class(i); int len = (A_MAX + 1) / 2; int n_flags = 0; int flag_space = 5; if (!c) return; /* Output to the screen */ text_out_hook = text_out_to_screen; /* Indent output */ text_out_indent = CLASS_AUX_COL; Term_gotoxy(CLASS_AUX_COL, TABLE_ROW); for (j = 0; j < len; j++) { const char *name1 = stat_names_reduced[j]; const char *name2 = stat_names_reduced[j + len]; int adj1 = c->c_adj[j]; int adj2 = c->c_adj[j + len]; text_out_e("%s%+3d %s%+3d\n", name1, adj1, name2, adj2); } text_out_e("\n"); skill_help(c->c_skills, c->c_mhp, c->c_exp, -1); if (c->spell_book == TV_MAGIC_BOOK) { text_out_e("\nLearns arcane magic"); } else if (c->spell_book == TV_PRAYER_BOOK) { text_out_e("\nLearns divine magic"); } for (k = 0; k < PF_MAX; k++) { const char *s; if (n_flags >= flag_space) break; if (!pf_has(c->pflags, k)) continue; s = get_pflag_desc(k); if (!s) continue; text_out_e("\n%s", s); n_flags++; } while(n_flags < flag_space) { text_out_e("\n"); n_flags++; } /* Reset text_out() indentation */ text_out_indent = 0; }
static void race_help(int i, void *db, const region *l) { int j; size_t k; struct player_race *r = player_id2race(i); int len = (A_MAX + 1) / 2; int n_flags = 0; int flag_space = 3; if (!r) return; /* Output to the screen */ text_out_hook = text_out_to_screen; /* Indent output */ text_out_indent = RACE_AUX_COL; Term_gotoxy(RACE_AUX_COL, TABLE_ROW); for (j = 0; j < len; j++) { const char *name1 = stat_names_reduced[j]; const char *name2 = stat_names_reduced[j + len]; int adj1 = r->r_adj[j]; int adj2 = r->r_adj[j + len]; text_out_e("%s%+3d %s%+3d\n", name1, adj1, name2, adj2); } text_out_e("\n"); skill_help(r->r_skills, r->r_mhp, r->r_exp, r->infra); text_out_e("\n"); for (k = 0; k < OF_MAX; k++) { if (n_flags >= flag_space) break; if (!of_has(r->flags, k)) continue; text_out_e("\n%s", get_flag_desc(k)); n_flags++; } for (k = 0; k < PF_MAX; k++) { if (n_flags >= flag_space) break; if (!pf_has(r->pflags, k)) continue; text_out_e("\n%s", get_pflag_desc(k)); n_flags++; } while(n_flags < flag_space) { text_out_e("\n"); n_flags++; } /* Reset text_out() indentation */ text_out_indent = 0; }
/** * Check if we can gain a specialty ability -BR- */ bool check_specialty_gain(int specialty) { int i; /* Can't learn it if we already know it */ for (i = 0; i < MAX_SPECIALTIES; i++) { if (p_ptr->specialty_order[i] == specialty) return (FALSE); } /* Is it allowed for this class? */ if (pf_has(cp_ptr->specialties, specialty) && (abilities[specialty].type == PLAYER_FLAG_SPECIAL)) return (TRUE); return FALSE; }
/** * Turn off spells with a side effect or a gf_type that is resisted by * something in flags, subject to intelligence and chance. * * \param spells is the set of spells we're pruning * \param flags is the set of object flags we're testing * \param pflags is the set of player flags we're testing * \param el is what we know about the monster's elemental resists * \param race is the monster type we're operating on */ void unset_spells(bitflag *spells, bitflag *flags, bitflag *pflags, struct element_info *el, const struct monster_race *race) { const struct mon_spell_info *info; bool smart = rf_has(race->flags, RF_SMART); for (info = mon_spell_types; info->index < RSF_MAX; info++) { const struct monster_spell *spell = monster_spell_by_index(info->index); const struct effect *effect; /* Ignore missing spells */ if (!spell) continue; if (!rsf_has(spells, info->index)) continue; /* Get the effect */ effect = spell->effect; /* First we test the elemental spells */ if (info->type & (RST_BOLT | RST_BALL | RST_BREATH)) { int element = effect->params[0]; int learn_chance = el[element].res_level * (smart ? 50 : 25); if (randint0(100) < learn_chance) rsf_off(spells, info->index); } else { /* Now others with resisted effects */ while (effect) { /* Timed effects */ if ((smart || !one_in_(3)) && (effect->index == EF_TIMED_INC) && of_has(flags, timed_protect_flag(effect->params[0]))) break; /* Mana drain */ if ((smart || one_in_(2)) && (effect->index == EF_DRAIN_MANA) && pf_has(pflags, PF_NO_MANA)) break; effect = effect->next; } if (effect) rsf_off(spells, info->index); } } }
static void class_help(int i, void *db, const region *l) { int j; size_t k; struct player_class *c = player_id2class(i); const struct player_race *r = player->race; int len = (STAT_MAX + 1) / 2; int n_flags = 0; int flag_space = 5; if (!c) return; /* Output to the screen */ text_out_hook = text_out_to_screen; /* Indent output */ text_out_indent = CLASS_AUX_COL; Term_gotoxy(CLASS_AUX_COL, TABLE_ROW); for (j = 0; j < len; j++) { const char *name = stat_names_reduced[j]; int adj = c->c_adj[j] + r->r_adj[j]; text_out_e("%s%+3d", name, adj); if (j*2 + 1 < STAT_MAX) { name = stat_names_reduced[j + len]; adj = c->c_adj[j + len] + r->r_adj[j + len]; text_out_e(" %s%+3d", name, adj); } text_out("\n"); } text_out_e("\n"); skill_help(r->r_skills, c->c_skills, r->r_mhp + c->c_mhp, r->r_exp + c->c_exp, -1); if (c->magic.spell_realm->index != REALM_NONE) text_out_e("\nLearns %s magic", c->magic.spell_realm->adjective); for (k = 0; k < PF_MAX; k++) { const char *s; if (n_flags >= flag_space) break; if (!pf_has(c->pflags, k)) continue; s = get_pflag_desc(k); if (!s) continue; text_out_e("\n%s", s); n_flags++; } while(n_flags < flag_space) { text_out_e("\n"); n_flags++; } /* Reset text_out() indentation */ text_out_indent = 0; }