Add an upgrade rule for Country -> Faction

This commit is contained in:
penev92
2015-07-06 02:39:21 +03:00
parent 2e04fb5ddd
commit 0f0497b74d
5 changed files with 86 additions and 67 deletions

View File

@@ -1404,28 +1404,29 @@ namespace OpenRA.Mods.Common.UtilityCommands
{ {
// Common code for making each trait // Common code for making each trait
Action<string, string, string> addTrait = (type, newType, values) => Action<string, string, string> addTrait = (type, newType, values) =>
{
var upgradeTypes = trait.Value.Nodes.FirstOrDefault(n => n.Key == type + "Upgrade");
var modifier = trait.Value.Nodes.FirstOrDefault(n => n.Key == type + "Modifier");
if (upgradeTypes == null || !string.IsNullOrEmpty(upgradeTypes.Value.Value) || modifier == null || !string.IsNullOrEmpty(modifier.Value.Value))
{ {
var yaml = new MiniYaml(null); var upgradeTypes = trait.Value.Nodes.FirstOrDefault(n => n.Key == type + "Upgrade");
if (modifier == null) var modifier = trait.Value.Nodes.FirstOrDefault(n => n.Key == type + "Modifier");
modifier = new MiniYamlNode("Modifier", new MiniYaml(values));
else
modifier.Key = "Modifier";
yaml.Nodes.Add(modifier);
if (upgradeTypes == null) if (upgradeTypes == null || !string.IsNullOrEmpty(upgradeTypes.Value.Value) || modifier == null ||
upgradeTypes = new MiniYamlNode("UpgradeTypes", new MiniYaml(type.ToLowerInvariant())); !string.IsNullOrEmpty(modifier.Value.Value))
else {
upgradeTypes.Key = "UpgradeTypes"; var yaml = new MiniYaml(null);
yaml.Nodes.Add(upgradeTypes); if (modifier == null)
modifier = new MiniYamlNode("Modifier", new MiniYaml(values));
else
modifier.Key = "Modifier";
yaml.Nodes.Add(modifier);
node.Value.Nodes.Add(new MiniYamlNode((newType ?? type) + "Multiplier@EXPERIENCE", yaml)); if (upgradeTypes == null)
} upgradeTypes = new MiniYamlNode("UpgradeTypes", new MiniYaml(type.ToLowerInvariant()));
}; else
upgradeTypes.Key = "UpgradeTypes";
yaml.Nodes.Add(upgradeTypes);
node.Value.Nodes.Add(new MiniYamlNode((newType ?? type) + "Multiplier@EXPERIENCE", yaml));
}
};
// Execute common code for each trait // Execute common code for each trait
addTrait("Firepower", null, "110, 115, 120, 130"); addTrait("Firepower", null, "110, 115, 120, 130");
@@ -1505,6 +1506,24 @@ namespace OpenRA.Mods.Common.UtilityCommands
} }
} }
// Rename the `Country` trait to `Faction`
if (engineVersion < 20150714)
{
var split = node.Key.Split('@');
if (split.Any() && split[0] == "Country")
{
node.Key = node.Key.Replace("Country", "Faction");
var race = node.Value.Nodes.FirstOrDefault(x => x.Key == "Race");
if (race != null)
race.Key = "InternalName";
var randomRace = node.Value.Nodes.FirstOrDefault(x => x.Key == "RandomRaceMembers");
if (randomRace != null)
randomRace.Key = "RandomFactionMembers";
}
}
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1); UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
} }
} }

View File

