📄 playcanvas.java.bak
字号:
break;
case 5: // '\005'
broadCastChangeGround(21, 24, broadCastType);
groundIDs = (new int[] {
21, 22, 23, 24
});
break;
case 6: // '\006'
broadCastChangeGround(26, 31, broadCastType);
groundForBuilding[27] = 0; //很特别哦。
groundForBuilding[28] = 0;//很特别哦,其他CASE都没有
groundIDs = (new int[] {
26, 29, 30, 31
});
break;
case 7: // '\007'
broadCastChangeGround(33, 35, broadCastType);
groundIDs = (new int[] {
33, 34, 35
});
break;
case 8: // '\b'
broadCastChangeGround(38, 47, broadCastType);
groundIDs = (new int[] {
38, 39, 40, 43, 44, 46, 47
});
break;
}
if(broadCastType == 11)
richMan.showBroadCast("天使祝福:\n", groundIDs, nowPlayerID != 0, "新闻");
else
if(broadCastType == 5)
richMan.showBroadCast("怪兽袭击\n:", groundIDs, nowPlayerID != 0, "新闻");
else
if(broadCastType == 15)
richMan.showBroadCast("地震摧毁:\n", groundIDs, nowPlayerID != 0, "新闻");
else
if(broadCastType == 25)
richMan.showBroadCast("龙卷风毁坏:\n", groundIDs, nowPlayerID != 0, "新闻");
}
/**
* 广播改变(地震等)
* @param beginID 开始地皮序号
* @param endID 结束地皮序号
* @param broadCastType 广播类型
*/
private void broadCastChangeGround(int beginID, int endID, int broadCastType)
{
switch(broadCastType)
{
case 11: // 天使祝福
for(int location = beginID; location < endID + 1; location++)
{
if(groundForBuilding[location] >= 100)
groundForBuilding[location] += 100;
else
if(groundForBuilding[location] >= 10)
groundForBuilding[location] += 10;
else
if(groundForBuilding[location] > 0)
groundForBuilding[location]++;
adjustGroundOverBuilding(location);
}
break;
case 15: // 地震摧毁
for(int l1 = beginID; l1 < endID + 1; l1++)
groundForBuilding[l1] = 0;
break;
default: // 龙卷风毁坏,怪兽袭击
destroyGround(beginID, endID);
break;
}
}
/**
* 龙卷风破坏土地
* @param beginID 开始地皮序号
* @param endID 结束地皮序号
*/
private void destroyGround(int beginID, int endID)
{
for(int j1 = beginID; j1 < endID + 1; j1++)
if(groundForBuilding[j1] != 0)
groundForBuilding[j1] = groundForBuilding[j1] >= 10 ? groundForBuilding[j1] >= 100 ? 100 : 10 : 1;
}
/**
* 调整土地,避免过度建设
* @param groundLocation 土地位置
*/
private void adjustGroundOverBuilding(int groundLocation)
{
groundForBuilding[groundLocation] = groundForBuilding[groundLocation] != 5 ? groundForBuilding[groundLocation] != 50 ? groundForBuilding[groundLocation] != 500 ? groundForBuilding[groundLocation] : 400 : 40 : 4;
}
/**
* 获得财产税
*/
private int fetchBuildingTax()
{
int tax = 0;
int playerBuiding = 1;
for(int j1 = 0; j1 < nowPlayerID; j1++)
playerBuiding *= 10;
for(int i = 0; i < groundForBuilding.length; i++)
if(groundForBuilding[i] == 1 * playerBuiding)
tax += fetchGroundPrice(i);
else
if(groundForBuilding[i] == 2 * playerBuiding)
tax += (fetchGroundPrice(i) * 8 * 5) / 100;
else
if(groundForBuilding[i] == 3 * playerBuiding)
tax += (fetchGroundPrice(i) * 8 * 15) / 100;
else
if(groundForBuilding[i] == 4 * playerBuiding)
tax += (fetchGroundPrice(i) * 8 * 125) / 100;
return tax;
}
/**
* 判断是否是当前角色的地皮
*/
private boolean isNowPlayerIDGround()
{
if(groundForBuilding[player_location[nowPlayerID]] == 0)
return true;
else
return nowPlayerID == (groundForBuilding[player_location[nowPlayerID]] >= 10 ? groundForBuilding[player_location[nowPlayerID]] >= 100 ? 2 : 1 : 0);
}
/**
* 买地或是加盖房子
*/
private void buildorBuyGround()
{
int buildingLevel = groundForBuilding[player_location[nowPlayerID]];
for(int i1 = 0; i1 < 2; i1++)
if(buildingLevel > 10)
buildingLevel /= 10;
richMan.buildorBuyGround(player_location[nowPlayerID], fetchGroundPrice(player_location[nowPlayerID]), nowPlayerID != 0, buildingLevel);
}
/**
* 减钱(走到别人的地皮上)
* @param groundBelongtoWho 谁的土地
* @param price 过路费
*/
private void decreaseMoney(int groundBelongtoWho, int price)
{
player_money[nowPlayerID] -= price;
player_money[groundBelongtoWho] += price;
// 如果角色钱 < 0 把他所有的土地清除
if(player_money[nowPlayerID] < 0)
switch(nowPlayerID)
{
default:
break;
case 0: // '\0'
for(int j1 = 0; j1 < groundForBuilding.length; j1++)
if(groundForBuilding[j1] < 10 && groundForBuilding[j1] > 0)
groundForBuilding[j1] = 0;
break;
case 1: // '\001'
for(int j1 = 0; j1 < groundForBuilding.length; j1++)
if(groundForBuilding[j1] < 100 && groundForBuilding[j1] > 10)
groundForBuilding[j1] = 0;
break;
case 2: // '\002'
for(int l1 = 0; l1 < groundForBuilding.length; l1++)
if(groundForBuilding[l1] >= 100)
groundForBuilding[l1] = 0;
break;
}
richMan.showPaymentExpense(price, nowPlayerID != 0);
}
/**
* 判断当前的当前角色所处地皮是谁的。
*/
private int fetchNowPlayerLocationGroundBelongtoWho()
{
if(groundForBuilding[player_location[nowPlayerID]] < 10)
return 0;
else
return groundForBuilding[player_location[nowPlayerID]] >= 100 ? 2 : 1;
}
/**
* 获得地皮的价格
* @param groundID 地皮ID
*/
private int fetchGroundPrice(int groundID)
{
switch(groundID)
{
case 0: // '\0'
return 82;
case 1: // '\001'
case 13: // '\r'
return 80;
case 3: // '\003'
case 8: // '\b'
return 100;
case 4: // '\004'
case 7: // '\007'
case 9: // '\t'
case 31: // '\037'
case 38: // '&'
case 44: // ','
return 120;
case 12: // '\f'
case 29: // '\035'
case 34: // '"'
return 90;
case 17: // '\021'
case 23: // '\027'
case 24: // '\030'
case 30: // '\036'
case 46: // '.'
case 47: // '/'
return 110;
case 18: // '\022'
return 130;
case 19: // '\023'
return 95;
case 21: // '\025'
case 43: // '+'
return 150;
case 22: // '\026'
case 40: // '('
return 140;
case 26: // '\032'
return 105;
case 33: // '!'
case 35: // '#'
return 85;
case 39: // '\''
return 125;
case 2: // '\002'
case 5: // '\005'
case 6: // '\006'
case 10: // '\n'
case 11: // '\013'
case 14: // '\016'
case 15: // '\017'
case 16: // '\020'
case 20: // '\024'
case 25: // '\031'
case 27: // '\033'
case 28: // '\034'
case 32: // ' '
case 36: // '$'
case 37: // '%'
case 41: // ')'
case 42: // '*'
case 45: // '-'
default:
return 0;
}
}
/**
* 获得相连的地皮价格
* @param id 地皮ID
*/
private int fetchConnectedLocationPrice(int id)
{
int price = 0;
int groundID = id;
byte groundActorID = groundForBuilding[groundID] >= 10 ? (byte)(groundForBuilding[groundID] >= 100 ? 100 : 10) : 1;
if(groundID != 0)
do
{
if(groundForBuilding[groundID - 1] == 0 || groundForBuilding[groundID - 1] < groundActorID || groundForBuilding[groundID - 1] > groundActorID * 4)
break;
price += fetchTheGroundPrice(groundForBuilding[groundID - 1], groundID - 1);
} while(--groundID != 0);
groundID = groundID;
do
{
if(groundForBuilding[groundID + 1] == 0 || groundForBuilding[groundID + 1] < groundActorID || groundForBuilding[groundID + 1] > groundActorID * 4)
break;
price += fetchTheGroundPrice(groundForBuilding[groundID + 1], groundID + 1);
} while(++groundID != 49);
if(price == 0)
price = fetchAddPrice(groundID);
else
price += fetchTheGroundPrice(groundForBuilding[groundID], groundID);
return price;
}
/**
* 获得地皮价格
* @param groundBuilding 地皮的级别
* @param groudID 地皮ID
*/
private int fetchTheGroundPrice(int groundBuilding, int groundID)
{
switch(groundBuilding)
{
case 1: // '\001'
case 10: // '\n'
case 100: // 'd'
return fetchGroundPrice(groundID);
}
return 500;
}
/**
* 获得地皮价格
* @param 地皮ID
*/
private int fetchAddPrice(int groundID)
{
switch(groundForBuilding[groundID])
{
case 1: // '\001'
case 10: // '\n'
case 100: // 'd'
return (fetchGroundPrice(groundID) * 4) / 5;
case 2: // '\002'
case 20: // '\024'
case 200:
return fetchGroundPrice(groundID) * 2;
case 3: // '\003'
case 30: // '\036'
case 300:
return (fetchGroundPrice(groundID) * 14) / 5;
case 4: // '\004'
case 40: // '('
case 400:
return fetchGroundPrice(groundID) * 4;
}
return 0;
}
/**
* 计算地皮的数量
* @param groundValue 地皮值
*/
public int countPlayerGround(int goundValue)
{
int count = 0;
for(int i = 0; i < groundForBuilding.length; i++)
if(groundForBuilding[i] == goundValue)
count++;
return count;
}
/**
* 计算角色在地图上的坐标X
* @param id 地皮ID
*/
private int computePlayerX(int id)
{
return id <= 44 && id >= 3 ? id >= 7 ? id >= 12 ? id >= 16 ? id >= 21 ? id >= 25 ? id >= 33 ? id >= 45 ? 0 : 208 - 16 * (id - 33) : 224 : 160 + 16 * (id - 21) : 144 : 96 + 16 * (id - 12) : 80 : 32 + 16 * (id - 3) : 16;
}
/**
* 计算角色在地图上的坐标Y
* @param id 地皮ID
*/
private int computePlayerY(int id)
{
return id >= 3 ? id >= 7 ? id >= 11 ? id >= 16 ? id >= 20 ? id >= 26 ? id >= 32 ? id >= 46 ? id >= 50 ? 0 : 32 + 16 * (id - 46) : 16 : 112 - 16 * (id - 26) : 128 : 64 + 16 * (id - 16) : 48 : 112 - 16 * (id - 7) : 128 : 96 + 16 * id;
}
/**
* 计算地皮在地图上的坐标X
* @param id 地皮ID
*/
private int computeGroundX(int id)
{
return id >= 2 ? id >= 5 ? id >= 10 ? id >= 14 ? id >= 20 ? id >= 25 ? id >= 32 ? id >= 45 ? ((int) (id >= 48 ? -200 : 0)) : 208 - 16 * (id - 33) : 240 : 160 + 16 * (id - 21) : 128 : 96 + 16 * (id - 12) : 64 : 32 + 16 * (id - 3) : 0;
}
/**
* 计算角色在地图上的坐标Y
* @param id 地皮ID
*/
private int computeGroundY(int id)
{
return id >= 2 ? id >= 5 ? id >= 10 ? id >= 14 ? id >= 20 ? id >= 25 ? id >= 32 ? id >= 45 ? id >= 48 ? 0 : 32 + 16 * (id - 46) : 0 : 112 - 16 * (id - 26) : 144 : 80 + 16 * (id - 17) : 64 : 112 - 16 * (id - 7) : 144 : 96 + 16 * id;
}
/**
* 初始化游戏
*/
public void initialGame()
{
//角色
for(int i = 0; i < 3; i++)
{
player_location[i] = 49;
player_money[i] = 3500;
player_prinson_canNotMoveNum[i] = 0;
player_sleep_canNotMoveNum[i] = 0;
for(int j = 0; j < 5; j++)
player_cards[i][j] = 16;
for(int j = 0; j < 4; j++)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -