Esempio n. 1
0
    /// <summary>
    /// 能力解决
    /// </summary>
    public async Task <bool> Solve(Induction induction)
    {
        Inductions.Remove(induction);
        Cost = DefineCost();
        if (CheckConditions(induction) && Cost.Check())
        {
            if (Optional)
            {
                if (!await Request.AskIfUse(this, Controller))
                {
                    return(false);
                }
            }
            //Owner.Controller.Broadcast(new Message(MessageType.UseSkill, new System.Collections.ArrayList { this }));
            await Cost.Pay();
            await Do(induction);

            if (OncePerTurn)
            {
                UsedInThisTurn = true;
                Inductions.Clear();
                UnInduceAll();
            }
            return(true);
        }
        return(false);
    }
Esempio n. 2
0
 public bool Check()
 {
     if (!Available)
     {
         return(false);
     }
     if (Type == SupportSkillType.Attacking && (Game.TurnPlayer != Controller))
     {
         return(false);
     }
     if (Type == SupportSkillType.Defending && (Game.TurnPlayer == Controller))
     {
         return(false);
     }
     Cost = DefineCost();
     return(CheckConditions(Game.AttackingUnit, Game.DefendingUnit) && Cost.Check());
 }
Esempio n. 3
0
 /// <summary>
 /// 判断该能力是否可以发动
 /// </summary>
 /// <returns>若可以发动,返回true</returns>
 public bool Check()
 {
     foreach (var card in Controller.AllCards)
     {
         foreach (var item in card.SubSkillList)
         {
             if (item is IUserForbidActionSkill)
             {
                 if (((IUserForbidActionSkill)item).ForbiddenSkillName == Name)
                 {
                     return(false);
                 }
             }
         }
     }
     if (!Available)
     {
         return(false);
     }
     if (UsedInThisTurn)
     {
         return(false);
     }
     if (!Owner.IsOnField)
     {
         if (
             !(Controller.Bond.Contains(Owner) && Owner.FrontShown && TypeSymbols.Contains(SkillTypeSymbol.Bond)) &&
             !(TypeSymbols.Contains(SkillTypeSymbol.Special))
             )
         {
             return(false);
         }
     }
     if (Keyword == SkillKeyword.CCS && (!Owner.IsClassChanged))
     {
         return(false);
     }
     if (!CheckConditions())
     {
         return(false);
     }
     Cost = DefineCost();
     return(Cost.Check());
 }