示例#1
0
        /**
         * Apply an override to a normal computation resulting in another normal computation.
         */

        public static ComputeValue PerformOverride(string filename, int start_line, int start_column, int end_line,
                                                   int end_column, ComputeOverride wrapper, ComputeValue original)
        {
            if (original == null)
            {
                return((task_master, reference, context, self, container) =>
                       new FailureComputation(task_master, new BasicSourceReference("used by override", filename,
                                                                                    start_line, start_column, end_line, end_column, reference), "override of non-existant attribute"));
            }
            return
                ((task_master, reference, context, self, container) =>
                 wrapper(task_master, reference, context, self, container,
                         original(task_master,
                                  new BasicSourceReference("used by override", filename, start_line, start_column, end_line,
                                                           end_column, reference), context, self, container)));
        }
示例#2
0
 /**
  * Apply an override to a normal computation resulting in another normal computation.
  */
 public static ComputeValue PerformOverride(ComputeOverride wrapper, ComputeValue original, string filename, int start_line, int start_column, int end_line, int end_column)
 {
     return((task_master, reference, context, self, container) => wrapper(task_master, reference, context, self, container, original(task_master, new SourceReference("used by override", filename, start_line, start_column, end_line, end_column, reference), context, self, container)));
 }
示例#3
0
 /// <summary>
 ///     Add a bonus that is equivalent to the current value of some other character variable of the current character, but
 ///     with a particular computation
 /// </summary>
 /// <param name="computation">
 ///     A supported computation to be performed on the referenced variable before using it as a
 ///     bonus. <see cref="BonusComputation" />
 /// </param>
 /// <param name="referencedVariableName">The name of the variable to be added as a bonus</param>
 public BonusBuilder <TKind> AddReference(string referencedVariableName, ComputeValue computation)
 {
     return(AddReference("", referencedVariableName, computation));
 }
示例#4
0
 /// <summary>
 ///     Add a bonus that is equivalent to the current value of some other character variable of the current character, but
 ///     with a particular computation
 /// </summary>
 /// <param name="type">The type of this bonus. For untyped, call the overload without this parameter</param>
 /// <param name="computation">
 ///     A supported computation to be performed on the referenced variable before using it as a
 ///     bonus. <see cref="BonusComputation" />
 /// </param>
 /// <param name="referencedVariableName">The name of the variable to be added as a bonus</param>
 public BonusBuilder <TKind> AddReference(string type, string referencedVariableName, ComputeValue computation)
 {
     return(new BonusBuilder <TKind>(
                _collection,
                _name,
                _workingVariable.Add(new ComputedValue(type, _collection.GetVariable(referencedVariableName), computation))
                ));
 }
示例#5
0
 /// <summary>
 /// Add a bonus that is equivalent to the current value of some other character variable of the current character, but with a particular computation
 /// </summary>
 /// <param name="type">The type of this bonus. For untyped, call the overload without this parameter</param>
 /// <param name="computation">A supported computation to be performed on the referenced variable before using it as a bonus. <see cref="BonusComputation"/></param>
 /// <param name="referencedVariableName">The name of the variable to be added as a bonus</param>
 public BonusBuilder AddReference(string type, string referencedVariableName, ComputeValue computation)
 {
     _character.GetVariable(_name).Add(new ComputedValue(type, _character.GetVariable(referencedVariableName), computation));
     return(this);
 }