Team-specific combat mission descriptions + deepest lore
This commit is contained in:
@@ -177,13 +177,22 @@
|
||||
|
||||
<CombatMission
|
||||
name="Search and Destroy"
|
||||
description="[location1] and [location2] are at war! Eliminate the enemy crew and return to base."
|
||||
|
||||
descriptionneutral="A Coalition vessel has been dispatched from [location1] to destroy a renegade vessel at the outskirts of [location2]."
|
||||
description1="A renegade vessel has been detected at the outskirts of [location2]. Treason against the Europa Coalition is punishable by death - eliminate the renegades and return to [location1]!"
|
||||
description2="You're a member of a renegade group opposing the Europa Coalition. According to your informants at [location1], a Coalition ship has just been dispatched on a mission to take down your vessel. Eliminate their crew and return to [location2]."
|
||||
|
||||
teamname1="Coalition"
|
||||
teamname2="Renegade"
|
||||
|
||||
multiplayeronly="true"
|
||||
commonness="20"
|
||||
reward="2000"
|
||||
successmessage="[winner] has defeated [loser]!"
|
||||
|
||||
successmessage="The [loser] vessel has been defeated by the [winner] crew!"
|
||||
failuremessage="Both crews have perished.">
|
||||
<message header="Crew eliminated" text="[location1] has fallen! Navigate back to your base."/>
|
||||
<message header="Crew eliminated" text="[location2] has fallen! Navigate back to your base."/>
|
||||
|
||||
<message header="Crew eliminated" text="The renegade crew has been defeated! The Coalition vessel has to make its way back to [location1]."/>
|
||||
<message header="Crew eliminated" text="The Coalition crew has been defeated! The renegade vessel has to make its way back to [location2]."/>
|
||||
</CombatMission>
|
||||
</Missions>
|
||||
@@ -16,8 +16,8 @@ namespace Barotrauma
|
||||
|
||||
private int requiredDeliveryAmount;
|
||||
|
||||
public CargoMission(XElement element)
|
||||
: base(element)
|
||||
public CargoMission(XElement element, Location[] locations)
|
||||
: base(element, locations)
|
||||
{
|
||||
itemConfig = element.Element("Items");
|
||||
|
||||
|
||||
@@ -15,6 +15,26 @@ namespace Barotrauma
|
||||
private int state = 0;
|
||||
private int winner = -1;
|
||||
|
||||
private string[] descriptions;
|
||||
|
||||
private static string[] teamNames;
|
||||
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GameMain.NetworkMember==null || GameMain.NetworkMember.Character==null)
|
||||
{
|
||||
//non-team-specific description
|
||||
return descriptions[0];
|
||||
}
|
||||
|
||||
//team specific
|
||||
return descriptions[GameMain.NetworkMember.Character.TeamID];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override string SuccessMessage
|
||||
{
|
||||
get
|
||||
@@ -22,14 +42,47 @@ namespace Barotrauma
|
||||
if (winner == -1) return "";
|
||||
|
||||
return successMessage
|
||||
.Replace("[loser]", Locations[1 - winner]
|
||||
.Replace("[winner]", Locations[winner]));
|
||||
.Replace("[loser]", teamNames[1 - winner])
|
||||
.Replace("[winner]", teamNames[winner]);
|
||||
}
|
||||
}
|
||||
|
||||
public CombatMission(XElement element)
|
||||
: base(element)
|
||||
public CombatMission(XElement element, Location[] locations)
|
||||
: base(element, locations)
|
||||
{
|
||||
descriptions = new string[]
|
||||
{
|
||||
ToolBox.GetAttributeString(element, "descriptionneutral", ""),
|
||||
ToolBox.GetAttributeString(element, "description1", ""),
|
||||
ToolBox.GetAttributeString(element, "description2", "")
|
||||
};
|
||||
|
||||
for (int i = 0; i < descriptions.Length; i++ )
|
||||
{
|
||||
for (int n = 0; n < 2;n++ )
|
||||
{
|
||||
descriptions[i] = descriptions[i].Replace("[location" + (n + 1) + "]", Locations[n]);
|
||||
}
|
||||
}
|
||||
|
||||
teamNames = new string[]
|
||||
{
|
||||
ToolBox.GetAttributeString(element, "teamname1", "Team A"),
|
||||
ToolBox.GetAttributeString(element, "teamname2", "Team B")
|
||||
};
|
||||
}
|
||||
|
||||
public static string GetTeamName(int teamID)
|
||||
{
|
||||
//team IDs start from 1, while teamName array starts from 0
|
||||
teamID--;
|
||||
|
||||
if (teamID < 0 || teamID >= teamNames.Length)
|
||||
{
|
||||
return "Team " + teamID;
|
||||
}
|
||||
|
||||
return teamNames[teamID];
|
||||
}
|
||||
|
||||
public override bool AssignTeamIDs(List<Client> clients, out int hostTeam)
|
||||
@@ -111,6 +164,15 @@ namespace Barotrauma
|
||||
|
||||
foreach (Character character in Character.CharacterList)
|
||||
{
|
||||
if (GameMain.NetworkMember != null && character == GameMain.NetworkMember.Character)
|
||||
{
|
||||
//ugly hack to switch the text in the mission popup to the team-specific description
|
||||
if (GUIMessageBox.MessageBoxes.Count > 0 && GUIMessageBox.MessageBoxes.Peek().UserData as string == "missionstartmessage")
|
||||
{
|
||||
(GUIMessageBox.MessageBoxes.Peek() as GUIMessageBox).Text = Description;
|
||||
}
|
||||
}
|
||||
|
||||
if (character.TeamID == 1)
|
||||
{
|
||||
crews[0].Add(character);
|
||||
@@ -122,14 +184,14 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
bool[] teamDead =
|
||||
{
|
||||
crews[0].All(c => c.IsDead || c.IsUnconscious),
|
||||
crews[1].All(c => c.IsDead || c.IsUnconscious)
|
||||
};
|
||||
|
||||
if (state == 0)
|
||||
{
|
||||
bool[] teamDead =
|
||||
{
|
||||
crews[0].All(c => c.IsDead || c.IsUnconscious),
|
||||
crews[1].All(c => c.IsDead || c.IsUnconscious)
|
||||
};
|
||||
|
||||
for (int i = 0; i < teamDead.Length; i++)
|
||||
{
|
||||
if (!teamDead[i] && teamDead[1-i])
|
||||
@@ -155,6 +217,11 @@ namespace Barotrauma
|
||||
if (GameMain.Server != null) GameMain.Server.EndGame();
|
||||
}
|
||||
}
|
||||
|
||||
if (teamDead[0] && teamDead[1])
|
||||
{
|
||||
if (GameMain.Server != null) GameMain.Server.EndGame();
|
||||
}
|
||||
}
|
||||
|
||||
public override void End()
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Barotrauma
|
||||
get { return name; }
|
||||
}
|
||||
|
||||
public string Description
|
||||
public virtual string Description
|
||||
{
|
||||
get { return description; }
|
||||
}
|
||||
@@ -88,7 +88,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public Mission(XElement element)
|
||||
public Mission(XElement element, Location[] locations)
|
||||
{
|
||||
name = ToolBox.GetAttributeString(element, "name", "");
|
||||
|
||||
@@ -111,6 +111,21 @@ namespace Barotrauma
|
||||
headers.Add(ToolBox.GetAttributeString(subElement, "header", ""));
|
||||
messages.Add(ToolBox.GetAttributeString(subElement, "text", ""));
|
||||
}
|
||||
|
||||
|
||||
for (int n = 0; n < 2; n++)
|
||||
{
|
||||
Locations[n] = locations[n].Name;
|
||||
description = description.Replace("[location" + (n + 1) + "]", locations[n].Name);
|
||||
|
||||
successMessage = successMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
|
||||
failureMessage = failureMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
|
||||
|
||||
for (int m = 0; m < messages.Count; m++)
|
||||
{
|
||||
messages[m] = messages[m].Replace("[location" + (n + 1) + "]", locations[n].Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Mission LoadRandom(Location[] locations, MTRandom rand, string missionType = "", bool isSinglePlayer = false)
|
||||
@@ -192,25 +207,11 @@ namespace Barotrauma
|
||||
continue;
|
||||
}
|
||||
|
||||
ConstructorInfo constructor = t.GetConstructor(new[] { typeof(XElement) });
|
||||
ConstructorInfo constructor = t.GetConstructor(new[] { typeof(XElement), typeof(Location[]) });
|
||||
|
||||
object instance = constructor.Invoke(new object[] { element });
|
||||
object instance = constructor.Invoke(new object[] { element, locations });
|
||||
|
||||
Mission mission = (Mission)instance;
|
||||
|
||||
for (int n = 0; n<2; n++)
|
||||
{
|
||||
mission.Locations[n] = locations[n].Name;
|
||||
mission.description = mission.description.Replace("[location"+(n+1)+"]", locations[n].Name);
|
||||
|
||||
mission.successMessage = mission.successMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
|
||||
mission.failureMessage = mission.failureMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
|
||||
|
||||
for (int m=0;m<mission.messages.Count;m++)
|
||||
{
|
||||
mission.messages[m] = mission.messages[m].Replace("[location" + (n + 1) + "]", locations[n].Name);
|
||||
}
|
||||
}
|
||||
|
||||
return mission;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace Barotrauma
|
||||
get { return monster != null && !monster.IsDead ? radarPosition : Vector2.Zero; }
|
||||
}
|
||||
|
||||
public MonsterMission(XElement element)
|
||||
: base(element)
|
||||
public MonsterMission(XElement element, Location[] locations)
|
||||
: base(element, locations)
|
||||
{
|
||||
monsterFile = ToolBox.GetAttributeString(element, "monsterfile", "");
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public SalvageMission(XElement element)
|
||||
: base(element)
|
||||
public SalvageMission(XElement element, Location[] locations)
|
||||
: base(element, locations)
|
||||
{
|
||||
string itemName = ToolBox.GetAttributeString(element, "itemname", "");
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (teamIDs.Count > 1)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0,y-20,100,20),"Team "+teamIDs[i], GUI.Style, crewFrame);
|
||||
new GUITextBlock(new Rectangle(0, y - 20, 100, 20), CombatMission.GetTeamName(teamIDs[i]), GUI.Style, crewFrame);
|
||||
}
|
||||
|
||||
GUIListBox crewList = new GUIListBox(new Rectangle(0, y, 280, listBoxHeight), Color.White * 0.7f, GUI.Style, crewFrame);
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace Barotrauma
|
||||
|
||||
if (mission == null) return;
|
||||
|
||||
new GUIMessageBox(mission.Name, mission.Description, 400, 400);
|
||||
var missionMsg = new GUIMessageBox(mission.Name, mission.Description, 400, 400);
|
||||
missionMsg.UserData = "missionstartmessage";
|
||||
|
||||
Networking.GameServer.Log("Mission: " + mission.Name, Color.Cyan);
|
||||
Networking.GameServer.Log(mission.Description, Color.Cyan);
|
||||
|
||||
Reference in New Issue
Block a user