-
Notifications
You must be signed in to change notification settings - Fork 2
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
[GH-431] Add currency cost to levels #617
Conversation
…add-currency-cost-to-level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as a nitpicky comment, I like the uncountable version of cost
better for the cost of playing a level. Instead of attempt_costs
, i'd go for attempt_cost
.
Also, the description is now outdated as it uses the previous "currency_costs
" attribute.
Lastly, is there an issue already in the client for implementing handling of "cant afford" errors? Because of course right now this breaks in the client
…add-currency-cost-to-level
Closes: https://github.com/lambdaclass/champions_of_mirra/issues/431
Associated PR: https://github.com/lambdaclass/champions_of_mirra/issues/463
Motivation
We need to be able to charge the user with a currency cost in order to get access to fight some of the levels. For example, the Dungeon levels will have a cost in Shovels.
Summary of changes
How to test it?
Run the backend and start the client in the main branch. For starters, everything should be working as usual, when none of the existing levels have a CurrencyCost associated.
Add this line to the map used for level creation in seeds.ex:
currency_costs: [%CurrencyCost{currency_id: gold_currency.id, amount: 13}],
Also, you'll need to add this alias to that file:
alias GameBackend.Users.Currencies.CurrencyCost
You should end up with something like this:
Now all the levels cost 13 Gold. Before fighting a new level, check your current amount of gold. If you fight the level and lose the battle, your amount of gold should have decreased by 13. If you won, your gold amount should now be
previous amount + level reward - level cost
.Checklist