Search in sources :

Example 1 with ChangeStatAnim

use of com.janfic.games.computercombat.model.animations.ChangeStatAnim in project computercombat by janfic.

the class ChangeDefenseAbility method doAbility.

@Override
public List<MoveResult> doAbility(MatchState state, Move move) {
    List<MoveResult> results = new ArrayList<>();
    String currentUID = move.getPlayerUID();
    String opponentUID = state.getOtherProfile(state.currentPlayerMove);
    List<MoveAnimation> animation = new ArrayList<>();
    MoveAnimation consume = Ability.consumeCardProgress(state, move);
    animation.add(consume);
    for (Card card : state.getAllCards()) {
        if (cardFilter.filter(card, state, move)) {
            int amount = this.amount.analyze(state, move);
            card.changeArmor(amount);
            animation.add(new ChangeStatAnim("armor", amount, card, card.getOwnerUID()));
        }
    }
    state.currentPlayerMove = state.getOtherProfile(state.currentPlayerMove);
    MoveResult result = new MoveResult(move, MatchState.record(state), animation);
    results.add(result);
    return results;
}
Also used : MoveAnimation(com.janfic.games.computercombat.model.moves.MoveAnimation) ChangeStatAnim(com.janfic.games.computercombat.model.animations.ChangeStatAnim) ArrayList(java.util.ArrayList) MoveResult(com.janfic.games.computercombat.model.moves.MoveResult) Card(com.janfic.games.computercombat.model.Card)

Aggregations

Card (com.janfic.games.computercombat.model.Card)1 ChangeStatAnim (com.janfic.games.computercombat.model.animations.ChangeStatAnim)1 MoveAnimation (com.janfic.games.computercombat.model.moves.MoveAnimation)1 MoveResult (com.janfic.games.computercombat.model.moves.MoveResult)1 ArrayList (java.util.ArrayList)1