-
Notifications
You must be signed in to change notification settings - Fork 12
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
3 changed files
with
40 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"Releases": [ | ||
{ | ||
"Id": "TabletopTweaks-Core", | ||
"Version": "0.6.7" | ||
"Version": "0.6.8" | ||
} | ||
] | ||
} |
38 changes: 38 additions & 0 deletions
38
TabletopTweaks-Core/NewComponents/AbilitySpecific/AdamantineMindTrigger.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,38 @@ | ||
using Kingmaker.ElementsSystem; | ||
using Kingmaker.EntitySystem.Stats; | ||
using Kingmaker.PubSubSystem; | ||
using Kingmaker.RuleSystem.Rules; | ||
using Kingmaker.UnitLogic.Mechanics.Components; | ||
using Kingmaker.UnitLogic.Mechanics; | ||
using Kingmaker.UnitLogic; | ||
using Kingmaker.Blueprints.Classes.Spells; | ||
using Kingmaker.Blueprints.JsonSystem; | ||
|
||
namespace TabletopTweaks.Core.NewComponents.AbilitySpecific { | ||
[TypeId("4e0c887660ff412fa3fe63524e475e90")] | ||
public class AdamantineMindTrigger : UnitFactComponentDelegate, IInitiatorRulebookHandler<RuleSavingThrow>, IRulebookHandler<RuleSavingThrow>, ISubscriber, IInitiatorRulebookSubscriber { | ||
public void OnEventAboutToTrigger(RuleSavingThrow evt) { | ||
} | ||
|
||
public void OnEventDidTrigger(RuleSavingThrow evt) { | ||
if (this.CheckConditions(evt) && base.Fact.MaybeContext != null) { | ||
MechanicsContext maybeContext = base.Fact.MaybeContext; | ||
using ((maybeContext != null) ? maybeContext.GetDataScope(base.Owner) : null) { | ||
IFactContextOwner factContextOwner = base.Fact as IFactContextOwner; | ||
if (factContextOwner != null) { | ||
var NewSave = base.Context.TriggerRule(new RuleSavingThrow(evt.Reason.Context.MaybeCaster, SavingThrowType.Will, evt.DifficultyClass)); | ||
if (!NewSave.IsPassed) { | ||
factContextOwner.RunActionInContext(this.Action, evt.Reason.Context.MaybeCaster); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
private bool CheckConditions(RuleSavingThrow evt) { | ||
return evt.IsPassed && evt.Reason?.Context.MaybeCaster != null && (evt.Reason?.Context.SpellDescriptor & this.Descriptor) != SpellDescriptor.None; | ||
} | ||
|
||
public SpellDescriptorWrapper Descriptor = SpellDescriptor.MindAffecting; | ||
public ActionList Action; | ||
} | ||
} |
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