public void TestBasicTouchPreferredOverTricksOfTheTradeWithHighDurability2() { Simulator.Engine.Ability tott = new TricksOfTheTrade(); Simulator.Engine.Ability basicTouch = new BasicTouch(); Simulator.Engine.Ability steadyHand = new SteadyHand(); State state = new State(); state.Condition = Simulator.Engine.Condition.Good; state.Control = 119; state.Craftsmanship = 131; state.CP = 254; state.MaxCP = 254; state.MaxDurability = 70; state.Durability = 70; state.MaxProgress = 74; state.Quality = 284; state.MaxQuality = 1053; state.SynthLevel = 20; state.CrafterLevel = 19; state = steadyHand.Activate(state, true); State tottState = tott.Activate(state, true); tottState.Condition = Condition.Normal; State basicTouchState = basicTouch.Activate(state, true); basicTouchState.Condition = Condition.Normal; Assert.IsTrue(basicTouchState.Score > tottState.Score); }
public void TestManipulation() { Manipulation manipulation = new Manipulation(); BasicSynthesis basic = new BasicSynthesis(); SteadyHand steadyHand = new SteadyHand(); State state = Utility.CreateDefaultState(); state.Durability = 30; state.MaxDurability = 60; // Verify that Manipulation can be activated successfully. State s1 = manipulation.Activate(state, true); Assert.AreEqual <uint>(manipulation.Duration, Manipulation.GetTurnsRemaining(s1)); // Verify that the durability has not changed simply as a result of activating manipulation. Assert.AreEqual <uint>(state.Durability, s1.Durability); // Verify that Manipulation can't be used if it's already up. Assert.IsFalse(manipulation.CanUse(s1)); // Verify that using Basic Synthesis with Manipulation up doesn't decrease the durability. State s2 = basic.Activate(s1, true); Assert.AreEqual <uint>(s1.Durability, s2.Durability); Assert.AreEqual <uint>(2, Manipulation.GetTurnsRemaining(s2)); Assert.IsFalse(manipulation.CanUse(s2)); // Verify that using Steady hand with Manipulation up causes the durability to increase by 10. State s3 = steadyHand.Activate(s2, true); Assert.AreEqual <uint>(s2.Durability + 10, s3.Durability); Assert.AreEqual <uint>(1, Manipulation.GetTurnsRemaining(s3)); Assert.IsFalse(manipulation.CanUse(s3)); // Use another Basic Synthesis so we can verify that the buff de-activates. State s4 = basic.Activate(s3, true); Assert.IsTrue(manipulation.CanUse(s4)); }
public void TestUrgentCompletion2() { Analyzer analyzer = new Analyzer(); BasicSynthesis bs = new BasicSynthesis(); SteadyHand sh = new SteadyHand(); analyzer.Actions.AddAction(bs); //analyzer.Actions.AddAction(new BasicTouch()); //analyzer.Actions.AddAction(new MastersMend()); analyzer.Actions.AddAction(sh); //analyzer.Actions.AddAction(new Observe()); State state = Utility.CreateDefaultState(); // Make sure we don't have enough CP to run Master's Mend. state.CP = Compute.CP(SynthAction <SynthActionAttribute, MastersMend> .Attributes.CP, state) - 1; state.Durability = 20; // Make sure exactly 2 Basic Synthesis' are required to finish the synth. state.Progress = 0; state.MaxProgress = 2 * Compute.Progress(state, bs.BaseEfficiency); analyzer.Run(state); // The best sequence is Steady Hand -> Basic Synthesis -> Basic Synthesis Simulator.Engine.Ability bestAction = analyzer.OptimalAction(state); Assert.AreEqual <Type>(typeof(SteadyHand), bestAction.GetType()); state = sh.Activate(state, true); bestAction = analyzer.OptimalAction(state); Assert.AreEqual <Type>(typeof(BasicSynthesis), bestAction.GetType()); state = bs.Activate(state, true); bestAction = analyzer.OptimalAction(state); Assert.AreEqual <Type>(typeof(BasicSynthesis), bestAction.GetType()); state = bs.Activate(state, true); Assert.AreEqual(SynthesisStatus.COMPLETED, state.Status); }
public void TestSteadyHand() { SteadyHand sh = new SteadyHand(); HastyTouch ht = new HastyTouch(); State state = Utility.CreateDefaultState(); state.Control = 10; state.MaxDurability = 100; state.Durability = 100; state.MaxProgress = 127; // Make sure we can actually use SH Assert.IsTrue(sh.CanUse(state)); State afterSH = sh.Activate(state, true); // Make sure Steady Hand uses the right amount of TP. Assert.AreEqual <uint>(state.CP - sh.RequiredCP, afterSH.CP); // Test that the buff is up, and is active for the correct number of turns. Assert.AreEqual <uint>(sh.Duration, SteadyHand.GetTurnsRemaining(afterSH)); // Use Basic Synthesis 5 times, and make sure the success bonus decreases. for (int i = 5; i > 0; --i) { Assert.AreEqual <uint>((uint)i, SteadyHand.GetTurnsRemaining(afterSH)); Assert.IsTrue(Compute.SuccessRate(ht.BaseSuccessRate, afterSH) > Compute.SuccessRate(ht.BaseSuccessRate, state)); // Make sure we can't use SH while SH is up. Assert.IsFalse(sh.CanUse(afterSH)); afterSH = ht.Activate(afterSH, true); } Assert.AreEqual <uint>(0, SteadyHand.GetTurnsRemaining(afterSH)); Assert.AreEqual <double>(Compute.SuccessRate(sh.BaseSuccessRate, state), Compute.SuccessRate(sh.BaseSuccessRate, afterSH)); }