mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
New Option: Snowball Size (#647)
* snowball size * snowball size option * decrease threshold * increase range in case snowball too smol
This commit is contained in:
1 parent
212515dc52
commit
fb7f7caa07
3 files changed
+16
-4
No files matched your search
+13
-2
@@ -17,6 +17,7 @@ public static class Snowdown
|
|||||||
public static float SnowballThrowSpeed = 4f;
|
public static float SnowballThrowSpeed = 4f;
|
||||||
private static int SnowballGainFrequency = 5;
|
private static int SnowballGainFrequency = 5;
|
||||||
private static int MaxSnowballsInHand = 5;
|
private static int MaxSnowballsInHand = 5;
|
||||||
|
public static float SnowballSize = 1f;
|
||||||
private static int MaxCoinsInHand = 10;
|
private static int MaxCoinsInHand = 10;
|
||||||
private static bool GameEndsAfterTime = true;
|
private static bool GameEndsAfterTime = true;
|
||||||
private static int GameEndTime = 300;
|
private static int GameEndTime = 300;
|
||||||
@@ -37,6 +38,7 @@ public static class Snowdown
|
|||||||
private static OptionItem GameEndTimeOption;
|
private static OptionItem GameEndTimeOption;
|
||||||
private static OptionItem GameEndsWhenPointsReachedOption;
|
private static OptionItem GameEndsWhenPointsReachedOption;
|
||||||
private static OptionItem PointsToReachOption;
|
private static OptionItem PointsToReachOption;
|
||||||
|
private static OptionItem SnowballSizeOption;
|
||||||
private static Dictionary<PowerUp, OptionItem> PowerUpPriceOptions = [];
|
private static Dictionary<PowerUp, OptionItem> PowerUpPriceOptions = [];
|
||||||
|
|
||||||
private static readonly PowerUp[] AllPowerUp = Enum.GetValues<PowerUp>();
|
private static readonly PowerUp[] AllPowerUp = Enum.GetValues<PowerUp>();
|
||||||
@@ -94,13 +96,19 @@ public static class Snowdown
|
|||||||
GameEndsWhenPointsReachedOption = new BooleanOptionItem(id++, "Snowdown.GameEndsWhenPointsReachedOption", true, tab)
|
GameEndsWhenPointsReachedOption = new BooleanOptionItem(id++, "Snowdown.GameEndsWhenPointsReachedOption", true, tab)
|
||||||
.SetColor(color)
|
.SetColor(color)
|
||||||
.SetGameMode(gameMode);
|
.SetGameMode(gameMode);
|
||||||
|
|
||||||
PointsToReachOption = new IntegerOptionItem(id++, "Snowdown.PointsToReachOption", new(1, 100, 1), 5, tab)
|
PointsToReachOption = new IntegerOptionItem(id++, "Snowdown.PointsToReachOption", new(1, 100, 1), 5, tab)
|
||||||
.SetColor(color)
|
.SetColor(color)
|
||||||
.SetGameMode(gameMode)
|
.SetGameMode(gameMode)
|
||||||
.SetParent(GameEndsWhenPointsReachedOption)
|
.SetParent(GameEndsWhenPointsReachedOption)
|
||||||
.SetValueFormat(OptionFormat.Pieces);
|
.SetValueFormat(OptionFormat.Pieces);
|
||||||
|
|
||||||
|
SnowballSizeOption = new FloatOptionItem(id++, "Snowdown.SnowballSizeOption", new(0.1f, 2f, 0.1f), 1f, tab)
|
||||||
|
.SetHeader(true)
|
||||||
|
.SetColor(color)
|
||||||
|
.SetGameMode(gameMode)
|
||||||
|
.SetValueFormat(OptionFormat.Multiplier);
|
||||||
|
|
||||||
PowerUpPriceOptions = AllPowerUp.ToDictionary(x => x, x => new IntegerOptionItem(id++, "Snowdown.PowerUpPriceOption", new(1, 20, 1), PowerUpPrices[x], tab)
|
PowerUpPriceOptions = AllPowerUp.ToDictionary(x => x, x => new IntegerOptionItem(id++, "Snowdown.PowerUpPriceOption", new(1, 20, 1), PowerUpPrices[x], tab)
|
||||||
.SetColor(color)
|
.SetColor(color)
|
||||||
.SetGameMode(gameMode)
|
.SetGameMode(gameMode)
|
||||||
@@ -218,6 +226,7 @@ public static class Snowdown
|
|||||||
GameEndTime = GameEndTimeOption.GetInt();
|
GameEndTime = GameEndTimeOption.GetInt();
|
||||||
GameEndsWhenPointsReached = GameEndsWhenPointsReachedOption.GetBool();
|
GameEndsWhenPointsReached = GameEndsWhenPointsReachedOption.GetBool();
|
||||||
PointsToReach = PointsToReachOption.GetInt();
|
PointsToReach = PointsToReachOption.GetInt();
|
||||||
|
SnowballSize = SnowballSizeOption.GetFloat();
|
||||||
PowerUpPrices = PowerUpPriceOptions.ToDictionary(x => x.Key, x => x.Value.GetInt());
|
PowerUpPrices = PowerUpPriceOptions.ToDictionary(x => x.Key, x => x.Value.GetInt());
|
||||||
|
|
||||||
Data = Main.EnumeratePlayerControls().ToDictionary(x => x.PlayerId, _ => new PlayerData());
|
Data = Main.EnumeratePlayerControls().ToDictionary(x => x.PlayerId, _ => new PlayerData());
|
||||||
@@ -260,7 +269,9 @@ public static class Snowdown
|
|||||||
|
|
||||||
long now = Utils.TimeStamp;
|
long now = Utils.TimeStamp;
|
||||||
Vector2 pos = __instance.Pos();
|
Vector2 pos = __instance.Pos();
|
||||||
Snowball touchingSnowball = Snowballs.Find(x => x.Active && x.Thrower != __instance && FastVector2.DistanceWithinRange(x.Position, pos, 1.5f));
|
var snowballRange = Mathf.Max(0.5f, 1.5f * SnowballSize);
|
||||||
|
Snowball touchingSnowball = Snowballs.Find(x => x.Active && x.Thrower != __instance && FastVector2.DistanceWithinRange(x.Position, pos, snowballRange));
|
||||||
|
|
||||||
|
|
||||||
if (touchingSnowball != null)
|
if (touchingSnowball != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -949,7 +949,7 @@ namespace EHR
|
|||||||
{
|
{
|
||||||
Thrower = thrower;
|
Thrower = thrower;
|
||||||
Direction = direction;
|
Direction = direction;
|
||||||
CreateNetObject("<line-height=97%><cspace=0.16em><#0000>W</color><mark=#e4fdff>WWWW</mark><#0000>W</color>\n<mark=#e4fdff>WWWWWW</mark>\n<mark=#e4fdff>WWWWWW</mark>\n<mark=#e4fdff>WWWWWW</mark>\n<mark=#e4fdff>WWWWWW</mark>\n<#0000>W</color><mark=#e4fdff>WWWW</mark><#0000>W", from);
|
CreateNetObject($"<size={Snowdown.SnowballSize * 100}%><line-height=97%><cspace=0.16em><#0000>W</color><mark=#e4fdff>WWWW</mark><#0000>W</color>\n<mark=#e4fdff>WWWWWW</mark>\n<mark=#e4fdff>WWWWWW</mark>\n<mark=#e4fdff>WWWWWW</mark>\n<mark=#e4fdff>WWWWWW</mark>\n<#0000>W</color><mark=#e4fdff>WWWW</mark><#0000>W", from);
|
||||||
Active = true;
|
Active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -961,7 +961,7 @@ namespace EHR
|
|||||||
|
|
||||||
Vector2 newPos = Position + Direction * Time.fixedDeltaTime * Snowdown.SnowballThrowSpeed;
|
Vector2 newPos = Position + Direction * Time.fixedDeltaTime * Snowdown.SnowballThrowSpeed;
|
||||||
|
|
||||||
if ((PhysicsHelpers.AnythingBetween(Position, newPos, Constants.ShipOnlyMask, false)) ||
|
if (PhysicsHelpers.AnythingBetween(Position, newPos, Constants.ShipOnlyMask, false) ||
|
||||||
newPos.x < Snowdown.MapBounds.X.Left || newPos.x > Snowdown.MapBounds.X.Right || newPos.y < Snowdown.MapBounds.Y.Bottom || newPos.y > Snowdown.MapBounds.Y.Top)
|
newPos.x < Snowdown.MapBounds.X.Left || newPos.x > Snowdown.MapBounds.X.Right || newPos.y < Snowdown.MapBounds.Y.Bottom || newPos.y > Snowdown.MapBounds.Y.Top)
|
||||||
{
|
{
|
||||||
SetInactive();
|
SetInactive();
|
||||||
|
|||||||
@@ -8140,6 +8140,7 @@
|
|||||||
"Snowdown.PowerUpPriceOption": "{powerup} Powerup Price (Coins)",
|
"Snowdown.PowerUpPriceOption": "{powerup} Powerup Price (Coins)",
|
||||||
"Snowdown.ShopHelp": "Vanish: Cycle between powerups | Pet: Buy selected powerup | Sabotage: Exit shop",
|
"Snowdown.ShopHelp": "Vanish: Cycle between powerups | Pet: Buy selected powerup | Sabotage: Exit shop",
|
||||||
"Snowdown.SnowballGainFrequencyOption": "Initial Snowball Gaining Frequency",
|
"Snowdown.SnowballGainFrequencyOption": "Initial Snowball Gaining Frequency",
|
||||||
|
"Snowdown.SnowballSizeOption": "Snowball Size",
|
||||||
"Snowdown.SnowballThrowSpeedOption": "Snowball Throwing Speed",
|
"Snowdown.SnowballThrowSpeedOption": "Snowball Throwing Speed",
|
||||||
"SnowdownButtonText": "THROW",
|
"SnowdownButtonText": "THROW",
|
||||||
"DoomTag": "DOOM TAG",
|
"DoomTag": "DOOM TAG",
|
||||||
|
|||||||
Reference in new issue
Block a user