public void Init() { // create dummy designs attackerDesign = new Design <Ship>(); attackerDesign.AddComponent(mod.ComponentTemplates.FindByName("Bridge")); attackerDesign.AddComponent(mod.ComponentTemplates.FindByName("Life Support")); attackerDesign.AddComponent(mod.ComponentTemplates.FindByName("Crew Quarters")); attackerDesign.AddComponent(mod.ComponentTemplates.FindByName("Quantum Reactor")); defenderDesign = new Design <Ship>(); defenderDesign.AddComponent(mod.ComponentTemplates.FindByName("Bridge")); defenderDesign.AddComponent(mod.ComponentTemplates.FindByName("Life Support")); defenderDesign.AddComponent(mod.ComponentTemplates.FindByName("Crew Quarters")); defenderDesign.AddComponent(mod.ComponentTemplates.FindByName("Quantum Reactor")); }
public void AbilitiesFromIdenticalComponents() { // create engine component template ComponentTemplate engineTemplate = new() { Name = "Ion Engine" }; engineTemplate.Abilities.Add(new Ability( engineTemplate, AbilityRule.Find("Standard Ship Movement"), null, 1)); // add some engines int numEngines = 6; for (var i = 0; i < numEngines; i++) { design.AddComponent(engineTemplate); } // test thrust Assert.AreEqual(numEngines, design.StrategicSpeed); } }
private void AddComponents(IDesign d, params string[] compNames) { foreach (var cn in compNames) { d.AddComponent(Mod.Current.ComponentTemplates.FindByName(cn)); } }
public void NormalDamageVersusShips() { attackerDesign.AddComponent(mod.ComponentTemplates.FindByName("Depleted Uranium Cannon I")); attacker = attackerDesign.Instantiate(); // armor should get hit before hull defenderDesign.AddComponent(mod.ComponentTemplates.FindByName("Armor I")); SetupDefender(); TestDamage(attacker, defender, 1, expectedArmorDmg: 1); // phased shields should get hit before normal shields defenderDesign.AddComponent(mod.ComponentTemplates.FindByName("Shield Generator I")); defenderDesign.AddComponent(mod.ComponentTemplates.FindByName("Phased - Shield Generator I")); SetupDefender(); TestDamage(attacker, defender, 1, expectedNormalShieldDmg: 1); // make sure our ship can be destroyed SetupDefender(); TestDamage(attacker, defender, 99999, defender.HullHitpoints, defender.ArmorHitpoints, defender.PhasedShields, defender.NormalShields); }