use of com.janfic.games.computercombat.model.animations.DestroyCardAnimation in project computercombat by janfic.
the class DestroyCardAbility method doAbility.
@Override
public List<MoveResult> doAbility(MatchState state, Move move) {
List<MoveResult> results = new ArrayList<>();
List<MoveAnimation> animations = new ArrayList<>();
List<Card> removed = new ArrayList<>();
for (Card card : destroyed) {
for (Card c : state.activeEntities.get(card.getOwnerUID())) {
if (c.equals(card)) {
removed.add(c);
List<Card> destroy = new ArrayList<>();
destroy.add(c);
animations.add(new DestroyCardAnimation(c.getOwnerUID(), destroy));
}
}
}
for (Card card : removed) {
state.activeEntities.get(card.getOwnerUID()).remove(card);
}
MoveResult result = new MoveResult(move, MatchState.record(state), animations);
results.add(result);
return results;
}
Aggregations