예제 #1
0
        /// <summary>
        /// </summary>
        /// <param name="entity">
        /// </param>
        /// <returns>
        /// </returns>
        public bool CheckRequirement(IInstancedEntity entity)
        {
            if (this.theCheckFunc == null)
            {
                try
                {
                    this.theCheckFunc = RequirementLambdaCreator.Create(this);
                    return(this.theCheckFunc(entity));
                }
                catch (Exception)
                {
                    LogUtil.Debug("Could not create lambda for a requirement.");
                    LogUtil.Debug("Values:");
                    LogUtil.Debug("Target:       " + ((ItemTarget)this.Target));
                    LogUtil.Debug(
                        "StatId:       " + (this.Statnumber + " (" + StatNamesDefaults.GetStatName(this.Statnumber))
                        + ")");
                    LogUtil.Debug("Operator:     " + ((Operator)this.Operator));
                    LogUtil.Debug("Value:        " + this.Value);
                    LogUtil.Debug("ChildOperator:" + ((Operator)this.ChildOperator));
                    return(false);
                }
            }

            return(this.theCheckFunc(entity));
        }
예제 #2
0
 /// <summary>
 /// </summary>
 /// <param name="entity">
 /// </param>
 /// <returns>
 /// </returns>
 public bool CheckRequirement(IInstancedEntity entity)
 {
     if (this.theCheckFunc == null)
     {
         try
         {
             this.theCheckFunc = RequirementLambdaCreator.Create(this);
             //return this.theCheckFunc(entity);
         }
         catch (Exception)
         {
             LogUtil.Debug(DebugInfoDetail.GameFunctions, "Could not create lambda for a requirement.");
             LogUtil.Debug(DebugInfoDetail.GameFunctions, "Values:");
             LogUtil.Debug(DebugInfoDetail.GameFunctions, "Target:       " + (this.Target));
             LogUtil.Debug(
                 DebugInfoDetail.GameFunctions,
                 "StatId:       " + (this.Statnumber + " (" + StatNamesDefaults.GetStatName(this.Statnumber))
                 + ")");
             LogUtil.Debug(DebugInfoDetail.GameFunctions, "Operator:     " + (this.Operator));
             LogUtil.Debug(DebugInfoDetail.GameFunctions, "Value:        " + this.Value);
             LogUtil.Debug(DebugInfoDetail.GameFunctions, "ChildOperator:" + (this.ChildOperator));
             return(false);
         }
     }
     LogUtil.Debug(DebugInfoDetail.GameFunctions, "Values:");
     LogUtil.Debug(DebugInfoDetail.GameFunctions, "Target:       " + (this.Target));
     LogUtil.Debug(
         DebugInfoDetail.GameFunctions,
         "StatId:       " + (this.Statnumber + " (" + StatNamesDefaults.GetStatName(this.Statnumber))
         + ")");
     LogUtil.Debug(DebugInfoDetail.GameFunctions, "Operator:     " + (this.Operator));
     LogUtil.Debug(DebugInfoDetail.GameFunctions, "Value:        " + this.Value + " <-> " + entity.Stats[this.Statnumber].Value.ToString());
     LogUtil.Debug(DebugInfoDetail.GameFunctions, "ChildOperator:" + (this.ChildOperator));
     LogUtil.Debug(DebugInfoDetail.GameFunctions, "Result:       " + this.theCheckFunc(entity));
     return(this.theCheckFunc(entity));
 }