Beispiel #1
0
 // 进入普通攻击状态
 public void enterAttack()
 {
     if (this.m_card.sceneCardItem.cardArea != CardArea.CARDCELLTYPE_HAND)   // 只要点击的不是手牌
     {
         // 只有点击自己的时候,才启动攻击
         if (this.m_card.sceneCardItem.bSelfSide())   // 应该再判断是否能够继续攻击
         {
             // 技能牌进入攻击判断流程
             if ((int)CardType.CARDTYPE_SKILL == m_card.sceneCardItem.m_cardTableItem.m_type)     // 如果点击的是技能卡牌
             {
                 // 技能消耗 Mp 和攻击次数
                 if (canLaunchAtt())
                 {
                     if (m_card.sceneCardItem.m_cardTableItem.m_bNeedFaShuTarget == 0)         // 如果没有攻击目标
                     {
                         // 直接发送消息
                         stCardMoveAndAttackMagicUserCmd skillCmd = new stCardMoveAndAttackMagicUserCmd();
                         skillCmd.dwAttThisID = m_card.sceneCardItem.svrCard.qwThisID;
                         UtilMsg.sendMsg(skillCmd);
                     }
                     else        // 有攻击目标
                     {
                         m_card.m_sceneDZData.m_gameOpState.enterAttackOp(EnGameOp.eOpSkillAttackTarget, m_card);
                     }
                 }
             }
             else if ((int)CardType.CARDTYPE_ATTEND == m_card.sceneCardItem.m_cardTableItem.m_type ||
                      (int)CardType.CARDTYPE_HERO == m_card.sceneCardItem.m_cardTableItem.m_type)      // 随从卡、英雄卡
             {
                 // 有攻击力和攻击次数
                 if (canLaunchAtt())
                 {
                     this.m_card.m_sceneDZData.m_gameOpState.enterAttackOp(EnGameOp.eOpNormalAttack, this.m_card);
                 }
             }
         }
     }
 }
Beispiel #2
0
        // 拖放结束处理
        override protected void onDragEnd()
        {
            m_isCalc = false;

            // 如果在一定小范围内
            if (bInHandArea())
            {
                // 拖动结束直接退回去
                // 开始缩放
                //m_card.trackAniControl.destScale = SceneDZCV.SMALLFACT;
                backCard2Orig();
            }
            else
            {
                m_card.trackAniControl.endDragAni();       // 结束动画

#if DEBUG_NOTNET
                m_card.m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].addCardToOutList(m_card);        // 放入输出列表
#endif
                if (m_card.sceneCardItem != null)
                {
                    if (m_card.sceneCardItem.svrCard != null)
                    {
                        // 法术攻击一次必然要消失
                        if (m_card.sceneCardItem.m_cardTableItem.m_type == (int)CardType.CARDTYPE_MAGIC) // 如果是法术牌
                        {
                            if (m_card.sceneCardItem.m_cardTableItem.m_bNeedFaShuTarget > 0)             // 如果有攻击目标
                            {
                                // 直接放下去,然后选择攻击目标
                                m_card.m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].outSceneCardList.removeWhiteCard(); // 将占位的牌移除
                                m_card.hide();                                                                                         // 隐藏起来
                                // 英雄播放攻击准备特效
                                if (m_card.sceneCardItem.m_cardTableItem.m_skillPrepareEffect > 0)
                                {
                                    m_card.m_sceneDZData.m_sceneDZAreaArr[(int)(m_card.sceneCardItem.playerSide)].centerHero.effectControl.startSkillAttPrepareEffect((int)m_card.sceneCardItem.m_cardTableItem.m_skillPrepareEffect);
                                }
                                m_card.m_sceneDZData.m_gameOpState.enterAttackOp(EnGameOp.eOpFaShu, m_card);
                            }
                            else        // 如果没有攻击目标,直接拖出去
                            {
                                // 发送法术攻击消息
                                stCardMoveAndAttackMagicUserCmd cmd = new stCardMoveAndAttackMagicUserCmd();
                                cmd.dwAttThisID = m_card.sceneCardItem.svrCard.qwThisID;
                                cmd.dwMagicType = (uint)m_card.sceneCardItem.m_cardTableItem.m_faShu;
                                UtilMsg.sendMsg(cmd);

                                m_card.m_sceneDZData.m_gameOpState.enterMoveOp(m_card);      // 进入移动操作
                            }
                        }
                        else if (m_card.sceneCardItem.m_cardTableItem.m_zhanHou > 0 && m_card.sceneCardItem.m_cardTableItem.m_bNeedZhanHouTarget > 0)           // 如果有战吼,并且需要攻击目标
                        {
                            // 直接放下去,然后选择攻击目标
                            m_card.m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].outSceneCardList.removeWhiteCard(); // 将占位的牌移除
                            m_card.m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].removeFormInList(m_card);           // 从手牌区移除卡牌
                            m_card.convOutModel();
                            m_card.m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].addCardToOutList(m_card, m_card.m_sceneDZData.curWhiteIdx);
                            m_card.m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].inSceneCardList.updateSceneCardPos();
                            m_card.m_sceneDZData.m_gameOpState.enterAttackOp(EnGameOp.eOpZhanHouAttack, m_card);
                        }
                        else        // 如果是普通移动牌,就发送移动消息
                        {
                            stCardMoveAndAttackMagicUserCmd cmd = new stCardMoveAndAttackMagicUserCmd();
                            cmd.dst = new stObjectLocation();
                            if (m_card.sceneCardItem.m_cardTableItem != null)
                            {
                                cmd.dst.dwTableID = 0;
                                cmd.dst.x         = 0;
                                cmd.dwAttThisID   = m_card.sceneCardItem.svrCard.qwThisID;

                                if (m_card.sceneCardItem.m_cardTableItem.m_type == (int)CardType.CARDTYPE_EQUIP)
                                {
                                    cmd.dst.dwLocation = (int)CardArea.CARDCELLTYPE_EQUIP;
                                    cmd.dst.y          = 0;
                                }
                                else
                                {
                                    cmd.dst.dwLocation = (int)CardArea.CARDCELLTYPE_COMMON;
                                    cmd.dst.y          = (byte)m_card.m_sceneDZData.curWhiteIdx;
                                }
                                UtilMsg.sendMsg(cmd);
                            }

                            m_card.m_sceneDZData.m_gameOpState.enterMoveOp(m_card);      // 进入移动操作
                        }
                    }
                }
            }
        }
