mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
Remove variable naming hiding
new property named Stats update sav7b/pb7 to delete unused handling trainer parameters too
This commit is contained in:
parent
1d76d799fd
commit
cc59c3cbe8
5 changed files with 44 additions and 68 deletions
|
@ -507,34 +507,28 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
// Synthetic Trading Logic
|
||||
public void Trade(string SAV_Trainer, int SAV_TID, int SAV_SID, int SAV_COUNTRY, int SAV_REGION, int SAV_GENDER, bool Bank, int Day = 1, int Month = 1, int Year = 2015)
|
||||
public void Trade(string SAV_Trainer, int SAV_TID, int SAV_SID, int SAV_GENDER, int Day = 1, int Month = 1, int Year = 2015)
|
||||
{
|
||||
// Eggs do not have any modifications done if they are traded
|
||||
if (IsEgg && !(SAV_Trainer == OT_Name && SAV_TID == TID && SAV_SID == SID && SAV_GENDER == OT_Gender))
|
||||
SetLinkTradeEgg(Day, Month, Year);
|
||||
// Process to the HT if the OT of the Pokémon does not match the SAV's OT info.
|
||||
else if (!TradeOT(SAV_Trainer, SAV_TID, SAV_SID, SAV_COUNTRY, SAV_REGION, SAV_GENDER))
|
||||
TradeHT(SAV_Trainer, SAV_COUNTRY, SAV_REGION, SAV_GENDER, Bank);
|
||||
else if (!TradeOT(SAV_Trainer, SAV_TID, SAV_SID, SAV_GENDER))
|
||||
TradeHT(SAV_Trainer, SAV_GENDER);
|
||||
}
|
||||
|
||||
private bool TradeOT(string SAV_Trainer, int SAV_TID, int SAV_SID, int SAV_COUNTRY, int SAV_REGION, int SAV_GENDER)
|
||||
private bool TradeOT(string SAV_Trainer, int SAV_TID, int SAV_SID, int SAV_GENDER)
|
||||
{
|
||||
// Check to see if the OT matches the SAV's OT info.
|
||||
if (!(SAV_Trainer == OT_Name && SAV_TID == TID && SAV_SID == SID && SAV_GENDER == OT_Gender))
|
||||
return false;
|
||||
|
||||
CurrentHandler = 0;
|
||||
if (!IsUntraded && (SAV_COUNTRY != Geo1_Country || SAV_REGION != Geo1_Region))
|
||||
TradeGeoLocation(SAV_COUNTRY, SAV_REGION);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void TradeHT(string SAV_Trainer, int SAV_COUNTRY, int SAV_REGION, int SAV_GENDER, bool Bank)
|
||||
private void TradeHT(string SAV_Trainer, int SAV_GENDER)
|
||||
{
|
||||
if (SAV_Trainer != HT_Name || SAV_GENDER != HT_Gender || (Geo1_Country == 0 && Geo1_Region == 0 && !IsUntradedEvent6))
|
||||
TradeGeoLocation(SAV_COUNTRY, SAV_REGION);
|
||||
|
||||
CurrentHandler = 1;
|
||||
if (HT_Name != SAV_Trainer)
|
||||
{
|
||||
|
@ -543,21 +537,6 @@ namespace PKHeX.Core
|
|||
}
|
||||
HT_Name = SAV_Trainer;
|
||||
HT_Gender = SAV_GENDER;
|
||||
|
||||
// Make a memory if no memory already exists. Pretty terrible way of doing this but I'd rather not overwrite existing memories.
|
||||
if (HT_Memory == 0)
|
||||
TradeMemory(Bank);
|
||||
}
|
||||
|
||||
// Misc Updates
|
||||
private void TradeGeoLocation(int GeoCountry, int GeoRegion)
|
||||
{
|
||||
// No geolocations are set, ever! -- except for bank. Don't set them anyway.
|
||||
}
|
||||
|
||||
public void TradeMemory(bool Bank)
|
||||
{
|
||||
// no bank?
|
||||
}
|
||||
|
||||
// Legality Properties
|
||||
|
@ -577,10 +556,7 @@ namespace PKHeX.Core
|
|||
public override int OTLength => 12;
|
||||
public override int NickLength => 12;
|
||||
|
||||
public override ushort[] GetStats(PersonalInfo p)
|
||||
{
|
||||
return CalculateStatsBeluga(p);
|
||||
}
|
||||
public override ushort[] GetStats(PersonalInfo p) => CalculateStatsBeluga(p);
|
||||
|
||||
public ushort[] CalculateStatsBeluga(PersonalInfo p)
|
||||
{
|
||||
|
@ -588,7 +564,7 @@ namespace PKHeX.Core
|
|||
int nature = Nature;
|
||||
int friend = CurrentFriendship; // stats +10% depending on friendship!
|
||||
int scalar = (int)(((friend / 255.0f / 10.0f) + 1.0f) * 100.0f);
|
||||
ushort[] Stats =
|
||||
ushort[] stats =
|
||||
{
|
||||
(ushort)(AV_HP + GetStat(p.HP, HT_HP ? 31 : IV_HP, level) + 10 + level),
|
||||
(ushort)(AV_ATK + (scalar * GetStat(p.ATK, HT_ATK ? 31 : IV_ATK, level, nature, 0) / 100)),
|
||||
|
@ -598,8 +574,8 @@ namespace PKHeX.Core
|
|||
(ushort)(AV_SPD + (scalar * GetStat(p.SPD, HT_SPD ? 31 : IV_SPD, level, nature, 3) / 100)),
|
||||
};
|
||||
if (Species == 292)
|
||||
Stats[0] = 1;
|
||||
return Stats;
|
||||
stats[0] = 1;
|
||||
return stats;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -720,48 +720,48 @@ namespace PKHeX.Core
|
|||
{
|
||||
int level = CurrentLevel;
|
||||
|
||||
ushort[] Stats = this is IHyperTrain t ? GetStats(p, t, level) : GetStats(p, level);
|
||||
ushort[] stats = this is IHyperTrain t ? GetStats(p, t, level) : GetStats(p, level);
|
||||
// Account for nature
|
||||
PKX.ModifyStatsForNature(Stats, Nature);
|
||||
return Stats;
|
||||
PKX.ModifyStatsForNature(stats, Nature);
|
||||
return stats;
|
||||
}
|
||||
|
||||
private ushort[] GetStats(PersonalInfo p, IHyperTrain t, int level)
|
||||
{
|
||||
ushort[] Stats = new ushort[6];
|
||||
Stats[0] = (ushort)(p.HP == 1 ? 1 : (((t.HT_HP ? 31 : IV_HP) + (2 * p.HP) + (EV_HP / 4) + 100) * level / 100) + 10);
|
||||
Stats[1] = (ushort)((((t.HT_ATK ? 31 : IV_ATK) + (2 * p.ATK) + (EV_ATK / 4)) * level / 100) + 5);
|
||||
Stats[2] = (ushort)((((t.HT_DEF ? 31 : IV_DEF) + (2 * p.DEF) + (EV_DEF / 4)) * level / 100) + 5);
|
||||
Stats[4] = (ushort)((((t.HT_SPA ? 31 : IV_SPA) + (2 * p.SPA) + (EV_SPA / 4)) * level / 100) + 5);
|
||||
Stats[5] = (ushort)((((t.HT_SPD ? 31 : IV_SPD) + (2 * p.SPD) + (EV_SPD / 4)) * level / 100) + 5);
|
||||
Stats[3] = (ushort)((((t.HT_SPE ? 31 : IV_SPE) + (2 * p.SPE) + (EV_SPE / 4)) * level / 100) + 5);
|
||||
return Stats;
|
||||
ushort[] stats = new ushort[6];
|
||||
stats[0] = (ushort)(p.HP == 1 ? 1 : (((t.HT_HP ? 31 : IV_HP) + (2 * p.HP) + (EV_HP / 4) + 100) * level / 100) + 10);
|
||||
stats[1] = (ushort)((((t.HT_ATK ? 31 : IV_ATK) + (2 * p.ATK) + (EV_ATK / 4)) * level / 100) + 5);
|
||||
stats[2] = (ushort)((((t.HT_DEF ? 31 : IV_DEF) + (2 * p.DEF) + (EV_DEF / 4)) * level / 100) + 5);
|
||||
stats[4] = (ushort)((((t.HT_SPA ? 31 : IV_SPA) + (2 * p.SPA) + (EV_SPA / 4)) * level / 100) + 5);
|
||||
stats[5] = (ushort)((((t.HT_SPD ? 31 : IV_SPD) + (2 * p.SPD) + (EV_SPD / 4)) * level / 100) + 5);
|
||||
stats[3] = (ushort)((((t.HT_SPE ? 31 : IV_SPE) + (2 * p.SPE) + (EV_SPE / 4)) * level / 100) + 5);
|
||||
return stats;
|
||||
}
|
||||
|
||||
private ushort[] GetStats(PersonalInfo p, int level)
|
||||
{
|
||||
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);
|
||||
return Stats;
|
||||
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);
|
||||
return stats;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies the specified stats to the <see cref="PKM"/>.
|
||||
/// </summary>
|
||||
/// <param name="Stats">Battle Stats (H/A/B/S/C/D)</param>
|
||||
public void SetStats(ushort[] Stats)
|
||||
/// <param name="stats">Battle Stats (H/A/B/S/C/D)</param>
|
||||
public void SetStats(ushort[] stats)
|
||||
{
|
||||
Stat_HPMax = Stat_HPCurrent = Stats[0];
|
||||
Stat_ATK = Stats[1];
|
||||
Stat_DEF = Stats[2];
|
||||
Stat_SPE = Stats[3];
|
||||
Stat_SPA = Stats[4];
|
||||
Stat_SPD = Stats[5];
|
||||
Stat_HPMax = Stat_HPCurrent = stats[0];
|
||||
Stat_ATK = stats[1];
|
||||
Stat_DEF = stats[2];
|
||||
Stat_SPE = stats[3];
|
||||
Stat_SPA = stats[4];
|
||||
Stat_SPD = stats[5];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -232,7 +232,7 @@ namespace PKHeX.Core
|
|||
public override ushort[] GetStats(PersonalInfo p)
|
||||
{
|
||||
var lv = Stat_Level;
|
||||
ushort[] Stats =
|
||||
ushort[] stats =
|
||||
{
|
||||
GetStat(p.HP , IV_HP , EV_HP , lv),
|
||||
GetStat(p.ATK, IV_ATK, EV_ATK, lv),
|
||||
|
@ -241,8 +241,8 @@ namespace PKHeX.Core
|
|||
GetStat(p.SPA, IV_SPA, EV_SPA, lv),
|
||||
GetStat(p.SPD, IV_SPD, EV_SPD, lv),
|
||||
};
|
||||
Stats[0] += (ushort)(5 + lv); // HP
|
||||
return Stats;
|
||||
stats[0] += (ushort)(5 + lv); // HP
|
||||
return stats;
|
||||
}
|
||||
|
||||
protected static ushort GetStat(int BV, int IV, int EV, int LV)
|
||||
|
|
|
@ -263,14 +263,14 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Updates stats according to the specified nature.
|
||||
/// </summary>
|
||||
/// <param name="Stats">Current stats to amplify if appropriate</param>
|
||||
/// <param name="stats">Current stats to amplify if appropriate</param>
|
||||
/// <param name="nature">Nature</param>
|
||||
public static void ModifyStatsForNature(ushort[] Stats, int nature)
|
||||
public static void ModifyStatsForNature(ushort[] stats, int nature)
|
||||
{
|
||||
if (GetNatureModification(nature, out int incr, out int decr))
|
||||
return;
|
||||
Stats[incr] *= 11; Stats[incr] /= 10;
|
||||
Stats[decr] *= 9; Stats[decr] /= 10;
|
||||
stats[incr] *= 11; stats[incr] /= 10;
|
||||
stats[decr] *= 9; stats[decr] /= 10;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -147,7 +147,7 @@ namespace PKHeX.Core
|
|||
// Apply to this Save File
|
||||
int CT = pk.CurrentHandler;
|
||||
var Date = DateTime.Now;
|
||||
pk.Trade(OT, TID, SID, Country, SubRegion, Gender, false, Date.Day, Date.Month, Date.Year);
|
||||
pk.Trade(OT, TID, SID, Gender, Date.Day, Date.Month, Date.Year);
|
||||
if (CT != pk.CurrentHandler) // Logic updated Friendship
|
||||
{
|
||||
// Copy over the Friendship Value only under certain circumstances
|
||||
|
|
Loading…
Add table
Reference in a new issue