mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Add misc edit to defeat all trainers & rebattle all
This commit is contained in:
parent
39f8e9173e
commit
36a97a6eda
3 changed files with 49 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace PKHeX.Core
|
||||
{
|
||||
|
@ -15,6 +16,9 @@ namespace PKHeX.Core
|
|||
private const int COUNT_TRAINER = 707;
|
||||
private const int SIZE_TRAINER = 8; // bool,bool
|
||||
|
||||
public bool AnyDefeated => Enumerable.Range(0, COUNT_TRAINER).Any(GetIsWin);
|
||||
public bool AnyUndefeated => Enumerable.Range(0, COUNT_TRAINER).Any(z => !GetIsWin(z));
|
||||
|
||||
/// <summary>
|
||||
/// Don't use this unless you've finished the post-game.
|
||||
/// </summary>
|
||||
|
|
|
@ -32,11 +32,13 @@ namespace PKHeX.WinForms
|
|||
this.B_Save = new System.Windows.Forms.Button();
|
||||
this.TC_Misc = new System.Windows.Forms.TabControl();
|
||||
this.TAB_Main = new System.Windows.Forms.TabPage();
|
||||
this.B_DefeatEyecatch = new System.Windows.Forms.Button();
|
||||
this.B_Roamer = new System.Windows.Forms.Button();
|
||||
this.B_DialgaPalkia = new System.Windows.Forms.Button();
|
||||
this.B_Darkrai = new System.Windows.Forms.Button();
|
||||
this.B_Shaymin = new System.Windows.Forms.Button();
|
||||
this.B_Spiritomb = new System.Windows.Forms.Button();
|
||||
this.B_RebattleEyecatch = new System.Windows.Forms.Button();
|
||||
this.TC_Misc.SuspendLayout();
|
||||
this.TAB_Main.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -78,6 +80,8 @@ namespace PKHeX.WinForms
|
|||
//
|
||||
// TAB_Main
|
||||
//
|
||||
this.TAB_Main.Controls.Add(this.B_RebattleEyecatch);
|
||||
this.TAB_Main.Controls.Add(this.B_DefeatEyecatch);
|
||||
this.TAB_Main.Controls.Add(this.B_Roamer);
|
||||
this.TAB_Main.Controls.Add(this.B_DialgaPalkia);
|
||||
this.TAB_Main.Controls.Add(this.B_Darkrai);
|
||||
|
@ -91,6 +95,16 @@ namespace PKHeX.WinForms
|
|||
this.TAB_Main.Text = "Main";
|
||||
this.TAB_Main.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// B_DefeatEyecatch
|
||||
//
|
||||
this.B_DefeatEyecatch.Location = new System.Drawing.Point(136, 134);
|
||||
this.B_DefeatEyecatch.Name = "B_DefeatEyecatch";
|
||||
this.B_DefeatEyecatch.Size = new System.Drawing.Size(124, 58);
|
||||
this.B_DefeatEyecatch.TabIndex = 5;
|
||||
this.B_DefeatEyecatch.Text = "Defeat all Eyecatch Trainers";
|
||||
this.B_DefeatEyecatch.UseVisualStyleBackColor = true;
|
||||
this.B_DefeatEyecatch.Click += new System.EventHandler(this.B_DefeatEyecatch_Click);
|
||||
//
|
||||
// B_Roamer
|
||||
//
|
||||
this.B_Roamer.Location = new System.Drawing.Point(136, 70);
|
||||
|
@ -141,6 +155,16 @@ namespace PKHeX.WinForms
|
|||
this.B_Spiritomb.UseVisualStyleBackColor = true;
|
||||
this.B_Spiritomb.Click += new System.EventHandler(this.B_Spiritomb_Click);
|
||||
//
|
||||
// B_RebattleEyecatch
|
||||
//
|
||||
this.B_RebattleEyecatch.Location = new System.Drawing.Point(6, 198);
|
||||
this.B_RebattleEyecatch.Name = "B_RebattleEyecatch";
|
||||
this.B_RebattleEyecatch.Size = new System.Drawing.Size(124, 58);
|
||||
this.B_RebattleEyecatch.TabIndex = 6;
|
||||
this.B_RebattleEyecatch.Text = "Rebattle all Eyecatch Trainers";
|
||||
this.B_RebattleEyecatch.UseVisualStyleBackColor = true;
|
||||
this.B_RebattleEyecatch.Click += new System.EventHandler(this.B_RebattleEyecatch_Click);
|
||||
//
|
||||
// SAV_Misc8b
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -171,5 +195,7 @@ namespace PKHeX.WinForms
|
|||
private System.Windows.Forms.Button B_Spiritomb;
|
||||
private System.Windows.Forms.Button B_DialgaPalkia;
|
||||
private System.Windows.Forms.Button B_Roamer;
|
||||
private System.Windows.Forms.Button B_DefeatEyecatch;
|
||||
private System.Windows.Forms.Button B_RebattleEyecatch;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@ namespace PKHeX.WinForms
|
|||
B_Shaymin.Enabled = SAV.Work.GetFlag(545) || !(SAV.Work.GetWork(276) == 1 && SAV.Zukan.HasNationalDex && SAV.Items.GetItemQuantity(452) == 1 && SAV.Work.GetSystemFlag(5)); // HAIHUEVENT_ID_D30, Oak's Letter
|
||||
B_DialgaPalkia.Enabled = SAV.Work.GetFlag(308) && SAV.Work.GetWork(84) != 5; // FE_D05R0114_SPPOKE_GET, WK_SCENE_D05R0114 (1-3 story related, 4 = captured, 5 = can retry)
|
||||
B_Roamer.Enabled = SAV.Encounter.Roamer1Encount != 1 || SAV.Encounter.Roamer2Encount != 1; // 0 = inactive, 1 = roaming, 2 = KOed, 3 = captured
|
||||
|
||||
B_RebattleEyecatch.Enabled = SAV.BattleTrainer.AnyDefeated;
|
||||
B_DefeatEyecatch.Enabled = SAV.BattleTrainer.AnyUndefeated;
|
||||
}
|
||||
|
||||
private void SaveMain()
|
||||
|
@ -97,5 +100,21 @@ namespace PKHeX.WinForms
|
|||
System.Media.SystemSounds.Asterisk.Play();
|
||||
B_Roamer.Enabled = false;
|
||||
}
|
||||
|
||||
private void B_DefeatEyecatch_Click(object sender, EventArgs e)
|
||||
{
|
||||
SAV.BattleTrainer.DefeatAll();
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
B_DefeatEyecatch.Enabled = false;
|
||||
B_RebattleEyecatch.Enabled = true;
|
||||
}
|
||||
|
||||
private void B_RebattleEyecatch_Click(object sender, EventArgs e)
|
||||
{
|
||||
SAV.BattleTrainer.RebattleAll();
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
B_RebattleEyecatch.Enabled = false;
|
||||
B_DefeatEyecatch.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue