捕鱼达人源代码下载及解析二
#include "StdAfx.h"
#include "GameLogic.h"
//////////////////////////////////////////////////////////////////////////
//扑克数据
const BYTE CGameLogic::m_cbFishStyle[100]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x09,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x09,0x0A,
0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,
0x02,0x02,0x02,0x02,0x02,0x03,0x03,0x03,0x03,0x03,
0x03,0x03,0x03,0x03,0x03,0x04,0x04,0x04,0x04,0x04,
0x04,0x04,0x04,0x04,0x04,0x05,0x05,0x05,0x05,0x05,
0x05,0x05,0x05,0x05,0x05,0x06,0x06,0x06,0x06,0x06,
0x07,0x07,0x07,0x07,0x07,0x08,0x08,0x09,0x09,0x0A,
};
//////////////////////////////////////////////////////////////////////////
//构造函数
CGameLogic::CGameLogic()
{
memset(m_cbCaptureRate, 0, sizeof(m_cbCaptureRate));
}
//析构函数
CGameLogic::~CGameLogic()
{
}
int CGameLogic::GetFishBonus(int nFishStyle)
{
int nBonus;
if (nFishStyle == 0)
{
nBonus = 1;
}
else if (nFishStyle == 1)
{
nBonus = 2;
}
else if (nFishStyle == 2)
{
nBonus = 4;
}
else if (nFishStyle == 3)
{
nBonus = 7;
}
else if (nFishStyle == 4)
{
nBonus = 10;
}
else if (nFishStyle == 5)
{
nBonus = 20;
}
else if (nFishStyle == 6)
{
nBonus = 30;
}
else if (nFishStyle == 7)
{
nBonus = 40;
}
else if (nFishStyle == 8)
{
nBonus = 50;
}
else if (nFishStyle == 9)
{
nBonus = 60;
}
else if (nFishStyle == 10)
{
nBonus = 100;
}
return nBonus;
}
bool CGameLogic::GetCaptureProbability(int nFishNetStyle, int nFishStyle)
{
int nRateCount = ((10-nFishNetStyle)+1.0)*(1.0+(nFishNetStyle+1)/5.0);
memset(m_cbCaptureRate, 0, sizeof(m_cbCaptureRate));
memset(m_cbCaptureRate, 1, nRateCount);
return (m_cbCaptureRate[rand()%100]==1);
}
BYTE CGameLogic::GetRandFishStyle()
{
int nIndex = rand()%100;
return m_cbFishStyle[nIndex];
}
int CGameLogic::GetFishPathWithStyle(int nStyle)
{
int nIndex = 0;
if (nStyle == 10)
{
nIndex = rand()%4;
}
else
{
nIndex = rand()%8;
}
return (nStyle*10 + nIndex);
}
//////////////////////////////////////////////////////////////////////////
标签:
上一篇:深海捕鱼手游技巧
下一篇:捕鱼季游戏机结构分析