Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the attack logic #26 #57

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

WhoIsNac
Copy link
Contributor

@WhoIsNac WhoIsNac commented Aug 14, 2023

attack _system

✅ We check if the player is an Attacker
✅ If the attacker has more dribbling status than the defender, we reduce the attacker's defense by the defender dribble stats.
✅ Create_card system crated (only cost and role param missing)
✅ Attack_system update with the place_card logic.
✅ When the card has been dribbled, we remove the card from the field according to its position
✅If the Attacker has not dribbled the opposing card , we remove the Attacker from the field + end of the turn.
✅ Added 1st review change.

I started the attack logic and the contract and implemented the test, (I also created a card creation contract to do the test with the card stats).

But to finish the implementation, we need to finish the card logic system and also the place_card system to know each card in the field in order to start the attack sequence.

I've also created a create_card contract so that I can test attacks between two cards.

Fixes #26

I have implemented the beginning of the contract as well as the attack logic tests but the implementation of the attack requires the modification of the component file as well as the implementation of the card deck system in order to verify the lenght of the players' hand.
I have implemented the beginning of the contract as well as the attack logic tests but the implementation of the attack requires the modification of the component file as well as the implementation of the card deck system in order to verify the lenght of the players' hand.
@vercel
Copy link

vercel bot commented Aug 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tsubasa ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 24, 2023 8:28pm

Fix error in test Attack , also finished the implementation of the create_card system , and i added some comment to the code
contracts/src/systems/attack.cairo Outdated Show resolved Hide resolved
contracts/src/systems/attack.cairo Outdated Show resolved Hide resolved
contracts/src/systems/attack.cairo Outdated Show resolved Hide resolved
contracts/src/systems/attack.cairo Outdated Show resolved Hide resolved
Attack_system update with the place_card logic.

When the card has been dribbled, we remove the card from the field according to its position

If the Attacker has not dribbled the opposing card , we remove the Attacker from the field + end of the turn.

Added the review change.
@WhoIsNac
Copy link
Contributor Author

Review Implemented.

Attack_system/test update with the place_card logic .

When the card has been dribbled, we remove the card from the field according to its position

If the Attacker has not dribbled the opposing card , we remove the Attacker from the field + end of the turn.

Comment on lines +11 to +14
/// * `ctx` - Dojo context.
/// * `game_id` - The current game_id.
/// * `card_id_player1` - The token id of the card placed.
/// * `card_id_player2` - The token id of the card placed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// * `ctx` - Dojo context.
/// * `game_id` - The current game_id.
/// * `card_id_player1` - The token id of the card placed.
/// * `card_id_player2` - The token id of the card placed.
/// Description of the function
///
/// # Arguments
///
/// * `ctx` - Dojo context.
/// * `game_id` - The current game_id.
/// * `card_id_player1` - The token id of the card placed.
/// * `card_id_player2` - The token id of the card placed.

Comment on lines 32 to 37
match card_player1.role {
Roles::Goalkeeper => value = 0,
Roles::Defender => value = 0,
Roles::Midfielder => value = 0,
Roles::Attacker => value = 1,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you doing that ?

Roles::Attacker => value = 1,
}

if value == 1 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not right, you should loop through all the players card, they'll all attack one by one starting from the Roles::Attacker

@WhoIsNac
Copy link
Contributor Author

Sry wrong manipulation

@rkdud007
Copy link
Contributor

Hi, I thought attack_system contains updating the score of players when they score a goal. Current code seems not containing. Can you check? @WhoIsNac @LucasLvy

added attack logic , but can't remove the player placement
@vercel
Copy link

vercel bot commented Aug 24, 2023

@WhoIsNac is attempting to deploy a commit to the keep-starknet-strange Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement the attack logic
3 participants