architdate / PKHeX-Plugins

Plugins for PKHeX
MIT License
593 stars 133 forks source link

Smogon Import Gen 1/2 #48

Closed soopercool101 closed 4 years ago

soopercool101 commented 4 years ago

Currently the Smogon Import for the first two generations sets Stat XP to 0. This should instead be maxed to 65535 as this is the assumed default for all stats in these gens.

architdate commented 4 years ago

Are you talking about the EVs being able to be pushed to 65535? Sorry I don't quite understand the issue.

Lusamine commented 4 years ago

When you import a set like this:

Pidgeot
- Double-Edge
- Hyper Beam
- Mimic
- Mirror Move

Showdown automatically assumes it has maxed stat exp: image

The same set imported with ALM in Gen 1-2 gives you 0 stat exp: image

architdate commented 4 years ago

Should probably be fixed in base pkhex then? @kwsch ? Considering that RegenTemplate inherits from IBattleTemplate anyway. Ideally @smogon should probably fix the behavior to match ingame mechanics (so make the max EVs as 65535 per stat instead of 252 and then scaling it)

kwsch commented 4 years ago

Showdown Sets do not specify the format they were created for, so there is no context to imply that EVs should be set to 65535. It depends on what the ShowdownSet is applied to -- the PKM object.

I agree that they shouldn't say it's 252 EVs for a GBPKM; the games do sqrt(u16)/4 instead of u8/4. The end result is still the same, as anything above 63504 yields the same stat boost as 63504.

soopercool101 commented 4 years ago

Generating a generation 1 or 2 set now throws an error here, likely a base pkhex issue @kwsch image

I can't seem to get this to debug properly unfortunately

kwsch commented 4 years ago

pk should never be null; I'd recommend turning on nullable checks in your project. Without seeing call stack or locals, that's all I can discern.

soopercool101 commented 4 years ago
Exception Details:
System.NullReferenceException: Object reference not set to an instance of an object.
   at PKHeX.Core.PKMConverter.ConvertToType(PKM pk, Type destType, String& comment) in C:\git\PKHeX\PKHeX.Core\PKM\Util\PKMConverter.cs:line 231
   at AutoModPlugins.ModLogic.GetRandomEncounter(PKM blank, ITrainerInfo tr, Int32 species) in C:\git\PKHeX-Plugins\PKHeX.Core.AutoMod\Enhancements\ModLogic.cs:line 117
   at AutoModPlugins.ModLogic.GetRandomEncounter(ITrainerInfo tr, Int32 species, PKM& pk) in C:\git\PKHeX-Plugins\PKHeX.Core.AutoMod\Enhancements\ModLogic.cs:line 95
   at PKHeX.Core.AutoMod.Legalizer.GetLegalFromSet(ITrainerInfo tr, IBattleTemplate set, PKM template, LegalizationResult& msg) in C:\git\PKHeX-Plugins\PKHeX.Core.AutoMod\AutoMod\Legalizer.cs:line 126
   at PKHeX.Core.AutoMod.Legalizer.ImportToExisting(SaveFile tr, IReadOnlyList`1 sets, IList`1 arr, Int32 start, Boolean overwrite) in C:\git\PKHeX-Plugins\PKHeX.Core.AutoMod\AutoMod\Legalizer.cs:line 70
   at AutoModPlugins.ShowdownSetLoader.ImportSetsToBoxes(IReadOnlyList`1 sets, Boolean replace) in C:\git\PKHeX-Plugins\AutoLegalityMod\GUI\ShowdownSetLoader.cs:line 107
   at AutoModPlugins.ShowdownSetLoader.Import(IReadOnlyList`1 sets) in C:\git\PKHeX-Plugins\AutoLegalityMod\GUI\ShowdownSetLoader.cs:line 62
   at AutoModPlugins.SmogonGenner.GenSmogonSets(PKM rough) in C:\git\PKHeX-Plugins\AutoLegalityMod\Plugins\SmogonGenner.cs:line 46
   at AutoModPlugins.SmogonGenner.SmogonGenning(Object sender, EventArgs e) in C:\git\PKHeX-Plugins\AutoLegalityMod\Plugins\SmogonGenner.cs:line 23
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)