Skip to content

Commit

Permalink
Merge branch 'feat-mvp' of github.com:Mississippi-Labs/mississippi in…
Browse files Browse the repository at this point in the history
…to feat-mvp
  • Loading branch information
TiyoSheng committed Oct 17, 2023
2 parents f087dd4 + 73cde1d commit 4c88e9d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
15 changes: 8 additions & 7 deletions packages/contracts/src/systems/BattleSystem.sol
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,16 @@ contract BattleSystem is System {
}

function initPlayerHp(address _player) public view returns (uint256) {
uint256 time = Player.getLastBattleTime(_player);
uint256 hp = Player.getHp(_player);
// uint256 time = Player.getLastBattleTime(_player);
// uint256 hp = Player.getHp(_player);

uint256 elapsedTime = block.timestamp - time;
uint256 maxHp = 10000; // Todo: max hp slot
uint256 increase = (elapsedTime / 10) / 100 * maxHp ;
hp = hp + increase;
// uint256 elapsedTime = block.timestamp - time;
// uint256 maxHp = 10000; // Todo: max hp slot
// uint256 increase = (elapsedTime / 10) / 100 * maxHp ;
// hp = hp + increase;

return (hp > maxHp) ? maxHp : hp;
// return (hp > maxHp) ? maxHp : hp;
return 0;
}

function raisePlayerHp(uint256 _targetHP, uint256 _percent, address _player) public {
Expand Down
10 changes: 2 additions & 8 deletions packages/contracts/src/systems/MoveSystem.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ contract MoveSystem is System {
PlayerLocationLock.set(_msgSender(), 0);
}


function transfer(uint16 x, uint16 y) external {
//传送门,将用户在战区和非战区移动
// 将用户坐标随机转移到指定位置
Player.setX(_msgSender(), x);
Player.setY(_msgSender(), y);
}

modifier CheckContinuity(Move[] memory moveList) {
// 验证行走轨迹合法且连续
uint8 prefer = 1;
Expand Down Expand Up @@ -134,4 +126,6 @@ contract MoveSystem is System {
// GameConfig.pushBattlefieldPlayers(GAME_CONFIG_KEY, _user);
Player.setState(_user, PlayerState.Exploring);
}


}
4 changes: 2 additions & 2 deletions packages/contracts/worlds.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"4242": {
"address": "0x2782b8cDD01d01871bcF4197955a0C1cFa296223",
"blockNumber": 27816101
"address": "0x2A53D186317194340Aa32a6128A0C88e1a37F138",
"blockNumber": 27830588
},
"31337": {
"address": "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0"
Expand Down

0 comments on commit 4c88e9d

Please sign in to comment.