Skip to content

Commit

Permalink
Fix Potion of Oblivion (1st Attempt)
Browse files Browse the repository at this point in the history
Remove FE flags from a character when they drink Potion of Oblivion, so that if they re-take the FE Perk, they will be able to refund the point again.
  • Loading branch information
Hanter-19 committed May 28, 2023
1 parent cab5ab8 commit 451a545
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 2.0.2

# 2.0.1
- Fixed a bug that was causing the Favoured Enemy - Archer perk to not refund. Many thanks to Emo Used HM01 for reporting the bug!
- Coding convention: renamed hook filename to match the original file it is hooking
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
::mods_hookExactClass("entity/tactical/actor", function(o) {

local old_resetPerks = o.resetPerks;

o.resetPerks = function(){

old_resetPerks();

// Remove all flags related to Favoured Enemy Perks
local flags = this.getFlags();
foreach (flag in flags.m) {
if (flag.Key.find("favoured_enemy") != null) {
::LegendsFavouredEnemyRefund.Mod.Debug.printLog("Removing flag \"" + flag.Key + "\" for " + this.getName());
flags.remove(flag.Key);
}
}

};

});
4 changes: 3 additions & 1 deletion scripts/!mods_preload/mod_legends_favoured_enemy_refund.nut
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Create the object representing this mod
// First we populate basic information about this mod
::LegendsFavouredEnemyRefund <- {
Version = "2.0.1",
Version = "2.0.2",
ID = "mod_legends_favoured_enemy_refund",
Name = "Legends Favoured Enemy Perk Point Refund",
};
Expand Down Expand Up @@ -33,6 +33,8 @@
::include("mod_legends_favoured_enemy_refund/hooks/skills/legend_favoured_enemy_skill.nut");
// Hook existing perk_legend_favoured_enemy_master_archer object specifically because it overrides the inherited onUpdate() function from legend_favoured_enemy_skill
::include("mod_legends_favoured_enemy_refund/hooks/skills/perks/perk_legend_favoured_enemy_master_archer.nut");
// Hook existing actor object to handle resetPerks scenarios
::include("mod_legends_favoured_enemy_refund/hooks/entity/tactical/actor/actor.nut");

// Add Mod Settings page
// Note: This script must be triggered within /scripts/!mods_preload directory, otherwise MSU will not add the mod settings page
Expand Down

0 comments on commit 451a545

Please sign in to comment.