Skip to content

Commit

Permalink
Merge branch 'next' of https://github.com/BibliothecaDAO/eternum into…
Browse files Browse the repository at this point in the history
… next
  • Loading branch information
spaghettiOnToast committed Dec 11, 2024
2 parents 3abc79a + 54f1955 commit e58751c
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/.env.local.sample
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ VITE_REALMS_ADDRESS=0x755683a990769aad84fa4127bfc8dfa685d4f4fd751bd43e47ca46ff72
VITE_LORDS_ADDRESS=0x5a4cee7e1bfee8a41f884cbdcb17f051ca7cd46bbd5598f91c01887b2f83ee6

VITE_VRF_PROVIDER_ADDRESS="0x0"
VITE_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5
VITE_PUBLIC_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5
2 changes: 1 addition & 1 deletion client/.env.preview
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ VITE_PUBLIC_IMAGE_PROXY_URL=https://abc.com
VITE_PUBLIC_IPFS_GATEWAY=https://abc.com

VITE_VRF_PROVIDER_ADDRESS="0x051fea4450da9d6aee758bdeba88b2f665bcbf549d2c61421aa724e9ac0ced8f"
VITE_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5
VITE_PUBLIC_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const SettleRealmComponent = ({ setSettledRealmId }: { setSettledRealmId: (id: n
const res = await create_multiple_realms({
realm_ids: realmIds,
owner: account.address,
frontend: env.VITE_CLIENT_FEE_RECIPIENT,
frontend: env.VITE_PUBLIC_CLIENT_FEE_RECIPIENT,
signer: account,
season_pass_address: env.VITE_SEASON_PASS_ADDRESS,
});
Expand Down
2 changes: 1 addition & 1 deletion client/src/ui/modules/onboarding/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const SettleRealm = ({ onPrevious }: { onPrevious: () => void }) => {
const res = await create_multiple_realms({
realm_ids: realmIds,
owner: account.address,
frontend: env.VITE_CLIENT_FEE_RECIPIENT,
frontend: env.VITE_PUBLIC_CLIENT_FEE_RECIPIENT,
signer: account,
season_pass_address: env.VITE_SEASON_PASS_ADDRESS,
});
Expand Down
8 changes: 8 additions & 0 deletions contracts/src/models/combat.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ impl TroopsImpl of TroopsTrait {
return resource_precision_u64;
}

fn assert_minimum_for_battle(self: Troops) {
let total = self.knight_count + self.paladin_count + self.crossbowman_count;
assert!(
total >= (100 * RESOURCE_PRECISION).try_into().unwrap(),
"you need to have at least have 100 troops for battle"
);
}

fn assert_normalized(self: Troops) {
assert!(
self.knight_count % Self::normalization_factor() == 0,
Expand Down
2 changes: 2 additions & 0 deletions contracts/src/systems/combat/contracts/battle_systems.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ mod battle_systems {

let mut attacking_army: Army = world.read_model(attacking_army_id);
attacking_army.assert_not_in_battle();
attacking_army.troops.assert_minimum_for_battle();

let attacking_army_entity_owner: EntityOwner = world.read_model(attacking_army_id);
attacking_army_entity_owner.assert_caller_owner(world);
Expand Down Expand Up @@ -877,6 +878,7 @@ mod battle_pillage_systems {
// ensure attacking army is not in a battle
let mut attacking_army: Army = world.read_model(army_id);
attacking_army.assert_not_in_battle();
attacking_army.troops.assert_minimum_for_battle();

// ensure army is at structure position
let army_position: Position = world.read_model(army_id);
Expand Down
2 changes: 1 addition & 1 deletion landing/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ VITE_PUBLIC_IMAGE_PROXY_URL=https://abc.com
VITE_PUBLIC_IPFS_GATEWAY=https://abc.com

VITE_VRF_PROVIDER_ADDRESS="0x051fea4450da9d6aee758bdeba88b2f665bcbf549d2c61421aa724e9ac0ced8f"
VITE_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5
VITE_PUBLIC_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5
2 changes: 1 addition & 1 deletion landing/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ VITE_LORDS_ADDRESS=0x5f6c0fdb83120c1314d2152a98ade017117f1565333e13784b318ea32c5


VITE_VRF_PROVIDER_ADDRESS="0x051fea4450da9d6aee758bdeba88b2f665bcbf549d2c61421aa724e9ac0ced8f"
VITE_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5
VITE_PUBLIC_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5
2 changes: 1 addition & 1 deletion landing/.env.sepolia
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ VITE_PUBLIC_IMAGE_PROXY_URL=https://abc.com
VITE_PUBLIC_IPFS_GATEWAY=https://abc.com

VITE_VRF_PROVIDER_ADDRESS="0x051fea4450da9d6aee758bdeba88b2f665bcbf549d2c61421aa724e9ac0ced8f"
VITE_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5
VITE_PUBLIC_CLIENT_FEE_RECIPIENT=0x045c587318c9ebcf2fbe21febf288ee2e3597a21cd48676005a5770a50d433c5

0 comments on commit e58751c

Please sign in to comment.