Skip to content

Commit

Permalink
Make auto-training respond more when a djinni casts spells.
Browse files Browse the repository at this point in the history
Calculate how much exercise spell skills gives for a new character
before splitting spell skills. This means that level 1 djinn auto-train
magic to a similar degree to other species.

Train spell skills (roughly) in proportion to the exercise put into
them, where it had been much less.
  • Loading branch information
Aliscans committed Jul 21, 2024
1 parent 1906822 commit 0c32d3b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion crawl-ref/source/ng-setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,15 @@ static void _setup_generic(const newgame_def& ng,
set_form(transformation::beast, 1); // hacky...
}

reassess_starting_skills();
reassess_starting_skills(false);
init_skill_order();
init_can_currently_train();
init_train();
if (you.religion == GOD_TROG)
join_trog_skills();
init_training();
if (you.has_mutation(MUT_INNATE_CASTER))
cleanup_innate_magic_skills();

// Apply autoinscribe rules to inventory.
request_autoinscribe();
Expand Down
7 changes: 4 additions & 3 deletions crawl-ref/source/skills.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void cleanup_innate_magic_skills()
// Characters are actually granted skill points, not skill levels.
// Here we take racial aptitudes into account in determining final
// skill levels.
void reassess_starting_skills()
void reassess_starting_skills(bool balance_djinn)
{
// go backwards, need to do Dodging before Armour
// "sk >= SK_FIRST_SKILL" might be optimised away, so do this differently.
Expand Down Expand Up @@ -311,7 +311,8 @@ void reassess_starting_skills()
}
}

if (you.has_mutation(MUT_INNATE_CASTER))
// For a new game, this is called after training is calculated.
if (balance_djinn && you.has_mutation(MUT_INNATE_CASTER))
cleanup_innate_magic_skills();
}

Expand Down Expand Up @@ -843,7 +844,7 @@ static void _balance_magic_training()
ASSERT(n_skills > 0);
// Total training for all magic skills should be the base average,
// divided between each skill.
const int to_train = max(train_total / (n_skills * n_skills), 1);
const int to_train = max(train_total / n_skills, 1);
for (skill_type sk = SK_SPELLCASTING; sk <= SK_LAST_MAGIC; ++sk)
if (!is_removed_skill(sk) && you.skills[sk] < MAX_SKILL_LEVEL)
you.training[sk] = to_train;
Expand Down
2 changes: 1 addition & 1 deletion crawl-ref/source/skills.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int calc_skill_cost(int skill_cost_level);
void check_skill_cost_change();

bool skill_default_shown(skill_type sk);
void reassess_starting_skills();
void reassess_starting_skills(bool balance_djinn = true);
bool check_selected_skills();
void init_train();
void init_can_currently_train();
Expand Down

0 comments on commit 0c32d3b

Please sign in to comment.