elthran / RPG-Game

0 stars 1 forks source link

Simplify Proficiency code. #278

Open klondikemarlen opened 6 years ago

klondikemarlen commented 6 years ago

Quote from @elthran

maybe just give everything value modifier percent

and the special ones get current maximum and then if we dont use them all its fine, but they are there so something could add +1 to your attack speed amount. or it could modify it by adding +10%

values always being added before modifiers

speed = 0 modifier = 1 for item/ability: speed += speed.value for item/ability: modifier += speed.modifier speed *= modifier and just do the same thing for every proficiency then you could have like a giant axe that adds damage.value = 20 and speed.modifier = -0.1 so it adds 20 to your attack damage but you attack 10% slower I just want it to be simple so for any item, you just do proficience_value/modifier = whatever

and then all proficiency just check and modify themselves by anything which matches their name

This should be updated in the:

klondikemarlen commented 6 years ago

Similar issue #234.

klondikemarlen commented 6 years ago

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

klondikemarlen commented 6 years ago

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

klondikemarlen commented 6 years ago

Described better in https://github.com/elthran/RPG-Game/commit/467e24138ff51acf04160f45aa8b4701fef3e560#diff-849801a765e275fb115b959802c95cfe by @elthran I did some colour coding.

klondikemarlen commented 6 years ago

My current understanding goes like:

So we end up with a calculation order of:

  1. hero.specializations
  2. hero.abilities <-- limited by hero.specializations
  3. hero.attributes <-- limited by hero.abilities? --- hero base stats Hero calculated stats: a. hero.calculated_attributes = hero.base_attributes + item.attributes + ability.attributes b. hero.base_proficiencies <-- limited by hero.calculated_attributes, if they exceed the max, cap them. c. hero.calculated_proficiencies = hero.base_proficiencies + item.proficiencies + ability.proficiencies

z. valid item calculation <-- degrade stats if item is too high level for Hero ... --- hero calculated stats See below for example by @elthran

klondikemarlen commented 6 years ago

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

elthran commented 6 years ago

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.

elthran commented 6 years ago

Example:

  1. 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)

  2. 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.

  3. His Brawn is calculated as being a base of 5 and +1 for "Berserker". So he has Brawn of 6.

  4. 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.

  5. 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.

  6. 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.

  7. His damage is recalculated using the modifiers. 14 * 1.5 is 21. So his damage outputs based on a value of 21.