public void CreateCondition_Unnoticed_Test() { var character = CreateMockCharacter(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, EntityIds.UNNOTICED_CONDITION_ID); Assert.IsTrue(character.Conditions.HasConditionId(EntityIds.UNNOTICED_CONDITION_ID)); Assert.IsTrue(condition is Unnoticed); Assert.AreSame(condition, character.Conditions.GetById(EntityIds.UNNOTICED_CONDITION_ID)); }
public void CreateCondition_Prone_Test() { var character = CreateMockCharacter(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, EntityIds.PRONE_CONDITION_ID); Assert.IsTrue(character.Conditions.HasConditionId(EntityIds.PRONE_CONDITION_ID)); Assert.IsTrue(condition is Prone); Assert.AreSame(condition, character.Conditions.GetById(EntityIds.PRONE_CONDITION_ID)); }
public void CreateCondition_Indifferent_Test() { var character = CreateMockCharacter(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, EntityIds.INDIFFERENT_CONDITION_ID); Assert.IsTrue(character.Conditions.HasConditionId(EntityIds.INDIFFERENT_CONDITION_ID)); Assert.IsTrue(condition is Indifferent); Assert.AreSame(condition, character.Conditions.GetById(EntityIds.INDIFFERENT_CONDITION_ID)); }
public void CreateCondition_Friendly_Test() { var character = CreateMockCharacter(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, EntityIds.FRIENDLY_CONDITION_ID); Assert.IsTrue(character.Conditions.HasConditionId(EntityIds.FRIENDLY_CONDITION_ID)); Assert.IsTrue(condition is Friendly); Assert.AreSame(condition, character.Conditions.GetById(EntityIds.FRIENDLY_CONDITION_ID)); }
public void CreateCondition_Immobilized_Test() { var character = CreateMockCharacter(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, EntityIds.IMMOBILIZED_CONDITION_ID); Assert.IsTrue(character.Conditions.HasConditionId(EntityIds.IMMOBILIZED_CONDITION_ID)); Assert.IsTrue(condition is Immobilized); Assert.AreSame(condition, character.Conditions.GetById(EntityIds.IMMOBILIZED_CONDITION_ID)); }
public void CreateCondition_Broken_Test() { var obj = CreateMockObject(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(obj, EntityIds.BROKEN_CONDITION_ID); Assert.IsTrue(obj.Conditions.Any(c => c.Id == EntityIds.BROKEN_CONDITION_ID)); Assert.IsTrue(condition is Broken); Assert.AreSame(condition, obj.Conditions[0]); }
public void CreateCondition_Blinded_Test() { var character = CreateMockCharacter(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, EntityIds.BLINDED_CONDITION_ID); Assert.IsTrue(character.Conditions.Any(c => c.Id == EntityIds.BLINDED_CONDITION_ID)); Assert.IsTrue(condition is Blinded); Assert.AreSame(condition, character.Conditions[0]); }
public void CreateCondition_Wounded_WithLevel_Test() { var character = CreateMockCharacter(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, EntityIds.WOUNDED_CONDITION_ID, 2); Assert.IsTrue(character.Conditions.HasConditionId(EntityIds.WOUNDED_CONDITION_ID)); Assert.IsTrue(condition is Wounded); Assert.AreSame(condition, character.Conditions[0]); Assert.AreEqual(2, character.Conditions[0].Level); }
public void CreateCondition_Stunned_WithoutLevel_Test() { var character = CreateMockCharacter(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, EntityIds.STUNNED_CONDITION_ID); Assert.IsTrue(character.Conditions.HasConditionId(EntityIds.STUNNED_CONDITION_ID)); Assert.IsTrue(condition is Stunned); Assert.AreSame(condition, character.Conditions[0]); Assert.AreEqual(1, character.Conditions[0].Level); }
public void CreateCondition_PersistentDamage_Test() { var character = CreateMockCharacter(); var die = new Die("Acid", 1, 4, 1); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, EntityIds.PERSISTENT_DAMAGE_CONDITION_ID, "Acid", die); Assert.IsTrue(character.Conditions.HasConditionId(EntityIds.PERSISTENT_DAMAGE_CONDITION_ID)); Assert.IsTrue(condition is PersistentDamage); Assert.AreSame(condition, character.Conditions[0]); }
public void CreateCondition_Dying_WithoutLevel_Test() { var character = CreateMockCharacter(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, EntityIds.DYING_CONDITION_ID); Assert.IsTrue(character.Conditions.Any(c => c.Id == EntityIds.DYING_CONDITION_ID)); Assert.IsTrue(condition is Dying); Assert.AreSame(condition, character.Conditions[0]); Assert.AreEqual(1, character.Conditions[0].Level); }
public void CreateCondition_Drained_WithLevel_Test() { var character = CreateMockCharacter(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, EntityIds.DRAINED_CONDITION_ID, 2); Assert.IsTrue(character.Conditions.Any(c => c.Id == EntityIds.DRAINED_CONDITION_ID)); Assert.IsTrue(condition is Drained); Assert.AreSame(condition, character.Conditions[0]); Assert.AreEqual(2, character.Conditions[0].Level); }
public void CreateCondition_Clumsy_WithLevel_Test() { var character = CreateMockCharacter(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, EntityIds.CLUMSY_CONDITION_ID, 3); Assert.IsTrue(character.Conditions.Any(c => c.Id == EntityIds.CLUMSY_CONDITION_ID)); Assert.IsTrue(condition is Clumsy); Assert.AreSame(condition, character.Conditions[0]); Assert.AreEqual(3, character.Conditions[0].Level); }
public void CreateCondition_BadArgument_Test() { var character = CreateMockCharacter(); var factory = new ConditionFactory(); var condition = factory.CreateCondition(character, -1); }
static Mission ReadFile(string filePath) { var mission = new Mission(); var fileStream = new FileStream(filePath, FileMode.Open); var binaryReader = new BinaryReader(fileStream); // 1. House Tech level binaryReader.Read(mission.HouseTechLevel, 0, mission.HouseTechLevel.Length); // 2. Starting money for (var i = 0; i < mission.StartingMoney.Length; i++) { mission.StartingMoney[i] = binaryReader.ReadInt32(); } // 3. Unknown region of 40 bytes binaryReader.Read(mission.UnknownRegion1, 0, mission.UnknownRegion1.Length); // 4. House index allocation binaryReader.Read(mission.HouseIndexAllocation, 0, mission.HouseIndexAllocation.Length); // 5. AI Section for (var i = 0; i < mission.AISection.Length; i++) { mission.AISection[i] = new AISection(binaryReader.ReadBytes(AISection.ByteCount)); } // 6. Diplomacy for (var i = 0; i < mission.Diplomacy.Length; i++) { mission.Diplomacy[i] = new DiplomacyRow(binaryReader.ReadBytes(DiplomacyRow.ByteCount)); } // 7. Events for (var i = 0; i < mission.Events.Length; i++) { mission.Events[i] = EventFactory.CreateEvent(binaryReader.ReadBytes(Event.ByteCount)); } // 8. Conditions for (var i = 0; i < mission.Conditions.Length; i++) { mission.Conditions[i] = ConditionFactory.CreateCondition(binaryReader.ReadBytes(Condition.ByteCount)); } // 9. Tileset image name binaryReader.Read(mission.TilesetImageName, 0, mission.TilesetImageName.Length); // 10. Tileset data file name binaryReader.Read(mission.TilesetDataName, 0, mission.TilesetDataName.Length); // 11. Active events count mission.EventCount = binaryReader.ReadByte(); // 12. Active conditions count mission.ConditionCount = binaryReader.ReadByte(); // 13. Time limit mission.TimeLimit = binaryReader.ReadInt32(); // 14. Unknown region of remaining bytes binaryReader.Read(mission.UnknownRegion2, 0, mission.UnknownRegion2.Length); binaryReader.Close(); fileStream.Close(); return(mission); }