Skip to content

Commit

Permalink
1060
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsFabTest committed Feb 10, 2024
1 parent 40ecbb0 commit 364fb87
Show file tree
Hide file tree
Showing 20 changed files with 288 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Nebula/CustomOptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ MetaScreenContent getSuitableContent()

limiterOptions = CustomOption.Create(Color.white, "option.limitOptions", false, null, true, false, "", CustomOptionTab.Settings).SetGameMode(CustomGameMode.ActuallyAll);
CustomOption.RegisterTopOption(limiterOptions);
timeLimitOption = CustomOption.Create(Color.white, "option.timeLimitOption", 20f, 1f, 80f, 1f, limiterOptions).SetGameMode(CustomGameMode.ActuallyAll);
timeLimitOption = CustomOption.Create(Color.white, "option.timeLimitOption", 20f, 0f, 80f, 1f, limiterOptions).SetGameMode(CustomGameMode.ActuallyAll);
timeLimitSecondOption = CustomOption.Create(Color.white, "option.timeLimitSecondOption", 0f, 0f, 55f, 5f, limiterOptions).SetGameMode(CustomGameMode.ActuallyAll);
timeLimitOption.suffix = "minute";
timeLimitSecondOption.suffix = "second";
Expand Down
3 changes: 2 additions & 1 deletion Nebula/Module/CustomOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public enum CustomGameMode
Battle = 16,
ActuallyAll = 127,
VirusCrisis = 32,
Compete = 64
Compete = 64,
ExceptCompete = 63
}

[Flags]
Expand Down
8 changes: 4 additions & 4 deletions Nebula/Nebula.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ public class NebulaPlugin : BasePlugin
public const string AmongUsVersion = "2023.3.28";
public const string PluginGuid = "cn.zsfabtest.amongus.nebular";
public const string PluginName = "TheNebula-R-LTS";
public const string PluginVersion = "1.0.5.7";
public const string PluginVersion = "1.0.6.0";
public const bool IsSnapshot = false;

public static string PluginVisualVersion = (IsSnapshot ? ("24.02.09" + " - ") : "") + PluginVersion;
public static string PluginVisualVersion = (IsSnapshot ? ("24.02.10" + " - ") : "") + PluginVersion;
public static string PluginStage = IsSnapshot ? "Snapshot" : "";

public const string PluginVersionForFetch = "1.0.5.7";
public byte[] PluginVersionData = new byte[] { 1, 0, 5, 7 };
public const string PluginVersionForFetch = "1.0.6.0";
public byte[] PluginVersionData = new byte[] { 1, 0, 6, 0 };

public static NebulaPlugin Instance;

Expand Down
6 changes: 3 additions & 3 deletions Nebula/Patches/EndGamePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class EndCondition
public static EndCondition TrilemmaWin = new EndCondition(25, new Color(209f / 255f, 63f / 255f, 138f / 255f), "trilemma", 0, Module.CustomGameMode.Standard);
public static EndCondition SantaWin = new EndCondition(26, Roles.NeutralRoles.SantaClaus.RoleColor, "santa", 4, Module.CustomGameMode.Standard);

public static EndCondition NobodyWin = new EndCondition(48, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody", 0, Module.CustomGameMode.ActuallyAll).SetNoBodyWin(true);
public static EndCondition NobodyWin = new EndCondition(48, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody", 0, Module.CustomGameMode.ExceptCompete).SetNoBodyWin(true);
public static EndCondition NobodySkeldWin = new EndCondition(49, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody.skeld", 32, Module.CustomGameMode.ActuallyAll).SetNoBodyWin(true);
public static EndCondition NobodyMiraWin = new EndCondition(50, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody.mira", 32, Module.CustomGameMode.ActuallyAll).SetNoBodyWin(true);
public static EndCondition NobodyPolusWin = new EndCondition(51, new Color(72f / 255f, 78f / 255f, 84f / 255f), "nobody.polus", 32, Module.CustomGameMode.ActuallyAll).SetNoBodyWin(true);
Expand All @@ -55,7 +55,7 @@ public class EndCondition
public static EndCondition UndeadMasterWin = new EndCondition(144,Roles.NeutralRoles.UndeadMaster.RoleColor,"undeadMaster",1,Module.CustomGameMode.Standard);
public static EndCondition RedTeamWin = new EndCondition(145, Color.red, "redTeam", 1, Module.CustomGameMode.Compete);
public static EndCondition BlueTeamWin = new EndCondition(146, Color.blue, "blueTeam", 1, Module.CustomGameMode.Compete);
public static EndCondition Tie = new EndCondition(64, new Color(72f / 255f, 78f / 255f, 84f / 255f), "tie", 0, Module.CustomGameMode.ActuallyAll).SetNoBodyWin(true);
public static EndCondition Tie = new EndCondition(147, new Color(72f / 255f, 78f / 255f, 84f / 255f), "tie", 32, Module.CustomGameMode.ActuallyAll).SetNoBodyWin(true);

public static HashSet<EndCondition> AllEnds = new HashSet<EndCondition>() {
CrewmateWinByVote ,CrewmateWinByTask,CrewmateWinDisconnect,
Expand All @@ -65,7 +65,7 @@ public class EndCondition
LoversWin,TrilemmaWin,AvengerWin,
NoGame,NobodyWin,NobodySkeldWin,NobodyMiraWin,NobodyPolusWin,NobodyAirshipWin,
PavlovWin,MoriartyWin,MoriartyWinByKillHolmes,CascrubinterWin,GuesserWin,YandereWin,WerewolfWin,ChallengerWin,OracleWin,GhostWin,PuppeteerWin,YellowTeamWin,GreenTeamWin,InfectedWin,SurvivalWin,
HighRollerWin,RedTeamWin,BlueTeamWin
HighRollerWin,RedTeamWin,BlueTeamWin,Tie
};

public static EndCondition GetEndCondition(GameOverReason gameOverReason)
Expand Down
2 changes: 1 addition & 1 deletion Nebula/Patches/MeetingPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static bool Prefix(MeetingHud __instance, [HarmonyArgument(0)] byte srcPlayerId,
{
GameData.PlayerInfo playerById = GameData.Instance.GetPlayerById(srcPlayerId);
GameData.PlayerInfo playerById2 = GameData.Instance.GetPlayerById(suspectPlayerId);
__instance.logger.Debug(playerById.PlayerName + " has voted for " + ((playerById2 != null) ? playerById2.PlayerName : "No one"), null);
Debug.Log(playerById.PlayerName + " has voted for " + ((playerById2 != null) ? playerById2.PlayerName : "No one"));
int num = __instance.playerStates.IndexOf((Il2CppSystem.Predicate<PlayerVoteArea>)((PlayerVoteArea pv) => pv.TargetPlayerId == srcPlayerId));
PlayerVoteArea playerVoteArea = __instance.playerStates[num];
if (!playerVoteArea.AmDead && !playerVoteArea.DidVote)
Expand Down
4 changes: 2 additions & 2 deletions Nebula/Patches/UpdatePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,13 @@ public static void Postfix(HudManager __instance)

Objects.Ghost.Update();

if (CustomOptionHolder.timeLimitOption.getBool()) Game.GameData.data.TimerUpdate();
if (CustomOptionHolder.limiterOptions.getBool()) Game.GameData.data.TimerUpdate();

Module.Information.UpperInformationManager.Update();

if (Game.GameData.data.Ghost != null) Game.GameData.data.Ghost.Update();
}
catch (NullReferenceException excep) { UnityEngine.Debug.Log(excep.StackTrace); }
catch (NullReferenceException excep) { Debug.Log(excep.StackTrace); }

}

Expand Down
15 changes: 12 additions & 3 deletions Nebula/RPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1865,8 +1865,17 @@ public static void Extort(byte playerId,float time){

public static void CompeteGetPoint(byte team)
{
if (team == 0) Roles.CompeteRoles.RedTeam.Point++;
else Roles.CompeteRoles.BlueTeam.Point++;
if (team == 0)
{
Roles.Roles.RedTeam.Point++;
}
else
{
Roles.Roles.BlueTeam.Point++;
}

Debug.Log($"Red: {Roles.Roles.RedTeam.Point}");
Debug.Log($"Blue: {Roles.Roles.BlueTeam.Point}");
}
}

Expand Down Expand Up @@ -2971,7 +2980,7 @@ public static void Extort(PlayerControl p,float time){

public static void CompeteGetPoint(byte team)
{
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.Extort, Hazel.SendOption.Reliable, -1);
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.CompeteGetPoint, Hazel.SendOption.Reliable, -1);
writer.Write(team);
AmongUsClient.Instance.FinishRpcImmediately(writer);
RPCEvents.CompeteGetPoint(team);
Expand Down
14 changes: 14 additions & 0 deletions Nebula/Resources/Languages/SChinese.dat
Original file line number Diff line number Diff line change
Expand Up @@ -2358,6 +2358,20 @@
"role.blueTeam.hint" : "击杀<color=#FF0000FF>红队</color>队员"
"role.blueTeam.info" : "击杀红队队员。"

"role.soulEater.name" : "噬魂者"
"role.soulEater.short" : "噬"
"role.soulEater.description" : "悄无声息地击杀船员"
"role.soulEater.hint" : "夺取船员的灵魂"
"role.soulEater.info" : "噬魂者每轮只能刀一次。\n在指定时间内若没有开会,被标记对象会隐身,开会前暴毙。"
"role.soulEater.killCooldown" : "击杀冷却时间"
"role.soulEater.delayOption" : "延迟时间"

"role.deadbeat.name" : "栽赃者"
"role.deadbeat.short" : "栽"
"role.deadbeat.description" : "借他人之手击杀船员"
"role.deadbeat.hint" : "指定击杀船员"
"role.deadbeat.info" : "栽赃者需要标记一个人。\n使用击杀后将由被标记的人击杀。\n栽赃者会瞬移,而被标记者不会。"

"option.display.random" : "随机"

"side.paparazzo.name" : "摄影师"
Expand Down
Binary file modified Nebula/Resources/Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 16 additions & 5 deletions Nebula/Roles/CompeteRoles/BlueTeam.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
namespace Nebula.Roles.CompeteRoles;
using Reactor.Utilities.Extensions;
using TMPro;

namespace Nebula.Roles.CompeteRoles;

public class BlueTeam : Role
{
public static int Point = 0;
public int Point = 0;

public override void GlobalInitialize(PlayerControl __instance)
{
Expand Down Expand Up @@ -35,7 +38,7 @@ public override void ButtonInitialize(HudManager __instance)
).SetTimer(15f);
killButton.MaxTimer = CustomOptionHolder.CompeteKillCooldownOption.getFloat();
killButton.SetButtonCoolDownOption(true);
Debug.LogError(killButton.MaxTimer);
//Debug.LogError(killButton.MaxTimer);
}

public override void CleanUp()
Expand All @@ -56,17 +59,25 @@ public override void MyPlayerControlUpdate()

public override void OnDied()
{
Events.StandardEvent.SetEvent(() => { RPCEventInvoker.RevivePlayer(PlayerControl.LocalPlayer, true, false); },time:CustomOptionHolder.CompeteReviveDelayOption.getFloat());
Events.StandardEvent.SetEvent(() => { RPCEventInvoker.RevivePlayer(PlayerControl.LocalPlayer, false, false); },time:CustomOptionHolder.CompeteReviveDelayOption.getFloat());
}

public override void EditOthersDisplayNameColor(byte playerId, ref Color displayColor)
{
if (Helpers.playerById(playerId).GetModData().role.side == Side.BlueTeam) displayColor = Color;
else displayColor = Color.red;
}

public BlueTeam() : base("BlueTeam","blueTeam",Color.blue,RoleCategory.Neutral,Side.BlueTeam,Side.BlueTeam,
new HashSet<Side> { Side.BlueTeam },new HashSet<Side>() { Side.BlueTeam },new HashSet<Patches.EndCondition>() { Patches.EndCondition.BlueTeamWin },
false, VentPermission.CanUseUnlimittedVent, true, true, true)
true, VentPermission.CanUseUnlimittedVent, true, true, true)
{
canReport = false;
CanCallEmergencyMeeting = false;

ValidGamemode = Module.CustomGameMode.Compete;
IsHideRole = true;

Point = 0;
}
}
20 changes: 15 additions & 5 deletions Nebula/Roles/CompeteRoles/RedTeam.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using static Il2CppSystem.Globalization.CultureInfo;
using Reactor.Utilities.Extensions;
using TMPro;
using static Il2CppSystem.Globalization.CultureInfo;

namespace Nebula.Roles.CompeteRoles;

public class RedTeam : Role
{
public static int Point = 0;
public int Point = 0;

public override void GlobalInitialize(PlayerControl __instance)
{
Expand Down Expand Up @@ -37,7 +39,7 @@ public override void ButtonInitialize(HudManager __instance)
).SetTimer(15f);
killButton.MaxTimer = CustomOptionHolder.CompeteKillCooldownOption.getFloat();
killButton.SetButtonCoolDownOption(true);
Debug.LogError(killButton.MaxTimer);
//Debug.LogError(killButton.MaxTimer);
}

public override void CleanUp()
Expand All @@ -58,17 +60,25 @@ public override void MyPlayerControlUpdate()

public override void OnDied()
{
Events.StandardEvent.SetEvent(() => { RPCEventInvoker.RevivePlayer(PlayerControl.LocalPlayer, true, false); },time:CustomOptionHolder.CompeteReviveDelayOption.getFloat());
Events.StandardEvent.SetEvent(() => { RPCEventInvoker.RevivePlayer(PlayerControl.LocalPlayer, false, false); },time:CustomOptionHolder.CompeteReviveDelayOption.getFloat());
}

public override void EditOthersDisplayNameColor(byte playerId, ref Color displayColor)
{
if (Helpers.playerById(playerId).GetModData().role.side == Side.RedTeam) displayColor = Color;
else displayColor = Color.blue;
}

public RedTeam() : base("RedTeam","redTeam",Color.red,RoleCategory.Neutral,Side.RedTeam,Side.RedTeam,
new HashSet<Side> { Side.RedTeam },new HashSet<Side>() { Side.RedTeam },new HashSet<Patches.EndCondition>() { Patches.EndCondition.RedTeamWin },
false, VentPermission.CanUseUnlimittedVent, true, true, true)
true, VentPermission.CanUseUnlimittedVent, true, true, true)
{
canReport = false;
CanCallEmergencyMeeting = false;

ValidGamemode = Module.CustomGameMode.Compete;
IsHideRole = true;

Point = 0;
}
}
2 changes: 1 addition & 1 deletion Nebula/Roles/ComplexRoles/Guesser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ static void guesserOnClick(int buttonTarget, MeetingHud __instance)
actualRole == role ||
role.GetImplicateRoles().Contains(actualRole) ||
role.GetImplicateExtraRoles().Any((r) => focusedTargetData.HasExtraRole(r)) ||
role == Roles.SchrodingersCat && (NeutralRoles.SchrodingersCat.AllCat.Contains(actualRole))
role == Roles.SchrodingersCat && (NeutralRoles.SchrodingersCat.AllCat.Any((ro) => ro.id == actualRole.id))
)
? focusedTarget : PlayerControl.LocalPlayer;
Expand Down
2 changes: 1 addition & 1 deletion Nebula/Roles/ExtraRoles/Lover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public override void CleanUp()
}


