/// <summary>
 /// 从执行服务移除一个能力代码
 /// </summary>
 /// <param name="code">要移除的能力代码</param>
 /// <returns></returns>
 public static Code UnregisterCode(Code code)
 {
     lock (CodeList)
     {
         if (CodeList.Contains(code)) CodeList.Remove(code);
     }
     return code;
 }
 /// <summary>
 /// 注册一个能力代码到执行服务
 /// </summary>
 /// <param name="code">要注册的能力代码</param>
 /// <returns></returns>
 public static Code RegisterCode(Code code)
 {
     lock (CodeList)
     {
         if (!CodeList.Contains(code)) CodeList.Add(code);
     }
     return code;
 }
 /// <summary>
 /// 设置卡片的属性
 /// </summary>
 /// <param name="id">卡片ID</param>
 /// <param name="beforeUsingCheck">使用检查前能力代码</param>
 /// <param name="usingCheck">使用检查能力代码</param>
 /// <param name="afterUsingCheck">使用检查后能力代码</param>
 /// <param name="use">使用时能力代码</param>
 /// <returns></returns>
 public Card SetCard(int id, Code beforeUsingCheck, Code usingCheck, Code afterUsingCheck, Code use)
 {
     ID = id;
     CodeBeforeUsingCheck = beforeUsingCheck;
     CodeUsingCheck = usingCheck;
     CodeAfterUsingCheck = afterUsingCheck;
     CodeUse = use;
     return this;
 }
 public static Servant SetServant(Servant servant, string name, Code[] codes)
 {
     return servant.SetServant(name, codes);
 }
 public Servant SetServant(string name, Code[] codes)
 {
     Dispatcher.Run(() => Definition = new ServantDefinition(name));
     Codes = codes;
     return this;
 }
 internal override ExecuteInformation Execute(Code previousCode, Code nextCode, ExecuteInformation parameter)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// 设置卡片的属性
 /// </summary>
 /// <param name="card">目标卡片</param>
 /// <param name="id">卡片ID</param>
 /// <param name="beforeUsingCheck">使用检查前能力代码</param>
 /// <param name="usingCheck">使用检查能力代码</param>
 /// <param name="afterUsingCheck">使用检查后能力代码</param>
 /// <param name="use">使用时能力代码</param>
 /// <returns></returns>
 public static Card SetCard(Card card, int id, Code beforeUsingCheck, Code usingCheck, Code afterUsingCheck, Code use)
 {
     return card.SetCard(id, beforeUsingCheck, usingCheck, afterUsingCheck, use);
 }
 /// <summary>
 /// 执行能力代码
 /// </summary>
 /// <param name="previousCode">执行链上的前一个能力代码</param>
 /// <param name="nextCode">执行链上的后一个能力代码</param>
 /// <param name="parameter">执行信息</param>
 /// <returns></returns>
 internal abstract ExecuteInformation Execute(Code previousCode, Code nextCode, ExecuteInformation parameter);
 /// <summary>
 /// 立即执行指定能力代码
 /// </summary>
 /// <param name="code">目标能力代码</param>
 /// <param name="parameter">执行信息</param>
 /// <returns></returns>
 public static ExecuteInformation Execute(Code code, ExecuteInformation parameter)
 {
     RegisterCode(code);
     return Execute(ExecuteTimePoint.Now, parameter.ExecuteParameter);
 }