package controls; import interfaces.IAttack; import models.Algo; import views.Constants; import java.util.List; import java.util.Map; public class StepScheduler implements IAttack { Algo algo; Constants.Step step; int turnCount=0; boolean isATurn; public StepScheduler(){ algo = new Algo(); isATurn=true; } public Constants.Step getStep(){ return step; } @Override public void Attack(int guess, int attacker, int target) { if(isATurn){ if(isDeckLess()){ algo.inputSelectA(guess, attacker, target); }else{ algo.inputDrawA(guess, target); } }else { if(isDeckLess()){ algo.inputSelectB(guess, attacker, target); }else{ algo.inputDrawB(guess, target); } } turnCount++; } @Override public List<Map.Entry<Integer, Boolean>> getMyHands() { return isATurn?algo.getHandsA():algo.getHandsB(); } @Override public List<Map.Entry<Integer, Boolean>> getOpponentHands() { return isATurn?algo.getHandsB():algo.getHandsA(); } @Override public Map.Entry<Integer, Boolean> getTopCard() { return null; } public boolean isDeckLess(){ return algo.getDeck().size()==0; } public boolean isSucceedLatestAttack(){ if(isATurn){ if(isDeckLess()){ return algo.getSucceedSelectA().getKey(); }else{ return algo.getSucceedDrawA().getKey(); } }else { if(isDeckLess()){ return algo.getSucceedSelectB().getKey(); }else{ return algo.getSucceedDrawB().getKey(); } } } public boolean getIsATurn(){ return isATurn; } }