2424using System . Threading . Tasks ;
2525using System . Windows ;
2626using System . Windows . Controls ;
27+ using System . Windows . Documents ;
2728using System . Windows . Media ;
2829using System . Windows . Media . Imaging ;
30+ using System . Windows . Navigation ;
2931using System . Xml ;
3032
3133namespace PokemonManager {
@@ -2315,6 +2317,15 @@ public static bool CanSwitchPokemon(IPokemon pokemon) {
23152317 public static bool CanSwitchShadowPokemon ( IPokemon pokemon ) {
23162318 if ( IsHoldingPokemon ) {
23172319 bool needsNewLocation = pokemon . IsShadowPokemon && pokemon . GameSave != holdPokemon . Container . GameSave ;
2320+ if ( holdPokemon . Container . GameSave . GameType == GameTypes . XD ) {
2321+ if ( pokemon . IsShadowPokemon && holdPokemon . Container . Type == ContainerTypes . Daycare )
2322+ needsNewLocation = true ;
2323+ else if ( pokemon . IsShadowPokemon && holdPokemon . Container . Type == ContainerTypes . Purifier && holdPokemon . Index > 0 )
2324+ needsNewLocation = true ;
2325+ else if ( ! pokemon . IsShadowPokemon && holdPokemon . Container . Type == ContainerTypes . Purifier && holdPokemon . Index == 0 )
2326+ needsNewLocation = true ;
2327+ }
2328+
23182329 for ( int i = 0 ; i < pokemon . PokePC . NumBoxes && needsNewLocation ; i ++ ) {
23192330 for ( int j = 0 ; j < 30 && needsNewLocation ; j ++ ) {
23202331 if ( pokemon . PokePC [ i ] [ j ] == null ) {
@@ -2330,6 +2341,8 @@ public static bool CanSwitchShadowPokemon(IPokemon pokemon) {
23302341 public static bool CanSwitchEgg ( IPokemon pokemon ) {
23312342 if ( IsHoldingPokemon ) {
23322343 bool needsNewLocation = pokemon . IsEgg && ( holdPokemon . Container . GameType == GameTypes . Colosseum || holdPokemon . Container . GameType == GameTypes . XD ) ;
2344+ if ( pokemon . IsEgg && holdPokemon . Container . Type == ContainerTypes . Daycare )
2345+ needsNewLocation = true ;
23332346 for ( int i = 0 ; i < pokemon . PokePC . NumBoxes && needsNewLocation ; i ++ ) {
23342347 for ( int j = 0 ; j < 30 && needsNewLocation ; j ++ ) {
23352348 if ( pokemon . PokePC [ i ] [ j ] == null ) {
@@ -2365,6 +2378,16 @@ public static void SwitchPokemon(IPokemon pokemon) {
23652378 // Try to make the pokemon drop in the current game. It's only required for shadow Pokemon though.
23662379 bool needsNewLocation = ( pokemon . IsShadowPokemon && pokemon . GameSave != holdPokemon . Container . GameSave ) ||
23672380 ( pokemon . IsEgg && ( holdPokemon . Container . GameType == GameTypes . Colosseum || holdPokemon . Container . GameType == GameTypes . XD ) ) ;
2381+ if ( holdPokemon . Container . GameSave . GameType == GameTypes . XD ) {
2382+ if ( pokemon . IsShadowPokemon && holdPokemon . Container . Type == ContainerTypes . Daycare )
2383+ needsNewLocation = true ;
2384+ else if ( pokemon . IsShadowPokemon && holdPokemon . Container . Type == ContainerTypes . Purifier && holdPokemon . Index > 0 )
2385+ needsNewLocation = true ;
2386+ else if ( ! pokemon . IsShadowPokemon && holdPokemon . Container . Type == ContainerTypes . Purifier && holdPokemon . Index == 0 )
2387+ needsNewLocation = true ;
2388+ }
2389+ if ( pokemon . IsEgg && holdPokemon . Container . Type == ContainerTypes . Daycare )
2390+ needsNewLocation = true ;
23682391 for ( int i = 0 ; i < pokemon . PokePC . NumBoxes && needsNewLocation ; i ++ ) {
23692392 for ( int j = 0 ; j < 30 && needsNewLocation ; j ++ ) {
23702393 if ( pokemon . PokePC [ i ] [ j ] == null ) {
@@ -2400,6 +2423,8 @@ public static void DropPokemon() {
24002423 holdPokemon . Pokemon . IsMoving = false ;
24012424 if ( holdPokemon . Container . Type == ContainerTypes . Party )
24022425 ( ( IPokeParty ) holdPokemon . Container ) . AddPokemon ( holdPokemon . Pokemon ) ;
2426+ else if ( holdPokemon . Container . Type == ContainerTypes . Daycare && holdPokemon . Index < 2 )
2427+ ( ( IDaycare ) holdPokemon . Container ) . AddPokemon ( holdPokemon . Pokemon ) ;
24032428 else if ( holdPokemon . Container . Type == ContainerTypes . Purifier && holdPokemon . Index > 0 )
24042429 ( ( XDPurificationChamber ) holdPokemon . Container ) . AddPokemon ( holdPokemon . Pokemon ) ;
24052430 else
0 commit comments