MV [YEP_ItemCore/ItemDurability/UpgradeSlots]Lose random upgrade on durability threshold?

I wanted to have the upgrades be lost as the item loses durability, so that repairing involves putting new and potentially more situational upgrades on an item. Can this be done?
It can be done, but would require a LOT of custom code.
It can be done, but would require a LOT of custom code.
Why so much?
Can it not just target random?
It would help if you stated more specifically, mechanically, what you wanted to happen.

Maliki might be more familiar with the plugins than I am, but it doesn't seem conceptually like it would be that hard to me. But actually giving you any code requires your precise specifications for it.
The item upgrades do not have "downgrade" code built in. You would have to build that array into items, then have a trigger function call at durability thresholds to pick which upgrade to remove. Yes, random removal is possible, but if a plugin maker was to do it, they would do best to allow the dev a way to choose downgrade order. And of course, all of it has to be reversible if/when durability is restored. I know you said you didn't want that, but again, the general use would come first. Not impossible, but far from easy.
It would help if you stated more specifically, mechanically, what you wanted to happen.

Maliki might be more familiar with the plugins than I am, but it doesn't seem conceptually like it would be that hard to me. But actually giving you any code requires your precise specifications for it.
Say an item is degraded to the 80% theshold. In that case, it would remove a random upgrade from the item.
If it's easier, removing the most recent upgrade from the item would also work.
The item upgrades do not have "downgrade" code built in. You would have to build that array into items, then have a trigger function call at durability thresholds to pick which upgrade to remove. Yes, random removal is possible, but if a plugin maker was to do it, they would do best to allow the dev a way to choose downgrade order. And of course, all of it has to be reversible if/when durability is restored. I know you said you didn't want that, but again, the general use would come first. Not impossible, but far from easy.
Would it be any easier to remove the most recent upgrade instead of a random one?
The item upgrades do not have "downgrade" code built in. You would have to build that array into items, then have a trigger function call at durability thresholds to pick which upgrade to remove. Yes, random removal is possible, but if a plugin maker was to do it, they would do best to allow the dev a way to choose downgrade order. And of course, all of it has to be reversible if/when durability is restored. I know you said you didn't want that, but again, the general use would come first. Not impossible, but far from easy.
Would it be any easier to remove the most recent upgrade instead of a random one?
Double-post notice: @KaitlynKitty
Neither is particularly more difficult to do. There's just a lot that happens under the hood, and a lot of potential options that I'm sure devs would like to have included. Like instead of losing the upgrades, perhaps someone would rather temporarily turn it off til the equipment is repaired.
@Maliki79 is absolutely right - the plugin doesn't actually track the specific item that was used to upgrade your item, and it doesn't track which upgrade effects came from which item.

It stores the upgrade item's name, but of course that's not awesome since your database can have duplicate item names.

So without modifying the plugin more extensively, you can't just strip one upgrade out. It shouldn't be too hard to say "at X% durability it loses all upgrades," as there is a reset function.

Original thread: https://forums.rpgmakerweb.com/threads/yep_itemcore-itemdurability-upgradeslots-lose-random-upgrade-on-durability-threshold.163926/