修改非空断言可能会导致的崩溃错误
This commit is contained in:
@@ -36,6 +36,7 @@ class GameManager {
|
||||
}
|
||||
}
|
||||
claculateRanking(aPlayers) {
|
||||
var _a, _b;
|
||||
let sortPlayers = [];
|
||||
for (const player of aPlayers.values()) {
|
||||
if (player.mHp <= 0) {
|
||||
@@ -51,11 +52,13 @@ class GameManager {
|
||||
if (sortPlayers[i].mCharacterName != "") {
|
||||
continue;
|
||||
}
|
||||
let characterName = this.mCharacterNames.pop();
|
||||
let characterName = (_a = this.mCharacterNames.pop()) !== null && _a !== void 0 ? _a : "";
|
||||
sortPlayers[i].mCharacterName = characterName;
|
||||
if (characterName == "飞鸟千寻") {
|
||||
let player = aPlayers.get(sortPlayers[i].mCurrentEnemy);
|
||||
player.mCharacterName = "高桥林佑";
|
||||
if (player) {
|
||||
player.mCharacterName = "高桥林佑";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,7 +68,7 @@ class GameManager {
|
||||
if (player.mHp > 0) {
|
||||
player.mRank = 1;
|
||||
if (this.mCharacterNames.length > 0) {
|
||||
player.mCharacterName = this.mCharacterNames.pop();
|
||||
player.mCharacterName = (_b = this.mCharacterNames.pop()) !== null && _b !== void 0 ? _b : "";
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -73,22 +76,30 @@ class GameManager {
|
||||
}
|
||||
}
|
||||
calcuteGameFightResult() {
|
||||
var _a;
|
||||
let temp = new Map(this.mGameFightPlayer);
|
||||
let restRound = null;
|
||||
while (temp.size > 0) {
|
||||
const iterator = temp.keys();
|
||||
const playerID = iterator.next().value;
|
||||
const playerID = (_a = iterator.next().value) !== null && _a !== void 0 ? _a : "";
|
||||
let player = temp.get(playerID);
|
||||
if (!player) {
|
||||
return;
|
||||
}
|
||||
if (player.mIsResting) {
|
||||
restRound = [player, this.mGameFightPlayer.get(player.mCurrentEnemy)],
|
||||
let enemy = this.mGameFightPlayer.get(player.mCurrentEnemy);
|
||||
if (!enemy) {
|
||||
return;
|
||||
}
|
||||
restRound = [player, enemy],
|
||||
temp.delete(playerID);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
let enemy = temp.get(player.mCurrentEnemy);
|
||||
if (!enemy) {
|
||||
return;
|
||||
}
|
||||
if (player.mAgile >= enemy.mAgile) //palyer 敏捷高
|
||||
{
|
||||
this.claculatePlayerHp(player, enemy);
|
||||
|
Reference in New Issue
Block a user