public virtual bool IsSpawnable()
public override bool IsSpawnable()
{
if (maxPairsOption.getFloat() == 0f) return false;

Expand Down
99 changes: 99 additions & 0 deletions Nebula/Roles/ExtremeRoles/Deadbeat.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
namespace Nebula.Roles.ImpostorRoles;

public class Deadbeat : Template.TImpostor
{
private SpriteLoader AssassinMarkButtonSprite = new SpriteLoader("Nebula.Resources.AssassinMarkButton.png", 115f);

public override void Initialize(PlayerControl __instance)
{
target = null;
}

public override void LoadOptionData()
{
base.LoadOptionData();
TopOption.tab = Module.CustomOptionTab.AdvancedSettings;
}

private PlayerControl target;
private CustomButton markButton,killButton;
public override void ButtonInitialize(HudManager __instance)
{
if(markButton != null)
{
markButton.Destroy();
}
markButton = new CustomButton(
() =>
{
target = Game.GameData.data.myData.currentTarget;
},
() => { return !PlayerControl.LocalPlayer.Data.IsDead; },
() => { return PlayerControl.LocalPlayer.CanMove && Game.GameData.data.myData.currentTarget; },
() => { target = null; },
AssassinMarkButtonSprite.GetSprite(),
Expansion.GridArrangeExpansion.GridArrangeParameter.None,
__instance,
Module.NebulaInputManager.abilityInput.keyCode,
"button.label.mark"
).SetTimer(0);
markButton.Timer = markButton.MaxTimer = 0;

if(killButton != null)
{
killButton.Destroy();
}
killButton = new CustomButton(
() =>
{
RPCEventInvoker.FakeKill(PlayerControl.LocalPlayer,Game.GameData.data.myData.currentTarget);
Helpers.checkMuderAttemptAndKill(target,Game.GameData.data.myData.currentTarget,Game.PlayerData.PlayerStatus.Dead,showAnimation:false);
Game.GameData.data.myData.currentTarget = null;
killButton.Timer = killButton.MaxTimer;
},
() => { return !PlayerControl.LocalPlayer.Data.IsDead; },
() => { return PlayerControl.LocalPlayer.CanMove && Game.GameData.data.myData.currentTarget; },
() => { killButton.Timer = killButton.MaxTimer; },
__instance.KillButton.graphic.sprite,
Expansion.GridArrangeExpansion.GridArrangeParameter.AlternativeKillButtonContent,
__instance,
Module.NebulaInputManager.modKillInput.keyCode,
"button.label.kill"
).SetTimer(CustomOptionHolder.InitialKillCoolDownOption.getFloat());
killButton.MaxTimer = GameOptionsManager.Instance.CurrentGameOptions.GetFloat(FloatOptionNames.KillCooldown);
killButton.SetButtonCoolDownOption(true);
}

public override void CleanUp()
{
if(markButton != null)
{
markButton.Destroy();
markButton = null;
}
if(killButton != null)
{
killButton.Destroy();
killButton = null;
}
target = null;
}

public override void EditCoolDown(CoolDownType type, float count)
{
killButton.Timer -= count;
killButton.actionButton.ShowButtonText("+" + count + "s");
}

public override void MyPlayerControlUpdate()
{
Game.MyPlayerData data = Game.GameData.data.myData;
data.currentTarget = Patches.PlayerControlPatch.SetMyTarget((p) => !target || p.PlayerId != target.PlayerId);
Patches.PlayerControlPatch.SetPlayerOutline(data.currentTarget, Palette.ImpostorRed);
}

public Deadbeat() : base("Deadbeat", "deadbeat", false)
{
HideKillButtonEvenImpostor = true;
}
}
2 changes: 1 addition & 1 deletion Nebula/Roles/ExtremeRoles/FakeLover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public override void EditDescriptionString(ref string desctiption)

private SpriteLoader buttonSprite = new SpriteLoader("Nebula.Resources.InvolveButton.png", 115f, "ui.button.lover.involve");

public virtual bool IsSpawnable()
public override bool IsSpawnable()
{
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions Nebula/Roles/ExtremeRoles/Kotwal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public override void ButtonInitialize(HudManager __instance)
{
PlayerControl target = Game.GameData.data.myData.currentTarget;
Events.LocalEvent.Activate(new KotwalEvent(target));
RPCEventInvoker.AddAndUpdateRoleData(PlayerControl.LocalPlayer.PlayerId, appointDataId, -1);
appointDataId--;
},
() => { return !PlayerControl.LocalPlayer.Data.IsDead && Game.GameData.data.myData.getGlobalData().GetRoleData(appointDataId) > 0; },
() => { return !PlayerControl.LocalPlayer.Data.IsDead && appointDataId > 0; },
() => { return Game.GameData.data.myData.currentTarget && PlayerControl.LocalPlayer.CanMove; },
() => { appoint.Timer = appoint.MaxTimer; },
buttonSprite.GetSprite(),
Expand Down
Loading

0 comments on commit 364fb87

Please sign in to comment.