Chosen Solution

so in my country we have alot of power cuts so anytime im playing a game plugged in and the electricity cuts the laptop shuts off instead of switching to the integrated graphics card

If you have all these power issues it is probably detecting a surge and the overvoltage protection is kicking in. Buy a UPS(uninterrupted power supply) and plug this into the wall and teh laptop into the UPS. this will prevent the power surge or loss from happening and you shouldn’t have issues anymore.