Package com.jcloisterzone.game.phase

Source Code of com.jcloisterzone.game.phase.PlaguePhase

package com.jcloisterzone.game.phase;

import java.util.List;

import com.jcloisterzone.board.Position;
import com.jcloisterzone.board.TileTrigger;
import com.jcloisterzone.game.Game;
import com.jcloisterzone.game.capability.PlagueCapability;
import com.jcloisterzone.game.capability.PlagueCapability.PlagueSource;

public class PlaguePhase extends Phase {

    private final PlagueCapability plagueCap;

    public PlaguePhase(Game game) {
        super(game);
        plagueCap = game.getCapability(PlagueCapability.class);
    }

    @Override
    public boolean isActive() {
        return game.hasCapability(PlagueCapability.class);
    }

    @Override
    public void enter() {
        if (getTile().hasTrigger(TileTrigger.PLAGUE)) {
            PlagueSource source = new PlagueSource(getTile().getPosition());
            plagueCap.getPlagueSources().add(source);
        } else {
            List<Position> sources = plagueCap.getActiveSources();
            if (!sources.isEmpty()) {
                //TODO spread flea
            }
        }
        next();
    }

}
TOP

Related Classes of com.jcloisterzone.game.phase.PlaguePhase

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.