Skip to content

Commit 65a8c38

Browse files
committed
Added documentation and name change
Changed TurnBuilder.AddCard() to TurnBuilder.AddCardBlueprint()
1 parent 0883ad0 commit 65a8c38

4 files changed

Lines changed: 101 additions & 7 deletions

File tree

InscryptionAPI/Card/CardExtensions.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ public static TailParams SetLostTailPortrait(this TailParams info, Texture2D por
115115
return info;
116116
}
117117

118+
/// <summary>
119+
/// Sets the card so it shows up for normal card choices in Act 1.
120+
/// </summary>
118121
public static CardInfo SetDefaultPart1Card(this CardInfo info)
119122
{
120123
if (!info.metaCategories.Contains(CardMetaCategory.Rare))
@@ -126,6 +129,9 @@ public static CardInfo SetDefaultPart1Card(this CardInfo info)
126129
return info;
127130
}
128131

132+
/// <summary>
133+
/// Sets the card so it shows up for normal card choices in Act 3.
134+
/// </summary>
129135
public static CardInfo SetDefaultPart3Card(this CardInfo info)
130136
{
131137
if (!info.metaCategories.Contains(CardMetaCategory.Rare))
@@ -137,6 +143,9 @@ public static CardInfo SetDefaultPart3Card(this CardInfo info)
137143
return info;
138144
}
139145

146+
/// <summary>
147+
/// Sets the card so it shows up for rare card choices and applies the rare background.
148+
/// </summary>
140149
public static CardInfo SetRare(this CardInfo info)
141150
{
142151
info.AddMetaCategories(CardMetaCategory.Rare);
@@ -151,6 +160,9 @@ public static CardInfo SetRare(this CardInfo info)
151160
return info;
152161
}
153162

