-
Notifications
You must be signed in to change notification settings - Fork 2
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
27 changed files
with
1,246 additions
and
9 deletions.
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
Binary file not shown.
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
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
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
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,113 @@ | ||
using System.Linq; | ||
using UnityEngine; | ||
namespace TheOtherRoles.Patches.CursedTasks; | ||
|
||
internal static class Burger | ||
{ | ||
[HarmonyPatch(typeof(BurgerMinigame))] | ||
private static class BurgerMinigamePatch | ||
{ | ||
[HarmonyPatch(nameof(BurgerMinigame.Begin)), HarmonyPostfix] | ||
private static void BeginPostfix(BurgerMinigame __instance) | ||
{ | ||
if (!ModOption.CursedTasks) return; | ||
switch (Random.RandomRange(0f, 1f)) | ||
{ | ||
case <= 0.50f: // 50% | ||
__instance.ExpectedToppings = new(6); | ||
__instance.ExpectedToppings[0] = BurgerToppingTypes.Plate; | ||
for (var i = 1; i < __instance.ExpectedToppings.Count; i++) | ||
{ | ||
var topping = (BurgerToppingTypes)IntRange.Next(0, 6); | ||
var set = __instance.ExpectedToppings.Count(t => t == topping) < topping switch | ||
{ | ||
BurgerToppingTypes.TopBun => 1, | ||
BurgerToppingTypes.BottomBun => 1, | ||
BurgerToppingTypes.Lettuce => 3, | ||
_ => 2 | ||
}; | ||
if (set) __instance.ExpectedToppings[i] = topping; | ||
else i--; | ||
} | ||
break; | ||
case <= 0.70f: // 20% | ||
__instance.ExpectedToppings = new(6); | ||
__instance.ExpectedToppings[0] = BurgerToppingTypes.Plate; | ||
var bun = (new BurgerToppingTypes[] { BurgerToppingTypes.Meat, BurgerToppingTypes.Onion, BurgerToppingTypes.Tomato }).GetRandom(); | ||
__instance.ExpectedToppings[1] = bun; | ||
__instance.ExpectedToppings[5] = bun; | ||
for (var i = 2; i < __instance.ExpectedToppings.Count - 1; i++) | ||
{ | ||
var topping = (BurgerToppingTypes)IntRange.Next(2, 6); | ||
var set = __instance.ExpectedToppings.Count(t => t == topping) < topping switch | ||
{ | ||
BurgerToppingTypes.TopBun => 1, | ||
BurgerToppingTypes.BottomBun => 1, | ||
BurgerToppingTypes.Lettuce => 3, | ||
_ => 2 | ||
}; | ||
if (set) __instance.ExpectedToppings[i] = topping; | ||
else i--; | ||
} | ||
break; | ||
case <= 0.90f: // 20% | ||
__instance.ExpectedToppings = new(6); | ||
__instance.ExpectedToppings[0] = BurgerToppingTypes.Plate; | ||
__instance.ExpectedToppings[1] = BurgerToppingTypes.Lettuce; | ||
__instance.ExpectedToppings[5] = BurgerToppingTypes.Lettuce; | ||
for (var i = 2; i < __instance.ExpectedToppings.Count - 1; i++) | ||
{ | ||
var topping = (new BurgerToppingTypes[] { BurgerToppingTypes.Lettuce, BurgerToppingTypes.Onion, BurgerToppingTypes.Tomato }).GetRandom(); | ||
var set = __instance.ExpectedToppings.Count(t => t == topping) < topping switch | ||
{ | ||
BurgerToppingTypes.TopBun => 1, | ||
BurgerToppingTypes.BottomBun => 1, | ||
BurgerToppingTypes.Lettuce => 3, | ||
_ => 2 | ||
}; | ||
if (set) __instance.ExpectedToppings[i] = topping; | ||
else i--; | ||
} | ||
break; | ||
case <= 0.95f: // 5% | ||
__instance.ExpectedToppings = new(3); | ||
__instance.ExpectedToppings[0] = BurgerToppingTypes.Plate; | ||
__instance.ExpectedToppings[1] = BurgerToppingTypes.BottomBun; | ||
__instance.ExpectedToppings[2] = BurgerToppingTypes.TopBun; | ||
break; | ||
case <= 1.00f: // 5% | ||
__instance.ExpectedToppings = new(6); | ||
__instance.ExpectedToppings[0] = BurgerToppingTypes.Plate; | ||
if (BoolRange.Next(0.1f)) | ||
{ | ||
__instance.ExpectedToppings[1] = BurgerToppingTypes.Lettuce; | ||
__instance.ExpectedToppings[5] = BurgerToppingTypes.Lettuce; | ||
} | ||
else | ||
{ | ||
__instance.ExpectedToppings[1] = BurgerToppingTypes.BottomBun; | ||
__instance.ExpectedToppings[5] = BurgerToppingTypes.TopBun; | ||
} | ||
for (var i = 2; i < __instance.ExpectedToppings.Count - 1; i++) | ||
{ | ||
var topping = (BurgerToppingTypes)IntRange.Next(2, 6); | ||
if (__instance.ExpectedToppings.Count(t => t == topping) >= 2) i--; | ||
else __instance.ExpectedToppings[i] = topping; | ||
} | ||
if (BoolRange.Next(0.01f)) | ||
{ | ||
var burgerToppingTypes = __instance.ExpectedToppings[5]; | ||
__instance.ExpectedToppings[5] = __instance.ExpectedToppings[4]; | ||
__instance.ExpectedToppings[4] = burgerToppingTypes; | ||
} | ||
break; | ||
} | ||
|
||
for (var i = 0; i < __instance.PaperSlots.Length; i++) | ||
{ | ||
if (i < __instance.ExpectedToppings.Count - 1) __instance.PaperSlots[i].sprite = __instance.PaperToppings[(int)__instance.ExpectedToppings[i + 1]]; | ||
else __instance.PaperSlots[i].enabled = false; | ||
} | ||
} | ||
} | ||
} |
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,19 @@ | ||
using UnityEngine; | ||
namespace TheOtherRoles.Patches.CursedTasks | ||
{ | ||
internal class CaliDistributar | ||
{ | ||
[HarmonyPatch(typeof(SweepMinigame))] | ||
private static class SweepMinigamePatch | ||
{ | ||
[HarmonyPatch(nameof(SweepMinigame.FixedUpdate)), HarmonyPrefix] | ||
private static void FixedUpdatePrefix(SweepMinigame __instance) | ||
{ | ||
if (!ModOption.CursedTasks) return; | ||
var numer = new System.Random(); | ||
float num = numer.Next(10, 50); | ||
__instance.timer += Time.fixedDeltaTime * num; | ||
} | ||
} | ||
} | ||
} |
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,34 @@ | ||
using UnityEngine; | ||
using Random = UnityEngine.Random; | ||
|
||
namespace TheOtherRoles.Patches.CursedTasks | ||
{ | ||
internal static class CustomCardSwipe | ||
{ | ||
private static readonly bool PrevState = false; | ||
|
||
[HarmonyPatch(typeof(CardSlideGame))] | ||
private static class CardSlidePatch | ||
{ | ||
[HarmonyPatch(nameof(CardSlideGame.Begin))] | ||
[HarmonyPrefix] | ||
private static void BeginPrefix(CardSlideGame __instance) | ||
{ | ||
if (!ModOption.CursedTasks) return; | ||
__instance.AcceptedTime = new FloatRange(0.5f, 0.5f); | ||
} | ||
|
||
[HarmonyPatch(nameof(CardSlideGame.Update))] | ||
[HarmonyPrefix] | ||
private static void PutCardBackPrefix(CardSlideGame __instance) | ||
{ | ||
if (!ModOption.CursedTasks) return; | ||
var CurrentState = __instance.redLight.color == Color.red; | ||
if (PrevState == CurrentState || !CurrentState) return; | ||
var randomNumber = Random.RandomRangeInt(0, 40); | ||
if (randomNumber == 0) __instance.AcceptedTime = new FloatRange(0.25f, 2f); | ||
else __instance.AcceptedTime = new FloatRange(0.495f, 0.505f); | ||
} | ||
} | ||
} | ||
} |
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,21 @@ | ||
namespace TheOtherRoles.Patches.CursedTasks; | ||
|
||
internal class CollectShells | ||
{ | ||
[HarmonyPatch(typeof(CollectShellsMinigame))] | ||
private static class CollectShellsMinigameMinigamePatch | ||
{ | ||
[HarmonyPatch(nameof(CollectShellsMinigame.Begin)), HarmonyPrefix] | ||
|
||
private static void BeginPrefix(CollectShellsMinigame __instance) | ||
{ | ||
if (!ModOption.CursedTasks) return; | ||
var Rd = new System.Random(); | ||
|
||
__instance.numShellsRange = (IntRange)Rd.Next(4, 20); | ||
|
||
} | ||
} | ||
|
||
|
||
} |
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,17 @@ | ||
namespace TheOtherRoles.Patches.CursedTasks | ||
{ | ||
internal class Course | ||
{ | ||
[HarmonyPatch(typeof(CourseMinigame))] | ||
private static class CourseMinigamePatch | ||
{ | ||
[HarmonyPatch(nameof(CourseMinigame.Begin)), HarmonyPrefix] | ||
private static void BeginPrefix(CourseMinigame __instance) | ||
{ | ||
if (!ModOption.CursedTasks) return; | ||
var rd = new System.Random(); | ||
__instance.NumPoints = rd.Next(20, 27); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.