forked from Vek17/TabletopTweaks-Base
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
302 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
TabletopTweaks/NewComponents/ContextArcaneSpellFailureIncrease.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Kingmaker.Blueprints; | ||
using Kingmaker.Blueprints.Facts; | ||
using Kingmaker.Blueprints.Items.Armors; | ||
using Kingmaker.Blueprints.JsonSystem; | ||
using Kingmaker.PubSubSystem; | ||
using Kingmaker.RuleSystem.Rules.Abilities; | ||
using Kingmaker.UnitLogic; | ||
using Kingmaker.UnitLogic.Mechanics; | ||
using System.Linq; | ||
|
||
namespace TabletopTweaks.NewComponents { | ||
[AllowedOn(typeof(BlueprintUnitFact), false)] | ||
[TypeId("83ce1f63bacb4494887fb0b2080eddcd")] | ||
class ContextArcaneSpellFailureIncrease : UnitFactComponentDelegate, | ||
IInitiatorRulebookHandler<RuleCalculateArcaneSpellFailureChance>, | ||
IRulebookHandler<RuleCalculateArcaneSpellFailureChance>, | ||
ISubscriber, IInitiatorRulebookSubscriber { | ||
|
||
public void OnEventAboutToTrigger(RuleCalculateArcaneSpellFailureChance evt) { | ||
if (!evt.Armor.Blueprint.IsShield && (!CheckCategory || Categorys.Contains(evt.Armor.ArmorType()))) { | ||
evt.AddArmorBonus(Reduce ? -Value.Calculate(base.Context) : Value.Calculate(base.Context)); | ||
} | ||
if (evt.Armor.Blueprint.IsShield && (!CheckCategory || Categorys.Contains(evt.Armor.Blueprint.ProficiencyGroup))) { | ||
evt.AddShieldBonus(Reduce ? -Value.Calculate(base.Context) : Value.Calculate(base.Context)); | ||
} | ||
} | ||
|
||
public void OnEventDidTrigger(RuleCalculateArcaneSpellFailureChance evt) { | ||
} | ||
|
||
public bool Reduce; | ||
public ContextValue Value; | ||
public bool CheckCategory; | ||
public ArmorProficiencyGroup[] Categorys; | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
TabletopTweaks/NewComponents/ContextArmorCheckPenaltyIncrease.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Kingmaker.Blueprints; | ||
using Kingmaker.Blueprints.Facts; | ||
using Kingmaker.Blueprints.Items.Armors; | ||
using Kingmaker.Blueprints.JsonSystem; | ||
using Kingmaker.Items; | ||
using Kingmaker.PubSubSystem; | ||
using Kingmaker.RuleSystem.Rules; | ||
using Kingmaker.UnitLogic; | ||
using Kingmaker.UnitLogic.Mechanics; | ||
using System.Linq; | ||
|
||
namespace TabletopTweaks.NewComponents { | ||
[AllowedOn(typeof(BlueprintUnitFact), false)] | ||
[TypeId("5c83ff59ace044d19376f4bbe035b544")] | ||
class ContextArmorCheckPenaltyIncrease : UnitFactComponentDelegate, | ||
IInitiatorRulebookHandler<RuleCalculateArmorCheckPenalty>, | ||
IRulebookHandler<RuleCalculateArmorCheckPenalty>, | ||
ISubscriber, IInitiatorRulebookSubscriber { | ||
|
||
public override void OnTurnOn() { | ||
ItemEntityArmor maybeArmor = base.Owner.Body.Armor.MaybeArmor; | ||
if (maybeArmor != null) { | ||
maybeArmor.RecalculateStats(); | ||
} | ||
ItemEntityShield maybeShield = base.Owner.Body.SecondaryHand.MaybeShield; | ||
if (maybeShield == null) { | ||
return; | ||
} | ||
maybeShield.ArmorComponent.RecalculateStats(); | ||
} | ||
|
||
public void OnEventAboutToTrigger(RuleCalculateArmorCheckPenalty evt) { | ||
if (!evt.Armor.Blueprint.IsShield && (!CheckCategory || Categorys.Contains(evt.Armor.ArmorType()))) { | ||
evt.AddBonus(Value.Calculate(base.Context)); | ||
return; | ||
} | ||
if (evt.Armor.Blueprint.IsShield && (!CheckCategory || Categorys.Contains(evt.Armor.Blueprint.ProficiencyGroup))) { | ||
evt.AddBonus(Value.Calculate(base.Context)); | ||
} | ||
} | ||
|
||
public void OnEventDidTrigger(RuleCalculateArmorCheckPenalty evt) { | ||
} | ||
|
||
public bool Reduce; | ||
public ContextValue Value; | ||
public bool CheckCategory; | ||
public ArmorProficiencyGroup[] Categorys; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
TabletopTweaks/NewComponents/ContextMaxDexBonusIncrease.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Kingmaker.Blueprints; | ||
using Kingmaker.Blueprints.Facts; | ||
using Kingmaker.Blueprints.Items.Armors; | ||
using Kingmaker.Blueprints.JsonSystem; | ||
using Kingmaker.Items; | ||
using Kingmaker.PubSubSystem; | ||
using Kingmaker.RuleSystem.Rules; | ||
using Kingmaker.UnitLogic; | ||
using Kingmaker.UnitLogic.Mechanics; | ||
using System.Linq; | ||
|
||
namespace TabletopTweaks.NewComponents { | ||
[AllowedOn(typeof(BlueprintUnitFact), false)] | ||
[TypeId("39d2343f6d254e44ac05f3efb2c1937d")] | ||
class ContextMaxDexBonusIncrease : UnitFactComponentDelegate, | ||
IInitiatorRulebookHandler<RuleCalculateArmorMaxDexBonusLimit>, | ||
IRulebookHandler<RuleCalculateArmorMaxDexBonusLimit>, | ||
ISubscriber, IInitiatorRulebookSubscriber { | ||
|
||
public override void OnTurnOn() { | ||
ItemEntityArmor maybeArmor = base.Owner.Body.Armor.MaybeArmor; | ||
if (maybeArmor != null) { | ||
maybeArmor.RecalculateStats(); | ||
} | ||
ItemEntityShield maybeShield = base.Owner.Body.SecondaryHand.MaybeShield; | ||
if (maybeShield == null) { | ||
return; | ||
} | ||
maybeShield.ArmorComponent.RecalculateStats(); | ||
} | ||
|
||
public void OnEventAboutToTrigger(RuleCalculateArmorMaxDexBonusLimit evt) { | ||
if (!evt.Armor.Blueprint.IsShield && (!CheckCategory || Categorys.Contains(evt.Armor.ArmorType()))) { | ||
evt.AddBonus(Value.Calculate(base.Context)); | ||
return; | ||
} | ||
if (evt.Armor.Blueprint.IsShield && (!CheckCategory || Categorys.Contains(evt.Armor.Blueprint.ProficiencyGroup))) { | ||
evt.AddBonus(Value.Calculate(base.Context)); | ||
} | ||
} | ||
|
||
public void OnEventDidTrigger(RuleCalculateArmorMaxDexBonusLimit evt) { | ||
} | ||
|
||
public ContextValue Value; | ||
public bool CheckCategory; | ||
public ArmorProficiencyGroup[] Categorys; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Kingmaker.Blueprints.JsonSystem; | ||
using Kingmaker.EntitySystem.Entities; | ||
using Kingmaker.PubSubSystem; | ||
using Kingmaker.UnitLogic; | ||
using Kingmaker.UnitLogic.Class.LevelUp; | ||
|
||
namespace TabletopTweaks.NewComponents { | ||
[TypeId("0104e3c3ea2e4f789bc1b1ac4a874d7b")] | ||
class RecalculateOnLevelUp : UnitFactComponentDelegate, IUnitLevelUpHandler { | ||
public void HandleUnitAfterLevelUp(UnitEntityData unit, LevelUpController controller) { | ||
if (base.Fact.Owner == unit) { | ||
base.Fact.Reapply(); | ||
} | ||
} | ||
|
||
public void HandleUnitBeforeLevelUp(UnitEntityData unit) { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.