From 822b3af66fdb4246af7e07756fb0f8eb9c9672d5 Mon Sep 17 00:00:00 2001 From: Doan Van Khanh Date: Sat, 30 Jun 2018 19:32:49 +0700 Subject: [PATCH] getting planets' difficuties also checks for skipped zones --- .../gmail/vkhanh234/SaliensAuto/ZoneController.java | 11 +++++++++++ .../vkhanh234/SaliensAuto/data/Planet/Planet.java | 10 ---------- .../vkhanh234/SaliensAuto/searchmode/MostXpMode.java | 3 ++- .../gmail/vkhanh234/SaliensAuto/utils/TextUtils.java | 3 ++- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/gmail/vkhanh234/SaliensAuto/ZoneController.java b/src/main/java/com/gmail/vkhanh234/SaliensAuto/ZoneController.java index 334d64b..a44b272 100644 --- a/src/main/java/com/gmail/vkhanh234/SaliensAuto/ZoneController.java +++ b/src/main/java/com/gmail/vkhanh234/SaliensAuto/ZoneController.java @@ -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; diff --git a/src/main/java/com/gmail/vkhanh234/SaliensAuto/data/Planet/Planet.java b/src/main/java/com/gmail/vkhanh234/SaliensAuto/data/Planet/Planet.java index 495900f..272f7af 100644 --- a/src/main/java/com/gmail/vkhanh234/SaliensAuto/data/Planet/Planet.java +++ b/src/main/java/com/gmail/vkhanh234/SaliensAuto/data/Planet/Planet.java @@ -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; diff --git a/src/main/java/com/gmail/vkhanh234/SaliensAuto/searchmode/MostXpMode.java b/src/main/java/com/gmail/vkhanh234/SaliensAuto/searchmode/MostXpMode.java index 961f0a8..1d63976 100644 --- a/src/main/java/com/gmail/vkhanh234/SaliensAuto/searchmode/MostXpMode.java +++ b/src/main/java/com/gmail/vkhanh234/SaliensAuto/searchmode/MostXpMode.java @@ -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; @@ -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--){ diff --git a/src/main/java/com/gmail/vkhanh234/SaliensAuto/utils/TextUtils.java b/src/main/java/com/gmail/vkhanh234/SaliensAuto/utils/TextUtils.java index d323791..9bd9772 100644 --- a/src/main/java/com/gmail/vkhanh234/SaliensAuto/utils/TextUtils.java +++ b/src/main/java/com/gmail/vkhanh234/SaliensAuto/utils/TextUtils.java @@ -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; @@ -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)+", ";