Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Commit

Permalink
update abis
Browse files Browse the repository at this point in the history
  • Loading branch information
hmzdot committed Dec 5, 2021
1 parent d361faa commit 2d6d8c8
Show file tree
Hide file tree
Showing 31 changed files with 132,881 additions and 47 deletions.
2 changes: 1 addition & 1 deletion artifacts/contracts/Clash.sol/Clash.dbg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../build-info/f4c900e7a4bb21168e98fd215f2e2e1c.json"
"buildInfo": "../../build-info/16bdc3db163ab84597ca6f0794335654.json"
}
23 changes: 17 additions & 6 deletions artifacts/contracts/Clash.sol/Clash.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion artifacts/contracts/Marketplace.sol/Marketplace.dbg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../build-info/f4c900e7a4bb21168e98fd215f2e2e1c.json"
"buildInfo": "../../build-info/16bdc3db163ab84597ca6f0794335654.json"
}
2 changes: 1 addition & 1 deletion artifacts/contracts/MatchMaker.sol/MatchMaker.dbg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../build-info/f4c900e7a4bb21168e98fd215f2e2e1c.json"
"buildInfo": "../../build-info/16bdc3db163ab84597ca6f0794335654.json"
}
4 changes: 2 additions & 2 deletions artifacts/contracts/MatchMaker.sol/MatchMaker.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion artifacts/contracts/tokens/ARENA.sol/ARENA.dbg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/f4c900e7a4bb21168e98fd215f2e2e1c.json"
"buildInfo": "../../../build-info/16bdc3db163ab84597ca6f0794335654.json"
}
2 changes: 1 addition & 1 deletion artifacts/contracts/tokens/BILIRA.sol/BILIRA.dbg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/f4c900e7a4bb21168e98fd215f2e2e1c.json"
"buildInfo": "../../../build-info/16bdc3db163ab84597ca6f0794335654.json"
}
2 changes: 1 addition & 1 deletion artifacts/contracts/tokens/GOD.sol/GOD.dbg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/f4c900e7a4bb21168e98fd215f2e2e1c.json"
"buildInfo": "../../../build-info/16bdc3db163ab84597ca6f0794335654.json"
}
2 changes: 1 addition & 1 deletion artifacts/contracts/tokens/SONS.sol/SONS.dbg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/f4c900e7a4bb21168e98fd215f2e2e1c.json"
"buildInfo": "../../../build-info/16bdc3db163ab84597ca6f0794335654.json"
}
2 changes: 1 addition & 1 deletion artifacts/contracts/tokens/XP.sol/XP.dbg.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../build-info/f4c900e7a4bb21168e98fd215f2e2e1c.json"
"buildInfo": "../../../build-info/16bdc3db163ab84597ca6f0794335654.json"
}
38 changes: 22 additions & 16 deletions contracts/Clash.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,17 @@ contract Clash {
Player playerTwo;
Player currentPlayer;

function getAllCells() external view returns (Cell[] memory) {
/* function getAllCells() external view returns (Cell[] memory) {
Cell[] memory cellArray = new Cell[](_tableSize * _tableSize);
for (uint256 i = 0; i < cellArray.length; i++) {
cellArray[i] = gameBoard[i / 5][i % 5];
}
return cellArray;
}
*/
function getCell(uint8 i, uint8 j) external view returns (Cell memory) {
return gameBoard[i][j];
}

function getEnemyDeck() external view returns (uint8[] memory) {
return msg.sender == playerOne.addr ? playerTwo.deck : playerOne.deck;
Expand Down Expand Up @@ -162,6 +166,8 @@ contract Clash {
deck: deckTwo
});

currentPlayer = playerTwo;

// Set immutables
_owner = msg.sender;
_boardOwner = arenaOwner;
Expand Down Expand Up @@ -207,13 +213,13 @@ contract Clash {
// ######### PUT CARD ######### //

function _putCardOnBoard(uint8 slotId, uint8 col) private {
/* require(
require(
_gameTick - lastGameTicks[currentPlayer.addr][slotId] >= 2,
"Can't put player this turn"
);
require(col < _tableSize, "Invalid column");
require(!gameBoard[0][col].occupied, "Cell is occupied");
*/

uint8 typeId = currentPlayer.deck[slotId];
Card memory card = godContract.getCard(typeId);
require(
Expand Down Expand Up @@ -248,9 +254,9 @@ contract Clash {
target.row < _tableSize && target.col < _tableSize,
"Target off-bounds"
);
/* require(originCell.owner == msg.sender, "Not owning the origin");
require(originCell.owner == msg.sender, "Not owning the origin");
require(currentPlayer.energy > MOVE_ENERGY_COST, "Energy insufficient");
*/

uint8 vertDistance = upwards
? target.row - origin.row
: origin.row - target.row;
Expand All @@ -276,10 +282,10 @@ contract Clash {
Cell memory originCell = gameBoard[origin.row][origin.col];
Cell memory targetCell = gameBoard[target.row][target.col];

/* require(originCell.owner == msg.sender, "Not owning the pawn");
require(originCell.owner == msg.sender, "Not owning the pawn");
require(targetCell.occupied, "Attacking on an empty cell");
require(targetCell.owner != msg.sender, "Attacking on own cells");
*/

Card memory card = godContract.getCard(originCell.cardId);
require(card.cardType == CardType.DAMAGE, "Not a card attack");

Expand Down Expand Up @@ -329,11 +335,11 @@ contract Clash {

Cell memory originCell = gameBoard[origin.row][origin.col];
Card memory card = godContract.getCard(originCell.cardId);
/*

require(originCell.owner == msg.sender, "Not owning the pawn");
require(card.cardType == CardType.DAMAGE, "Not an attack player");
require(currentPlayer.energy > ATTACK_ENERGY_COST, "Not enough energy");
*/

// Upwards orientation
bool upwards = currentPlayer.addr == playerOne.addr;

Expand Down Expand Up @@ -366,14 +372,14 @@ contract Clash {

uint256 pool = (tokenContract.allowance(_owner, address(this)) *
_winnerPercent) / 1000;
/*

require(targetCell.occupied, "Target cell is empty");
require(targetCell.owner == targetPlayer.addr, "Wrong target player");
require(
flashLoans[msg.sender] <= pool,
"No balance left to use god power"
);
*/

flashLoans[msg.sender] += (pool / 5);

if (targetCell.health <= card.points) {
Expand All @@ -397,15 +403,14 @@ contract Clash {

function _healCell(Origin calldata origin, Target calldata target) private {
Cell memory originCell = gameBoard[origin.row][origin.col];
// Cell memory targetCell = gameBoard[target.row][target.col];
Cell memory targetCell = gameBoard[target.row][target.col];
Card memory card = godContract.getCard(originCell.cardId);

/* require(originCell.owner == msg.sender, "Not owning the pawn");
require(originCell.owner == msg.sender, "Not owning the pawn");
require(targetCell.occupied, "Target cell is empty");
require(targetCell.owner == msg.sender, "Not owning the target");
require(card.cardType == CardType.HEAL, "Not a heal card");

*/
// Upwards orientation
bool upwards = currentPlayer.addr == playerOne.addr;

Expand Down Expand Up @@ -442,14 +447,14 @@ contract Clash {
uint256 pool = (tokenContract.allowance(_owner, address(this)) *
_winnerPercent) / 1000;

/* require(
require(
flashLoans[msg.sender] <= pool,
"No balance left to use god power"
);
require(card.cardType == CardType.HEAL, "Not a heal card");
require(targetCell.occupied, "Target cell is empty");
require(targetCell.owner == msg.sender, "Not owning the target");
*/

flashLoans[msg.sender] += (pool / 5);

gameBoard[target.row][target.col].health +=
Expand All @@ -464,6 +469,7 @@ contract Clash {
function _endTurn() private {
currentPlayer.energy += _energyPerRound;
_turn = (_turn == Turn.PLAYER_ONE) ? Turn.PLAYER_TWO : Turn.PLAYER_ONE;
currentPlayer = (_turn == Turn.PLAYER_ONE) ? playerTwo : playerOne;
_gameTick++;

emit TurnFinished(uint8(_turn));
Expand Down
Loading

0 comments on commit 2d6d8c8

Please sign in to comment.