bubbletwist/lib/game/stone/penta_special_stone.dart

30 lines
683 B
Dart
Raw Permalink Normal View History

2024-06-17 16:24:51 +02:00
import '../board.dart';
import 'special_stone.dart';
import 'stone_location.dart';
class PentaSpecialStone extends SpecialStone {
2024-06-17 16:24:51 +02:00
PentaSpecialStone(super.board);
2024-06-17 16:24:51 +02:00
@override
int getSpecialStoneNumber() {
return 5;
}
2024-06-17 16:24:51 +02:00
@override
void performSpecialStoneAction() {
StoneLocation sl = StoneLocation(row: -1, column: -1);
for (int i = 0; i < Board.boardSize; ++i) {
for (int j = 0; j < Board.boardSize; ++j) {
sl.row = i;
sl.column = j;
if (this == board.getStone(sl)) {
continue;
}
2024-06-17 16:24:51 +02:00
if (board.getStone(sl)?.getStoneColor() == getStoneColor()) {
board.removeStone(sl);
}
}
}
}
}