Open klondikemarlen opened 6 years ago
Similar issue #234.
Quote from @elthran
So the current method is: your hero has a proficiency called defence for example. and then every single item and ability has a variable called defence_value and defence_modifier (yes, this is probably a shit way to do it).
what happens anytime you equip/unequip is that your character runs this code for every proficiency (in this case defence)
self.proficiency.defence.value = self.proficiency.defence.level self.proficiency.defence.modifier = 1 (your defence value is equal to how many points you put into it and you have a modifier of 1).
then the prficiency runs for item in hero.equipped_items: self.proficiency.defence.value += item.defence_value self.proficiency.defence.modifier += item.defence_modifier
(repeat for abilities)
finally it runs self.proficiency.defence.final_number = self.proficiency.defence_value * self.proficiency.defence_modifier
so its really realy slow and awkward but in theory it would work. but you need to come up with a better way
the main problem with my method is that every time you equip/unequip anything, every single proficiency you have needs to reset its value
Quote from @elthran
What we need are about 30 proficiencies. Each one has a value and a modifier. These two numbers can be adjusted by leveling it up or through equipment/abilities. So if my character has 10 defense points and where's a piece of armour that gives him +10% defense, he should have 11 defense
Then he learns an ability that gives him +10 defense, he now has 22 defense totL. but it's complicated to code simply
Described better in https://github.com/elthran/RPG-Game/commit/467e24138ff51acf04160f45aa8b4701fef3e560#diff-849801a765e275fb115b959802c95cfe by @elthran I did some colour coding.
My current understanding goes like:
So we end up with a calculation order of:
z. valid item calculation <-- degrade stats if item is too high level for Hero ... --- hero calculated stats See below for example by @elthran
Quote from @elthran
the problem is this: you need 2 strength to equip a sword. you put on ring of strength, equip the sword, then unequip ring of strength. what happens? so then we can have no hardcaps and instead softcaps. so your strength modifies how well you use it. and if it passes a threshold (the cap), then the modifer goes up very quickly so a 7 year old could use a giant sword but at like -90% speed
Degrade stats:
Assume a sword has a recommended brawn of 5, after after everything your brawn comes out to 3. The sword display should now be in red. And the baseline property of the item (for a sword would be damage and attack speed) shuld be reduced by a set percent per level below recommended. So lets say we set it at 20%. A character using this sword would swing it at -40% speed and do -40% damage. Something like that.
Example:
You have a Hero. His Specialization.archetype is Brute. (He was able to become a Brute because he reached 5 Brawn attribute points, but that might be irrelevant here)
He has learned the specialization.archetype.ability called "Berserker". He was allowed to do this because he has the specialization.archetype of Brute. This gives him +1 Brawn.
His Brawn is calculated as being a base of 5 and +1 for "Berserker". So he has Brawn of 6.
His items are checked to see if he has any other attribute bonuses. His ring of strength gives him +1 Brawn. So his Brawn is 7.
His proficiency caps are now determined (items and abilities can exceed the cap of profs. the prof cap is just for baseline values). His Brawn of 7 lets him have up to 4 points into damage. However, he currently only has 3 points into damage. His baseline damage value is calculated based on 3. His baseline damage modifier is always 1.
He has an ability "Dragon Slayer" which gives him +30% damage. His damage modifier is now 1.3 He also has a magic item called "Deadly Broadsword". It gives him +11 damage and +20% damage. His damage modifier is now 1.5 and his damage value is 13.
His damage is recalculated using the modifiers. 14 * 1.5 is 21. So his damage outputs based on a value of 21.
Quote from @elthran
This should be updated in the:
[ ] Proficiency Template code
[ ] the Proficiency code
[ ] the various test suites and other code.