return it->second;
}
-const magic_type &PlayerRealm::get_spell_info(int realm, int spell_idx)
+const magic_type &PlayerRealm::get_spell_info(int realm, int spell_idx, std::optional<PlayerClassType> pclass)
{
if (spell_idx < 0 || 32 <= spell_idx) {
THROW_EXCEPTION(std::invalid_argument, format("Invalid spell idx: %d", spell_idx));
const auto realm_enum = i2enum<magic_realm_type>(realm);
if (MAGIC_REALM_RANGE.contains(realm_enum)) {
+ if (pclass) {
+ return class_magics_info.at(enum2i(*pclass)).info[realm - 1][spell_idx];
+ }
return mp_ptr->info[realm - 1][spell_idx];
}
if (TECHNIC_REALM_RANGE.contains(realm_enum)) {
#include "system/angband.h"
#include "util/flag-group.h"
#include <cstdint>
+#include <optional>
#include <vector>
using RealmChoices = FlagGroup<magic_realm_type, REALM_MAX>;
PlayerRealm(PlayerType *player_ptr);
static const LocalizedString &get_name(int realm);
- static const magic_type &get_spell_info(int realm, int num);
+ static const magic_type &get_spell_info(int realm, int num, std::optional<PlayerClassType> pclass = std::nullopt);
static ItemKindType get_book(int realm);
static RealmChoices get_realm1_choices(PlayerClassType pclass);
static RealmChoices get_realm2_choices(PlayerClassType pclass);