<ClCompile Include="..\..\src\object-hook\hook-weapon.c" />\r
<ClCompile Include="..\..\src\object-hook\hook-armor.c" />\r
<ClCompile Include="..\..\src\player\bad-status-setter.c" />\r
+ <ClCompile Include="..\..\src\player\player-realm.c" />\r
<ClCompile Include="..\..\src\spell-kind\spells-curse-removal.c" />\r
<ClCompile Include="..\..\src\spell-kind\spells-perception.c" />\r
<ClCompile Include="..\..\src\spell-kind\spells-recall.c" />\r
<ClInclude Include="..\..\src\object-hook\hook-quest.h" />\r
<ClInclude Include="..\..\src\object-hook\hook-weapon.h" />\r
<ClInclude Include="..\..\src\player\bad-status-setter.h" />\r
+ <ClInclude Include="..\..\src\player\player-realm.h" />\r
<ClInclude Include="..\..\src\player\special-defense-types.h" />\r
<ClInclude Include="..\..\src\spell-kind\spells-curse-removal.h" />\r
<ClInclude Include="..\..\src\spell-kind\spells-perception.h" />\r
<ClCompile Include="..\..\src\object\item-tester-hooker.c">
<Filter>object</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\player\player-realm.c">
+ <Filter>player</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\cmd\cmd-basic.h">
<ClInclude Include="..\..\src\object\item-tester-hooker.h">
<Filter>object</Filter>
</ClInclude>
+ <ClInclude Include="..\..\src\player\player-realm.h">
+ <Filter>player</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\wall.bmp" />
player/player-personality.c player/player-personality.h \
player/player-race.c player/player-race.h \
player/player-race-types.h \
+ player/player-realm.c player/player-realm.h \
player/player-skill.c player/player-skill.h \
player/player-status.c player/player-status.h \
player/player-personalities-types.h \
#include "object/object-kind.h"
#include "object/object-info.h"
#include "perception/object-perception.h"
+#include "player/player-realm.h"
#include "util/quarks.h"
#include "util/string-processor.h"
if (o_ptr->tval != TV_ARCANE_BOOK) name = FALSE;
}
- if (REALM1_BOOK == o_ptr->tval &&
+ if (get_realm1_book(player_ptr) == o_ptr->tval &&
player_ptr->pclass != CLASS_SORCERER &&
player_ptr->pclass != CLASS_RED_MAGE)
{
name = FALSE;
}
- if (REALM2_BOOK == o_ptr->tval &&
+ if (get_realm2_book(player_ptr) == o_ptr->tval &&
player_ptr->pclass != CLASS_SORCERER &&
player_ptr->pclass != CLASS_RED_MAGE)
{
#include "object/object-value.h"
#include "object/object-info.h"
#include "object-enchant/special-object-flags.h"
+#include "player/player-realm.h"
#include "util/string-processor.h"
/*
check_book_realm(player_ptr, o_ptr->tval, o_ptr->sval)))
return FALSE;
- if (IS_FLG(FLG_REALM1) &&
- (REALM1_BOOK != o_ptr->tval ||
+ if (IS_FLG(FLG_REALM1) && (get_realm1_book(player_ptr) != o_ptr->tval ||
player_ptr->pclass == CLASS_SORCERER ||
player_ptr->pclass == CLASS_RED_MAGE))
return FALSE;
- if (IS_FLG(FLG_REALM2) &&
- (REALM2_BOOK != o_ptr->tval ||
+ if (IS_FLG(FLG_REALM2) && (get_realm2_book(player_ptr) != o_ptr->tval ||
player_ptr->pclass == CLASS_SORCERER ||
player_ptr->pclass == CLASS_RED_MAGE))
return FALSE;
#include "player/player-class.h"
#include "player/player-damage.h"
#include "player/player-effects.h"
+#include "player/player-realm.h"
#include "player/player-skill.h"
#include "player/player-status.h"
#include "player/selfinfo.h"
/* Access the item's sval */
sval = o_ptr->sval;
- if (o_ptr->tval == REALM2_BOOK) increment = 32;
- else if (o_ptr->tval != REALM1_BOOK)
+ if (o_ptr->tval == get_realm2_book(caster_ptr)) increment = 32;
+ else if (o_ptr->tval != get_realm1_book(caster_ptr))
{
if (!get_check(_("本当に魔法の領域を変更しますか?", "Really, change magic realm? "))) return;
change_realm2(caster_ptr, tval2realm(o_ptr->tval));
/* Access the item's sval */
sval = o_ptr->sval;
- if ((caster_ptr->pclass != CLASS_SORCERER) && (caster_ptr->pclass != CLASS_RED_MAGE) && (o_ptr->tval == REALM2_BOOK)) increment = 32;
+ if ((caster_ptr->pclass != CLASS_SORCERER) && (caster_ptr->pclass != CLASS_RED_MAGE) && (o_ptr->tval == get_realm2_book(caster_ptr))) increment = 32;
/* Track the object kind */
object_kind_track(caster_ptr, o_ptr->k_idx);
#include "object/object-flags.h"
#include "perception/object-perception.h"
#include "player/player-class.h"
+#include "player/player-realm.h"
#include "realm/realm-names-table.h"
#include "system/object-type-definition.h"
#include "util/bit-flags-calculator.h"
else if (!is_magic(tval2realm(o_ptr->tval)))
return FALSE;
- return (REALM1_BOOK == o_ptr->tval) || (REALM2_BOOK == o_ptr->tval) || (choices & (0x0001 << (tval2realm(o_ptr->tval) - 1)));
+ return (get_realm1_book(player_ptr) == o_ptr->tval) || (get_realm2_book(player_ptr) == o_ptr->tval) || (choices & (0x0001 << (tval2realm(o_ptr->tval) - 1)));
}
/*!
#include "object-enchant/object-ego.h"
#include "object/object-flags.h"
#include "object/object-kind.h"
+#include "player/player-realm.h"
#include "realm/realm-names-table.h"
#include "sv-definition/sv-other-types.h"
#include "sv-definition/sv-ring-types.h"
return ((book_tval == TV_ARCANE_BOOK) || (book_sval < 2));
}
- return (REALM1_BOOK == book_tval || REALM2_BOOK == book_tval);
+ return (get_realm1_book(owner_ptr) == book_tval || get_realm2_book(owner_ptr) == book_tval);
}
object_type *ref_item(player_type *owner_ptr, INVENTORY_IDX item)
--- /dev/null
+#include "player/player-realm.h"
+#include "object/tval-types.h"
+
+REALM_IDX get_realm1_book(player_type* player_ptr) { return player_ptr->realm1 + TV_LIFE_BOOK - 1; }
+
+REALM_IDX get_realm2_book(player_type *player_ptr) { return player_ptr->realm2 + TV_LIFE_BOOK - 1; }
--- /dev/null
+#pragma once
+
+#include "system/angband.h"
+
+/* Magic-books for the realms */
+REALM_IDX get_realm1_book(player_type *player_ptr);
+REALM_IDX get_realm2_book(player_type *player_ptr);
#define MAGIC_FAIL_5PERCENT 0x0002
#define MAGIC_GAIN_EXP 0x0004
-/*
- * todo ここからp_ptrを消すと、object-hookにある大量の関数ポインタを全部修正する必要がある
- * 影響範囲が広すぎるので保留
- * Magic-books for the realms
- */
-#define REALM1_BOOK (p_ptr->realm1 + TV_LIFE_BOOK - 1)
-#define REALM2_BOOK (p_ptr->realm2 + TV_LIFE_BOOK - 1)
-
/* no_flowed 判定対象となるスペル */
#define SPELL_DD_S 27
#define SPELL_DD_T 13
#include "object-hook/hook-enchant.h"
#include "object/object-value.h"
#include "perception/object-perception.h"
+#include "player/player-realm.h"
/*!
* @brief オブジェクトを定義された基準に従いソートするための関数 /
if (!j_ptr->k_idx)
return TRUE;
- if ((o_ptr->tval == REALM1_BOOK) && (j_ptr->tval != REALM1_BOOK))
+ if ((o_ptr->tval == get_realm1_book(player_ptr)) && (j_ptr->tval != get_realm1_book(player_ptr)))
return TRUE;
- if ((j_ptr->tval == REALM1_BOOK) && (o_ptr->tval != REALM1_BOOK))
+ if ((j_ptr->tval == get_realm1_book(player_ptr)) && (o_ptr->tval != get_realm1_book(player_ptr)))
return FALSE;
- if ((o_ptr->tval == REALM2_BOOK) && (j_ptr->tval != REALM2_BOOK))
+ if ((o_ptr->tval == get_realm2_book(player_ptr)) && (j_ptr->tval != get_realm2_book(player_ptr)))
return TRUE;
- if ((j_ptr->tval == REALM2_BOOK) && (o_ptr->tval != REALM2_BOOK))
+ if ((j_ptr->tval == get_realm2_book(player_ptr)) && (o_ptr->tval != get_realm2_book(player_ptr)))
return FALSE;
if (o_ptr->tval > j_ptr->tval)