163+
/// <summary>
164+
/// Adds the terrain trait and background to this card.
165+
/// </summary>
154166
public static CardInfo SetTerrain(this CardInfo info)
155167
{
156168
info.AddTraits(Trait.Terrain);
@@ -267,6 +279,9 @@ public static CardInfo AddSpecialAbilities(this CardInfo info, params SpecialTri
267279
return info;
268280
}
269281

282+
/// <summary>
283+
/// Adds this card to Act 2 packs and collection.
284+
/// </summary>
270285
public static CardInfo SetGBCPlayable(this CardInfo info, CardTemple temple)
271286
{
272287
info.AddMetaCategories(CardMetaCategory.GBCPack, CardMetaCategory.GBCPlayable);

InscryptionAPI/Encounters/EncounterExtensions.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,24 @@ public static OpponentManager.FullOpponent SetNewSequencer(this OpponentManager.
3030
return opp;
3131
}
3232

33+
/// <summary>
34+
/// Sets the difficulty range of this encounter.<br/>
35+
/// Difficulty is determined by the formula (6 * <c>tier</c>) + <c>battle#</c> + <c>modifier</c>.
36+
/// </summary>
37+
/// <param name="min">The minimum difficulty.</param>
38+
/// <param name="max">The maximum difficulty.</param>
3339
public static T SetDifficulty<T>(this T blueprint, int min, int max) where T : EncounterBlueprintData
3440
{
3541
blueprint.minDifficulty = min;
3642
blueprint.maxDifficulty = max;
3743
return blueprint;
3844
}
3945

46+
/// <summary>
47+
/// Adds dominant tribes to this region.<br/>
48+
/// The dominant tribes list determines the totems for this battle.
49+
/// </summary>
50+
/// <param name="tribes">The tribes to add.</param>
4051
public static T AddDominantTribes<T>(this T blueprint, params Tribe[] tribes) where T : EncounterBlueprintData
4152
{
4253
blueprint.dominantTribes = blueprint.dominantTribes ?? new();
@@ -54,6 +65,11 @@ public static T SetRegionSpecific<T>(this T blueprint, bool enabled) where T : E
5465
return blueprint;
5566
}
5667

68+
/// <summary>
69+
/// Adds random replacement cards to this region.<br/>
70+
/// A card from this list is selected whenever a card is randomly replaced by <c>randomReplaceChance</c>.
71+
/// </summary>
72+
/// <param name="cards">The cards to add.</param>
5773
public static T AddRandomReplacementCards<T>(this T blueprint, params string[] cards) where T : EncounterBlueprintData
5874
{
5975
blueprint.randomReplacementCards = blueprint.randomReplacementCards ?? new();
@@ -68,6 +84,11 @@ public static T AddRandomReplacementCards<T>(this T blueprint, params string[] c
6884
return blueprint;
6985
}
7086

87+
/// <summary>
88+
/// Adds redundant abilities to this region.<br/>
89+
/// Redundant abilities will not be used on totems for this encounter.
90+
/// </summary>
91+
/// <param name="abilities">The abilities to add.</param>
7192
public static T SetRedundantAbilities<T>(this T blueprint, params Ability[] abilities) where T : EncounterBlueprintData
7293
{
7394
blueprint.redundantAbilities = abilities.ToList();
@@ -100,6 +121,9 @@ public static T AddTurn<T>(this T blueprint, params CardBlueprint[] turn) where
100121
return blueprint;
101122
}
102123

124+
/// <summary>
125+
/// Creates a new turn for this encounter and returns the builder.
126+
/// </summary>
103127
public static TurnBuilder<T> CreateTurn<T>(this T blueprint) where T : EncounterBlueprintData
104128
{
105129
TurnBuilder<T> turnBuilder = new();

InscryptionAPI/Encounters/TurnBuilder.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,17 @@ public void SetBlueprint(T blueprint)
2525

2626
public static class TurnExtensions
2727
{
28-
29-
public static TurnBuilder<T> AddCard<T>(this TurnBuilder<T> turnBuilder, string card, int randomReplaceChance = 0,
28+
/// <summary>
29+
/// Adds a card blueprint to this turn.
30+
/// </summary>
31+
/// <param name="card">The default card. Can be null for no card.</param>
32+
/// <param name="randomReplaceChance">The integer probability of this card getting replaced by a card from the encounter's <c>randomReplacementCards</c></param>
33+
/// <param name="minDifficulty">The minimum difficulty for this card to appear.</param>
34+
/// <param name="maxDifficulty">The maximum difficulty for this card to appear.</param>
35+
/// <param name="difficultyReplace">Whether to replace this card when a certain difficulty threshold is met.</param>
36+
/// <param name="difficultyReplaceReq">The difficulty threshold for the <c>replacement</c> card to be used instead.</param>
37+
/// <param name="replacement">The replacement card for the difficulty replacement.</param>
38+
public static TurnBuilder<T> AddCardBlueprint<T>(this TurnBuilder<T> turnBuilder, string card, int randomReplaceChance = 0,
3039
int minDifficulty = 1, int maxDifficulty = 20,
3140
bool difficultyReplace = false, int difficultyReplaceReq = 0, string replacement = null)
3241
where T : EncounterBlueprintData

InscryptionAPI/Regions/RegionExtensions.cs

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ public static RegionData SetName(this RegionData region, string name)
1717
return region;
1818
}
1919

20+
/// <summary>
21+
/// Adds terrain cards to this region.<br/>
22+
/// Terrain cards require the <c>Terrain</c> trait to appear.<br/>
23+
/// Every region must have at least one valid terrain card.
24+
/// </summary>
25+
/// <param name="cards">The terrain cards to add.</param>
2026
public static RegionData AddTerrainCards(this RegionData region, params string[] cards)
2127
{
2228
region.terrainCards = region.terrainCards ?? new();
@@ -31,6 +37,12 @@ public static RegionData AddTerrainCards(this RegionData region, params string[]
3137
return region;
3238
}
3339

40+
/// <summary>
41+
/// Adds likely cards to this region.<br/>
42+
/// Likely cards require the <c>ChoiceNode</c> metacategory to appear.<br/>
43+
/// One of three normal card choices is guaranteed to contain a card from the region's likely cards.
44+
/// </summary>
45+
/// <param name="cards">The likely cards to add.</param>
3446
public static RegionData AddLikelyCards(this RegionData region, params string[] cards)
3547
{
3648
region.likelyCards = region.likelyCards ?? new();
@@ -45,6 +57,11 @@ public static RegionData AddLikelyCards(this RegionData region, params string[]
4557
return region;
4658
}
4759

60+
/// <summary>
61+
/// Adds consumables to this region.<br/>
62+
/// This only applies to consumables that are <c>regionSpecific</c>. Adding non-region-specific consumables will increase the probability of the consumable appearing.
63+
/// </summary>
64+
/// <param name="consumables"></param>
4865
public static RegionData AddConsumableItems(this RegionData region, params string[] consumables)
4966
{
5067
region.consumableItems = region.consumableItems ?? new();
@@ -65,6 +82,12 @@ public static RegionData AddConsumableItems(this RegionData region, params Consu
6582
return region;
6683
}
6784

85+
/// <summary>
86+
/// Adds dominant tribes to this region.<br/>
87+
/// One of three normal card choices is guaranteed to contain a card from the region's dominant tribes.<br/>
88+
/// Every region must have at least one dominant tribe.
89+
/// </summary>
90+
/// <param name="tribes">The tribes to add.</param>
6891
public static RegionData AddDominantTribes(this RegionData region, params Tribe[] tribes)
6992
{
7093
region.dominantTribes = region.dominantTribes ?? new();
@@ -87,13 +110,23 @@ public static RegionData SetCardsColor(this RegionData region, Color color)
87110
return region;
88111
}
89112

113+
/// <summary>
114+
/// Creates a new encounter for this region and returns the builder.<br/>
115+
/// Every region with battles needs at least one encounter.
116+
/// </summary>
117+
/// <param name="name">The name for the encounter.</param>
90118
public static EncounterBuilderBlueprintData CreateEncounter(this RegionData region, string name = null)
91119
{
92120
EncounterBuilderBlueprintData blueprint = ScriptableObject.CreateInstance<EncounterBuilderBlueprintData>();
93121
blueprint.SetBasic(name, region);
94122
return blueprint;
95123
}
96124

125+
/// <summary>
126+
/// Adds normal (card battle node) encounters to this region.<br/>
127+
/// Every region with battles needs at least one encounter.
128+
/// </summary>
129+
/// <param name="encounters">The encounters to add.</param>
97130
public static RegionData AddEncounters(this RegionData region, params EncounterBlueprintData[] encounters)
98131
{
99132
region.encounters = region.encounters ?? new();
@@ -107,12 +140,20 @@ public static RegionData AddEncounters(this RegionData region, params EncounterB
107140
return region;
108141
}
109142

143+
/// <summary>
144+
/// Sets the boss prep encounter condition for this region. If this condition is not met, the 'boss prep encounter' will not appear.
145+
/// </summary>
146+
/// <param name="condition">The condition that needs to be fulfilled</param>
110147
public static RegionData SetBossPrepCondition(this RegionData region, StoryEventCondition condition)
111148
{
112149
region.bossPrepCondition = condition;
113150
return region;
114151
}
115152

153+
/// <summary>
154+
/// Sets the boss prep encounter for this region. The boss prep encounter is the final battle node in the region, before the boss.
155+
/// </summary>
156+
/// <param name="encounter">The encounter to set.</param>
116157
public static RegionData SetBossPrepEncounter(this RegionData region, EncounterBlueprintData encounter)
117158
{
118159
region.bossPrepEncounter = encounter;
@@ -168,6 +209,10 @@ public static RegionData SetSilenceCabinAmbience(this RegionData region, bool en
168209
return region;
169210
}
170211

212+
/// <summary>
213+
/// Sets the music loop ID for this region.
214+
/// </summary>
215+
/// <param name="id">The music ID to use.</param>
171216
public static RegionData SetAmbientLoopId(this RegionData region, string id)
172217
{
173218
region.ambientLoopId = id;
@@ -216,15 +261,16 @@ public static RegionData SetMapParticlesPrefabs(this RegionData region, params G
216261
return region;
217262
}
218263

219-
public static RegionData Build(this RegionData region) {
264+
public static RegionData Build(this RegionData region, bool ignoreTerrainWarning = false, bool ignoreTribesWarning = false,
265+
bool ignoreEncountersWarning = false, bool ignoreBossesWarning = false) {
220266

221-
if (region.terrainCards == null || region.terrainCards.Count == 0)
267+
if (!ignoreTerrainWarning && (region.terrainCards == null || region.terrainCards.Count == 0))
222268
InscryptionAPIPlugin.Logger.LogWarning($"Region {region.name} does not have any terrain cards!");
223-
if (region.dominantTribes == null || region.dominantTribes.Count == 0)
269+
if (!ignoreTribesWarning && (region.dominantTribes == null || region.dominantTribes.Count == 0))
224270
InscryptionAPIPlugin.Logger.LogWarning($"Region {region.name} does not have any dominant tribes!");
225-
if (region.encounters == null || region.encounters.Count == 0)
271+
if (!ignoreEncountersWarning && (region.encounters == null || region.encounters.Count == 0))
226272
InscryptionAPIPlugin.Logger.LogWarning($"Region {region.name} does not have any encounters!");
227-
if (region.bosses == null || region.bosses.Count == 0)
273+
if (!ignoreBossesWarning && (region.bosses == null || region.bosses.Count == 0))
228274
InscryptionAPIPlugin.Logger.LogWarning($"Region {region.name} does not have any bosses!");
229275

230276
return region;

0 commit comments

Comments
 (0)