-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
magic level training similar to ultima online
- Loading branch information
Showing
7 changed files
with
104 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import random | ||
|
||
|
||
def train_sorcery(user, user_data, usersdb, mapdb): | ||
exp_cost = 5000 | ||
magic_gain = 50 | ||
failure_chance = 0.5 | ||
|
||
if user_data['exp'] < exp_cost: | ||
return False, f"You need {exp_cost} exp to train sorcery. You only have {user_data['exp']} exp." | ||
|
||
if random.random() < failure_chance: | ||
user_data['exp'] -= exp_cost | ||
return False, f"Your sorcery training failed. You lost {exp_cost} exp." | ||
|
||
user_data['exp'] -= exp_cost | ||
user_data['sorcery'] = user_data.get('sorcery', 0) + magic_gain | ||
|
||
usersdb[user].update(user_data) | ||
return True, f"Your sorcery training was successful! You gained {magic_gain} magic power." |