PaulQbFeng / too-tanky

3 stars 0 forks source link

Champion Stat handling for combat #24

Closed PaulQbFeng closed 1 year ago

PaulQbFeng commented 1 year ago

Currently in BaseChampion we use orig_base_stats and orig_bonus_stats to store the stats during the initialisation of champion and items.

However during damage simulation, we need to keep track of the stats dynamically as they can evolve during the fight:

We need a continuous update of those stats are they are key to compute autoattack and spell damage

The current proposal is to have during the champ initalisation all stats initialised at 0 with 3 different prefix as the champion direct attribute:

We could also think about adding a current prefix if needed.

What do you think ?

Lysxia commented 1 year ago

That proposal looks good to me. No need for current, I think that's the default interpretation of object fields.

LinSun00 commented 1 year ago

j'ai pas compris. Comment ça s'agence avec Stats() ? Ya encore orig_base_stats et orig_bonus_stats ou pas ?

PaulQbFeng commented 1 year ago

Y'aurait encore orig bast stast et orig bonus stats en temps qu'objet Stats qui serviront a garder une trace des stats base et bonus hors combat.

Mais pdnt la phase d'initialisation, on fera un truc du style

pour chaque stat de orig_base_stat:
   inserer la stat direct dans champion --> self.base_armor = orig_base_stat.armor

pour chaque stat de orig_bonus_stat:
   inserer la stat direct dans champion --> self.bonus_armor = orig_bonus_stat.armor

et aussi on aura self.armor = self.base_armor + self.bonus_armor quelque part

donc pdnt les damages, buff, debuff etc, on manipulera uniquement self.armor, self.base_armor, self.bonus_armor

Et quand on veut reinitialiser les stats apres un fight (remettre les hp au max, enlever les debuffs), on pourra recuperer ca a partir de orig_base_stat et orig_bonus_stat

PaulQbFeng commented 1 year ago

si je resume pour annie = Annie(level=1)

annie.orig_base_stats (Stats) --> initialiser une fois au debut a partir du champion et level. aucune interaction avec les fonctions damage, buff etc
annie.orig_bonus_stats (Stats) --> initialiser une fois au debut avec les items, runes, spell_level, passif. aucune interaction avec les fonctions damage, buff etc
annie.base_armor (float) --> current base armor, qui peut evoluer pdnt le fight
annie.bonus_armor (float) --> current bonus armor, qui peut evoluer pdnt le fight
annie.armor (float) --> current total armor, qui peut evoluer pdnt le fight
LinSun00 commented 1 year ago

Ok je valide aussi, jpp de orig_base_stats déjà, c'est super lourd visuellement

PaulQbFeng commented 1 year ago

oui ca a jamais ete la fonction de cette variable d'etre utilisee dans les fonctions de damage, d'ou cet issue critique

PaulQbFeng commented 1 year ago

je vais creer une PR pour ca quand j'ai le temps #2jobs