-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Battle View #129
Battle View #129
Conversation
Merge from Master
Merge from master
@@ -165,7 +163,7 @@ private bool RepeatAttack() | |||
{ | |||
if (ActivePokemon.CurrentHealth > 0 && _client.ActiveBattle.RepeatAttack) | |||
{ | |||
_client.UseAttack(_lastAttackId); | |||
_client.UseAttack(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure the game client sends 1 to repeat the attack?
I thought it was the previous attack ID.
We can remove _lastAttackId
if this is always 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I looked at PRO's code and it just sends 1.
@@ -176,6 +176,11 @@ public void Update() | |||
return; | |||
} | |||
|
|||
if (Game != null && Game.IsInBattle && Game.IsInactive && AI != null && AI.UseMandatoryAction()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, but this probably belongs to PROProtocol if the player cannot influence it.
PROProtocol should basically be enough to implement a full game client (without any cheat).
PROBot is just calling some PROProtocol methods to simulate the player movements, as if we were clicking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know where else I can put this while still by-passing the 'bot started' check.
@@ -34,5 +34,29 @@ public PokemonExperience(int currentLevel, int baseExperience, int totalLevelExp | |||
} | |||
TotalLevelExperience = totalLevelExperience; | |||
} | |||
|
|||
// A value between 0 and 54 that represents how much exp the Pokemon has gained since its last level. | |||
public int RatioToNextLevel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why between 0 and 54? This seems like an arbitrary choice.
A float between 0 and 1 or between 0 and 100 it probably more generic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just copy-pasted the way PRO does it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you or anyone else can figure out how to get the "experience gained since last level" I would gladly change this
PROShine/Views/BattleView.xaml.cs
Outdated
using System.Collections.Generic; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using FontAwesome.WPF; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The using
s are not sorted alphabetically!!1 😢
(This is just nitpicking, I know.)
PROShine/Views/BattleView.xaml.cs
Outdated
evs.Add($"{type}: {ev}"); | ||
} | ||
|
||
OpponentEVs.ToolTip = string.Join("
", evs); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this working by any chance? It's a bit weird to have an hexadecimal constant in the code.
string.Join(Environment.NewLine, evs);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure enough, thanks
PROShine/Views/BattleView.xaml.cs
Outdated
break; | ||
} | ||
} | ||
if (hasPP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool hasPP = active.Moves.Any(move => !string.IsNullOrEmpty(move?.Name) && move.CurrentPoints > 0);
This should work too if you want to LINQ-ify the loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I forget about that sometimes.
{ | ||
FloatingTip.IsOpen = true; | ||
_selectedRectangle.Visibility = Visibility.Visible; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this was already merged in a previous pull request.
Make sure you merge or rebase my changes before opening a pull request to prevent duplicates like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sorry,
I think there is one problem left. When a player gets disconnected from the server while battling, I think then the battle viewer should get reset. It should get reset like when it gets reset after a battle. I think that is the one thing missed. It can be crashed that time if the battle view doesn't get reset. |
if (move.CurrentPoints > 0) | ||
{ | ||
menuItem.Click += Attack_Click; | ||
hasPP = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the hasPP behavior so that it'll still show the other moves even if none of them have PP. (They'll still all be disabled of course)
No description provided.