Skip to content
This repository has been archived by the owner on Jul 5, 2018. It is now read-only.

Commit

Permalink
getting planets' difficuties also checks for skipped zones
Browse files Browse the repository at this point in the history
  • Loading branch information
kandoan committed Jun 30, 2018
1 parent 819a2fd commit 822b3af
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
11 changes: 11 additions & 0 deletions src/main/java/com/gmail/vkhanh234/SaliensAuto/ZoneController.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ private static Zone findBestZone(Planet planet, double maxProgress) {
return res;
}

public static int[] getDifficulties(Planet planet) {
int[] result = new int[5];
for(Zone zone:planet.zones){
if(zone.captured || zone.capture_progress>=Main.MAX_CAPTURE_RATE) continue;
if(!zone.boss_active && zone.capture_progress<0.4 && skipZones.contains(zone.zone_position)) continue;
if(zone.boss_active) result[4]++;
else result[zone.difficulty]++;
}
return result;
}

public static int getZoneScore() {
int score=getPointPerSec(currentZone.difficulty);
return score*120;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ public class Planet{
// return res;
// }

public int[] getDifficulties() {
int[] result = new int[5];
for(Zone zone:zones){
if(zone.captured || zone.capture_progress>=Main.MAX_CAPTURE_RATE) continue;
if(zone.boss_active) result[4]++;
else result[zone.difficulty]++;
}
return result;
}

public int getDiffValue(int diff){
switch (diff){
case 1: return 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gmail.vkhanh234.SaliensAuto.searchmode;

import com.gmail.vkhanh234.SaliensAuto.Main;
import com.gmail.vkhanh234.SaliensAuto.ZoneController;
import com.gmail.vkhanh234.SaliensAuto.data.Planet.Planet;
import com.gmail.vkhanh234.SaliensAuto.data.Planet.Planets;
import com.gmail.vkhanh234.SaliensAuto.utils.TextUtils;
Expand All @@ -13,7 +14,7 @@ protected String search(Planets planets){
String result=null;
for(Planet planet:planets.planets){
Planet planetData = Main.getPlanetData(planet.id);
int[] difficuties = planetData.getDifficulties();
int[] difficuties = ZoneController.getDifficulties(planetData);
Main.debug("> Planet "+TextUtils.getPlanetsDetailsText(planetData));
Main.debug("\tZones: "+TextUtils.getZonesText(planetData));
for(int i=4;i>=1;i--){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gmail.vkhanh234.SaliensAuto.utils;

import com.gmail.vkhanh234.SaliensAuto.Main;
import com.gmail.vkhanh234.SaliensAuto.ZoneController;
import com.gmail.vkhanh234.SaliensAuto.data.Planet.Planet;
import com.gmail.vkhanh234.SaliensAuto.data.Planet.TopClan;
import com.gmail.vkhanh234.SaliensAuto.data.Planet.Zone;
Expand All @@ -14,7 +15,7 @@ public static String getZonesText(Planet p) {
Planet planetData;
if(p.zones==null || p.zones.size()==0) planetData = Main.getPlanetData(p.id);
else planetData=p;
int[] difficuties = planetData.getDifficulties();
int[] difficuties = ZoneController.getDifficulties(planetData);
String s = "";
for(int i=1;i<=4;i++){
s+=Main.addDiffColor(difficuties[i]+" "+Main.getDiffText(i),i)+", ";
Expand Down

0 comments on commit 822b3af

Please sign in to comment.