mirror of
https://github.com/Relintai/entity_spell_system.git
synced 2025-02-20 17:14:44 +01:00
Implement level and money handling in _spell_learns.
This commit is contained in:
parent
57d80dafff
commit
0a1e08f541
@ -6272,6 +6272,20 @@ void Entity::_spell_learns(int id) {
|
||||
continue;
|
||||
|
||||
if (sp->get_id() == id) {
|
||||
int req_level = sp->get_level();
|
||||
|
||||
if (req_level > gets_level()) {
|
||||
return;
|
||||
}
|
||||
|
||||
int cost = sp->get_training_cost();
|
||||
|
||||
if (gets_money() < cost) {
|
||||
return;
|
||||
}
|
||||
|
||||
sets_money(gets_money() - cost);
|
||||
|
||||
Ref<Spell> req_spell = sp->get_training_required_spell();
|
||||
|
||||
if (req_spell.is_valid() && !spell_hass(req_spell)) {
|
||||
|
Loading…
Reference in New Issue
Block a user