Skip to content

Commit

Permalink
Handle Bridge Field->Stony Wilderness berry tree
Browse files Browse the repository at this point in the history
Closes #2610
  • Loading branch information
kwsch committed Dec 29, 2019
1 parent d6471e2 commit 9864f23
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion PKHeX.Core/Legality/Encounters/Data/Encounters8.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using static PKHeX.Core.EncounterUtil;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using static PKHeX.Core.EncounterUtil;
using static PKHeX.Core.Shiny;
using static PKHeX.Core.GameVersion;

Expand Down Expand Up @@ -49,6 +52,27 @@ static Encounters8()

MarkEncountersGeneration(8, SlotsSW, SlotsSH);
MarkEncountersGeneration(8, StaticSW, StaticSH, TradeGift_SWSH);

CopyBerryTreeFromBridgeFieldToStony(SlotsSW_Hidden, 26);
CopyBerryTreeFromBridgeFieldToStony(SlotsSH_Hidden, 25);
}

private static void CopyBerryTreeFromBridgeFieldToStony(IReadOnlyList<EncounterArea8> arr, int start)
{
// The Berry Trees in Bridge Field are right against the map boundary, and can be accessed on the adjacent Map ID (Stony Wilderness)
// Copy the two Berry Tree encounters from Bridge to Stony, as these aren't overworld (wandering) crossover encounters.
var bridge = arr[13];
Debug.Assert(bridge.Location == 142);
var stony = arr[31];
Debug.Assert(stony.Location == 144);

var ss = stony.Slots;
var ssl = ss.Length;
Array.Resize(ref ss, ssl + 2);
Array.Copy(bridge.Slots, start, ss, ssl, 2);
Debug.Assert(((EncounterSlot8)ss[ssl]).Weather == AreaWeather8.Shaking_Trees);
Debug.Assert(((EncounterSlot8)ss[ssl+1]).Weather == AreaWeather8.Shaking_Trees);
stony.Slots = ss;
}

private static readonly EncounterStatic[] Encounter_SWSH =
Expand Down

0 comments on commit 9864f23

Please sign in to comment.