void ConfigAbsorbing() { //bool bFaceEnemy = CellObjCtrlUtils.IsNbEnemy (_cellCtrl,0); bool bShouldAttack = CellObjCtrlUtils.ShouldAttacking(_cellCtrl); if (!bShouldAttack) { return; } for (int dir = 1; dir < 6; dir++) { bool bNbAidingMe = CellObjCtrlUtils.IsNbAidingMe(_cellCtrl, dir); if (!bNbAidingMe) { continue; } CellObjCtrl nbCtrl = CellObjCtrlUtils.GetNbCellObjCtrl(_cellCtrl, dir); ConfigAbsorbForCtrl2(nbCtrl); } /* * bool bBackToBack = CellObjCtrlUtils.IsBackToBack (_cellCtrl); * if (bBackToBack) { * CellObjCtrl nbCtrl = CellObjCtrlUtils.GetNbCellObjCtrl (_cellCtrl, 3); * _ToAbsorbCtrl = nbCtrl; * //ConfigAbsorbForCtrl (nbCtrl); * MiroModelV1 model = CellObjCtrlUtils.GetMiroModelFromCell(nbCtrl); * _AT = model.GetAT (); * _ToAbsorb = true; * //print ("AT:" + _AT); * //print ("ConfigAbsorbForCtrl (nbCtrl):" + nbCtrl); * print("_ToAbsorb:" + nbCtrl); * }*/ ConfigAbsorbForCtrl2(_cellCtrl); }
public static bool ShouldBeingAbsorbedToDir(CellObjCtrl cctrl, int relativeDir) { if (cctrl == null) { return(false); } bool bAttacking = CellObjCtrlUtils.ShouldAttacking(cctrl); bool bAssisting = CellObjCtrlUtils.ShouldAssistingAttacking(cctrl); if (!(bAttacking || bAssisting)) { return(false); } CellObjCtrl nbCtrl = CellObjCtrlUtils.GetNbCellObjCtrl(cctrl, relativeDir); if (nbCtrl == null) { return(false); } bool bIsEnemy = CellObjCtrlUtils.IsNbEnemy(cctrl, relativeDir); if (!bIsEnemy) { return(false); } CellObjCtrl nbBwdCtrl = CellObjCtrlUtils.GetNbCellObjCtrl(nbCtrl, 3); if (nbBwdCtrl == null) { return(false); } bool bNbBackToMe = (nbBwdCtrl == cctrl); if (!bNbBackToMe) { return(false); } MiroModelV1 nbModel = CellObjCtrlUtils.GetMiroModelFromCell(nbCtrl); bool bNbAlive = nbModel.IsAlive(); if (!bNbAlive) { return(false); } bool bNbFaceToFace = CellObjCtrlUtils.IsFaceToFace(nbCtrl); if (!bNbFaceToFace) { return(false); } CellObjCtrl nbFwdCtrl = CellObjCtrlUtils.GetFwdCellObjCtrl(nbCtrl); MiroModelV1 nbFwdModel = CellObjCtrlUtils.GetMiroModelFromCell(nbFwdCtrl); if (!nbFwdModel.IsAlive()) { return(false); } return(true); }