- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
public TourResult NextTour()
{
TourResult lresult = new TourResult();
lresult.TourNum = mCurrentTour;
lresult.IsEnd = false;
Card.Face[] lCurrFaces = getCurrentTourFace();
int lMaxFace = 0;
foreach (Card.Face lFace in lCurrFaces)
{
lMaxFace = ((int)lFace) > lMaxFace ? (int)lFace : lMaxFace;
}
int lMaxFaceCount = 0;
int lNotZeroCount = 0;
foreach (Card.Face lFace in lCurrFaces)
{
lMaxFaceCount = (int)lFace == lMaxFace ? lMaxFaceCount + 1 : lMaxFaceCount + 0;
lNotZeroCount = (int)lFace != 0 ? lNotZeroCount + 1 : lNotZeroCount + 0;
}
if (lMaxFaceCount > 1)
{
mUnknowTour = mUnknowTour > -1 ? mUnknowTour : mCurrentTour;
mCurrentTour++;
lresult.Message = "Одинаковые карты, надо разиграть";
lresult.PlayerIndex = -1;
lresult.Face = (Face)lMaxFace;
return lresult;
}
int lMaxFaceIndex;
for (lMaxFaceIndex = 0; lMaxFaceIndex < lCurrFaces.Length; lMaxFaceIndex++)
{
if (((int)lCurrFaces[lMaxFaceIndex]) == lMaxFace)
break;
}
if (lNotZeroCount < 2)
{
lresult.Message = "победил";
lresult.PlayerIndex = lMaxFaceIndex;
lresult.IsEnd = true;
return lresult;
}
int lPlaerCardsCount = mArr[lMaxFaceIndex].Count;
if (mUnknowTour > -1)
{
for (int i = mUnknowTour; i <= mCurrentTour; i++)
{
AddCardsToPlayer(i, lMaxFaceIndex);
}
mUnknowTour = -1;
}
else
{
AddCardsToPlayer(mCurrentTour, lMaxFaceIndex);
}
lresult.Message = "загреб краты";
for (int i = lPlaerCardsCount; i < mArr[lMaxFaceIndex].Count; i++)
{
lresult.Message += string.Format(" {0},", GetCardName(mArr[lMaxFaceIndex][i]));
}
lresult.PlayerIndex = lMaxFaceIndex;
mCurrentTour++;
return lresult;
}