Initial Hyper Training Support

This commit is contained in:
Michael Scire 2016-11-11 02:00:47 -08:00
parent fe99e4ee4b
commit 8ade9b21c7
5 changed files with 72 additions and 808 deletions

View file

@ -260,6 +260,7 @@
this.Label_PrevOT = new System.Windows.Forms.Label();
this.BTN_RerollEC = new System.Windows.Forms.Button();
this.GB_Markings = new System.Windows.Forms.GroupBox();
this.PB_MarkAlola = new System.Windows.Forms.PictureBox();
this.PB_Mark6 = new System.Windows.Forms.PictureBox();
this.PB_MarkPentagon = new System.Windows.Forms.PictureBox();
this.PB_Mark3 = new System.Windows.Forms.PictureBox();
@ -438,7 +439,6 @@
this.mnuLSave = new System.Windows.Forms.ToolStripMenuItem();
this.PB_Legal = new System.Windows.Forms.PictureBox();
this.L_UpdateAvailable = new System.Windows.Forms.LinkLabel();
this.PB_MarkAlola = new System.Windows.Forms.PictureBox();
this.tabMain.SuspendLayout();
this.Tab_Main.SuspendLayout();
this.FLP_Main.SuspendLayout();
@ -521,6 +521,7 @@
this.FLP_PKMEditors.SuspendLayout();
this.GB_nOT.SuspendLayout();
this.GB_Markings.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PB_MarkAlola)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Mark6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_MarkPentagon)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Mark3)).BeginInit();
@ -602,7 +603,6 @@
((System.ComponentModel.ISupportInitialize)(this.dragout)).BeginInit();
this.mnuL.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PB_Legal)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PB_MarkAlola)).BeginInit();
this.SuspendLayout();
//
// tabMain
@ -3377,6 +3377,17 @@
this.GB_Markings.TabStop = false;
this.GB_Markings.Text = "Markings";
//
// PB_MarkAlola
//
this.PB_MarkAlola.Image = global::PKHeX.Properties.Resources.sanchi;
this.PB_MarkAlola.InitialImage = global::PKHeX.Properties.Resources.sanchi;
this.PB_MarkAlola.Location = new System.Drawing.Point(96, 15);
this.PB_MarkAlola.Name = "PB_MarkAlola";
this.PB_MarkAlola.Size = new System.Drawing.Size(20, 20);
this.PB_MarkAlola.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.PB_MarkAlola.TabIndex = 9;
this.PB_MarkAlola.TabStop = false;
//
// PB_Mark6
//
this.PB_Mark6.Image = ((System.Drawing.Image)(resources.GetObject("PB_Mark6.Image")));
@ -5630,17 +5641,6 @@
this.L_UpdateAvailable.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.L_UpdateAvailable.Visible = false;
//
// PB_MarkAlola
//
this.PB_MarkAlola.Image = global::PKHeX.Properties.Resources.sanchi;
this.PB_MarkAlola.InitialImage = global::PKHeX.Properties.Resources.sanchi;
this.PB_MarkAlola.Location = new System.Drawing.Point(96, 15);
this.PB_MarkAlola.Name = "PB_MarkAlola";
this.PB_MarkAlola.Size = new System.Drawing.Size(20, 20);
this.PB_MarkAlola.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.PB_MarkAlola.TabIndex = 9;
this.PB_MarkAlola.TabStop = false;
//
// Main
//
this.AllowDrop = true;
@ -5773,6 +5773,7 @@
this.GB_nOT.ResumeLayout(false);
this.GB_nOT.PerformLayout();
this.GB_Markings.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.PB_MarkAlola)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Mark6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_MarkPentagon)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_Mark3)).EndInit();
@ -5865,7 +5866,6 @@
((System.ComponentModel.ISupportInitialize)(this.dragout)).EndInit();
this.mnuL.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.PB_Legal)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PB_MarkAlola)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

View file

@ -1626,7 +1626,34 @@ namespace PKHeX
private void clickIV(object sender, EventArgs e)
{
if (ModifierKeys == Keys.Control)
((MaskedTextBox) sender).Text = SAV.MaxIV.ToString();
if (SAV.Generation < 7)
((MaskedTextBox) sender).Text = SAV.MaxIV.ToString();
else
{
var index = Array.IndexOf(new[] {TB_HPIV, TB_ATKIV, TB_DEFIV, TB_SPAIV, TB_SPDIV, TB_SPEIV}, sender);
switch (index)
{
case 0:
pkm.HT_HP ^= true;
break;
case 1:
pkm.HT_ATK ^= true;
break;
case 2:
pkm.HT_DEF ^= true;
break;
case 3:
pkm.HT_SPA ^= true;
break;
case 4:
pkm.HT_SPD ^= true;
break;
case 5:
pkm.HT_SPE ^= true;
break;
}
updateIVs(sender, e);
}
else if (ModifierKeys == Keys.Alt)
((MaskedTextBox) sender).Text = 0.ToString();
}
@ -1790,6 +1817,14 @@ namespace PKHeX
pkm.IV_SPA = Util.ToInt32(TB_SPAIV.Text);
pkm.IV_SPD = Util.ToInt32(TB_SPDIV.Text);
var IV_Boxes = new[] {TB_HPIV, TB_ATKIV, TB_DEFIV, TB_SPAIV, TB_SPDIV, TB_SPEIV};
var HT_Vals = new[] {pkm.HT_HP, pkm.HT_ATK, pkm.HT_DEF, pkm.HT_SPA, pkm.HT_SPD, pkm.HT_SPE};
for (int i = 0; i < IV_Boxes.Length; i++)
if (HT_Vals[i])
IV_Boxes[i].BackColor = Color.LightGreen;
else
IV_Boxes[i].ResetBackColor();
if (SAV.Generation < 3)
{
TB_HPIV.Text = pkm.IV_HP.ToString();
@ -3758,6 +3793,7 @@ namespace PKHeX
clickSlot(sender, e);
}
private void pbBoxSlot_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)

