Added traitor code words

Fixed host never being traitor
This commit is contained in:
Alex Noir
2017-12-03 19:39:31 +03:00
parent ca535d295f
commit 63f8760b86
4 changed files with 132 additions and 2 deletions

View File

@@ -222,6 +222,9 @@
<Content Include="$(MSBuildThisFileDirectory)Content\Characters\Watcher\watcher.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\CodeWords.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="$(MSBuildThisFileDirectory)Content\damageshader.fx" />
<Content Include="$(MSBuildThisFileDirectory)Content\InfoTexts.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

View File

@@ -0,0 +1,75 @@
carrier
charybdis
coelanth
crawler
endworm
guardian
husk
mantis
moloch
thresher
watcher
water
submarine
red
green
blue
yellow
toxic
explosive
combustible
crate
renegade
ally
teamwork
railgun
nonsense
abyss
artifact
party
signal
airlock
scooter
ruins
C4
Compound-N
hyperzine
plasma
morbusine
oxygenite
revolver
harpoon
ocean
wrench
door
man
comrade
mask
diving
monitor
lights
battery
junction
button
locker
crate
honk
clown
horn
grenade
stun
baton
circuit
death
life
fish
shark
damage
ruins
shaft
aft
starboard
ice
cold
hot
fire

View File

@@ -102,6 +102,16 @@ namespace Barotrauma
NewMessage("***************", Color.Cyan);
}));
commands.Add(new Command("traitorlist", "traitorlist: List all the traitors and their targets.", (string[] args) =>
{
if (GameMain.Server == null) return;
TraitorManager traitorManager = GameMain.Server.TraitorManager;
if (traitorManager == null) return;
foreach (Traitor T in traitorManager.TraitorList)
{
NewMessage("- Traitor " + T.Character.Name + "'s target is " + T.TargetCharacter.Name + ".", Color.Cyan);
}
}));
commands.Add(new Command("createfilelist", "", (string[] args) =>
{

View File

@@ -1,5 +1,6 @@
using Barotrauma.Networking;
using System.Collections.Generic;
using System.IO;
namespace Barotrauma
{
@@ -16,6 +17,8 @@ namespace Barotrauma
partial class TraitorManager
{
private static string CodeWords = Path.Combine("Content", "CodeWords.txt");
public List<Traitor> TraitorList
{
get { return traitorList; }
@@ -47,14 +50,21 @@ namespace Barotrauma
traitorCandidates.Add(client.Character);
}
}
if (server.Character!= null) characters.Add(server.Character); //Add host character
if (server.Character != null)
{
characters.Add(server.Character); //Add host character
traitorCandidates.Add(server.Character);
}
if (characters.Count < 2)
{
return;
}
string codeWords = ToolBox.GetRandomLine(CodeWords) + ", " + ToolBox.GetRandomLine(CodeWords);
string codeResponse = ToolBox.GetRandomLine(CodeWords) + ", " + ToolBox.GetRandomLine(CodeWords);
traitorList = new List<Traitor>();
while (TraitorCount-- >= 0)
{
@@ -75,6 +85,34 @@ namespace Barotrauma
//Add them to the list
traitorList.Add(new Traitor(traitorCharacter, targetCharacter));
string greetingMessage = "You are the Traitor! Your secret task is to assassinate " + targetCharacter.Name + "! Discretion is an utmost concern; sinking the submarine and killing the entire crew "
+ "will arouse suspicion amongst the Fleet. If possible, make the death look like an accident.";
string moreAgentsMessage = "It is possible that there are other agents on this submarine. You don't know their names, but you do have a method of communication. "
+ "Use the code words to greet the agent and code response to respond. Disguise such words in a normal-looking phrase so the crew doesn't suspect anything.";
moreAgentsMessage += "\nThe code words are: " + codeWords + ".";
moreAgentsMessage += "\nThe code response is: " + codeResponse + ".";
if (server.Character != traitorCharacter)
{
var chatMsg = ChatMessage.Create(
null,
greetingMessage + "\n" + moreAgentsMessage,
(ChatMessageType)ChatMessageType.Server,
null);
var msgBox = ChatMessage.Create(
null,
"There might be other agents. Use these to communicate with them." +
"\nThe code words are: " + codeWords + "." +
"\nThe code response is: " + codeResponse + ".",
(ChatMessageType)ChatMessageType.MessageBox,
null);
Client client = server.ConnectedClients.Find(c => c.Character == traitorCharacter);
GameMain.Server.SendChatMessage(chatMsg, client);
GameMain.Server.SendChatMessage(msgBox, client);
}
#if CLIENT
if (server.Character == null)
{
@@ -83,6 +121,10 @@ namespace Barotrauma
else if (server.Character == traitorCharacter)
{
CreateStartPopUp(targetCharacter.Name);
GameMain.NetworkMember.AddChatMessage(greetingMessage + "\n" + moreAgentsMessage, ChatMessageType.Server);
GameMain.NetworkMember.AddChatMessage("There might be other agents. Use these to communicate with them." +
"\nThe code words are: " + codeWords + "." +
"\nThe code response is: " + codeResponse + ".", ChatMessageType.MessageBox);
return;
}
#endif