Implement level and money handling in _spell_learns.

This commit is contained in:
Relintai 2020-09-13 00:01:30 +02:00
parent 57d80dafff
commit 0a1e08f541

View File

@ -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)) {