diff --git a/TemplePlus/feat.cpp b/TemplePlus/feat.cpp index bf7006225..42ff2b2d0 100644 --- a/TemplePlus/feat.cpp +++ b/TemplePlus/feat.cpp @@ -935,7 +935,7 @@ uint32_t LegacyFeatSystem::FeatPrereqsCheck(objHndl objHnd, feat_enums featIdx, // Class Level else if (featReqCode >= stat_level_barbarian && featReqCode <= stat_level_shadow_sun_ninja) { if (classCodeBeingLevelledUp == featReqCode) { featReqCodeArg--; } - if ((int)objects.StatLevelGet(objHnd, (Stat)featReqCode) < featReqCodeArg) { return 0; } + if (objects.StatLevelGet(objHnd, (Stat)featReqCode) < featReqCodeArg) { return 0; } } // BAB else if (featReqCode == stat_attack_bonus){ diff --git a/TemplePlus/feat.h b/TemplePlus/feat.h index 1e326ad8b..68f2d7e75 100644 --- a/TemplePlus/feat.h +++ b/TemplePlus/feat.h @@ -53,7 +53,7 @@ struct ClassFeatTable struct FeatPrereq { - int featPrereqCode; + int featPrereqCode; // see feat_requirement_codes int featPrereqCodeArg; }; diff --git a/TemplePlus/python/python_object.cpp b/TemplePlus/python/python_object.cpp index 6a2280932..5af52e858 100644 --- a/TemplePlus/python/python_object.cpp +++ b/TemplePlus/python/python_object.cpp @@ -49,15 +49,6 @@ namespace py = pybind11; -// Helper function for checking if information should be updated with chargen packet info -bool UpdateWithChargenPacketInfo(objHndl handle) { - - // Check that the query: 1) is for the character being edited, 2) is not about a new character (snice the changes - // would already be added in that case) and 3) that the feat page is up (info from the packet should only affect - // the availability of feats not which character classes are available) - return (handle == chargen.GetEditedChar() && !chargen.IsNewChar() && chargen.IsSelectingFeats()); -} - struct PyObjHandle { PyObject_HEAD; ObjectId id; @@ -634,14 +625,6 @@ static PyObject* PyObjHandle_SkillLevelGet(PyObject* obj, PyObject* args) { auto skillLevel = dispatch.dispatch1ESkillLevel(self->handle, skillId, nullptr, handle, 1); - // Add additional skill points from the character editor if necessary - if (UpdateWithChargenPacketInfo(self->handle)) { - auto charPkt = chargen.GetCharEditorSelPacket(); - if (skillId < skill_count) { - skillLevel += charPkt.skillPointsAdded[skillId]; - } - } - return PyInt_FromLong(skillLevel); } @@ -660,14 +643,6 @@ static PyObject* PyObjHandle_SkillRanksGet(PyObject* obj, PyObject* args) { auto skillRanks = critterSys.SkillBaseGet(self->handle, skillId); - // Add additional skill points from the character editor if necessary - if (UpdateWithChargenPacketInfo(self->handle)) { - auto charPkt = chargen.GetCharEditorSelPacket(); - if (skillId < skill_count) { - skillRanks += charPkt.skillPointsAdded[skillId]; - } - } - return PyInt_FromLong(skillRanks); } @@ -744,17 +719,6 @@ static PyObject* PyObjHandle_GetBaseAttackBonus(PyObject* obj, PyObject* args) { auto bab = critterSys.GetBaseAttackBonus(self->handle); - // Recalculate bab based on new class level from character editor if necessary - if (UpdateWithChargenPacketInfo(self->handle)) { - auto charPkt = chargen.GetCharEditorSelPacket(); - - // Subtract the current base attack bouns for that character level from the new and add to the bab - int levelupClassLevel = objects.StatLevelGet(self->handle, charPkt.classCode); - int babCur = d20ClassSys.GetBaseAttackBonus(charPkt.classCode, levelupClassLevel); - int babNext = d20ClassSys.GetBaseAttackBonus(charPkt.classCode, levelupClassLevel+1); - int babDelta = babNext - babCur; - bab += babDelta; - } return PyInt_FromLong(bab); } @@ -774,22 +738,6 @@ static PyObject* PyObjHandle_StatLevelGet(PyObject* obj, PyObject* args) { auto statLevel = objects.StatLevelGet(self->handle, stat); - // Check on raising attribute or character level - if (UpdateWithChargenPacketInfo(self->handle)) { - auto charPkt = chargen.GetCharEditorSelPacket(); - - // Increase character level if appropriate - if (charPkt.classCode == stat) { - statLevel++; - } - - // Report 1 higher if the stat is being raised - if (stat == charPkt.statBeingRaised) { - statLevel++; - } - - } - return PyInt_FromLong(statLevel); } @@ -2593,35 +2541,6 @@ static PyObject* PyObjHandle_GetInt(PyObject* obj, PyObject* args) { { value = objects.getInt32(self->handle, field); - if (UpdateWithChargenPacketInfo(self->handle)) { - auto charPkt = chargen.GetCharEditorSelPacket(); - - // If this is the first level of cleric, return the selected alignmetn choice - if (field == stat_alignment_choice) { - if (charPkt.classCode == stat_level_cleric) { - int clericLevel = objects.StatLevelGet(self->handle, charPkt.classCode); - if (clericLevel == 1) { - value = charPkt.alignmentChoice; - } - } - } - - // Check if this character is being edited, if so take that into account - if (UpdateWithChargenPacketInfo(self->handle)) { - if (charPkt.classCode == stat_level_cleric) { - int clericLevel = objects.StatLevelGet(self->handle, charPkt.classCode); - if (clericLevel == 0) { //Must be the first cleric level - if (field == obj_f_critter_domain_1) { - value = charPkt.domain1; - } - if (field == obj_f_critter_domain_2) { - value = charPkt.domain2; - } - } - } - } - } - } else if (objectFields.GetType(field) == ObjectFieldType::Float32) { value = (int) objSystem->GetObject(self->handle)->GetFloat(field); @@ -2716,36 +2635,8 @@ static PyObject* PyObjHandle_HasFeat(PyObject* obj, PyObject* args) { uint32_t domain2 = 0; uint32_t alignmentChoice = 0; - // Update domains and alignment choice with info from the character editor if appropriate - if (UpdateWithChargenPacketInfo(self->handle)) { - auto charPkt = chargen.GetCharEditorSelPacket(); - levelRaised = charPkt.classCode; - if (levelRaised == stat_level_cleric) { - domain1 = charPkt.domain1; - domain2 = charPkt.domain2; - alignmentChoice = charPkt.alignmentChoice; - } - } - auto result = feats.HasFeatCountByClass(self->handle, feat, levelRaised, 0, domain1, domain2, alignmentChoice); - //Incriment the feat count if the feat has been selected on the levelup interface - if (UpdateWithChargenPacketInfo(self->handle)) { - auto charPkt = chargen.GetCharEditorSelPacket(); - if (feat == charPkt.feat0) { - result++; - } - if (feat == charPkt.feat1) { - result++; - } - if (feat == charPkt.feat2) { - result++; - } - if (feat == charPkt.feat3) { - result++; - } - } - return PyInt_FromLong(result); } diff --git a/TemplePlus/ui/ui_char_editor.cpp b/TemplePlus/ui/ui_char_editor.cpp index 81df8a314..929ed6b4e 100644 --- a/TemplePlus/ui/ui_char_editor.cpp +++ b/TemplePlus/ui/ui_char_editor.cpp @@ -35,11 +35,12 @@ #include #include "ui_assets.h" #include +#include "gamesystems/deity/legacydeitysystem.h" namespace py = pybind11; Chargen chargen; - +temple::GlobalStruct lgcySystems; class UiCharEditor { friend class UiCharEditorHooks; public: @@ -93,6 +94,9 @@ class UiCharEditor { #pragma region Widget callbacks void StateTitleRender(int widId); + void MainWndRender(int widId); + + void ClassBtnRender(int widId); BOOL ClassBtnMsg(int widId, TigMsg* msg); BOOL ClassNextBtnMsg(int widId, TigMsg* msg); @@ -134,10 +138,11 @@ class UiCharEditor { eastl::vector classBtnMapping; // used as an index of choosable character classes int GetClassWndPage(); Stat GetClassCodeFromWidgetAndPage(int idx, int page); - int GetStatesComplete(); + int &GetStatesComplete(); // logic void ClassSetPermissibles(); + bool ClassSanitize(); // re-check class requirements. Returns true if re-evaluation is required. bool IsSelectingNormalFeat(); // the normal feat you get every 3rd level in 3.5ed bool IsSelectingBonusFeat(); // selecting a class bonus feat @@ -379,6 +384,114 @@ PYBIND11_EMBEDDED_MODULE(char_editor, mm) { // methods #pragma region methods mm + .def("stat_level_get", [](int statEnum, int statArg)->int{ + auto stat = (Stat)statEnum; + auto handle = chargen.GetEditedChar(); + auto &charPkt = chargen.GetCharEditorSelPacket(); + + auto statLvl = 0; + if (statArg != -1) + statLvl = objects.StatLevelGet(handle, stat, statArg); + else + statLvl = objects.StatLevelGet(handle, stat); + + // Increase character level if appropriate + if (!chargen.IsNewChar()){ + if (charPkt.classCode == stat) { + statLvl++; + } + // Report 1 higher if the stat is being raised + if (stat == charPkt.statBeingRaised) { + statLvl++; + } + } + + return statLvl; + }, py::arg("stat"), py::arg("stat_arg") = -1) + .def("skill_level_get", [](int skillEnum)->int { + auto skill = (SkillEnum)skillEnum; + auto handle = chargen.GetEditedChar(); + auto &charPkt = chargen.GetCharEditorSelPacket(); + + auto skillLevel = critterSys.SkillLevel(handle, skill); + + // Add additional skill points from the character editor if necessary + + if (!chargen.IsNewChar()) { + auto levelRaised = charPkt.classCode; + auto pointsSpent = 0; + if (skill >= 0 && skill < skill_count) { + pointsSpent += charPkt.skillPointsAdded[skill]; + } + // Check if class skill - if not, halve their contribution (TODO sucks if skillLevel itself was rounded down :( ) + auto numAdded = pointsSpent/2; + if (d20ClassSys.IsClassSkill(skill, levelRaised) || + (levelRaised == stat_level_cleric && deitySys.IsDomainSkill(handle, skill)) + || d20Sys.D20QueryPython(handle, "Is Class Skill", skill)) { + numAdded = pointsSpent; + } + + skillLevel += numAdded; + + } + return skillLevel; + }) + .def("skill_ranks_get", [](int skillEnum)->int { + auto skill = (SkillEnum)skillEnum; + auto handle = chargen.GetEditedChar(); + auto &charPkt = chargen.GetCharEditorSelPacket(); + + // Add additional skill points from the character editor if necessary + auto skillRanks = critterSys.SkillBaseGet(handle, skill); + + if (!chargen.IsNewChar()){ + if (skill < skill_count) { + skillRanks += charPkt.skillPointsAdded[skill]; + } + } + return skillRanks; + }) + .def("has_feat", [](int featEnum)->int{ + auto feat = (feat_enums)featEnum; + auto handle = chargen.GetEditedChar(); + auto &charPkt = chargen.GetCharEditorSelPacket(); + + auto levelRaised = charPkt.classCode; + if (chargen.IsNewChar()) + levelRaised = (Stat)0; + + uint32_t domain1 = Domain_None; + uint32_t domain2 = Domain_None; + uint32_t alignmentChoice = 0; + + if (!chargen.IsNewChar()){ + if (levelRaised == stat_level_cleric) { + domain1 = charPkt.domain1; + domain2 = charPkt.domain2; + alignmentChoice = charPkt.alignmentChoice; + } + } + + + auto result = feats.HasFeatCountByClass(handle, feat, levelRaised, 0, domain1, domain2, alignmentChoice); + + if (feat == charPkt.feat0) { + result++; + } + if (feat == charPkt.feat1) { + result++; + } + if (feat == charPkt.feat2) { + result++; + } + if (feat == charPkt.feat3) { + result++; + } + + return result; + + }) + .def("set_bonus_feats", [](std::vector & fti){ chargen.SetBonusFeats(fti); }) @@ -1075,13 +1188,13 @@ BOOL UiCharEditor::FeatsWidgetsResize(UiResizeArgs & args){ bool UiCharEditor::IsSelectingFeats() { - bool bRes = false; + auto result = false; if (uiManager) { - bRes = !uiManager->IsHidden(featsMainWndId); + result = !uiManager->IsHidden(featsMainWndId); } - return bRes; + return result; } BOOL UiCharEditor::FeatsShow(){ @@ -1388,6 +1501,48 @@ void UiCharEditor::StateTitleRender(int widId){ UiRenderer::PopFont(); } +void UiCharEditor::MainWndRender(int widId){ + auto &dword_10BE9970 = temple::GetRef(0x10BE9970); + if (!dword_10BE9970){ + auto statesComplete = 0; + + auto stage = 0; + auto &mStagesComplete = GetStatesComplete(); + auto &selPkt = GetCharEditorSelPacket(); + auto &mActiveStage = GetState(); + + + for (stage = 0; stage < std::min(mStagesComplete + 1, (int)CharEditorStages::CE_STAGE_COUNT); stage++) { + auto &sys = lgcySystems[stage]; + if (!sys.checkComplete) + break; + if (!sys.checkComplete()) + break; + } + + if (stage != mStagesComplete) { + mStagesComplete = stage; + if (mActiveStage > stage) + mActiveStage = stage; + + // reset the next stages + for (auto nextStage = stage + 1; nextStage < CharEditorStages::CE_STAGE_COUNT; nextStage++) { + if (lgcySystems[nextStage].reset) { + lgcySystems[nextStage].reset(selPkt); + } + } + } + } + + auto wnd = uiManager->GetWindow(widId); + RenderHooks::RenderImgFile(temple::GetRef(0x10BE9974), wnd->x, wnd->y); + + UiRenderer::DrawTextureInWidget( widId, temple::GetRef(0x10BE993C), + {406, 15, 120, 227} , { 1,1,120,227 }); + + +} + void UiCharEditor::ClassBtnRender(int widId){ auto idx = WidgetIdIndexOf(widId, &classBtnIds[0], classBtnIds.size()); if (idx == -1) @@ -1450,6 +1605,10 @@ BOOL UiCharEditor::ClassBtnMsg(int widId, TigMsg * msg){ GetCharEditorSelPacket().classCode = classCode; PrepareNextStages(); temple::GetRef(0x10143FF0)(0); // resets all the next systems in case of change + if (ClassSanitize()) { // resets the chosen class in case the user cheats (e.g. by selecting skills up ahead) + PrepareNextStages(); + temple::GetRef(0x10143FF0)(0); // resets all the next systems in case of change + } return 1; } @@ -2870,7 +3029,7 @@ Stat UiCharEditor::GetClassCodeFromWidgetAndPage(int idx, int page){ return (Stat)classBtnMapping[idx2]; } -int UiCharEditor::GetStatesComplete(){ +int& UiCharEditor::GetStatesComplete(){ return temple::GetRef(0x10BE8D38); } @@ -2908,6 +3067,18 @@ void UiCharEditor::ClassSetPermissibles(){ uiManager->SetButtonState(classNextBtn, LgcyButtonState::Disabled); } +bool UiCharEditor::ClassSanitize(){ + auto handle = GetEditedChar(); + auto &selPkt = GetCharEditorSelPacket(); + auto classCode = selPkt.classCode; + if (!d20ClassSys.ReqsMet(handle, classCode) || !pythonClassIntegration.IsAlignmentCompatible(handle, classCode)){ + selPkt.classCode = (Stat)0; + return true; + } + + return false; +} + int UiCharEditor::GetNewLvl(Stat classEnum){ // default is classEnum = stat_level i.e. get the overall new level auto handle = GetEditedChar(); @@ -2922,6 +3093,10 @@ class UiCharEditorHooks : public TempleFix { void apply() override { // general + replaceFunction(0x10148880, [](int widId){ + uiCharEditor.MainWndRender(widId); + }); + replaceFunction(0x101B0760, []() { uiCharEditor.PrepareNextStages(); }); diff --git a/TemplePlus/ui/ui_char_editor.h b/TemplePlus/ui/ui_char_editor.h index fa98e8c92..b703715ee 100644 --- a/TemplePlus/ui/ui_char_editor.h +++ b/TemplePlus/ui/ui_char_editor.h @@ -28,20 +28,16 @@ enum FeatInfoFlag }; -struct LegacyCharEditorSystem{ - const char* name; - BOOL(__cdecl *systemInit)(GameSystemConf *); - BOOL(__cdecl *systemResize)(void *); - int systemReset; // unused - void(__cdecl *free)(); - void(__cdecl *hide)(); - void(__cdecl *show)(); - BOOL(__cdecl *checkComplete)(); // checks if the char editing stage is complete (thus allowing you to move on to the next stage). This is checked at every render call. - void(__cdecl *finalize)(CharEditorSelectionPacket &selPkt, objHndl &handle); //applies the configuration when clicking the "finish" button - void(__cdecl *reset)(CharEditorSelectionPacket & editSpec); - BOOL(__cdecl *activate)(); // inits values and sets appropriate states for buttons based on gameplay logic (e.g. stuff exclusive to certain classes etc.) -}; +enum CharEditorStages : int { + CE_Stage_Class = 0, + CE_Stage_Stats, + CE_Stage_Features, + CE_Stage_Skills, + CE_Stage_Feats, + CE_Stage_Spells, + CE_STAGE_COUNT +}; class CharEditorSystem { public: diff --git a/TemplePlus/ui/ui_chargen.h b/TemplePlus/ui/ui_chargen.h index ff6430da5..7b5a7a4fb 100644 --- a/TemplePlus/ui/ui_chargen.h +++ b/TemplePlus/ui/ui_chargen.h @@ -3,6 +3,7 @@ #include "widgets/widgets.h" class ChargenBigButton; +struct UiSystemConf; struct CharEditorSelectionPacket { int abilityStats[6]; @@ -118,4 +119,33 @@ class IPagedButton class ChargenPagedButton : public ChargenBigButton, public IPagedButton { +}; + +class LgcyChargenSystem { +public: + const char* name; + void(*Reset)(CharEditorSelectionPacket & charSpec); + void(*Activate)(); + BOOL(*SystemInit)(const UiSystemConf *); + void(*Free)(); + BOOL(*Resize)(UiResizeArgs &resizeArgs); + void(*Hide)(); + void(*Show)(); + BOOL(*CheckComplete)(); // checks if the char editing stage is complete (thus allowing you to move on to the next stage). This is checked at every render call. + void(*Finalize)(CharEditorSelectionPacket & charSpec, objHndl & handle); + void(*ButtonExited)(); +}; + +struct LegacyCharEditorSystem { + const char* name; + BOOL(__cdecl *systemInit)(GameSystemConf *); + BOOL(__cdecl *systemResize)(void *); + int systemReset; // unused + void(__cdecl *free)(); + void(__cdecl *hide)(); + void(__cdecl *show)(); + BOOL(__cdecl *checkComplete)(); // checks if the char editing stage is complete (thus allowing you to move on to the next stage). This is checked at every render call. + void(__cdecl *finalize)(CharEditorSelectionPacket &selPkt, objHndl &handle); //applies the configuration when clicking the "finish" button + void(__cdecl *reset)(CharEditorSelectionPacket & editSpec); + BOOL(__cdecl *activate)(); // inits values and sets appropriate states for buttons based on gameplay logic (e.g. stuff exclusive to certain classes etc.) }; \ No newline at end of file diff --git a/TemplePlus/ui/ui_pc_creation.h b/TemplePlus/ui/ui_pc_creation.h index 09d105e41..899f0d80b 100644 --- a/TemplePlus/ui/ui_pc_creation.h +++ b/TemplePlus/ui/ui_pc_creation.h @@ -9,7 +9,6 @@ struct UiSystemConf; class CombinedImgFile; -class LgcyChargenSystem; enum ChargenStages : int { CG_Stage_Stats = 0, @@ -456,19 +455,3 @@ class UiPcCreation { int __cdecl PcCreationFeatUiPrereqCheck(feat_enums feat); extern UiPcCreation uiPcCreation; - - -class LgcyChargenSystem { -public: - const char* name; - void(*Reset)(CharEditorSelectionPacket & charSpec); - void(*Activate)(); - BOOL(*SystemInit)(const UiSystemConf *); - void(*Free)(); - BOOL(*Resize)(UiResizeArgs &resizeArgs); - void(*Hide)(); - void(*Show)(); - BOOL(*CheckComplete)(); // checks if the char editing stage is complete (thus allowing you to move on to the next stage). This is checked at every render call. - void(*Finalize)(CharEditorSelectionPacket & charSpec, objHndl & handle); - void(*ButtonExited)(); -}; diff --git a/tpdata/tpgamefiles.dat b/tpdata/tpgamefiles.dat index 7cc88e7a9..24276dcb0 100644 Binary files a/tpdata/tpgamefiles.dat and b/tpdata/tpgamefiles.dat differ diff --git a/tpdatasrc/tpgamefiles/rules/feats/craven.txt b/tpdatasrc/tpgamefiles/rules/feats/craven.txt index a351235e1..9c3d1bb59 100644 --- a/tpdatasrc/tpgamefiles/rules/feats/craven.txt +++ b/tpdatasrc/tpgamefiles/rules/feats/craven.txt @@ -1,5 +1,5 @@ name: Craven -flags: 8388608 +flags: 12582912 prereqs: -description: 1 extra damage per character level for sneak attacks, -2 to saving throws against fear. +description: 1 extra damage per character level for sneak attacks, -2 to saving throws against fear. prereq descr: Sneak Attack, Can't be immune to fear diff --git a/tpdatasrc/tpgamefiles/scr/feats/deft opportunist.txt b/tpdatasrc/tpgamefiles/rules/feats/deft opportunist.txt similarity index 62% rename from tpdatasrc/tpgamefiles/scr/feats/deft opportunist.txt rename to tpdatasrc/tpgamefiles/rules/feats/deft opportunist.txt index 5c3cec6fe..ea20088e8 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/deft opportunist.txt +++ b/tpdatasrc/tpgamefiles/rules/feats/deft opportunist.txt @@ -1,5 +1,5 @@ name: Deft Opportunist flags: 4194304 -prereqs: 1580 1 stat_dexterity 15 +prereqs: 1580 1 1 15 description: You get a +4 bonus on attack rolls when making attacks of opportunity. -prereq descr: Combat Reflexes, DEX 15 +prereq descr: Combat Reflexes, Dex 15 diff --git a/tpdatasrc/tpgamefiles/rules/feats/vexing flanker.txt b/tpdatasrc/tpgamefiles/rules/feats/vexing flanker.txt index 6d4550227..2775e686e 100644 --- a/tpdatasrc/tpgamefiles/rules/feats/vexing flanker.txt +++ b/tpdatasrc/tpgamefiles/rules/feats/vexing flanker.txt @@ -1,5 +1,5 @@ name: Vexing Flanker flags: 4194320 -prereqs: 1013 1 +prereqs: 1580 1 description: When you take this feat your flanking bonus becomes +4. prereq descr: Combat Reflexes diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Craven.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Craven.py index ee63501c7..b56efd8b5 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Craven.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Craven.py @@ -1,11 +1,11 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): #Sneak Attack Check - if not attachee.has_feat(feat_sneak_attack): + if not char_editor.has_feat(feat_sneak_attack): return 0 - if attachee.stat_level_get(stat_level_paladin) > 1: #workaround until I figure out how to check for immunity to fear + if char_editor.stat_level_get(stat_level_paladin) > 1: #workaround until I figure out how to check for immunity to fear return 0 return 1 diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Divine Armor.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Divine Armor.py index 2c99de26b..fc6830d16 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Divine Armor.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Divine Armor.py @@ -1,10 +1,10 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): #Req 1, turn undead feat - if not (attachee.has_feat(feat_turn_undead) or attachee.has_feat(feat_rebuke_undead)): + if not (char_editor.has_feat(feat_turn_undead) or char_editor.has_feat(feat_rebuke_undead)): return 0 #Req2, Divine Caster Level 5 diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Divine Shield.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Divine Shield.py index 6ef084ecb..2b94ff212 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Divine Shield.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Divine Shield.py @@ -1,14 +1,14 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): #Req 1, turn undead feat - if not (attachee.has_feat(feat_turn_undead) or attachee.has_feat(feat_rebuke_undead)): + if not (char_editor.has_feat(feat_turn_undead) or char_editor.has_feat(feat_rebuke_undead)): return 0 #Req2, shield proficency - if not attachee.has_feat(feat_shield_proficiency): + if not char_editor.has_feat(feat_shield_proficiency): return 0 return 1 diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Divine Vigor.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Divine Vigor.py index b11eb94b7..64b0bdcee 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Divine Vigor.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Divine Vigor.py @@ -1,10 +1,10 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): #Turn or rebuke undead feat - if (attachee.has_feat(feat_turn_undead) or attachee.has_feat(feat_rebuke_undead)): + if (char_editor.has_feat(feat_turn_undead) or char_editor.has_feat(feat_rebuke_undead)): return 1 return 0 diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Extend Rage.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Extend Rage.py index a320033f3..9f4f23a07 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Extend Rage.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Extend Rage.py @@ -1,10 +1,10 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): #Barbarian Rage Check - if not attachee.has_feat(feat_barbarian_rage): + if not char_editor.has_feat(feat_barbarian_rage): return 0 return 1 diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Extra Music.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Extra Music.py index 2424dbc7b..7be5e46ff 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Extra Music.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Extra Music.py @@ -1,9 +1,9 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): #Bardic Music Check - if not attachee.has_feat(feat_bardic_music): + if not char_editor.has_feat(feat_bardic_music): return 0 return 1 diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Extra Rage.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Extra Rage.py index a320033f3..9f4f23a07 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Extra Rage.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Extra Rage.py @@ -1,10 +1,10 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): #Barbarian Rage Check - if not attachee.has_feat(feat_barbarian_rage): + if not char_editor.has_feat(feat_barbarian_rage): return 0 return 1 diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Extra Smiting.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Extra Smiting.py index b4bed5638..a66ccc534 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Extra Smiting.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Extra Smiting.py @@ -1,5 +1,5 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): #Return zero if base attack bonus is too low @@ -7,7 +7,7 @@ def CheckPrereq(attachee, classLevelled, abilityScoreRaised): return 0 #Paladin Smite Evil Check - if attachee.has_feat(feat_smite_evil): + if char_editor.has_feat(feat_smite_evil): return 1 #Destruction Domain Check @@ -17,11 +17,11 @@ def CheckPrereq(attachee, classLevelled, abilityScoreRaised): return 1 #Blackguard Smite for level 2 or greater black guards - if attachee.stat_level_get(stat_level_blackguard) >= 2: + if char_editor.stat_level_get(stat_level_blackguard) >= 2: return 1 #Blackguard Smite for level 1 with at least one paladin level - if attachee.stat_level_get(stat_level_blackguard) == 1 and attachee.stat_level_get(stat_level_paladin) >= 1: + if char_editor.stat_level_get(stat_level_blackguard) == 1 and char_editor.stat_level_get(stat_level_paladin) >= 1: return 1 return 0 diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Improved Favored Enemy.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Improved Favored Enemy.py index b975ad7b5..5c768291b 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Improved Favored Enemy.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Improved Favored Enemy.py @@ -1,5 +1,5 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): @@ -9,7 +9,7 @@ def CheckPrereq(attachee, classLevelled, abilityScoreRaised): #Check for any favored enemy feat for i in range (feat_favored_enemy_aberration , feat_favored_enemy_humanoid_human): - if attachee.has_feat(i): + if char_editor.has_feat(i): return 1 return 0 diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Improved Rapid Shot.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Improved Rapid Shot.py index 8803e1ef6..223da01cc 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Improved Rapid Shot.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Improved Rapid Shot.py @@ -1,12 +1,12 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): #Many Shot, Point Blank Shot and Rapid Shot are required either standard feats or from the ranger class - if attachee.has_feat(feat_manyshot) or attachee.has_feat(feat_ranger_manyshot): - if attachee.has_feat(feat_rapid_shot) or attachee.has_feat(feat_ranger_rapid_shot): - if attachee.has_feat(feat_point_blank_shot): + if char_editor.has_feat(feat_manyshot) or char_editor.has_feat(feat_ranger_manyshot): + if char_editor.has_feat(feat_rapid_shot) or char_editor.has_feat(feat_ranger_rapid_shot): + if char_editor.has_feat(feat_point_blank_shot): return 1 return 0 diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Melee Weapon Mastery - Slashing.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Melee Weapon Mastery - Slashing.py index e323acc7b..0ea37e7b8 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Melee Weapon Mastery - Slashing.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Melee Weapon Mastery - Slashing.py @@ -1,5 +1,5 @@ from toee import * - +import char_editor featDamType = D20DT_SLASHING def CheckPrereq(attachee, classLevelled, abilityScoreRaised): diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Practiced Spellcaster - Arcane.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Practiced Spellcaster - Arcane.py index 0ef26e989..6c2540a9e 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Practiced Spellcaster - Arcane.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Practiced Spellcaster - Arcane.py @@ -1,8 +1,8 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): - spellcraft_level = attachee.skill_ranks_get(skill_spellcraft) + spellcraft_level = char_editor.skill_ranks_get(skill_spellcraft) if spellcraft_level < 4: return 0 return 1 \ No newline at end of file diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Practiced Spellcaster - Divine.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Practiced Spellcaster - Divine.py index 0ef26e989..6c2540a9e 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Practiced Spellcaster - Divine.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Practiced Spellcaster - Divine.py @@ -1,8 +1,8 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): - spellcraft_level = attachee.skill_ranks_get(skill_spellcraft) + spellcraft_level = char_editor.skill_ranks_get(skill_spellcraft) if spellcraft_level < 4: return 0 return 1 \ No newline at end of file diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Practiced Spellcaster.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Practiced Spellcaster.py index 0ef26e989..6c2540a9e 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Practiced Spellcaster.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Practiced Spellcaster.py @@ -1,8 +1,8 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): - spellcraft_level = attachee.skill_ranks_get(skill_spellcraft) + spellcraft_level = char_editor.skill_ranks_get(skill_spellcraft) if spellcraft_level < 4: return 0 return 1 \ No newline at end of file diff --git a/tpdatasrc/tpgamefiles/scr/feats/feat - Rapid Metamagic.py b/tpdatasrc/tpgamefiles/scr/feats/feat - Rapid Metamagic.py index 6cafd7587..1cc609ce9 100644 --- a/tpdatasrc/tpgamefiles/scr/feats/feat - Rapid Metamagic.py +++ b/tpdatasrc/tpgamefiles/scr/feats/feat - Rapid Metamagic.py @@ -1,11 +1,11 @@ from toee import * - +import char_editor def CheckPrereq(attachee, classLevelled, abilityScoreRaised): spont_casting_lvl = attachee.spontaneous_spell_level_can_cast() if spont_casting_lvl <= 0: return 0 - spellcraft_level = attachee.skill_ranks_get(skill_spellcraft) + spellcraft_level = char_editor.skill_ranks_get(skill_spellcraft) if spellcraft_level < 12: return 0 return 1 \ No newline at end of file