Exemple #1
0
        protected override void ActivateInternal(State oldState, State newState, bool success)
        {
            base.ActivateInternal(oldState, newState, success);

            RemoveDurability(newState);

            if (success)
            {
                if ((completionFlags & CompletionFlags.Progress) != 0)
                {
                    uint delta = Compute.Progress(oldState, BaseEfficiency);
                    newState.Progress = Math.Min(newState.Progress + delta, newState.MaxProgress);
                }
                if ((completionFlags & CompletionFlags.Quality) != 0)
                {
                    uint effic = BaseEfficiency;
                    if (((completionFlags & CompletionFlags.TouchAction) != 0) && GreatStrides.IsActive(newState))
                    {
                        effic *= 2;
                        GreatStrides.SetTurnsRemaining(newState, 1);
                    }
                    uint delta = Compute.Quality(oldState, effic);
                    newState.Quality = Math.Min(newState.Quality + (uint)delta, newState.MaxQuality);
                    if (newState.InnerQuietIsActive)
                    {
                        ++newState.InnerQuietStacks;
                    }
                }
            }
        }
Exemple #2
0
        public static double FailureProbability(State state)
        {
            uint   progressRemaining        = state.MaxProgress - state.Progress;
            uint   basicProgressPerTurn     = Compute.Progress(state, 100);
            uint   successfulTurnsNeeded    = (uint)Math.Ceiling((double)progressRemaining / (double)basicProgressPerTurn);
            uint   numMastersMendsAvailable = state.CP / 92;
            uint   effectiveDurability      = Math.Min(state.MaxDurability, state.Durability + numMastersMendsAvailable * 30);
            uint   turnsRemaining           = (uint)Math.Ceiling((double)effectiveDurability / 10.0);
            double successProb = Probability(successfulTurnsNeeded, turnsRemaining, 0.9);

            return(1.0 - successProb);
        }