Hi! I'm working on a dungeon crawler in the style of the Dark Cloud 1 & 2 games and I wanted to try to make a weapon upgrade system similar to those games (more like the second also known as Dark Chronicle). In that system the weapons gain xp points when used to kill enemies and they level up, gaining points that you can use in exchange of materials to upgrade their stats. When the requirements are met you can evolve a weapon and transform it into a new weapon with a bonus in stats and a new look, restarting at level 0 with the weapon but keeping the stats added by upgrading.
It is best shown in this video
Any ideas how could I make a weapon gain levels this way?