I am making a card game, it is similar to Bang. You have a boss, which has some HP and you are getting cards with abilities, HP,DMG, etc. I want to make it as a .io game or maybe just a web application, it doesn't matter now. So the language I am building it in is Javascript + Node. But I ran into a problem with structure of game logic - abilities. The abilities of the cards are really hard to describe as a structure, sometimes they consist of "if enemy attacks you and his boss is fire type he does 50% less damage" or "every round you get 2 coins of this type" or "if he dies, after 5 rounds you can make him alive again, but this works only once". It is similar to hearstone/bang cards, but these have their own unique abilities and that's really amazing, when you play it with friends as cards, but I have no idea, how do i implement this as a program.
So as a game logic, I would like to make classes like Game - game controller + game info, Player - player controller + player info, but I don't really like my first and only idea of making the card abilities. It's basically saving the abilities as functions(in database as strings!), which are then run by the Game class somehow(using eval?/making them real functions and saving them to some array and then running them every time something happens?). It has to be really really dynamic and flexible, because new cards are being produced and so new abilities are. What are your thoughts of structure in this type of game? What is the cleanest way to make game logic of this game? How would you implement this?