示例#1
0
    public void ClearAttackCard()
    {
        BattleCardTriggerTime landCardTrigger = BattleCard.triggerTime;

        if (landCardTrigger.Equals(BattleCardTriggerTime.ATTACK_DICE_ROLL) || landCardTrigger.Equals(BattleCardTriggerTime.ATTACK_END_POINT) ||
            landCardTrigger.Equals(BattleCardTriggerTime.ATTACK_LOSE))
        {
            BattleCard = null;
        }
    }
示例#2
0
    /// <summary>
    /// 进攻或防守完的效果
    /// </summary>
    /// <param name="triggerTime"></param>
    public void AfterFightCardEffect(BattleCardTriggerTime triggerTime)
    {
        if (BattleCard == null || BattleCard.triggerTime != triggerTime)
        {
            return;
        }

        BattleCard.CardFunc(this);
        BattleCard = null;
    }
示例#3
0
    /// <summary>
    /// 摇骰子根据卡牌获得的额外收益
    /// </summary>
    /// <param name="triggerTime"></param>
    /// <returns></returns>
    public int GetExtraIncreaseByCard(BattleCardTriggerTime triggerTime)
    {
        if (BattleCard == null || BattleCard.triggerTime != triggerTime)
        {
            return(0);
        }
        int result = BattleCard.CardFunc(this);

        BattleCard = null;
        return(result);
    }
示例#4
0
 public void InitCardInfo(CardModel cardModel, int arrayIndex, Func <Land, int> CardFunc)
 {
     this.cardId     = cardModel.cardID;
     BG.sprite       = Resources.Load <Sprite>(cardModel.spritePath);
     goldCost.text   = cardModel.costGold.ToString();
     cardName.text   = cardModel.cardName;
     isSelfCard      = cardModel.isSelfCard == 1;
     this.arrayIndex = arrayIndex;
     triggerTime     = (BattleCardTriggerTime)Enum.Parse(typeof(BattleCardTriggerTime), cardModel.cardTriggerTime);
     this.CardFunc   = CardFunc;
     cardEffectType  = (CardEffectType)Enum.Parse(typeof(CardEffectType), cardModel.cardEffectType);
 }
示例#5
0
    private DicePanelParam GetDicePanelParamByLand(Land land, bool isAttack)
    {
        Camp camp           = CampDic[land.CampID];
        int  basicDiceRolls = land.GetBasicDiceRolls();
        //地块上的卡牌获得的额外投掷次数
        BattleCardTriggerTime diceRoll = isAttack ? BattleCardTriggerTime.ATTACK_DICE_ROLL : BattleCardTriggerTime.DEFENCE_DICE_ROLL;
        int cardExtraDiceRolls         = land.GetExtraIncreaseByCard(diceRoll);

        Debug.Log(camp.name + "阵营地块卡牌额外投掷次数是" + cardExtraDiceRolls);
        //阵营获得的额外投掷次数(坦克,飞机等+1)
        int campExtraDiceRolls = camp.GetExtraDiceRollsAttackByLand(land, isAttack);
        int finalDiceRolls     = basicDiceRolls + cardExtraDiceRolls + campExtraDiceRolls;
        //根据最终投掷次数模拟的结果
        int basicDiceRandomPoint = GetDiceRandomResult(finalDiceRolls);

        Debug.Log(camp.name + "阵营摇色子点数是" + basicDiceRandomPoint);
        //地块上的卡牌的额外点数加成
        BattleCardTriggerTime endPoint = isAttack ? BattleCardTriggerTime.ATTACK_END_POINT : BattleCardTriggerTime.DEFENCE_END_POINT;
        int cardExtraEndPoint          = land.GetExtraIncreaseByCard(endPoint);

        Debug.Log(camp.name + "阵营地块卡牌点数是" + cardExtraEndPoint);
        //阵营卡牌当回合持续buff点数加成
        int campCardExtraEndPoint = camp.hasCardBuff ? camp.CampBuffCardEffect.attackExtraEndPoint : 0;

        Debug.Log(camp.name + "阵营阵营buff点数是" + campCardExtraEndPoint);
        int finalDicePoint = basicDiceRandomPoint + cardExtraEndPoint + campCardExtraEndPoint;

        if (isAttack)
        {
            _attackPoint = finalDicePoint;
        }
        else
        {
            _defencePoint = finalDicePoint;
        }
        return(new DicePanelParam(camp.name, null, finalDiceRolls, finalDicePoint));
    }
示例#6
0
 public BattleCard(BattleCardTriggerTime triggerTime, Func <Land, int> CardFunc)
 {
     this.triggerTime = triggerTime;
     this.CardFunc    = CardFunc;
 }