public bool canAttackOp(SceneCardBase card, EnGameOp gameOp) { bool ret = false; if (m_opCard != null) { if (gameOp == m_curOp) // 如果当前处于这个操作状态 { if (gameOp == EnGameOp.eOpNormalAttack) // 如果当前处于攻击 { ret = canNormalAttack(card, gameOp); } else if (gameOp == EnGameOp.eOpFaShu || gameOp == EnGameOp.eOpSkillAttackTarget) // 当前处于法术牌攻击 { ret = canFaShuAttack(card, gameOp); } else if (gameOp == EnGameOp.eOpZhanHouAttack) // 当前处于战吼牌攻击 { ret = canZhanHouAttack(card, gameOp); } } } return(ret); }
public void quitMoveOp() { m_curOp = EnGameOp.eOpNone; m_opCard = null; // 退出操作后,需要开启手牌区域卡牌拖动操作 m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].enableAllInCardDragExceptOne(null); }
public void enterMoveOp(SceneCardBase card) { // 进入操作后,需要禁止手牌区域卡牌拖动操作 m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].disableAllInCardDragExceptOne(card as SceneCardBase); m_curOp = EnGameOp.eOpMoveIn2Out; m_opCard = card; }
// 这个说明攻击操作完成 public void endAttackOp() { m_curOp = EnGameOp.eOpNone; m_opCard = null; m_sceneDZData.m_attackArrow.stopArrow(); clearAttackTargetFlags(); // 退出操作后,需要开启手牌区域卡牌拖动操作 m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].enableAllInCardDragExceptOne(null); }
// 检查之前的攻击状态 public void checkPreAttackOp(EnGameOp op, SceneCardBase card) { if (EnGameOp.eOpZhanHouAttack == m_curOp) // 如果是战吼 { // 需要将其回退回去 m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].putHandFromOutByCard(m_opCard); } else if(EnGameOp.eOpFaShu == m_curOp) // 法术 { if (card.sceneCardItem.m_cardTableItem.m_bNeedFaShuTarget > 0) // 如果有攻击目标 { m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].cancelFashuOp(m_opCard); } } }
// 检查之前的攻击状态 public void checkPreAttackOp(EnGameOp op, SceneCardBase card) { if (EnGameOp.eOpZhanHouAttack == m_curOp) // 如果是战吼 { // 需要将其回退回去 m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].putHandFromOutByCard(m_opCard); } else if (EnGameOp.eOpFaShu == m_curOp) // 法术 { if (card.sceneCardItem.m_cardTableItem.m_bNeedFaShuTarget > 0) // 如果有攻击目标 { m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].cancelFashuOp(m_opCard); } } }
// 进入攻击操作 public void enterAttackOp(EnGameOp op, SceneCardBase card) { // 进入操作后,需要禁止手牌区域卡牌拖动操作 m_sceneDZData.m_sceneDZAreaArr[(int)EnDZPlayer.ePlayerSelf].disableAllInCardDragExceptOne(card as SceneCardBase); // 如果不是自己的回合,直接返回 if (!Ctx.m_instance.m_dataPlayer.m_dzData.bSelfSide()) { return; } // 进入某一个状态的时候,要查看之前的状态是否需要需要处理 checkPreAttackOp(op, m_opCard); m_curOp = op; m_opCard = card; // 开始拖动箭头 m_sceneDZData.m_attackArrow.startArrow(); addAttackTargetFlags(); }
protected bool canNormalAttack(SceneCardBase card, EnGameOp gameOp) { //if (m_opCard.sceneCardItem.m_playerSide != card.sceneCardItem.m_playerSide && !UtilMath.checkState(StateID.CARD_STATE_SLEEP, card.sceneCardItem.m_svrCard.state)) //{ // return true; //} //return false; bool ret = false; stCardAttackMagicUserCmd cmd = new stCardAttackMagicUserCmd(); cmd.dwAttThisID = m_opCard.sceneCardItem.svrCard.qwThisID; cmd.dwDefThisID = card.sceneCardItem.svrCard.qwThisID; cmd.dwMagicType = (uint)m_opCard.sceneCardItem.m_cardTableItem.m_faShu; ret = Ctx.m_instance.m_dataPlayer.m_dzData.cardAttackMagic(Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[(int)m_opCard.sceneCardItem.playerSide], cmd); if (ret) { (Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIChat) as IUIChat).outMsg("Client 普通攻击验证通过"); } return(ret); }
// 判断是否在某个操作中 public bool bInOp(EnGameOp op) { return op == m_curOp; }
protected SceneCardBase m_opCard; // 当前操作的卡牌 public GameOpState(SceneDZData sceneDZData) { m_curOp = EnGameOp.eOpNone; m_sceneDZData = sceneDZData; }
protected bool canSkillAttack(SceneCardBase card, EnGameOp gameOp, bool bZhanHou) { stCardAttackMagicUserCmd cmd = new stCardAttackMagicUserCmd(); cmd.dwAttThisID = m_opCard.sceneCardItem.svrCard.qwThisID; cmd.dwDefThisID = card.sceneCardItem.svrCard.qwThisID; int attackTarget = 0; if (bZhanHou) { cmd.bZhanHou = true; attackTarget = m_opCard.sceneCardItem.m_cardTableItem.m_bNeedZhanHouTarget; cmd.dwMagicType = (uint)m_opCard.sceneCardItem.m_cardTableItem.m_zhanHou; } else { cmd.bZhanHou = false; attackTarget = m_opCard.sceneCardItem.m_cardTableItem.m_bNeedFaShuTarget; cmd.dwMagicType = (uint)m_opCard.sceneCardItem.m_cardTableItem.m_faShu; } if (Ctx.m_instance.m_dataPlayer.m_dzData.cardAttackMagic(Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[(int)m_opCard.sceneCardItem.playerSide], cmd)) { if (UtilMath.checkAttackState(AttackTarget.ATTACK_TARGET_SHERO, (uint)attackTarget)) { if (EnDZPlayer.ePlayerSelf == card.sceneCardItem.playerSide) // 如果是自己 { if (CardArea.CARDCELLTYPE_HERO == card.sceneCardItem.cardArea) // 如果是主角 { (Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIChat) as IUIChat).outMsg("Client 法术攻击验证通过"); return true; } } } if (UtilMath.checkAttackState(AttackTarget.ATTACK_TARGET_SATTEND, (uint)attackTarget)) { if (EnDZPlayer.ePlayerSelf == card.sceneCardItem.playerSide) // 如果是自己 { if (CardArea.CARDCELLTYPE_COMMON == card.sceneCardItem.cardArea) // 如果是出牌区 { (Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIChat) as IUIChat).outMsg("Client 法术攻击验证通过"); return true; } } } if (UtilMath.checkAttackState(AttackTarget.ATTACK_TARGET_EHERO, (uint)attackTarget)) { if (EnDZPlayer.ePlayerEnemy == card.sceneCardItem.playerSide) // 如果是 enemy { if (CardArea.CARDCELLTYPE_HERO == card.sceneCardItem.cardArea) // 如果是主角 { (Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIChat) as IUIChat).outMsg("Client 法术攻击验证通过"); return true; } } } if (UtilMath.checkAttackState(AttackTarget.ATTACK_TARGET_EATTEND, (uint)attackTarget)) { if (EnDZPlayer.ePlayerEnemy == card.sceneCardItem.playerSide) // 如果是 enemy { if (CardArea.CARDCELLTYPE_COMMON == card.sceneCardItem.cardArea) // 如果是出牌区 { (Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIChat) as IUIChat).outMsg("Client 法术攻击验证通过"); return true; } } } } return false; }
protected bool canZhanHouAttack(SceneCardBase card, EnGameOp gameOp) { return canSkillAttack(card, gameOp, true); }
protected bool canFaShuAttack(SceneCardBase card, EnGameOp gameOp) { return canSkillAttack(card, gameOp, false); }
protected bool canNormalAttack(SceneCardBase card, EnGameOp gameOp) { //if (m_opCard.sceneCardItem.m_playerSide != card.sceneCardItem.m_playerSide && !UtilMath.checkState(StateID.CARD_STATE_SLEEP, card.sceneCardItem.m_svrCard.state)) //{ // return true; //} //return false; bool ret = false; stCardAttackMagicUserCmd cmd = new stCardAttackMagicUserCmd(); cmd.dwAttThisID = m_opCard.sceneCardItem.svrCard.qwThisID; cmd.dwDefThisID = card.sceneCardItem.svrCard.qwThisID; cmd.dwMagicType = (uint)m_opCard.sceneCardItem.m_cardTableItem.m_faShu; ret = Ctx.m_instance.m_dataPlayer.m_dzData.cardAttackMagic(Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[(int)m_opCard.sceneCardItem.playerSide], cmd); if(ret) { (Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIChat) as IUIChat).outMsg("Client 普通攻击验证通过"); } return ret; }
public bool canAttackOp(SceneCardBase card, EnGameOp gameOp) { bool ret = false; if (m_opCard != null) { if (gameOp == m_curOp) // 如果当前处于这个操作状态 { if (gameOp == EnGameOp.eOpNormalAttack) // 如果当前处于攻击 { ret = canNormalAttack(card, gameOp); } else if (gameOp == EnGameOp.eOpFaShu || gameOp == EnGameOp.eOpSkillAttackTarget) // 当前处于法术牌攻击 { ret = canFaShuAttack(card, gameOp); } else if (gameOp == EnGameOp.eOpZhanHouAttack) // 当前处于战吼牌攻击 { ret = canZhanHouAttack(card, gameOp); } } } return ret; }
protected bool canFaShuAttack(SceneCardBase card, EnGameOp gameOp) { return(canSkillAttack(card, gameOp, false)); }
protected bool canZhanHouAttack(SceneCardBase card, EnGameOp gameOp) { return(canSkillAttack(card, gameOp, true)); }
protected bool canSkillAttack(SceneCardBase card, EnGameOp gameOp, bool bZhanHou) { stCardAttackMagicUserCmd cmd = new stCardAttackMagicUserCmd(); cmd.dwAttThisID = m_opCard.sceneCardItem.svrCard.qwThisID; cmd.dwDefThisID = card.sceneCardItem.svrCard.qwThisID; int attackTarget = 0; if (bZhanHou) { cmd.bZhanHou = true; attackTarget = m_opCard.sceneCardItem.m_cardTableItem.m_bNeedZhanHouTarget; cmd.dwMagicType = (uint)m_opCard.sceneCardItem.m_cardTableItem.m_zhanHou; } else { cmd.bZhanHou = false; attackTarget = m_opCard.sceneCardItem.m_cardTableItem.m_bNeedFaShuTarget; cmd.dwMagicType = (uint)m_opCard.sceneCardItem.m_cardTableItem.m_faShu; } if (Ctx.m_instance.m_dataPlayer.m_dzData.cardAttackMagic(Ctx.m_instance.m_dataPlayer.m_dzData.m_playerArr[(int)m_opCard.sceneCardItem.playerSide], cmd)) { if (UtilMath.checkAttackState(AttackTarget.ATTACK_TARGET_SHERO, (uint)attackTarget)) { if (EnDZPlayer.ePlayerSelf == card.sceneCardItem.playerSide) // 如果是自己 { if (CardArea.CARDCELLTYPE_HERO == card.sceneCardItem.cardArea) // 如果是主角 { (Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIChat) as IUIChat).outMsg("Client 法术攻击验证通过"); return(true); } } } if (UtilMath.checkAttackState(AttackTarget.ATTACK_TARGET_SATTEND, (uint)attackTarget)) { if (EnDZPlayer.ePlayerSelf == card.sceneCardItem.playerSide) // 如果是自己 { if (CardArea.CARDCELLTYPE_COMMON == card.sceneCardItem.cardArea) // 如果是出牌区 { (Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIChat) as IUIChat).outMsg("Client 法术攻击验证通过"); return(true); } } } if (UtilMath.checkAttackState(AttackTarget.ATTACK_TARGET_EHERO, (uint)attackTarget)) { if (EnDZPlayer.ePlayerEnemy == card.sceneCardItem.playerSide) // 如果是 enemy { if (CardArea.CARDCELLTYPE_HERO == card.sceneCardItem.cardArea) // 如果是主角 { (Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIChat) as IUIChat).outMsg("Client 法术攻击验证通过"); return(true); } } } if (UtilMath.checkAttackState(AttackTarget.ATTACK_TARGET_EATTEND, (uint)attackTarget)) { if (EnDZPlayer.ePlayerEnemy == card.sceneCardItem.playerSide) // 如果是 enemy { if (CardArea.CARDCELLTYPE_COMMON == card.sceneCardItem.cardArea) // 如果是出牌区 { (Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUIChat) as IUIChat).outMsg("Client 法术攻击验证通过"); return(true); } } } } return(false); }
// 判断是否在某个操作中 public bool bInOp(EnGameOp op) { return(op == m_curOp); }