Пример #1
0
        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);
        }
Пример #2
0
 // Construct the CarpenterActions list.
 public CarpenterActions()
 {
     ResourceLibrary = new ResourceLibrary(Settings.ResourceLocation, ClassJobType.Carpenter);
     BasicSynthesis = new BasicSynthesis(CraftActionId.crp_BasicSynthesis,
         ResourceLibrary.ClassSkillImages["crp_BasicSynthesis"]);
     StandardSynthesis = new StandardSynthesis(CraftActionId.crp_StandardSynthesis,
         ResourceLibrary.ClassSkillImages["crp_StandardSynthesis"]);
     BasicTouch = new BasicTouch(CraftActionId.crp_BasicTouch, ResourceLibrary.ClassSkillImages["crp_BasicTouch"]);
     StandardTouch = new StandardTouch(CraftActionId.crp_StandardTouch,
         ResourceLibrary.ClassSkillImages["crp_StandardTouch"]);
     AdvancedTouch = new AdvancedTouch(CraftActionId.crp_AdvancedTouch,
         ResourceLibrary.ClassSkillImages["crp_AdvancedTouch"]);
     PreciseTouch = new PreciseTouch(CraftActionId.crp_PreciseTouch,
         ResourceLibrary.ClassSkillImages["crp_PreciseTouch"]);
     MastersMend = new MastersMend(CraftActionId.crp_MastersMend);
     MastersMendII = new MastersMendII(CraftActionId.crp_MastersMendII);
     SteadyHand = new SteadyHand(CraftActionId.crp_SteadyHand);
     InnerQuiet = new InnerQuiet(CraftActionId.crp_InnerQuiet);
     GreatStrides = new GreatStrides(CraftActionId.crp_GreatStrides);
     Observe = new Observe(CraftActionId.crp_Observe);
     CollectableSynthesis = new CollectableSynthesis(CraftActionId.crp_CollectableSynthesis);
     ByregotsBrow = new ByregotsBrow(CraftActionId.crp_ByregotsBrow);
     InnovativeTouch = new InnovativeTouch(CraftActionId.crp_InnovativeTouch);
     ByregotsMiracle = new ByregotsMiracle(CraftActionId.crp_ByregotsMiracle);
     NymeiasWheel = new NymeiasWheel(CraftActionId.crp_NymeiasWheel);
     TrainedHand = new TrainedHand(CraftActionId.crp_TrainedHand);
     Satisfaction = new Satisfaction(CraftActionId.crp_Satisfaction);
     Heart = new Heart(CraftActionId.crp_Heart);
     WhistleWhileYouWork = new WhistleWhileYouWork(CraftActionId.crp_WhistleWhileYouWork);
     PHTouch = new PHTouch(CraftActionId.crp_PreciseTouch);
 }
Пример #3
0
        public void TestSteadyHandTurns()
        {
            State details = new State();

            Assert.AreEqual <uint>(0, SteadyHand.GetTurnsRemaining(details));

            for (int i = 5; i >= 0; --i)
            {
                SteadyHand.SetTurnsRemaining(details, (uint)i);
                Assert.AreEqual <uint>((uint)i, SteadyHand.GetTurnsRemaining(details));
            }
        }
Пример #4
0
        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));
        }
Пример #5
0
        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);
        }
Пример #6
0
        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));
        }
Пример #7
0
        public void TestMultipleStatAssignment2()
        {
            State details = new State();

            details.CrafterLevel = 13U;
            details.SynthLevel   = 40U;
            details.Quality      = 1215U;
            details.MaxQuality   = 923U;
            details.Condition    = Engine.Condition.Excellent;
            Manipulation.SetTurnsRemaining(details, 2);
            GreatStrides.SetTurnsRemaining(details, 3);
            Ingenuity.SetTurnsRemaining(details, 1);
            SteadyHand.SetTurnsRemaining(details, 4);

            Assert.AreEqual <uint>(13, details.CrafterLevel);
            Assert.AreEqual <uint>(40, details.SynthLevel);
            Assert.AreEqual <uint>(1215, details.Quality);
            Assert.AreEqual <uint>(923, details.MaxQuality);
            Assert.AreEqual <Engine.Condition>(Engine.Condition.Excellent, details.Condition);
            Assert.AreEqual <uint>(2, Manipulation.GetTurnsRemaining(details));
            Assert.AreEqual <uint>(3, GreatStrides.GetTurnsRemaining(details));
            Assert.AreEqual <uint>(1, Ingenuity.GetTurnsRemaining(details));
            Assert.AreEqual <uint>(4, SteadyHand.GetTurnsRemaining(details));
        }