2018-08-03 03:11:42 +00:00
|
|
|
|
using System;
|
2020-09-13 21:40:10 +00:00
|
|
|
|
using System.Collections.Generic;
|
2020-08-30 17:23:22 +00:00
|
|
|
|
using System.Linq;
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
2018-03-09 05:18:32 +00:00
|
|
|
|
{
|
2019-09-10 07:21:51 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Shadow Pokémon Encounter found in <see cref="GameVersion.CXD"/>
|
|
|
|
|
/// </summary>
|
2020-11-27 19:51:02 +00:00
|
|
|
|
/// <inheritdoc cref="EncounterStatic"/>
|
2020-09-13 21:40:10 +00:00
|
|
|
|
public sealed class EncounterStaticShadow : EncounterStatic
|
2018-03-09 05:18:32 +00:00
|
|
|
|
{
|
2020-09-13 21:40:10 +00:00
|
|
|
|
public override int Generation => 3;
|
|
|
|
|
|
2019-09-10 07:21:51 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Team Specification with required <see cref="Species"/>, <see cref="Nature"/> and Gender.
|
|
|
|
|
/// </summary>
|
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
|
|
|
|
public readonly TeamLock[] Locks;
|
2019-09-10 07:21:51 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initial Shadow Gauge value.
|
|
|
|
|
/// </summary>
|
2020-12-22 01:48:08 +00:00
|
|
|
|
public int Gauge { get; init; }
|
2019-09-10 07:21:51 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Originates from the EReader scans (Japanese Only)
|
|
|
|
|
/// </summary>
|
2020-09-13 21:40:10 +00:00
|
|
|
|
public bool EReader => ReferenceEquals(IVs, EReaderEmpty);
|
|
|
|
|
|
|
|
|
|
public static readonly IReadOnlyList<int> EReaderEmpty = new[] {0,0,0,0,0,0};
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
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
|
|
|
|
public EncounterStaticShadow(TeamLock[] locks) => Locks = locks;
|
2020-09-13 21:40:10 +00:00
|
|
|
|
public EncounterStaticShadow() : this(Array.Empty<TeamLock>()) { }
|
2020-08-30 17:23:22 +00:00
|
|
|
|
|
|
|
|
|
private static readonly int[] MirorBXDLocations =
|
|
|
|
|
{
|
|
|
|
|
090, // Rock
|
|
|
|
|
091, // Oasis
|
|
|
|
|
092, // Cave
|
|
|
|
|
113, // Pyrite Town
|
|
|
|
|
059, // Realgam Tower
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-13 21:40:10 +00:00
|
|
|
|
protected override bool IsMatchEggLocation(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
return true; // transfer location verified later
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-30 17:23:22 +00:00
|
|
|
|
protected override bool IsMatchLocation(PKM pkm)
|
|
|
|
|
{
|
|
|
|
|
if (pkm.Format != 3)
|
|
|
|
|
return true; // transfer location verified later
|
|
|
|
|
|
|
|
|
|
var met = pkm.Met_Location;
|
|
|
|
|
if (Version == GameVersion.XD)
|
|
|
|
|
{
|
|
|
|
|
if (met == Location)
|
|
|
|
|
return true;
|
|
|
|
|
return MirorBXDLocations.Contains(met);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return met == Location;
|
|
|
|
|
}
|
2020-09-13 21:40:10 +00:00
|
|
|
|
|
|
|
|
|
protected override bool IsMatchLevel(PKM pkm, DexLevel evo)
|
|
|
|
|
{
|
|
|
|
|
if (pkm.Format != 3) // Met Level lost on PK3=>PK4
|
|
|
|
|
return Level <= evo.Level;
|
|
|
|
|
|
|
|
|
|
return pkm.Met_Level == Level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
|
|
|
|
|
{
|
|
|
|
|
base.ApplyDetails(sav, criteria, pk);
|
|
|
|
|
((IRibbonSetEvent3)pk).RibbonNational = true;
|
|
|
|
|
}
|
2018-10-21 02:03:04 +00:00
|
|
|
|
}
|
2020-08-30 17:23:22 +00:00
|
|
|
|
}
|