@@ -12,18 +12,18 @@
FogVariants: typea, typeb, typec, typed FogVariants: typea, typeb, typec, typed
OverrideFullShroud: full OverrideFullShroud: full
OverrideFullFog: full OverrideFullFog: full
Country@Random: Faction@Random:
Name: Any Name: Any
Race: Random InternalName: Random
RandomRaceMembers: gdi, nod RandomFactionMembers: gdi, nod
Description: Select a random faction. Description: Select a random faction.
Country@gdi: Faction@gdi:
Name: GDI Name: GDI
Race: gdi InternalName: gdi
Description: Global Defense Initiative\nThe GDI is an international military branch of the United Nations tasked\nwith keeping world peace. Commanding the combined forces of the world's\nmost powerful nations, they possess an unmatched arsenal of high-tech weaponry. Description: Global Defense Initiative\nThe GDI is an international military branch of the United Nations tasked\nwith keeping world peace. Commanding the combined forces of the world's\nmost powerful nations, they possess an unmatched arsenal of high-tech weaponry.
Country@nod: Faction@nod:
Name: Nod Name: Nod
Race: nod InternalName: nod
Description: Brotherhood of Nod\nThe Brotherhood is a religious cult centered around their leader Kane\nand the alien substance Tiberium. They utilize stealth technology\nand guerilla tactics to defeat those who oppose them. Description: Brotherhood of Nod\nThe Brotherhood is a religious cult centered around their leader Kane\nand the alien substance Tiberium. They utilize stealth technology\nand guerilla tactics to defeat those who oppose them.
ResourceType@green-tib: ResourceType@green-tib:
ResourceType: 1 ResourceType: 1

View File

@@ -14,26 +14,26 @@
OverrideFullShroud: full OverrideFullShroud: full
OverrideFullFog: full OverrideFullFog: full
ShroudBlend: Multiply ShroudBlend: Multiply
Country@Random: Faction@Random:
Name: Any Name: Any
Race: Random InternalName: Random
RandomRaceMembers: atreides, harkonnen, ordos RandomFactionMembers: atreides, harkonnen, ordos
Description: Select a random House. Description: Select a random House.
Country@Atreides: Faction@Atreides:
Name: Atreides Name: Atreides
Race: atreides InternalName: atreides
Description: House Atreides\nThe noble Atreides, from the water world of Caladan,\nrely on their ornithopters to ensure air superiority.\nThey have allied themselves with the Fremen, the fearsome\nnative warriors of Dune that can move undetected in battle. Description: House Atreides\nThe noble Atreides, from the water world of Caladan,\nrely on their ornithopters to ensure air superiority.\nThey have allied themselves with the Fremen, the fearsome\nnative warriors of Dune that can move undetected in battle.
Country@Harkonnen: Faction@Harkonnen:
Name: Harkonnen Name: Harkonnen
Race: harkonnen InternalName: harkonnen
Description: House Harkonnen\nThe evil Harkonnen will stop at nothing to gain control of the spice.\nThey rely on brute force and atomic weapons to achieve their goals:\nwealth, and the destruction of House Atreides. Description: House Harkonnen\nThe evil Harkonnen will stop at nothing to gain control of the spice.\nThey rely on brute force and atomic weapons to achieve their goals:\nwealth, and the destruction of House Atreides.
Country@Ordos: Faction@Ordos:
Name: Ordos Name: Ordos
Race: ordos InternalName: ordos
Description: House Ordos\nThe insidious Ordos of the icy planet Sigma Draconis IV\nare known for their wealth, greed and treachery.\nRelying heavily on mercenaries they often resort\nto sabotage and forbidden Ixian technologies. Description: House Ordos\nThe insidious Ordos of the icy planet Sigma Draconis IV\nare known for their wealth, greed and treachery.\nRelying heavily on mercenaries they often resort\nto sabotage and forbidden Ixian technologies.
Country@Corrino: Faction@Corrino:
Name: Corrino Name: Corrino
Race: corrino InternalName: corrino
Selectable: false Selectable: false
ResourceType@Spice: ResourceType@Spice:
ResourceType: 1 ResourceType: 1

View File

