/* * Checks various stuff to do when skills change, like new spells, ... */ void recalc_skills(bool init) { static int thaum_level = 0; /* TODO: This should be a hook in ToME's lua */ if (init) { thaum_level = get_skill_scale(SKILL_THAUMATURGY, 100); } else { int thaum_gain = 0; /* Gain thaum spells */ while (thaum_level < get_skill_scale(SKILL_THAUMATURGY, 100)) { if (spell_num == MAX_SPELLS) break; thaum_level++; generate_spell((thaum_level + 1) / 2); thaum_gain++; } if (thaum_gain) { if (thaum_gain == 1) msg_print("You have gained one new thaumaturgy spell."); else msg_format("You have gained %d new thaumaturgy spells.", thaum_gain); } process_hooks(HOOK_RECALC_SKILLS, "()"); /* Update stuffs */ p_ptr->update |= (PU_BONUS | PU_HP | PU_MANA | PU_SPELLS | PU_POWERS | PU_SANITY | PU_BODY); /* Redraw various info */ p_ptr->redraw |= (PR_WIPE | PR_BASIC | PR_EXTRA | PR_MAP); } }
/* Returns if a new companion is allowed */ bool can_create_companion(void) { s32b i, mcnt = 0; for_flags(&monst_list); { i = __key; /* Access the monster */ monster_type *m_ptr = get_monster(i); /* Ignore "dead" monsters */ if (!m_ptr->r_idx) continue; if ((m_ptr->faction == FACTION_PLAYER) && has_flag(m_ptr, FLAG_PERMANENT)) mcnt++; } end_for_flags(); if (mcnt < (1 + get_skill_scale(SKILL_LORE, 6))) return (TRUE); else return (FALSE); }