Skip to content

Commit 6f75b37

Browse files
Minor syntax changes
1 parent 010202c commit 6f75b37

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

InscryptionAPI/Triggers/CustomTriggerFinder.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,7 @@ public static List<TriggerReceiver> Call<T>(this CardTriggerHandler self, Func<T
366366
/// <returns>All trigger recievers of type T.</returns>
367367
public static IEnumerable<T> FindGlobalTriggers<T>(bool findFacedown, PlayableCard excluding = null)
368368
{
369-
var result = Enumerable.Empty<T>();
370-
369+
IEnumerable<T> result = Enumerable.Empty<T>();
371370
if (BoardManager.Instance)
372371
{
373372
result = result.Concat(FindTriggersOnBoard<T>(findFacedown));

InscryptionAPI/Triggers/CustomTriggerPatches.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,14 @@ private static void PassiveHealthBuffs(PlayableCard __instance, ref int __result
262262
[HarmonyPrefix]
263263
private static bool OpposingSlotsPrefix(PlayableCard __instance, ref List<CardSlot> __result, ref int __state)
264264
{
265-
var all = CustomTriggerFinder.FindGlobalTriggers<ISetupAttackSequence>(true).ToList();
265+
List<ISetupAttackSequence> all = CustomTriggerFinder.FindGlobalTriggers<ISetupAttackSequence>(true).ToList();
266266
all.RemoveAll(x => (x as TriggerReceiver) == null);
267267
all.Sort((x, x2) => x.GetTriggerPriority(__instance, OpposingSlotTriggerPriority.ReplacesDefaultOpposingSlot, new(), new(), 0, false) -
268268
x2.GetTriggerPriority(__instance, OpposingSlotTriggerPriority.ReplacesDefaultOpposingSlot, new(), new(), 0, false));
269269
bool didModify = false;
270270
bool discard = false;
271271
__state = 1;
272-
foreach (var opposing in all)
272+
foreach (ISetupAttackSequence opposing in all)
273273
{
274274
if (opposing.RespondsToModifyAttackSlots(__instance, OpposingSlotTriggerPriority.ReplacesDefaultOpposingSlot, new(), __result ?? new(), __state, false))
275275
{
@@ -278,13 +278,8 @@ private static bool OpposingSlotsPrefix(PlayableCard __instance, ref List<CardSl
278278
discard = false;
279279
}
280280
}
281-
if (!didModify && __instance.HasAbility(Ability.AllStrike))
282-
{
283-
__state = Mathf.Max(1, (__instance.OpponentCard ? Singleton<BoardManager>.Instance.PlayerSlotsCopy : Singleton<BoardManager>.Instance.OpponentSlotsCopy).FindAll(x => x.Card != null &&
284-
!__instance.CanAttackDirectly(x)).Count);
285-
}
286-
if (didModify)
287-
{
281+
282+
if (didModify) {
288283
if (__instance.HasAbility(Ability.SplitStrike))
289284
{
290285
ProgressionData.SetAbilityLearned(Ability.SplitStrike);
@@ -306,8 +301,12 @@ private static bool OpposingSlotsPrefix(PlayableCard __instance, ref List<CardSl
306301
__result.Add(__instance.slot.opposingSlot);
307302
}
308303
}
309-
if (__instance.HasAbility(Ability.SplitStrike))
310-
{
304+
else if (__instance.HasAbility(Ability.AllStrike)) {
305+
__state = Mathf.Max(1, (__instance.OpponentCard ? Singleton<BoardManager>.Instance.PlayerSlotsCopy : Singleton<BoardManager>.Instance.OpponentSlotsCopy).FindAll(x => x.Card != null &&
306+
!__instance.CanAttackDirectly(x)).Count);
307+
}
308+
309+
if (__instance.HasAbility(Ability.SplitStrike)) {
311310
__state += 1;
312311
}
313312
if (__instance.HasTriStrike())
@@ -352,7 +351,7 @@ private static void OpposingSlots(PlayableCard __instance, ref List<CardSlot> __
352351
if (isAttackingDefaultSlot && removeDefaultAttackSlot)
353352
__result.Remove(defaultslot);
354353
bool didRemoveOriginalSlot = __instance.HasAbility(Ability.SplitStrike) && (!__instance.HasTriStrike() || removeDefaultAttackSlot);
355-
var all = CustomTriggerFinder.FindGlobalTriggers<ISetupAttackSequence>(true).ToList();
354+
List<ISetupAttackSequence> all = CustomTriggerFinder.FindGlobalTriggers<ISetupAttackSequence>(true).ToList();
356355
all.RemoveAll(x => (x as TriggerReceiver) == null);
357356
var dummyresult = __result; // used for sorting by trigger priority
358357
all.Sort((x, x2) => x.GetTriggerPriority(__instance, OpposingSlotTriggerPriority.Normal, original, dummyresult, __state, didRemoveOriginalSlot) -

0 commit comments

Comments
 (0)