@@ -12,57 +12,57 @@
FogVariants: shroud FogVariants: shroud
Index: 255, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 20, 40, 56, 65, 97, 130, 148, 194, 24, 33, 66, 132, 28, 41, 67, 134, 1, 2, 4, 8, 3, 6, 12, 9, 7, 14, 13, 11, 5, 10, 15, 255 Index: 255, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 20, 40, 56, 65, 97, 130, 148, 194, 24, 33, 66, 132, 28, 41, 67, 134, 1, 2, 4, 8, 3, 6, 12, 9, 7, 14, 13, 11, 5, 10, 15, 255
UseExtendedIndex: true UseExtendedIndex: true
Country@0: Faction@0:
Name: Allies Name: Allies
Race: allies InternalName: allies
Side: Allies Side: Allies
Selectable: False Selectable: False
Country@1: Faction@1:
Name: England Name: England
Race: england InternalName: england
Side: Allies Side: Allies
Description: England: Espionage\nSpecial Unit: British Spy\nSpecial Unit: Phase Transport Description: England: Espionage\nSpecial Unit: British Spy\nSpecial Unit: Phase Transport
Country@2: Faction@2:
Name: France Name: France
Race: france InternalName: france
Side: Allies Side: Allies
Description: France: Deception\nSpecial Ability: Can build fake structures\nSpecial Unit: Mobile Gap Generator Description: France: Deception\nSpecial Ability: Can build fake structures\nSpecial Unit: Mobile Gap Generator
Country@3: Faction@3:
Name: Germany Name: Germany
Race: germany InternalName: germany
Side: Allies Side: Allies
Description: Germany: Technology\nSpecial Ability: Advanced Chronoshift\nSpecial Unit: Chrono Tank Description: Germany: Technology\nSpecial Ability: Advanced Chronoshift\nSpecial Unit: Chrono Tank
Country@4: Faction@4:
Name: Soviet Name: Soviet
Race: soviet InternalName: soviet
Side: Soviet Side: Soviet
Selectable: False Selectable: False
Country@5: Faction@5:
Name: Russia Name: Russia
Race: russia InternalName: russia
Side: Soviet Side: Soviet
Description: Russia: Tesla Weapons\nSpecial Unit: Tesla Tank\nSpecial Unit: Shock Trooper Description: Russia: Tesla Weapons\nSpecial Unit: Tesla Tank\nSpecial Unit: Shock Trooper
Country@6: Faction@6:
Name: Ukraine Name: Ukraine
Race: ukraine InternalName: ukraine
Side: Soviet Side: Soviet
Description: Ukraine: Demolitions\nSpecial Ability: Parabombs\nSpecial Unit: Demolition Truck Description: Ukraine: Demolitions\nSpecial Ability: Parabombs\nSpecial Unit: Demolition Truck
Country@random: Faction@random:
Name: Any Name: Any
Race: Random InternalName: Random
RandomRaceMembers: RandomAllies, RandomSoviet RandomFactionMembers: RandomAllies, RandomSoviet
Side: Random Side: Random
Description: A random country. Description: A random country.
Country@randomallies: Faction@randomallies:
Name: Allies Name: Allies
Race: RandomAllies InternalName: RandomAllies
RandomRaceMembers: england, france, germany RandomFactionMembers: england, france, germany
Side: Random Side: Random
Description: A random Allied country. Description: A random Allied country.
Country@randomsoviet: Faction@randomsoviet:
Name: Soviet Name: Soviet
Race: RandomSoviet InternalName: RandomSoviet
RandomRaceMembers: russia, ukraine RandomFactionMembers: russia, ukraine
Side: Random Side: Random
Description: A random Soviet country. Description: A random Soviet country.
ResourceType@ore: ResourceType@ore:

View File

@@ -12,16 +12,16 @@
UseExtendedIndex: true UseExtendedIndex: true
ShroudPalette: shroud ShroudPalette: shroud
FogPalette: shroud FogPalette: shroud
Country@Random: Faction@Random:
Name: Any Name: Any
Race: Random InternalName: Random
RandomRaceMembers: gdi, nod RandomFactionMembers: gdi, nod
Country@0: Faction@0:
Name: GDI Name: GDI
Race: gdi InternalName: gdi
Country@1: Faction@1:
Name: Nod Name: Nod
Race: nod InternalName: nod
ResourceType@Tiberium: ResourceType@Tiberium:
ResourceType: 1 ResourceType: 1
Palette: greentiberium Palette: greentiberium