2016-09-26 23:15:40 +00:00
|
|
|
|
using System;
|
PKHeX.Core Nullable cleanup (#2401)
* Handle some nullable cases
Refactor MysteryGift into a second abstract class (backed by a byte array, or fake data)
Make some classes have explicit constructors instead of { } initialization
* Handle bits more obviously without null
* Make SaveFile.BAK explicitly readonly again
* merge constructor methods to have readonly fields
* Inline some properties
* More nullable handling
* Rearrange box actions
define straightforward classes to not have any null properties
* Make extrabyte reference array immutable
* Move tooltip creation to designer
* Rearrange some logic to reduce nesting
* Cache generated fonts
* Split mystery gift album purpose
* Handle more tooltips
* Disallow null setters
* Don't capture RNG object, only type enum
* Unify learnset objects
Now have readonly properties which are never null
don't new() empty learnsets (>800 Learnset objects no longer created,
total of 2400 objects since we also new() a move & level array)
optimize g1/2 reader for early abort case
* Access rewrite
Initialize blocks in a separate object, and get via that object
removes a couple hundred "might be null" warnings since blocks are now readonly getters
some block references have been relocated, but interfaces should expose all that's needed
put HoF6 controls in a groupbox, and disable
* Readonly personal data
* IVs non nullable for mystery gift
* Explicitly initialize forced encounter moves
* Make shadow objects readonly & non-null
Put murkrow fix in binary data resource, instead of on startup
* Assign dex form fetch on constructor
Fixes legality parsing edge cases
also handle cxd parse for valid; exit before exception is thrown in FrameGenerator
* Remove unnecessary null checks
* Keep empty value until init
SetPouch sets the value to an actual one during load, but whatever
* Readonly team lock data
* Readonly locks
Put locked encounters at bottom (favor unlocked)
* Mail readonly data / offset
Rearrange some call flow and pass defaults
Add fake classes for SaveDataEditor mocking
Always party size, no need to check twice in stat editor
use a fake save file as initial data for savedata editor, and for
gamedata (wow i found a usage)
constrain eventwork editor to struct variable types (uint, int, etc),
thus preventing null assignment errors
2019-10-17 01:47:31 +00:00
|
|
|
|
using System.Collections.Generic;
|
2016-09-26 23:15:40 +00:00
|
|
|
|
|
2017-01-08 07:54:09 +00:00
|
|
|
|
namespace PKHeX.Core
|
2016-09-26 23:15:40 +00:00
|
|
|
|
{
|
2017-10-24 06:12:58 +00:00
|
|
|
|
/// <summary> Generation 3 <see cref="PKM"/> format, exclusively for Pokémon Colosseum. </summary>
|
2019-10-26 19:42:33 +00:00
|
|
|
|
public sealed class CK3 : G3PKM, IShadowPKM
|
2016-09-26 23:15:40 +00:00
|
|
|
|
{
|
2019-11-16 01:34:18 +00:00
|
|
|
|
private static readonly ushort[] Unused =
|
2016-09-26 23:15:40 +00:00
|
|
|
|
{
|
|
|
|
|
0x11, 0x12, 0x13,
|
|
|
|
|
0x61, 0x62, 0x63, 0x64,
|
|
|
|
|
0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xDA, 0xDB,
|
|
|
|
|
0xE4, 0xE5, 0xE6, 0xE7, 0xCE,
|
|
|
|
|
// 0xFC onwards unused?
|
|
|
|
|
};
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2019-11-16 01:34:18 +00:00
|
|
|
|
public override IReadOnlyList<ushort> ExtraBytes => Unused;
|
2018-12-20 06:10:32 +00:00
|
|
|
|
|
2020-01-04 22:48:39 +00:00
|
|
|
|
public override int SIZE_PARTY => PokeCrypto.SIZE_3CSTORED;
|
|
|
|
|
public override int SIZE_STORED => PokeCrypto.SIZE_3CSTORED;
|
2016-09-26 23:15:40 +00:00
|
|
|
|
public override int Format => 3;
|
2016-10-24 05:01:39 +00:00
|
|
|
|
public override PersonalInfo PersonalInfo => PersonalTable.RS[Species];
|
2020-09-26 19:09:02 +00:00
|
|
|
|
public CK3(byte[] data) : base(data) { }
|
|
|
|
|
public CK3() : this(new byte[PokeCrypto.SIZE_3CSTORED]) { }
|
2019-03-17 01:41:56 +00:00
|
|
|
|
public override PKM Clone() => new CK3((byte[])Data.Clone()) {Identifier = Identifier};
|
2016-09-26 23:15:40 +00:00
|
|
|
|
|
2019-03-21 04:50:44 +00:00
|
|
|
|
private string GetString(int Offset, int Count) => StringConverter3.GetBEString3(Data, Offset, Count);
|
2020-09-09 19:47:24 +00:00
|
|
|
|
private static byte[] SetString(string value, int maxLength) => StringConverter3.SetBEString3(value, maxLength);
|
2017-04-09 21:06:50 +00:00
|
|
|
|
|
|
|
|
|
// Trash Bytes
|
2020-01-19 00:57:25 +00:00
|
|
|
|
public override byte[] Nickname_Trash { get => GetData(0x2E, 20); set { if (value.Length == 20) value.CopyTo(Data, 0x2E); } }
|
|
|
|
|
public override byte[] OT_Trash { get => GetData(0x18, 20); set { if (value.Length == 20) value.CopyTo(Data, 0x18); } }
|
2017-04-09 21:06:50 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
// Future Attributes
|
|
|
|
|
|
|
|
|
|
// Silly Attributes
|
2017-05-13 03:32:36 +00:00
|
|
|
|
public override ushort Sanity { get => 0; set { } } // valid flag set in pkm structure.
|
2019-03-16 19:01:21 +00:00
|
|
|
|
public override ushort Checksum { get => Checksums.CRC16_CCITT(Data); set { } } // totally false, just a way to get a 'random' ident for the pkm.
|
2018-11-27 03:24:49 +00:00
|
|
|
|
public override bool ChecksumValid => true;
|
2019-05-15 01:36:43 +00:00
|
|
|
|
public override bool Valid { get => !Invalid; set => Invalid = !value; }
|
2016-09-26 23:15:40 +00:00
|
|
|
|
|
2017-08-01 06:03:51 +00:00
|
|
|
|
public override int Species { get => SpeciesConverter.GetG4Species(BigEndian.ToUInt16(Data, 0x00)); set => BigEndian.GetBytes((ushort)SpeciesConverter.GetG3Species(value)).CopyTo(Data, 0x00); }
|
2016-09-26 23:15:40 +00:00
|
|
|
|
// 02-04 unused
|
2017-05-13 03:32:36 +00:00
|
|
|
|
public override uint PID { get => BigEndian.ToUInt32(Data, 0x04); set => BigEndian.GetBytes(value).CopyTo(Data, 0x04); }
|
2019-03-16 23:48:38 +00:00
|
|
|
|
public override int Version { get => GetGBAVersionID(Data[0x08]); set => Data[0x08] = GetGCVersionID(value); }
|
2017-05-13 03:32:36 +00:00
|
|
|
|
public int CurrentRegion { get => Data[0x09]; set => Data[0x09] = (byte)value; }
|
|
|
|
|
public int OriginalRegion { get => Data[0x0A]; set => Data[0x0A] = (byte)value; }
|
2019-09-19 02:58:23 +00:00
|
|
|
|
public override int Language { get => Core.Language.GetMainLangIDfromGC(Data[0x0B]); set => Data[0x0B] = Core.Language.GetGCLangIDfromMain((byte)value); }
|
2017-05-13 03:32:36 +00:00
|
|
|
|
public override int Met_Location { get => BigEndian.ToUInt16(Data, 0x0C); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x0C); }
|
|
|
|
|
public override int Met_Level { get => Data[0x0E]; set => Data[0x0E] = (byte)value; }
|
|
|
|
|
public override int Ball { get => Data[0x0F]; set => Data[0x0F] = (byte)value; }
|
|
|
|
|
public override int OT_Gender { get => Data[0x10]; set => Data[0x10] = (byte)value; }
|
|
|
|
|
public override int SID { get => BigEndian.ToUInt16(Data, 0x14); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x14); }
|
|
|
|
|
public override int TID { get => BigEndian.ToUInt16(Data, 0x16); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x16); }
|
2017-06-18 01:37:19 +00:00
|
|
|
|
public override string OT_Name { get => GetString(0x18, 20); set => SetString(value, 10).CopyTo(Data, 0x18); } // +2 terminator
|
2020-05-26 23:59:47 +00:00
|
|
|
|
public override string Nickname { get => GetString(0x2E, 20); set { SetString(value, 10).CopyTo(Data, 0x2E); NicknameCopy = value; } } // +2 terminator
|
|
|
|
|
public string NicknameCopy { get => GetString(0x44, 20); set => SetString(value, 10).CopyTo(Data, 0x44); } // +2 terminator
|
2017-05-13 03:32:36 +00:00
|
|
|
|
public override uint EXP { get => BigEndian.ToUInt32(Data, 0x5C); set => BigEndian.GetBytes(value).CopyTo(Data, 0x5C); }
|
|
|
|
|
public override int Stat_Level { get => Data[0x60]; set => Data[0x60] = (byte)value; }
|
2016-09-26 23:15:40 +00:00
|
|
|
|
|
|
|
|
|
// 0x64-0x77 are battle/status related
|
2019-01-12 06:25:48 +00:00
|
|
|
|
public override int Status_Condition { get; set; } // where are we
|
2016-09-26 23:15:40 +00:00
|
|
|
|
// Not that the program cares
|
|
|
|
|
|
|
|
|
|
// Moves
|
2017-05-13 03:32:36 +00:00
|
|
|
|
public override int Move1 { get => BigEndian.ToUInt16(Data, 0x78); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x78); }
|
|
|
|
|
public override int Move1_PP { get => Data[0x7A]; set => Data[0x7A] = (byte)value; }
|
|
|
|
|
public override int Move1_PPUps { get => Data[0x7B]; set => Data[0x7B] = (byte)value; }
|
|
|
|
|
public override int Move2 { get => BigEndian.ToUInt16(Data, 0x7C); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x7C); }
|
|
|
|
|
public override int Move2_PP { get => Data[0x7E]; set => Data[0x7E] = (byte)value; }
|
|
|
|
|
public override int Move2_PPUps { get => Data[0x7F]; set => Data[0x7F] = (byte)value; }
|
|
|
|
|
public override int Move3 { get => BigEndian.ToUInt16(Data, 0x80); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x80); }
|
|
|
|
|
public override int Move3_PP { get => Data[0x82]; set => Data[0x82] = (byte)value; }
|
|
|
|
|
public override int Move3_PPUps { get => Data[0x83]; set => Data[0x83] = (byte)value; }
|
|
|
|
|
public override int Move4 { get => BigEndian.ToUInt16(Data, 0x84); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x84); }
|
|
|
|
|
public override int Move4_PP { get => Data[0x86]; set => Data[0x86] = (byte)value; }
|
|
|
|
|
public override int Move4_PPUps { get => Data[0x87]; set => Data[0x87] = (byte)value; }
|
2016-09-26 23:15:40 +00:00
|
|
|
|
|
2020-06-17 02:46:22 +00:00
|
|
|
|
public override int SpriteItem => ItemConverter.GetItemFuture3((ushort)HeldItem);
|
2017-05-13 03:32:36 +00:00
|
|
|
|
public override int HeldItem { get => BigEndian.ToUInt16(Data, 0x88); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x88); }
|
2016-09-26 23:15:40 +00:00
|
|
|
|
|
|
|
|
|
// More party stats
|
2017-05-13 03:32:36 +00:00
|
|
|
|
public override int Stat_HPCurrent { get => BigEndian.ToUInt16(Data, 0x8A); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8A); }
|
|
|
|
|
public override int Stat_HPMax { get => BigEndian.ToUInt16(Data, 0x8C); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8C); }
|
|
|
|
|
public override int Stat_ATK { get => BigEndian.ToUInt16(Data, 0x8E); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x8E); }
|
|
|
|
|
public override int Stat_DEF { get => BigEndian.ToUInt16(Data, 0x90); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x90); }
|
|
|
|
|
public override int Stat_SPA { get => BigEndian.ToUInt16(Data, 0x92); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x92); }
|
|
|
|
|
public override int Stat_SPD { get => BigEndian.ToUInt16(Data, 0x94); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x94); }
|
|
|
|
|
public override int Stat_SPE { get => BigEndian.ToUInt16(Data, 0x96); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0x96); }
|
2018-05-12 15:13:39 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
// EVs
|
2017-05-13 03:32:36 +00:00
|
|
|
|
public override int EV_HP {
|
|
|
|
|
get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x98));
|
|
|
|
|
set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x98); }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
public override int EV_ATK {
|
2017-05-13 03:32:36 +00:00
|
|
|
|
get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9A));
|
|
|
|
|
set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9A); }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
public override int EV_DEF {
|
2017-05-13 03:32:36 +00:00
|
|
|
|
get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9C));
|
|
|
|
|
set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9C); }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
public override int EV_SPA {
|
2017-05-13 03:32:36 +00:00
|
|
|
|
get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0x9E));
|
|
|
|
|
set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0x9E); }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
public override int EV_SPD {
|
2017-05-13 03:32:36 +00:00
|
|
|
|
get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA0));
|
|
|
|
|
set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA0); }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
public override int EV_SPE {
|
2017-05-13 03:32:36 +00:00
|
|
|
|
get => Math.Min(byte.MaxValue, BigEndian.ToUInt16(Data, 0xA2));
|
|
|
|
|
set => BigEndian.GetBytes((ushort)(value & 0xFF)).CopyTo(Data, 0xA2); }
|
2016-09-26 23:15:40 +00:00
|
|
|
|
|
|
|
|
|
// IVs
|
|
|
|
|
public override int IV_HP {
|
2017-05-13 03:32:36 +00:00
|
|
|
|
get => Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xA4));
|
|
|
|
|
set => BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xA4); }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
public override int IV_ATK {
|
2017-05-13 03:32:36 +00:00
|
|
|
|
get => Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xA6));
|
|
|
|
|
set => BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xA6); }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
public override int IV_DEF {
|
2017-05-13 03:32:36 +00:00
|
|
|
|
get => Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xA8));
|
|
|
|
|
set => BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xA8); }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
public override int IV_SPA {
|
2017-05-13 03:32:36 +00:00
|
|
|
|
get => Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xAA));
|
|
|
|
|
set => BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xAA); }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
public override int IV_SPD {
|
2017-05-13 03:32:36 +00:00
|
|
|
|
get => Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xAC));
|
|
|
|
|
set => BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xAC); }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
public override int IV_SPE {
|
2017-05-13 03:32:36 +00:00
|
|
|
|
get => Math.Min((ushort)31, BigEndian.ToUInt16(Data, 0xAE));
|
|
|
|
|
set => BigEndian.GetBytes((ushort)(value & 0x1F)).CopyTo(Data, 0xAE); }
|
2018-05-12 15:13:39 +00:00
|
|
|
|
|
2017-05-13 03:32:36 +00:00
|
|
|
|
public override int OT_Friendship { get => Data[0xB0]; set => Data[0xB0] = (byte)value; }
|
2016-09-26 23:15:40 +00:00
|
|
|
|
|
|
|
|
|
// Contest
|
2021-01-01 21:39:08 +00:00
|
|
|
|
public override byte CNT_Cool { get => Data[0xB2]; set => Data[0xB2] = value; }
|
|
|
|
|
public override byte CNT_Beauty { get => Data[0xB3]; set => Data[0xB3] = value; }
|
|
|
|
|
public override byte CNT_Cute { get => Data[0xB4]; set => Data[0xB4] = value; }
|
|
|
|
|
public override byte CNT_Smart { get => Data[0xB5]; set => Data[0xB5] = value; }
|
|
|
|
|
public override byte CNT_Tough { get => Data[0xB6]; set => Data[0xB6] = value; }
|
2018-02-03 20:42:06 +00:00
|
|
|
|
public override int RibbonCountG3Cool { get => Data[0xB7]; set => Data[0xB7] = (byte)value; }
|
|
|
|
|
public override int RibbonCountG3Beauty { get => Data[0xB8]; set => Data[0xB8] = (byte)value; }
|
|
|
|
|
public override int RibbonCountG3Cute { get => Data[0xB9]; set => Data[0xB9] = (byte)value; }
|
|
|
|
|
public override int RibbonCountG3Smart { get => Data[0xBA]; set => Data[0xBA] = (byte)value; }
|
|
|
|
|
public override int RibbonCountG3Tough { get => Data[0xBB]; set => Data[0xBB] = (byte)value; }
|
2021-01-01 21:39:08 +00:00
|
|
|
|
public override byte CNT_Sheen { get => Data[0xBC]; set => Data[0xBC] = value; }
|
2018-05-12 15:13:39 +00:00
|
|
|
|
|
2016-09-26 23:15:40 +00:00
|
|
|
|
// Ribbons
|
2020-12-22 00:53:28 +00:00
|
|
|
|
public override bool RibbonChampionG3Hoenn { get => Data[0xBD] == 1; set => Data[0xBD] = value ? 1 : 0; }
|
|
|
|
|
public override bool RibbonWinning { get => Data[0xBE] == 1; set => Data[0xBE] = value ? 1 : 0; }
|
|
|
|
|
public override bool RibbonVictory { get => Data[0xBF] == 1; set => Data[0xBF] = value ? 1 : 0; }
|
|
|
|
|
public override bool RibbonArtist { get => Data[0xC0] == 1; set => Data[0xC0] = value ? 1 : 0; }
|
|
|
|
|
public override bool RibbonEffort { get => Data[0xC1] == 1; set => Data[0xC1] = value ? 1 : 0; }
|
|
|
|
|
public override bool RibbonChampionBattle { get => Data[0xC2] == 1; set => Data[0xC2] = value ? 1 : 0; }
|
|
|
|
|
public override bool RibbonChampionRegional { get => Data[0xC3] == 1; set => Data[0xC3] = value ? 1 : 0; }
|
|
|
|
|
public override bool RibbonChampionNational { get => Data[0xC4] == 1; set => Data[0xC4] = value ? 1 : 0; }
|
|
|
|
|
public override bool RibbonCountry { get => Data[0xC5] == 1; set => Data[0xC5] = value ? 1 : 0; }
|
|
|
|
|
public override bool RibbonNational { get => Data[0xC6] == 1; set => Data[0xC6] = value ? 1 : 0; }
|
|
|
|
|
public override bool RibbonEarth { get => Data[0xC7] == 1; set => Data[0xC7] = value ? 1 : 0; }
|
|
|
|
|
public override bool RibbonWorld { get => Data[0xC8] == 1; set => Data[0xC8] = value ? 1 : 0; }
|
2018-09-15 05:37:47 +00:00
|
|
|
|
public override bool Unused1 { get => ((Data[0xC9] >> 0) & 1) == 1; set => Data[0xC9] = (byte)((Data[0xC9] & ~1) | (value ? 1 : 0)); }
|
|
|
|
|
public override bool Unused2 { get => ((Data[0xC9] >> 1) & 1) == 1; set => Data[0xC9] = (byte)((Data[0xC9] & ~2) | (value ? 2 : 0)); }
|
|
|
|
|
public override bool Unused3 { get => ((Data[0xC9] >> 2) & 1) == 1; set => Data[0xC9] = (byte)((Data[0xC9] & ~4) | (value ? 4 : 0)); }
|
|
|
|
|
public override bool Unused4 { get => ((Data[0xC9] >> 3) & 1) == 1; set => Data[0xC9] = (byte)((Data[0xC9] & ~8) | (value ? 8 : 0)); }
|
2017-05-13 03:32:36 +00:00
|
|
|
|
|
|
|
|
|
public override int PKRS_Strain { get => Data[0xCA] & 0xF; set => Data[0xCA] = (byte)(value & 0xF); }
|
2020-12-22 00:53:28 +00:00
|
|
|
|
public override bool IsEgg { get => Data[0xCB] == 1; set => Data[0xCB] = value ? 1 : 0; }
|
|
|
|
|
public override bool AbilityBit { get => Data[0xCC] == 1; set => Data[0xCC] = value ? 1 : 0; }
|
|
|
|
|
private bool Invalid { get => Data[0xCD] != 0; set => Data[0xCD] = value ? 1 : 0; }
|
2019-05-15 01:36:43 +00:00
|
|
|
|
|
2017-09-17 20:07:12 +00:00
|
|
|
|
public override int MarkValue { get => SwapBits(Data[0xCF], 1, 2); protected set => Data[0xCF] = (byte)SwapBits(value, 1, 2); }
|
2017-05-13 03:32:36 +00:00
|
|
|
|
public override int PKRS_Days { get => Math.Max((sbyte)Data[0xD0], (sbyte)0); set => Data[0xD0] = (byte)(value == 0 ? 0xFF : value & 0xF); }
|
|
|
|
|
public int ShadowID { get => BigEndian.ToUInt16(Data, 0xD8); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xD8); }
|
|
|
|
|
public int Purification { get => BigEndian.ToInt32(Data, 0xDC); set => BigEndian.GetBytes(value).CopyTo(Data, 0xDC); }
|
|
|
|
|
public uint EXP_Shadow { get => BigEndian.ToUInt32(Data, 0xC0); set => BigEndian.GetBytes(value).CopyTo(Data, 0xC0); }
|
2019-05-15 01:36:43 +00:00
|
|
|
|
// public bool Obedient { get => Data[0xF8] == 1; set => Data[0xF8] = (byte)(value ? 1 : 0); }
|
|
|
|
|
|
|
|
|
|
private int EncounterInfo { get => Data[0xFB]; set => Data[0xFB] = (byte)value; }
|
|
|
|
|
|
|
|
|
|
public override bool FatefulEncounter
|
|
|
|
|
{
|
|
|
|
|
get => (EncounterInfo & 1) == 1;
|
|
|
|
|
set => EncounterInfo = (byte)((EncounterInfo & ~(1 << 0)) | (value ? 1 << 0 : 0));
|
|
|
|
|
}
|
2016-09-26 23:15:40 +00:00
|
|
|
|
|
2020-10-07 05:36:27 +00:00
|
|
|
|
public const int Purified = -100;
|
|
|
|
|
public bool IsShadow => ShadowID != 0 && Purification != Purified;
|
|
|
|
|
|
2017-06-18 01:37:19 +00:00
|
|
|
|
protected override byte[] Encrypt()
|
2016-09-26 23:15:40 +00:00
|
|
|
|
{
|
|
|
|
|
return (byte[])Data.Clone();
|
|
|
|
|
}
|
2018-09-15 05:37:47 +00:00
|
|
|
|
|
2018-02-03 20:42:06 +00:00
|
|
|
|
public PK3 ConvertToPK3()
|
|
|
|
|
{
|
|
|
|
|
var pk = ConvertTo<PK3>();
|
|
|
|
|
pk.RefreshChecksum();
|
|
|
|
|
return pk;
|
|
|
|
|
}
|
2016-09-26 23:15:40 +00:00
|
|
|
|
}
|
|
|
|
|
}
|