bubbletwist/lib/game/stone/quad_special_stone.dart

41 lines
972 B
Dart
Raw Permalink Normal View History

2024-06-19 23:40:31 +02:00
import 'package:bubbletwist/game/stone/stone_location.dart';
import 'package:bubbletwist/game/stone/triggerable_special_stone.dart';
import '../board.dart';
class QuadSpecialStone extends TriggerableSpecialStone {
bool vertical;
QuadSpecialStone(super.board, this.vertical);
@override
int getSpecialStoneNumber() {
return 4;
}
@override
void performSpecialStoneAction() {
StoneLocation sl = StoneLocation(row: 0, column: 0);
if (vertical) {
for (int i = 0; i < Board.boardSize; ++i) {
if (i == row) {
continue; // Skip Stone itself to prevent self deleting
}
sl.row = i;
sl.column = column;
board.removeStone(sl);
}
} else {
for (int i = 0; i < Board.boardSize; ++i) {
if (i == column) {
continue; // Skip Stone itself to prevent self deleting
}
sl.row = row;
sl.column = i;
board.removeStone(sl);
}
}
}
}