Fight in Gym - always fail
Description: When I start battle, status of start battle is always UNSET
Steps to reproduce:
Battle battle = gym.battle(attackers);
StartGymBattleResponseOuterClass.StartGymBattleResponse.Result result = battle.start();
if(result == StartGymBattleResponseOuterClass.StartGymBattleResponse.Result.SUCCESS){
...
}else{
new throw Exception(result);
}
Expected behavior: Status should be SUCCESS
Actual behavior: Status always is UNSET
Version: Last commit ee28406d5a0f87dc2b16429f7b19e31fbac30a95
Are you only getting this today? If so, all API's are broken right now is probably why you are getting this. Niantic changed the way requests need to be sent. Wait until there is a fix for that and see if this problem still exists then
Using any of the above code, I get FAILED:UNSET or ERROR_INVALID_ATTACK_ACTIONS
I haven't tried it since the api change but I'll take a look in a bit.
I just gave it a try and it appears to be working: D/RequestHandler: Authenticated with static token Level: 7 Adding 183 - DROWZEE - 41 Adding 162 - EEVEE - 40 Adding 152 - DROWZEE - 40 Adding 144 - CLEFAIRY - 42 Adding 137 - SHELLDER - 22 Adding 124 - JYNX - 31 @ 42.30063, -73.999677 - RED In range: true Enabled: true 905 - LAPRAS - skullforlife 1068 - VAPOREON - tazjojo 1314 - FLAREON - Sistaqueen 1618 - NIDOKING - JaredTots Gym join logic... 10208 Adding 183 - DROWZEE - 41 Chose: DROWZEE - 183 result: ERROR_NOT_IN_RANGE
Adding 183 - DROWZEE - 41 Attackers: 1 FAILED:ERROR_NOT_IN_RANGE
@ 42.299666, -74.002315 - BLUE In range: true Enabled: true 629 - VAPOREON - KINGBOBY1265 1113 - VAPOREON - Swift1234 1294 - DRAGONITE - ThomasLewis Attackers: 1 Battling... Battle result:DEFEATED
If you're getting UNSET it means you're passing a null value somewhere. I'd double check your pokemon list.
IT IS VERY IMPORTANT THAT YOU:
- don't send pokemon to fight gyms that are not full health
- don't send pokemon to fight gyms that are deployed to a gym
That's a good point. My find highest CP method only returns available full health, not fainted pokemon.
That's also why I run it again if gym join was successful.
Also make sure that if it's a friendly gym that you only have 1 attacker instead of 6.
Although my messsages appear to be alright, my pkmn in good shape and not in gym, i still get success=0 without even an error. does somebody have a hint?
Current code in Battle is wrong and does not work correctly. @ramarro123:
- The attack time is not always 500! You must use code like PokemonMoveMeta pmm = PokemonMoveMetaRegistry.getMeta(pokemon.getMove1()); int attackTime = pmm.getTime();
to get correct time for "simple" pokemon attack...
-
The sleep outside attack code... but main issue -> we need to wait until Battle is begin... between battle.start() and attack(5)... waiting time depends on your attack speed....
-
ok
-
right.
more critical: You need to send more information: BattleAction action = BattleAction .newBuilder() .setType(BattleActionTypeOuterClass.BattleActionType.ACTION_ATTACK) // may be ACTION_SPECIAL_ATTACK | ACTION_DODGE .setActionStartMs(myTime /_currentDelayPerAction 100_times */) .setDurationMs(attackTime) .setAttackerIndex(-1) .setTargetIndex(-1) .setActivePokemonId(pok.getId()) // TBD.setTargetPokemonId(value) <-- did not get it in the battle log... looks like only with BattleActionType.ACTION_FAINT // TBD optional .setEnergyDelta(value) .setDamageWindowsStartTimestampMss(myTime+attackTime-200) .setDamageWindowsEndTimestampMss(myTime+attackTime) .build();
also, ACTION_ATTACK is just simple one... we need at least 2 more: ACTION_SPECIAL_ATTACK + ACTION_FAINT
the SPECIAL_ATTACK is required ".setTargetPokemonId(value)"
With Best Regards
@vmarchaud: Would be nice to get more BATTLEs for current "0.33.0" version. Thanks,
@FireXBall does it work for you? I'm writing my own battle bot and am finding that I don't need to set "activePokemonId", or the "DamageWindow..." or "AttackerIndex" when attacking. The server replies with SUCCESS result without these... however, I seem to take damage while the defender takes no damage currently...
@Nostrademous I have the same result - the server "accepts" all my requests, but I essentially sit there and take attacks without executing any of my own.
Never mind, I got it working (though I really need to get better pokemon lol). The opponent finally takes damage.
@firebolt55439 are you sending any extra info besides "target_index", "duration_ms", "action_start_ms" and "type"?
If not, then I'm guessing it's a timing thing on my side.
@Nostrademous I don't send attacker_index, but I do send the damage window and the active pokemon information, and I make sure that I'm sending strictly past actions (e.g. no future timestamps relative to server_time_ms)
@firebolt55439 thank you, that fixed it for me too. Doing damage now.
How does Dodging work? I send dodge actions but I still seem to take damage... I figured a bot would be able to dodge perfectly by adding a dodge_action between the damage window of the defending pokemon for every one of their attacks, no?
Perhaps special attacks cannot be dodged?
@Nostrademous Still haven't figured out why I can't really dodge anything - I just stick to doing fast attacks and the occasional special attack.
I have an iPhone and can't disable the SSL cert pinning - by any chance, do any of you have access to a recent MITM log for a gym battle? I know there's one posted here earlier, but it's pre-unknown6 and not entirely accurate. It would be very much appreciated :)
@firebolt55439 nope, that's the only one I know of.
@Nostrademous I'm going to jailbreak it just for PoGo now haha (the things I do for love...)
@firebolt55439 Thanks for your help here, what you posted will fix most peoples problems, i now have Attack Gyms working in C# ( I only recently seen this page. ).
Legend :+1:
@FaezeOner No problem - happy to help :).
On Thu, Aug 25, 2016 at 4:50 AM, FaezeOner [email protected] wrote:
@firebolt55439 https://github.com/firebolt55439 Thanks for your help here, what you posted will fix most peoples problems, i now have Attack Gyms working in C# ( I only recently seen this page. ).
Legend 👍
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Grover-c13/PokeGOAPI-Java/issues/252#issuecomment-242359313, or mute the thread https://github.com/notifications/unsubscribe-auth/ABO7p6OF9uxkjRmSpn2WEeNd8PayNukWks5qjYGigaJpZM4JVSIN .
-Sumer
@FaezeOner Hi, can you share the C# code for Attack Gyms? I like to play with it. Thanks a lot!