Amazon will discount your book if it thinks you will sell more books at that new price. Or sometimes it's because Amazon has a few copies of your book in stock which aren't selling, and it wants to free up space in its warehouse.
Whatever the reason, your royalty is unaffected. You are paid the same royalty, no matter what a customer pays. You earn a royalty based on the price bookstores pay to order, not what they might sell them for.
Discounting has its advantages. Sometimes Amazon will lower the price below what we can offer you for your author copies. If you buy them from Amazon you'll benefit twice — a normal royalty, and cheap book copies.