Simplify Friendship modification on set

Copies instead of highbounds.
Added supporting property in PK6 class.
This commit is contained in:
Kurt 2015-10-25 18:46:17 -07:00
parent 15e3ff2eb1
commit 76d6320b21
2 changed files with 10 additions and 8 deletions

View file

@ -402,6 +402,11 @@ namespace PKHeX
get { return CurrentHandler == 0 ? OT_Friendship : HT_Friendship; }
set { if (CurrentHandler == 0) OT_Friendship = value; else HT_Friendship = value; }
}
public int OppositeFriendship
{
get { return CurrentHandler == 1 ? OT_Friendship : HT_Friendship; }
set { if (CurrentHandler == 1) OT_Friendship = value; else HT_Friendship = value; }
}
public int[] IVs { get { return new[] { IV_HP, IV_ATK, IV_DEF, IV_SPE, IV_SPA, IV_SPD }; } }
public int[] EVs { get { return new[] { EV_HP, EV_ATK, EV_DEF, EV_SPE, EV_SPA, EV_SPD }; } }
public int[] Moves { get { return new[] { Move1, Move2, Move3, Move4 }; } }

View file

@ -347,14 +347,11 @@ namespace PKHeX
pk6.Trade(OT, TID, SID, Country, SubRegion, Gender, false, Date.Day, Date.Month, Date.Year);
if (CT != pk6.CurrentHandler) // Logic updated Friendship
{
if (pk6.Moves.Contains(216) && pk6.CurrentFriendship != 255) // Return
if (pk6.CurrentHandler == 0)
pk6.OT_Friendship = 255;
else pk6.HT_Friendship = 255;
else if (pk6.Moves.Contains(218) && pk6.CurrentFriendship != 0) // Frustration
if (pk6.CurrentHandler == 0)
pk6.OT_Friendship = 0;
else pk6.HT_Friendship = 0;
// Copy over the Friendship Value only under certain circumstances
if (pk6.Moves.Contains(216)) // Return
pk6.CurrentFriendship = pk6.OppositeFriendship;
else if (pk6.Moves.Contains(218)) // Frustration
pk6.CurrentFriendship = pk6.OppositeFriendship;
else if (pk6.CurrentHandler == 1) // OT->HT, needs new Friendship/Affection
pk6.TradeFriendshipAffection(OT);
}