//if result >0 ,means super armor is destroy, will do damage to owner // public int TryToHit(int forceValue, float damage, AttackHitType eht, ref int damageResult) { int armorBroken = -1; bool ret = true; if (_owner.CurrentAttack != null && _owner.CurrentAttack._needIgnoreSuperArmor) { ret = false; } if (_armorValues[FCConst.SUPER_ARMOR_LVL2] > 0 && ret) { damageResult = (int)(damage * _absorbValues[FCConst.SUPER_ARMOR_LVL2]); _armorValues[FCConst.SUPER_ARMOR_LVL2] -= forceValue; _armorValues[FCConst.SUPER_ARMOR_LVL2] -= damageResult; //thats real damage damageResult = (int)damage - damageResult; forceValue = 0; if (_armorValues[FCConst.SUPER_ARMOR_LVL2] <= 0) { // super armor is broken // try to use next level super armor to block attack armorBroken = FCConst.SUPER_ARMOR_LVL2; } else { //return armorBroken; } } // if super armor is broken, try to destroy normal armor if (_armorValues[FCConst.SUPER_ARMOR_LVL1] > 0) { int dr1 = (int)(damageResult * _absorbValues[FCConst.SUPER_ARMOR_LVL1]); _armorValues[FCConst.SUPER_ARMOR_LVL1] -= forceValue; if (forceValue <= 0) { _armorValues[FCConst.SUPER_ARMOR_LVL1] -= damage; } else { _armorValues[FCConst.SUPER_ARMOR_LVL1] -= dr1; } //thats real damage damageResult = (int)damageResult - dr1; if (_armorValues[FCConst.SUPER_ARMOR_LVL1] <= 0) { // super armor is broken forceValue = 0; armorBroken = FCConst.SUPER_ARMOR_LVL1; if (!_owner.HasState(AIAgent.STATE.ARMOR1_BROKEN)) { Revive(FCConst.SUPER_ARMOR_LVL1); } } return(armorBroken); } if (_armorValues[FCConst.SUPER_ARMOR_LVL1] <= 0 && _armorValues[FCConst.SUPER_ARMOR_LVL2] <= 0) { _armorValues[FCConst.SUPER_ARMOR_LVL0] -= forceValue; #if xingtianbo if (((eht == AttackHitType.Normal || eht >= AttackHitType.NORMAL_HURT) && _armorValues[FCConst.SUPER_ARMOR_LVL0] <= 0) || (eht > AttackHitType.Normal && eht < AttackHitType.NORMAL_HURT) || (eht > AttackHitType.BLEND_HURT)) { //normal armor is broken armorBroken = FCConst.SUPER_ARMOR_LVL0; } #endif if ((eht == AttackHitType.None && _armorValues[FCConst.SUPER_ARMOR_LVL0] <= 0) || (eht > AttackHitType.None)) { //normal armor is broken armorBroken = FCConst.SUPER_ARMOR_LVL0; } if (_armorValues[FCConst.SUPER_ARMOR_LVL0] <= 0) { Revive(FCConst.SUPER_ARMOR_LVL0); } } if (damage > 0 && damageResult <= 1) { damageResult = 1; } return(armorBroken); }