Beispiel #3
0
 // 英雄卡、随从卡即可以作为攻击者也可以作为被击者,法术卡、技能卡、装备卡只能作为攻击者
 override public void onCardClick(IDispatchObject dispObj)
 {
     if (!m_card.m_sceneDZData.m_gameRunState.isInState(GameRunState.INITCARD))                                                        // 如果处于初始化卡牌阶段
     {
         if (EnDZPlayer.ePlayerSelf != m_card.sceneCardItem.playerSide || CardArea.CARDCELLTYPE_HAND != m_card.sceneCardItem.cardArea) // 如果点击的不是自己的手牌
         {
             if (m_card.sceneCardItem != null)
             {
                 if (m_card.m_sceneDZData.m_gameOpState.bInOp(EnGameOp.eOpNormalAttack))     // 选择攻击目标
                 {
                     if (m_card.m_sceneDZData.m_gameOpState.canAttackOp(m_card, EnGameOp.eOpNormalAttack))
                     {
                         // 发送攻击指令
                         stCardAttackMagicUserCmd cmd = new stCardAttackMagicUserCmd();
                         cmd.dwAttThisID = m_card.m_sceneDZData.m_gameOpState.getOpCardID();
                         cmd.dwDefThisID = m_card.sceneCardItem.svrCard.qwThisID;
                         UtilMsg.sendMsg(cmd);
                     }
                     else
                     {
                         m_card.behaviorControl.enterAttack();
                     }
                 }
                 else if ((m_card.m_sceneDZData.m_gameOpState.bInOp(EnGameOp.eOpFaShu)))            // 法术攻击
                 {
                     if (m_card.m_sceneDZData.m_gameOpState.canAttackOp(m_card, EnGameOp.eOpFaShu)) // 选择攻击目标
                     {
                         // 必然是有目标的法术攻击
                         // 发送法术攻击消息
                         stCardMoveAndAttackMagicUserCmd cmd = new stCardMoveAndAttackMagicUserCmd();
                         cmd.dwAttThisID = m_card.m_sceneDZData.m_gameOpState.getOpCardID();
                         cmd.dwMagicType = (uint)m_card.m_sceneDZData.m_gameOpState.getOpCardFaShu();
                         cmd.dwDefThisID = m_card.sceneCardItem.svrCard.qwThisID;
                         //m_sceneDZData.m_gameOpState.quitAttackOp(false);
                         UtilMsg.sendMsg(cmd);
                     }
                     else
                     {
                         m_card.behaviorControl.enterAttack();
                     }
                 }
                 else if (m_card.m_sceneDZData.m_gameOpState.bInOp(EnGameOp.eOpZhanHouAttack))              // 战吼攻击
                 {
                     if (m_card.m_sceneDZData.m_gameOpState.canAttackOp(m_card, EnGameOp.eOpZhanHouAttack)) // 选择攻击目标
                     {
                         // 发送攻击指令
                         stCardMoveAndAttackMagicUserCmd cmd = new stCardMoveAndAttackMagicUserCmd();
                         cmd.dwAttThisID    = m_card.m_sceneDZData.m_gameOpState.getOpCardID();
                         cmd.dwMagicType    = (uint)m_card.m_sceneDZData.m_gameOpState.getOpCardFaShu();
                         cmd.dwDefThisID    = m_card.sceneCardItem.svrCard.qwThisID;
                         cmd.dst            = new stObjectLocation();
                         cmd.dst.dwLocation = (uint)CardArea.CARDCELLTYPE_COMMON;
                         cmd.dst.y          = (ushort)m_card.m_sceneDZData.m_gameOpState.getZhanHouCommonClientIdx();
                         UtilMsg.sendMsg(cmd);
                     }
                     else
                     {
                         m_card.behaviorControl.enterAttack();
                     }
                 }
                 else if (m_card.m_sceneDZData.m_gameOpState.bInOp(EnGameOp.eOpSkillAttackTarget))              // 技能目标攻击
                 {
                     if (m_card.m_sceneDZData.m_gameOpState.canAttackOp(m_card, EnGameOp.eOpSkillAttackTarget)) // 选择攻击目标
                     {
                         // 必然是有目标的法术攻击
                         // 发送法术攻击消息
                         stCardMoveAndAttackMagicUserCmd cmd = new stCardMoveAndAttackMagicUserCmd();
                         cmd.dwAttThisID = m_card.m_sceneDZData.m_gameOpState.getOpCardID();
                         cmd.dwMagicType = (uint)m_card.m_sceneDZData.m_gameOpState.getOpCardFaShu();
                         cmd.dwDefThisID = m_card.sceneCardItem.svrCard.qwThisID;
                         UtilMsg.sendMsg(cmd);
                     }
                 }
                 else        // 默认点击处理都走这里
                 {
                     m_card.behaviorControl.enterAttack();
                 }
             }
         }
     }
 }