Skip to content

Commit b8cf619

Browse files
committed
Add XML Docs to the Tests Module of the Community Patch.
1 parent a2ca935 commit b8cf619

4 files changed

Lines changed: 93 additions & 1 deletion

File tree

‎InscryptionCommunityPatch/Tests/DebugCards.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace InscryptionCommunityPatch.Tests;
66

7+
/// <summary>
8+
/// This class adds some Debug Cards for testing the Steel Trap Death Patch in the Main API's functionality.
9+
/// </summary>
710
public class DebugCards
811
{
912
/// <summary>

‎InscryptionCommunityPatch/Tests/TestBoons.cs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,26 @@
44

55
namespace InscryptionCommunityPatch.Tests;
66

7+
/// <summary>
8+
/// This is a test related to Boons.
9+
/// </summary>
710
public class SacrificeSquirrels : BoonBehaviour
811
{
12+
/// <summary>
13+
/// This makes the Boon respond specifically when resolving a card other than itself being a Squirrel.
14+
/// </summary>
15+
/// <param name="otherCard">The <see cref="PlayableCard"/> being resolved.</param>
16+
/// <returns>True when the Card Being Resolved other than itself is a Squirrel.</returns>
917
public override bool RespondsToOtherCardResolve(PlayableCard otherCard)
1018
{
1119
return otherCard.Info.name.ToLowerInvariant().Equals("squirrel");
1220
}
1321

22+
/// <summary>
23+
/// This triggers when <see cref="RespondsToOtherCardResolve"/> returns True. When it triggers it gives the cards the Unkillable Sigil after playing the Boon's Animation, then Render's the card.
24+
/// </summary>
25+
/// <param name="otherCard">The <see cref="PlayableCard"/> being resolved.</param>
26+
/// <returns>The <see cref="PlayableCard"/> updated and rerendered with the Unkillable Sigil.</returns>
1427
public override IEnumerator OnOtherCardResolve(PlayableCard otherCard)
1528
{
1629
yield return this.PlayBoonAnimation();

‎InscryptionCommunityPatch/Tests/TestCommunityPatches.cs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,20 @@
66

77
namespace InscryptionCommunityPatch.Tests;
88

9+
/// <summary>
10+
/// The home of the Community Patch's Tests/
11+
/// </summary>
912
[HarmonyPatch]
1013
public static class ExecuteCommunityPatchTests
1114
{
15+
/// <summary>
16+
/// The Boon associated with our Test Boon described in <see cref="SacrificeSquirrels"/>.
17+
/// </summary>
1218
public static BoonData.Type TestBoon;
1319

20+
/// <summary>
21+
/// This function prepares our Tests.
22+
/// </summary>
1423
public static void PrepareForTests()
1524
{
1625
AbilityManager.BaseGameAbilities.AbilityByID(Ability.Sharp).Info.canStack = true;
@@ -23,6 +32,10 @@ public static void PrepareForTests()
2332
Resources.Load<Texture2D>("art/cards/boons/boonportraits/boon_startinggoat"), false, true, true);
2433
}
2534

35+
/// <summary>
36+
/// This function patches in our Tests at the start of a New Ascension Run.
37+
/// </summary>
38+
/// <param name="__instance"></param>
2639
[HarmonyPatch(typeof(AscensionSaveData), nameof(AscensionSaveData.NewRun))]
2740
[HarmonyPostfix]
2841
private static void StartRunInTestMode(ref AscensionSaveData __instance)

‎InscryptionCommunityPatch/Tests/TestCost.cs‎

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,18 @@
88

99
namespace InscryptionCommunityPatch.Tests;
1010

11+
/// <summary>
12+
/// This function defines our Testing Cost.
13+
/// </summary>
1114
public class TestCost : CustomCardCost
1215
{
16+
/// <summary>
17+
/// The Name of the Custom Cost.
18+
/// </summary>
1319
public override string CostName => "TestCost";
20+
/// <summary>
21+
/// This function initializes our Test Cost.
22+
/// </summary>
1423
public static void Init()
1524
{
1625
PatchPlugin.Logger.LogDebug("Adding TestCost");
@@ -21,24 +30,60 @@ public static void Init()
2130
.SetFoundAtChoiceNodes(true, TextureHelper.GetImageAsTexture("testCost.png", typeof(TestCost).Assembly));
2231
}
2332

33+
/// <summary>
34+
/// This defines the Cost Tier associated with the Amount of the Cost.
35+
/// </summary>
36+
/// <param name="amount">The amount of the Test Cost.</param>
37+
/// <returns>A <see cref="Mathf.Floor"/> of <c>amount/2</c>.</returns>
2438
public static int CostTier(int amount)
2539
{
2640
return Mathf.FloorToInt(amount / 2f);
2741
}
42+
43+
/// <summary>
44+
/// A bool determining whether a <see cref="CardInfo"/> can be played with the current amount of the cost.
45+
/// </summary>
46+
/// <param name="amount">The Amount of a Cost the Player currently has.</param>
47+
/// <param name="card">The Card the Player is trying to play.</param>
48+
/// <param name="hand">The Player's current Hand.</param>
49+
/// <returns>True if the Amount of the Cost is <c>&lt;= 2</c>.</returns>
2850
public static bool CanBePlayed(int amount, CardInfo card, List<CardInfo> hand)
2951
{
3052
return amount <= 2;
3153
}
54+
55+
/// <summary>
56+
/// A Function used to get the Cost's Texture within 3D Act's.
57+
/// </summary>
58+
/// <param name="cardCost">The Cost Amount of the Card.</param>
59+
/// <param name="cardInfo">The <see cref="CardInfo"/> of the Card.</param>
60+
/// <param name="playableCard">The <see cref="PlayableCard"/> variant of the Card.</param>
61+
/// <returns>A <see cref="ReverseColours"/> application of the 3D Act Variant EnergyCost associated with the passed in Cost Amount.</returns>
3262
public static Texture2D Texture3D(int cardCost, CardInfo cardInfo, PlayableCard playableCard)
3363
{
3464
Texture2D tex = TextureHelper.GetImageAsTexture($"energy_cost_{Mathf.Min(7, cardCost)}.png", typeof(PatchPlugin).Assembly);
3565
return ReverseColours(tex);
3666
}
67+
68+
/// <summary>
69+
/// A Function used to get the Cost's Texture within 2D Act's.
70+
/// </summary>
71+
/// <param name="cardCost">The Cost Amount of the Card.</param>
72+
/// <param name="info">The <see cref="CardInfo"/> of the Card.</param>
73+
/// <param name="playableCard">The <see cref="PlayableCard"/> variant of the Card.</param>
74+
/// <returns>A <see cref="ReverseColours"/> application of the 2D Act Variant EnergyCost associated with the passed in Cost Amount.</returns>
75+
/// <returns></returns>
3776
public static Texture2D TexturePixel(int cardCost, CardInfo info, PlayableCard playableCard)
3877
{
3978
Texture2D tex = Part2CardCostRender.CombineIconAndCount(cardCost, TextureHelper.GetImageAsTexture($"pixel_energy.png", typeof(PatchPlugin).Assembly));
4079
return ReverseColours(tex);
4180
}
81+
82+
/// <summary>
83+
/// A function used to Reverse the Colours of a Sprite.
84+
/// </summary>
85+
/// <param name="texToReverse">The Texture in which to reverse the Colours of.</param>
86+
/// <returns>A Colour Reversed version of the Passed Texture.</returns>
4287
private static Texture2D ReverseColours(Texture2D texToReverse)
4388
{
4489
for (int x = 0; x < texToReverse.width; x++)
@@ -57,16 +102,34 @@ private static Texture2D ReverseColours(Texture2D texToReverse)
57102
return texToReverse;
58103
}
59104

105+
/// <summary>
106+
/// A Bool determining whether the Card's Cost was satisfied or not.
107+
/// </summary>
108+
/// <param name="cardCost">The Card's Cost.</param>
109+
/// <param name="card">The Card in which is attempting to be played.</param>
110+
/// <returns>True if the Cost was satisified and false otherwise.</returns>
60111
public override bool CostSatisfied(int cardCost, PlayableCard card)
61112
{
62113
return cardCost <= (Singleton<ResourcesManager>.Instance.PlayerEnergy - card.EnergyCost);
63114
}
64-
115+
116+
/// <summary>
117+
/// The Hint said when the Cost was not Satisfied.
118+
/// </summary>
119+
/// <param name="cardCost">The Card's Cost.</param>
120+
/// <param name="card">The Card in which is attempting to be played.</param>
121+
/// <returns>The String of the Hint to be said when the Card's Cost is not Satisfied.</returns>
65122
public override string CostUnsatisfiedHint(int cardCost, PlayableCard card)
66123
{
67124
return "Eat your greens aby. " + card.Info.DisplayedNameLocalized;
68125
}
69126

127+
/// <summary>
128+
/// Depletes the Card's Cost from our Custom Cost's Cost Pool.
129+
/// </summary>
130+
/// <param name="cardCost">The Card's Cost</param>
131+
/// <param name="card">The Card in which is attempting to be played.</param>
132+
/// <returns>The Card's Cost depleted from the Custom Cost's pool.</returns>
70133
public override IEnumerator OnPlayed(int cardCost, PlayableCard card)
71134
{
72135
if (cardCost > 0)

0 commit comments

Comments
 (0)