()
| 193 | return undoStackOwner == player; |
| 194 | } |
| 195 | public final boolean undo() { |
| 196 | if (undoStack.isEmpty()) { return false; } |
| 197 | |
| 198 | SpellAbility sa = undoStack.peek(); |
| 199 | if (sa.undo()) { |
| 200 | clearUndoStack(sa); |
| 201 | new ManaRefundService(sa).refundManaPaid(); |
| 202 | } else { |
| 203 | clearUndoStack(sa); |
| 204 | for (Mana pay : sa.getPayingMana()) { |
| 205 | clearUndoStack(pay.getManaAbility().getSourceSA()); |
| 206 | } |
| 207 | } |
| 208 | return true; |
| 209 | } |
| 210 | public final void clearUndoStack(SpellAbility sa) { |
| 211 | if (sa == null) { |
| 212 | return; |
no test coverage detected