Patent the code and sue Nintendo when they release the game.
You can’t patent code, and it’s automatically copyright protected. Nintendo just needs to prove they wrote the code originally, which should be easy.
You can patent the features that the code makes up.
Also, Nintendo has patented features existing in other games long before, and it hasn’t stopped them. The current lawsuit against palworld contains patent claims for features they do not actually own, which is why they need 100 different lawsuits coming their way so they get a taste of their own medicine.
They have an easy time suing one or two entities, but 100 different ones will have a significant economic impact.