Giter VIP home page Giter VIP logo

Comments (3)

oleg-derevenetz avatar oleg-derevenetz commented on May 24, 2024

The order of skills depends on the initial map seed (which is generated when the new game is started) and pre-defined for a given hero. See this method for details and comments:

Heroes::HeroSeedsForLevelUp Heroes::GetSeedsForLevelUp() const
{
/* We generate seeds based on the hero and global world map seed
* The idea is that, we want the skill selection to be randomized at each map restart,
* but deterministic for a given hero.
* We also want the available skills to change depending on current skills/stats of the hero,
* to avoid giving out the same skills/stats at each level up. We can't use the level field for this, as it
* doesn't change when we level up several levels at once.
* We also need to generate different seeds for each possible call to the random number generator,
* in order to avoid always drawing the same random number at level-up: otherwise this
* would mean that for all possible games, the 2nd secondary
* skill would always be the same once the 1st one is selected.
* */
uint32_t hash = world.GetMapSeed();
fheroes2::hashCombine( hash, _id );
fheroes2::hashCombine( hash, _race );
fheroes2::hashCombine( hash, attack );
fheroes2::hashCombine( hash, defense );
fheroes2::hashCombine( hash, power );
fheroes2::hashCombine( hash, knowledge );
for ( int skillId = Skill::Secondary::PATHFINDING; skillId <= Skill::Secondary::ESTATES; ++skillId ) {
fheroes2::hashCombine( hash, GetLevelSkill( skillId ) );
}
HeroSeedsForLevelUp seeds;
seeds.seedPrimarySkill = hash;
seeds.seedSecondarySkill1 = hash + 1;
seeds.seedSecondarySkill2 = hash + 2;
seeds.seedSecondarySkillRandomChoose = hash + 3;
return seeds;
}

from fheroes2.

crypt47 avatar crypt47 commented on May 24, 2024

Yes, I see. The only way to change upcomming choice is to upgrade hero skills without raising experience. It's a pitty that choice doesn't necessarily include one skill that was already selected before.

from fheroes2.

ihhub avatar ihhub commented on May 24, 2024

Moving this to the discussion section.

from fheroes2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.