Skip to content

Commit

Permalink
fix: fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TiyoSheng committed Nov 11, 2023
1 parent 60faa1e commit 27036a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
17 changes: 10 additions & 7 deletions packages/client/src/components/Battle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ export default function Battle(props) {
timeout = setTimeout(async () => {
let resultBattle:any = await forceEnd(battleId)
console.log(resultBattle)
if (resultbattle?.isEnd && resultbattle?.winner) {
props.finishBattle(resultbattle?.winner, resultbattle?.attacker, resultbattle?.defender)
if (resultBattle?.isEnd && resultBattle?.winner) {
props.finishBattle(resultBattle?.winner, resultBattle?.attacker, resultBattle?.defender)
return
}
}, 23000)
Expand All @@ -113,8 +113,8 @@ export default function Battle(props) {
timeout = setTimeout(async () => {
let resultBattle:any = await forceEnd(battleId)
console.log(resultBattle)
if (resultbattle?.isEnd && resultbattle?.winner) {
props.finishBattle(resultbattle?.winner, resultbattle?.attacker, resultbattle?.defender)
if (resultBattle?.isEnd && resultBattle?.winner) {
props.finishBattle(resultBattle?.winner, resultBattle?.attacker, resultBattle?.defender)
return
}
}, 23000)
Expand All @@ -130,8 +130,8 @@ export default function Battle(props) {
timeout = setTimeout(async () => {
let resultBattle:any = await forceEnd(battleId)
console.log(resultBattle)
if (resultbattle?.isEnd && resultbattle?.winner) {
props.finishBattle(resultbattle?.winner, resultbattle?.attacker, resultbattle?.defender)
if (resultBattle?.isEnd && resultBattle?.winner) {
props.finishBattle(resultBattle?.winner, resultBattle?.attacker, resultBattle?.defender)
return
}
}, 23000)
Expand Down Expand Up @@ -168,8 +168,11 @@ export default function Battle(props) {
}
}, [])

if (battle) {
if (battle && !battle?.isEnd) {
initBattle()
} else if (battle && battle?.isEnd) {
props.finishBattle(battle?.winner, battle?.attacker, battle?.defender)
return
}

// if (battle) {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/pages/game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ const Game = () => {
const submitGemFun = async () => {
setUserInfoVisible(true);
try {
// goHome();
goHome();
if (curPlayer.oreBalance > 0) {
await submitGem();
setContent(
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/worlds.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"blockNumber": 29582781
},
"31337": {
"address": "0x33E45b187da34826aBCEDA1039231Be46f1b05Af"
"address": "0x1D3EDBa836caB11C26A186873abf0fFeB8bbaE63"
},
"33784": {
"address": "0xFe29941C54C015B042994D0384F2b35BD7fb3f7a",
Expand Down

0 comments on commit 27036a8

Please sign in to comment.