File diff suppressed because it is too large Load diff

View file

@ -389,7 +389,13 @@ namespace PKHeX
public override int Ball { get { return Data[0xDC]; } set { Data[0xDC] = (byte)value; } }
public override int Met_Level { get { return Data[0xDD] & ~0x80; } set { Data[0xDD] = (byte)((Data[0xDD] & 0x80) | value); } }
public override int OT_Gender { get { return Data[0xDD] >> 7; } set { Data[0xDD] = (byte)((Data[0xDD] & ~0x80) | (value << 7)); } }
public override int EncounterType { get { return Data[0xDE]; } set { Data[0xDE] = (byte)value; } }
public override int HyperTrainFlags { get { return Data[0xDE]; } set { Data[0xDE] = (byte)value; } }
public override bool HT_HP { get { return ((HyperTrainFlags >> 0) & 1) == 1; } set { HyperTrainFlags = (HyperTrainFlags & ~(1 << 0)) | ((value ? 1 : 0) << 0); } }
public override bool HT_ATK { get { return ((HyperTrainFlags >> 1) & 1) == 1; } set { HyperTrainFlags = (HyperTrainFlags & ~(1 << 1)) | ((value ? 1 : 0) << 1); } }
public override bool HT_DEF { get { return ((HyperTrainFlags >> 2) & 1) == 1; } set { HyperTrainFlags = (HyperTrainFlags & ~(1 << 2)) | ((value ? 1 : 0) << 2); } }
public override bool HT_SPA { get { return ((HyperTrainFlags >> 3) & 1) == 1; } set { HyperTrainFlags = (HyperTrainFlags & ~(1 << 3)) | ((value ? 1 : 0) << 3); } }
public override bool HT_SPD { get { return ((HyperTrainFlags >> 4) & 1) == 1; } set { HyperTrainFlags = (HyperTrainFlags & ~(1 << 4)) | ((value ? 1 : 0) << 4); } }
public override bool HT_SPE { get { return ((HyperTrainFlags >> 5) & 1) == 1; } set { HyperTrainFlags = (HyperTrainFlags & ~(1 << 5)) | ((value ? 1 : 0) << 5); } }
public override int Version { get { return Data[0xDF]; } set { Data[0xDF] = (byte)value; } }
public override int Country { get { return Data[0xE0]; } set { Data[0xE0] = (byte)value; } }
public override int Region { get { return Data[0xE1]; } set { Data[0xE1] = (byte)value; } }

View file

@ -394,6 +394,14 @@ namespace PKHeX
public virtual bool SecretSuperTrainingUnlocked { get { return false; } set { } }
public virtual bool SecretSuperTrainingComplete { get { return false; } set { } }
public virtual int HyperTrainFlags { get { return 0; } set { } }
public virtual bool HT_HP { get { return false; } set { } }
public virtual bool HT_ATK { get { return false; } set { } }
public virtual bool HT_DEF { get { return false; } set { } }
public virtual bool HT_SPA { get { return false; } set { } }
public virtual bool HT_SPD { get { return false; } set { } }
public virtual bool HT_SPE { get { return false; } set { } }
public bool InhabitedGeneration(int Generation)
{
if (Format < Generation)
@ -472,12 +480,12 @@ namespace PKHeX
{
int level = CurrentLevel;
ushort[] Stats = new ushort[6];
Stats[0] = (ushort)(p.HP == 1 ? 1 : (IV_HP + 2 * p.HP + EV_HP / 4 + 100) * level / 100 + 10);
Stats[1] = (ushort)((IV_ATK + 2 * p.ATK + EV_ATK / 4) * level / 100 + 5);
Stats[2] = (ushort)((IV_DEF + 2 * p.DEF + EV_DEF / 4) * level / 100 + 5);
Stats[4] = (ushort)((IV_SPA + 2 * p.SPA + EV_SPA / 4) * level / 100 + 5);
Stats[5] = (ushort)((IV_SPD + 2 * p.SPD + EV_SPD / 4) * level / 100 + 5);
Stats[3] = (ushort)((IV_SPE + 2 * p.SPE + EV_SPE / 4) * level / 100 + 5);
Stats[0] = (ushort)(p.HP == 1 ? 1 : (((HT_HP ? 31 : IV_HP) + 2 * p.HP + EV_HP / 4 + 100) * level / 100 + 10));
Stats[1] = (ushort)(((HT_ATK ? 31 : IV_ATK) + 2 * p.ATK + EV_ATK / 4) * level / 100 + 5);
Stats[2] = (ushort)(((HT_DEF ? 31 : IV_DEF) + 2 * p.DEF + EV_DEF / 4) * level / 100 + 5);
Stats[4] = (ushort)(((HT_SPA ? 31 : IV_SPA) + 2 * p.SPA + EV_SPA / 4) * level / 100 + 5);
Stats[5] = (ushort)(((HT_SPD ? 31 : IV_SPD) + 2 * p.SPD + EV_SPD / 4) * level / 100 + 5);
Stats[3] = (ushort)(((HT_SPE ? 31 : IV_SPE) + 2 * p.SPE + EV_SPE / 4) * level / 100 + 5);
// Account for nature
int incr = Nature / 5 + 1;