-
Notifications
You must be signed in to change notification settings - Fork 11
/
SampleRule.cs
79 lines (73 loc) · 2.5 KB
/
SampleRule.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
namespace HouseRules.Essentials.Rules
{
using Boardgame;
using HarmonyLib;
using HouseRules.Core.Types;
/// <summary>
/// Represents a modular gameplay modification.
/// </summary>
/// <remarks>
/// <para>
/// It is recommended to use passive voice for naming rule classes, and to use the suffix <c>Rule</c>.
/// </para>
/// <para>
/// For example: Use <c>BallistaActionPointsAdjustedRule</c> instead of <c>AdjustBallistaActionPoints</c>.
/// </para>
/// </remarks>
public sealed class SampleRule : Rule, IPatchable
{
/// <summary>
/// Gets the description of the rule.
/// </summary>
public override string Description => "Sample rule";
/// <summary>
/// Called when the rule is activated.
/// </summary>
/// <remarks>
/// <para>
/// Rules should use this as an indication that they may begin to take effect.
/// </para>
/// <para>
/// This will be called at some point after the rule is selected to be used, but before a game begins
/// to be created.
/// </para>
/// </remarks>
protected override void OnActivate(GameContext gameContext)
{
}
/// <summary>
/// Called when the rule is deactivated.
/// </summary>
/// <remarks>
/// This method should undo any persisting changes made by the rule up until this point.
/// </remarks>
protected override void OnDeactivate(GameContext gameContext)
{
}
/// <summary>
/// Called before a game is created.
/// </summary>
protected override void OnPreGameCreated(GameContext gameContext)
{
}
/// <summary>
/// Called after a game is created.
/// </summary>
/// <remarks>
/// Note that even though the game is created, the level/POIs/enemies may not yet fully be loaded/spawned.
/// </remarks>
protected override void OnPostGameCreated(GameContext gameContext)
{
}
/// <summary>
/// Patches the game with the given patcher.
/// </summary>
/// <remarks>
/// Rules should use a static flag (e.g., <c>_isActivated</c>) in the patched method to
/// ensure it makes modifications only when it is activated.
/// </remarks>
private static void Patch(Harmony harmony)
{
}
}
}