@@ -71,7 +71,7 @@ public static void main(String[] args) {
7171 api .login (new PtcCredentialProvider (http , ExampleConstants .LOGIN , ExampleConstants .PASSWORD ), hasher );
7272 api .setLocation (ExampleConstants .LATITUDE , ExampleConstants .LONGITUDE , ExampleConstants .ALTITUDE );
7373
74- List <Pokemon > pokemons = api .getInventories (). getPokebank (). getPokemons () ;
74+ List <Pokemon > pokemons = api .inventories . pokebank . pokemons ;
7575
7676 //List to put all pokemon that can be used in a gym battle
7777 List <Pokemon > possiblePokemon = new ArrayList <>();
@@ -109,13 +109,13 @@ public int compare(Pokemon primary, Pokemon secondary) {
109109 }
110110
111111 //Sort from closest to farthest
112- MapObjects mapObjects = api .getMap ().getMapObjects () ;
113- List <Gym > gyms = new ArrayList <>(mapObjects .getGyms () );
112+ MapObjects mapObjects = api .getMap ().mapObjects ;
113+ List <Gym > gyms = new ArrayList <>(mapObjects .gyms );
114114 Collections .sort (gyms , new Comparator <Gym >() {
115115 @ Override
116116 public int compare (Gym primary , Gym secondary ) {
117- double lat = api .getLatitude () ;
118- double lng = api .getLongitude () ;
117+ double lat = api .latitude ;
118+ double lng = api .longitude ;
119119 double distance1 = MapUtil .distFrom (primary .getLatitude (), primary .getLongitude (), lat , lng );
120120 double distance2 = MapUtil .distFrom (secondary .getLatitude (), secondary .getLongitude (), lat , lng );
121121 return Double .compare (distance1 , distance2 );
@@ -124,14 +124,14 @@ public int compare(Gym primary, Gym secondary) {
124124
125125 for (Gym gym : gyms ) {
126126 //Check if gym is attackable, and check if it is not owned by your team
127- if (gym .isAttackable () && gym .getOwnedByTeam () != api .getPlayerProfile () .getPlayerData ().getTeam ()) {
127+ if (gym .isAttackable () && gym .getOwnedByTeam () != api .playerProfile .getPlayerData ().getTeam ()) {
128128 //Walk to gym; Documented pathing in TravelToPokestopExample
129129 Point destination = new Point (gym .getLatitude (), gym .getLongitude ());
130130 Path path = new Path (api .getPoint (), destination , 50.0 );
131131 System .out .println ("Traveling to " + destination + " at 50KMPH!" );
132132 path .start (api );
133133 try {
134- while (!path .isComplete () ) {
134+ while (!path .complete ) {
135135 Point point = path .calculateIntermediate (api );
136136 api .setLatitude (point .getLatitude ());
137137 api .setLongitude (point .getLongitude ());
@@ -149,7 +149,7 @@ public int compare(Gym primary, Gym secondary) {
149149
150150 //Start battle
151151 battle .start (new FightHandler (attackers ));
152- while (battle .isActive () ) {
152+ while (battle .active ) {
153153 handleAttack (api , battle );
154154 }
155155
@@ -162,10 +162,10 @@ public int compare(Gym primary, Gym secondary) {
162162 }
163163
164164 //If prestige reaches 0, deploy your pokemon
165- if (battle .getGym () .getPoints () <= 0 ) {
165+ if (battle .gym .getPoints () <= 0 ) {
166166 Pokemon best = possiblePokemon .get (0 );
167167 System .out .println ("Deploying " + best .getPokemonId () + " to gym." );
168- battle .getGym () .deployPokemon (best );
168+ battle .gym .deployPokemon (best );
169169 }
170170 }
171171 }
@@ -177,10 +177,10 @@ public int compare(Gym primary, Gym secondary) {
177177
178178 private static void handleAttack (PokemonGo api , Battle battle ) throws InterruptedException {
179179 int duration ;
180- PokemonMove specialMove = battle .getActiveAttacker (). getPokemon () .getMove2 ();
181- MoveSettings moveSettings = api .getItemTemplates () .getMoveSettings (specialMove );
180+ PokemonMove specialMove = battle .activeAttacker . pokemon .getMove2 ();
181+ MoveSettings moveSettings = api .itemTemplates .getMoveSettings (specialMove );
182182 //Check if we have sufficient energy to perform a special attack
183- int energy = battle .getActiveAttacker (). getEnergy () ;
183+ int energy = battle .activeAttacker . energy ;
184184 int desiredEnergy = -moveSettings .getEnergyDelta ();
185185 if (energy <= desiredEnergy ) {
186186 duration = battle .attack ();
@@ -225,7 +225,7 @@ public Pokemon[] createTeam(PokemonGo api, Battle battle) {
225225 public void onStart (PokemonGo api , Battle battle , Result result ) {
226226 System .out .println ("Battle started with result: " + result );
227227 try {
228- System .out .println ("Defender count: " + battle .getGym () .getDefendingPokemon ().size ());
228+ System .out .println ("Defender count: " + battle .gym .getDefendingPokemon ().size ());
229229 } catch (Exception e ) {
230230 e .printStackTrace ();
231231 }
@@ -250,11 +250,11 @@ public void onTimedOut(PokemonGo api, Battle battle) {
250250 @ Override
251251 public void onActionStart (PokemonGo api , Battle battle , Battle .ServerAction action ) {
252252 //Dodge all special attacks
253- if (action .getType () == BattleActionType .ACTION_SPECIAL_ATTACK ) {
253+ if (action .type == BattleActionType .ACTION_SPECIAL_ATTACK ) {
254254 System .out .println ("Dodging special attack!" );
255255 battle .dodge ();
256256 }
257- System .out .println (toIndexName (action ) + " performed " + action .getType () );
257+ System .out .println (toIndexName (action ) + " performed " + action .type );
258258 }
259259
260260 @ Override
@@ -283,17 +283,17 @@ public void onPlayerLeave(PokemonGo api, Battle battle, BattleParticipant left,
283283 public void onAttacked (PokemonGo api , Battle battle , Battle .BattlePokemon attacked ,
284284 Battle .BattlePokemon attacker , int duration ,
285285 long damageWindowStart , long damageWindowEnd , Battle .ServerAction action ) {
286- PokemonId attackedPokemon = attacked .getPokemon () .getPokemonId ();
287- PokemonId attackerPokemon = attacker .getPokemon () .getPokemonId ();
286+ PokemonId attackedPokemon = attacked .pokemon .getPokemonId ();
287+ PokemonId attackerPokemon = attacker .pokemon .getPokemonId ();
288288 System .out .println (attackedPokemon + " attacked by " + attackerPokemon + " (" + toIndexName (action ) + ")" );
289289 }
290290
291291 @ Override
292292 public void onAttackedSpecial (PokemonGo api , Battle battle , Battle .BattlePokemon attacked ,
293293 Battle .BattlePokemon attacker , int duration ,
294294 long damageWindowStart , long damageWindowEnd , Battle .ServerAction action ) {
295- PokemonId attackedPokemon = attacked .getPokemon () .getPokemonId ();
296- PokemonId attackerPokemon = attacker .getPokemon () .getPokemonId ();
295+ PokemonId attackedPokemon = attacked .pokemon .getPokemonId ();
296+ PokemonId attackerPokemon = attacker .pokemon .getPokemonId ();
297297 System .out .println (attackedPokemon
298298 + " attacked with special attack by " + attackerPokemon + " (" + toIndexName (action ) + ")" );
299299 }
@@ -321,12 +321,12 @@ public void onDefenderHealthUpdate(PokemonGo api, Battle battle, int lastHealth,
321321
322322 @ Override
323323 public void onAttackerSwap (PokemonGo api , Battle battle , Battle .BattlePokemon newAttacker ) {
324- System .out .println ("Attacker change: " + newAttacker .getPokemon () .getPokemonId ());
324+ System .out .println ("Attacker change: " + newAttacker .pokemon .getPokemonId ());
325325 }
326326
327327 @ Override
328328 public void onDefenderSwap (PokemonGo api , Battle battle , Battle .BattlePokemon newDefender ) {
329- System .out .println ("Defender change: " + newDefender .getPokemon () .getPokemonId ());
329+ System .out .println ("Defender change: " + newDefender .pokemon .getPokemonId ());
330330 }
331331
332332 @ Override
@@ -349,7 +349,7 @@ public void onDodge(PokemonGo api, Battle battle, Battle.BattlePokemon pokemon,
349349 */
350350 private String toIndexName (Battle .ServerAction action ) {
351351 String name = "Attacker" ;
352- if (action .getAttackerIndex () == -1 ) {
352+ if (action .attackerIndex == -1 ) {
353353 name = "Defender" ;
354354 }
355355 return name ;
0 commit comments