As per the latest revelations, the defeat of Dewa Nika and Joy Boy at the hands of Im Sama 900 years ago, as per the One Piece universe calendar, was due to a war that took place at night. The source of Joy Boy’s power was Dewa Nika, and Im Sama’s power was sourced from the moon, making them stronger during the night. A total of 20 ancient kings betrayed Joy Boy, and along with Im Sama, they were too dominant for Joy Boy. The war could have had different results if Joy Boy had not taken part in it at night.
In the One Piece world, Im Sama was the brother of Joy Boy, the heir to Saint Florix, the ruler of the ancient kingdom before the present one. Before Florix ascended the throne, he gave Joy Boy the power of Sun God Nika (Dewa Nika), while Im Sama received the power of Moon God Xark (Dewa Xark). At first, Im Sama was not concerned, but when Joy Boy was chosen as the heir to the throne, he became jealous and revolted, resulting in a civil war.
During the war, 7 out of the 27 small kingdoms that were part of the ancient kingdom remained loyal to Joy Boy. Bonaris, the king of the Rakshasa race, was one of the seven loyalists. However, the remaining 20 sided with Im Sama and helped him win the war, in which Joy Boy fought despite the decline in his power, which was sourced from Dewa Nika, during the night.
The Gorosei, the highest leaders of the World Government, are the six remaining ancient kings who betrayed Joy Boy. According to Eiichiro Oda, the creator of One Piece, the names of the 27 ancient kings were taken from the order of the Milky Way galaxy and mostly named after planets. However, to date, there are only five Gorosei known, indicating that one of them may have died. Saint Vegayorix Earth, also known as Gorosei Earth, was one of the six but died during the God Valley incident while attempting to destroy the Rocks Pirates, led by Rocks D. Xebec.
One of the loyalists to Joy Boy and ruler of the Rakshasa race, Bonaris, appeared alongside Akagami no Shanks, Dorry, and Brogy, who are descendants of the Rakshasa race, in the One Piece Arc Elbaf, where the secrets of the race may be uncovered.
Lastly, another character with the power of Dewa Nika has been introduced, and they are believed to be related to Im Sama. However, it is worth noting that some parts of this article are purely theories and entertainment and do not intend to add, subtract, or change the storylines in One Piece authored by Eiichiro Oda.
In conclusion, the One Piece world has always been full of mysteries, secrets, and legends, and each revelation creates more questions that will only be answered as the story progresses.