public string FormatMovement() { string movement = Program.Character.Movement; int intMovement; if (int.TryParse(Program.Character.Movement, out intMovement)) { if (Fatigued.Equals("Exhaustion 5") || Grappled.Equals("Afflicted") || Restrained.Equals("Afflicted")) { movement = "0"; } else { if (Encumbrance.Equals("Encumbered")) { movement = (intMovement - 10).ToString(); intMovement = intMovement - 10; } else if (Encumbrance.Equals("Heavily Encumbered")) { movement = (intMovement - 20).ToString(); intMovement = intMovement - 20; } if (Fatigued.Equals("Exhaustion 2") || Fatigued.Equals("Exhaustion 3") || Fatigued.Equals("Exhaustion 4")) { movement = (intMovement / 2).ToString(); } } } return(movement); }
public void Apply_NotACharacter_Test() { var entity = Mock.Of <IEntity>(); var fatigued = new Fatigued(); fatigued.Apply(entity); Assert.IsTrue(true); // If we made it here without exception then the test passed }
public void Remove_NoConditions_Test() { var character = CreateMockCharacter(); var fatigued = new Fatigued(); fatigued.Apply(character); fatigued.Remove(character); Assert.AreEqual(0, character.Conditions.Count); }
public void Apply_Character_WithExistingFatiguedCondition_Test() { var character = CreateMockCharacter(); character.Conditions.Add(new Fatigued()); var fatigued = new Fatigued(); fatigued.Apply(character); }
public void Apply_Character_NoConditions_Test() { var character = CreateMockCharacter(); var fatigued = new Fatigued(); fatigued.Apply(character); Assert.AreEqual(EntityIds.FATIGUED_CONDITION_ID, character.Conditions[0].Id); Assert.AreSame(fatigued, character.Conditions[0]); Assert.AreEqual(ModifierType.Status, character.Conditions[0].Modifier.Type); Assert.AreEqual(-1, character.Conditions[0].Modifier.Value); Assert.IsTrue(character.Conditions[0].AppliesTo.Contains(EntityIds.AC_ID)); Assert.IsTrue(character.Conditions[0].AppliesTo.Contains(EntityIds.FORT_SAVE_ID)); Assert.IsTrue(character.Conditions[0].AppliesTo.Contains(EntityIds.REFLEX_SAVE_ID)); Assert.IsTrue(character.Conditions[0].AppliesTo.Contains(EntityIds.WILL_SAVE_ID)); }
public string FormatHealth() { string health = Program.Character.HitPoints.MaxHP.ToString(); int halfHP = Program.Character.HitPoints.MaxHP / 2; if (Fatigued.Equals("Exhaustion 4") || Fatigued.Equals("Exhaustion 5")) { health = halfHP.ToString(); if (Program.Character.HitPoints.HP > halfHP) { Program.Character.HitPoints.HP = halfHP; } } else if (Fatigued.Equals("Exhaustion 6")) { health = "0"; Program.Character.HitPoints.HP = 0; } return(health); }
public string[] ToArray() { string[] array = new string[16]; array[0] = Blinded.Equals("Cured") ? "" : "Blinded"; array[1] = Charmed.Equals("Cured") ? "" : "Charmed"; array[2] = Deafened.Equals("Cured") ? "" : "Deafened"; array[3] = Encumbrance.Equals("Normal") ? "" : Encumbrance; array[4] = Fatigued.Equals("Cured") ? "" : Fatigued; array[5] = Frightened.Equals("Cured") ? "" : "Frightened"; array[6] = Grappled.Equals("Cured") ? "" : "Grappled"; array[7] = Incapacitated.Equals("Cured") ? "" : "Incapacitated"; array[8] = Invisible.Equals("Cured") ? "" : "Invisible"; array[9] = Paralyzed.Equals("Cured") ? "" : "Paralyzed"; array[10] = Petrified.Equals("Cured") ? "" : "Petrified"; array[11] = Poisoned.Equals("Cured") ? "" : "Poisoned"; array[12] = Prone.Equals("Cured") ? "" : "Prone"; array[13] = Restrained.Equals("Cured") ? "" : "Restrained"; array[14] = Stunned.Equals("Cured") ? "" : "Stunned"; array[15] = Unconscious.Equals("Cured") ? "" : "Unconscious"; return(array); }
public void FormatChecks() { if (Fatigued.Equals("Exhaustion 1") || Fatigued.Equals("Exhaustion 2") || Fatigued.Equals("Exhaustion 3") || Fatigued.Equals("Exhaustion 4") || Fatigued.Equals("Exhaustion 5") || Afflicted(Frightened) || Afflicted(Poisoned)) { foreach (Skills skill in Program.Character.oSkills) { skill.Checks = Constants.Checks.Disadvantage; } } if (Afflicted(Blinded)) { foreach (Skills skill in Program.Character.oSkills) { skill.Checks = Constants.Checks.Fail; } } if (Fatigued.Equals("Exhaustion 3") || Fatigued.Equals("Exhaustion 4") || Fatigued.Equals("Exhaustion 5")) { foreach (SavingThrows saves in Program.Character.oSavingThrows) { saves.Checks = Constants.Checks.Disadvantage; } } if (Afflicted(Restrained)) { Program.Character.oSavingThrows[(int)MainPage.Saves.Dexterity].Checks = Constants.Checks.Disadvantage; } if (Afflicted(Paralyzed) || Afflicted(Stunned)) { Program.Character.oSavingThrows[(int)MainPage.Saves.Strength].Checks = Constants.Checks.Fail; Program.Character.oSavingThrows[(int)MainPage.Saves.Dexterity].Checks = Constants.Checks.Fail; } }