use of com.janfic.games.computercombat.model.Card in project computercombat by janfic.
the class ChargeAbilitiesHeuristicAnalyzer method getMaxCharges.
public int getMaxCharges(MoveResult result) {
int totalCharge = 0;
String currentUID = result.getMove().getPlayerUID();
String opponentUID = result.getState().getOtherProfile(currentUID);
for (Card card : result.getState().activeEntities.get(opponentUID)) {
totalCharge += card.getRunRequirements();
}
totalCharge += result.getState().computers.get(opponentUID).getRunProgress();
return totalCharge;
}
use of com.janfic.games.computercombat.model.Card in project computercombat by janfic.
the class ChargedAbilitiesHeuristicAnalyzer method analyze.
@Override
public float analyze(List<MoveResult> results) {
MatchState oldState = results.get(0).getState();
Map<String, List<Card>> activeEntities = oldState.activeEntities;
String playerUid = results.get(0).getMove().getPlayerUID();
List<Card> activeCards = activeEntities.get(playerUid);
Integer oldRunProgress = 0;
Integer totalRunRequirements = 0;
for (Card activeCard : activeCards) {
oldRunProgress += activeCard.getRunProgress();
totalRunRequirements += activeCard.getRunRequirements();
}
MatchState endState = results.get(results.size() - 1).getState();
Map<String, List<Card>> newActiveEntities = endState.activeEntities;
List<Card> newActiveCards = newActiveEntities.get(playerUid);
Integer newRunProgress = 0;
for (Card newActiveCard : newActiveCards) {
newRunProgress += newActiveCard.getRunProgress();
}
return Math.max(0, (newRunProgress - oldRunProgress) / Math.max(totalRunRequirements, 1));
}
Aggregations