PaulQbFeng / too-tanky

3 stars 0 forks source link

base_armor, bonus_armor, armor #57

Closed LinSun00 closed 1 year ago

LinSun00 commented 1 year ago

Let's say I want to implem armor reduction. Given our current code, we would probably create self.armor_debuff = [ ] in BaseChampion.init and it would work fine. Armor is defined as the sum of base_armor and bonus_armor (initialized with orig_base_stats.armor and orig_bonus_stats.armor). Since armor reduction can be applied during a combo by a spell or an item, it has to be handled dynamically. Should we define a getter and setter method for base_armor and bonus_armor and put armor in STAT_UNDERLYING_PROPERTIES ?

PaulQbFeng commented 1 year ago

Can it be handled by only changing base_armor and bonus_armor ?

30 flat armor reduction and 30% armor reduction

-> For a target with 300 armor (100 base and 200 bonus armor) 300 reduced to 270 (90 base and 180 bonus armor), -10 base, -20 bonus 270 reduced to 189 (63 base and 126 bonus armor) 0.7 base , 0.7 bonus

LinSun00 commented 1 year ago

Yes it could of course. I guess a better way of phrasing the question is: where/when do we change base_armorand bonus_armorin the code ? We could do it everytime we get those stats by changing their getters, or change it whenever we add an armor reduction debuff to self.armor_debuff. Which one is better ?

PaulQbFeng commented 1 year ago

Proposal 1/N: in a spell's apply_debuff have something like target.base_armor, target.bonus_armor = reduce_armor(target, amount) or target.reduce_armor(amount)

with reduce_armor being the method or the function that will handle the base and bonus armor reduciton depending on flat/percent total/bonus armor reduction