PKHeX/PKHeX.Core/Ribbons/IRibbonSetMark8.cs
Lusamine ab33df2fc9
Enforce weather legality for SWSH (#3221)
* Add weather types by location

Creates a dictionary of possible weather types for each SWSH location.
Unlisted locations may only have Normal weather or do not have any
encounter slots.

* Prune unused weather from static encounters

Some encounters were too permissive with weather, e.g. Sandstorm in
Fields of Honor and Challenge Beach; Snowstorm at Dyna Tree Hill.

A few crossover areas that would have limited the possible weathers were
marked with a "(c)". An example is Nidorina from Giant's Bed crossing
to Frostpoint Field, where Raining and Thunderstorm do not occur.

This additionally organizes encounters by location.

* Move location-weather dictionary to EncounterArea8

* Verify weather marks on encounterslot/static encounters

* Adds some static encounters available through weather bleed

Weathers aren't normally available, but these static encounters are
close enough to the boundary that the weather in an adjacent area can be
used to spawn them.

- Frostpoint Field Snorlax with Raining/Thunderstorm from Giant's Bed
- Snowslide Slope Amaura with Raining/Thunderstorm from Giant's Bed
- Frigid Sea Carracosta with Intense_Sun from Three-Point Pass
- Frigid Sea Magmortar with Intense_Sun from Three-Point Pass
- Ballimere Lake Corviknight with Snowstorm from Giant's Bed
- Ballimere Lake Cryogonal with Snowstorm from Giant's Bed
- Ballimere Lake Tyrunt with all weather from Giant's Bed
- Lakeside Cave Ferrothorn with all weather from Ballimere Lake
- Tunnel to the Top Golbat with all weather from Path to the Peak

* Defer weather marks if incompatible, enforce encounterslot weather

This uses the area weather to check fishing slots and tentatively adds
some tables for weather bleed encounterslots.

* Warm-Up Tunnel gets weather bleed from Training Lowlands

* Update for base PKHeX

* Handle weather bleed for SWSH encounter slots

Co-authored-by: Skadiv <62726360+Skadiv@users.noreply.github.com>

* Minor clean

Having duplicate weather marks is illegal, so just auto-partial match them instead of checking the other marks.

* Rearrange slot weather check logic

* Claim reserved byte in SWSH pkl

* No need for two variable names now

* Valid weather marks on tree/fishing should return with main weather

* Fix tree/fishing deferral and add another surf slot weather bleed

* Disallow tree/fishing encounters from using bleed tables

None are currently known at this time, and only hidden grass encounters
have a weather bleed table

* Condense bleed expression, combine tree/fish flag check

* Move weather-bleed check into EncounterArea8

Makes the dictionaries private instead of internal.

Co-authored-by: Skadiv <62726360+Skadiv@users.noreply.github.com>
2021-07-26 14:28:05 -07:00

166 lines
No EOL
6.9 KiB
C#

namespace PKHeX.Core
{
/// <summary> Marks introduced in Generation 8 </summary>
public interface IRibbonSetMark8
{
bool RibbonMarkLunchtime { get; set; }
bool RibbonMarkSleepyTime { get; set; }
bool RibbonMarkDusk { get; set; }
bool RibbonMarkDawn { get; set; }
bool RibbonMarkCloudy { get; set; }
bool RibbonMarkRainy { get; set; }
bool RibbonMarkStormy { get; set; }
bool RibbonMarkSnowy { get; set; }
bool RibbonMarkBlizzard { get; set; }
bool RibbonMarkDry { get; set; }
bool RibbonMarkSandstorm { get; set; }
bool RibbonMarkMisty { get; set; }
bool RibbonMarkDestiny { get; set; }
bool RibbonMarkFishing { get; set; }
bool RibbonMarkCurry { get; set; }
bool RibbonMarkUncommon { get; set; }
bool RibbonMarkRare { get; set; }
bool RibbonMarkRowdy { get; set; }
bool RibbonMarkAbsentMinded { get; set; }
bool RibbonMarkJittery { get; set; }
bool RibbonMarkExcited { get; set; }
bool RibbonMarkCharismatic { get; set; }
bool RibbonMarkCalmness { get; set; }
bool RibbonMarkIntense { get; set; }
bool RibbonMarkZonedOut { get; set; }
bool RibbonMarkJoyful { get; set; }
bool RibbonMarkAngry { get; set; }
bool RibbonMarkSmiley { get; set; }
bool RibbonMarkTeary { get; set; }
bool RibbonMarkUpbeat { get; set; }
bool RibbonMarkPeeved { get; set; }
bool RibbonMarkIntellectual { get; set; }
bool RibbonMarkFerocious { get; set; }
bool RibbonMarkCrafty { get; set; }
bool RibbonMarkScowling { get; set; }
bool RibbonMarkKindly { get; set; }
bool RibbonMarkFlustered { get; set; }
bool RibbonMarkPumpedUp { get; set; }
bool RibbonMarkZeroEnergy { get; set; }
bool RibbonMarkPrideful { get; set; }
bool RibbonMarkUnsure { get; set; }
bool RibbonMarkHumble { get; set; }
bool RibbonMarkThorny { get; set; }
bool RibbonMarkVigor { get; set; }
bool RibbonMarkSlump { get; set; }
bool HasMark();
}
internal static partial class RibbonExtensions
{
public static bool HasWeatherMark(this IRibbonSetMark8 m)
{
return m.RibbonMarkCloudy || m.RibbonMarkRainy || m.RibbonMarkStormy || m.RibbonMarkSnowy
|| m.RibbonMarkBlizzard || m.RibbonMarkDry || m.RibbonMarkSandstorm || m.RibbonMarkMisty;
}
private static readonly string[] RibbonSetNamesMark8 =
{
nameof(IRibbonSetMark8.RibbonMarkLunchtime),
nameof(IRibbonSetMark8.RibbonMarkSleepyTime),
nameof(IRibbonSetMark8.RibbonMarkDusk),
nameof(IRibbonSetMark8.RibbonMarkDawn),
nameof(IRibbonSetMark8.RibbonMarkCloudy),
nameof(IRibbonSetMark8.RibbonMarkRainy),
nameof(IRibbonSetMark8.RibbonMarkStormy),
nameof(IRibbonSetMark8.RibbonMarkSnowy),
nameof(IRibbonSetMark8.RibbonMarkBlizzard),
nameof(IRibbonSetMark8.RibbonMarkDry),
nameof(IRibbonSetMark8.RibbonMarkSandstorm),
nameof(IRibbonSetMark8.RibbonMarkMisty),
nameof(IRibbonSetMark8.RibbonMarkDestiny),
nameof(IRibbonSetMark8.RibbonMarkFishing),
nameof(IRibbonSetMark8.RibbonMarkCurry),
nameof(IRibbonSetMark8.RibbonMarkUncommon),
nameof(IRibbonSetMark8.RibbonMarkRare),
nameof(IRibbonSetMark8.RibbonMarkRowdy),
nameof(IRibbonSetMark8.RibbonMarkAbsentMinded),
nameof(IRibbonSetMark8.RibbonMarkJittery),
nameof(IRibbonSetMark8.RibbonMarkExcited),
nameof(IRibbonSetMark8.RibbonMarkCharismatic),
nameof(IRibbonSetMark8.RibbonMarkCalmness),
nameof(IRibbonSetMark8.RibbonMarkIntense),
nameof(IRibbonSetMark8.RibbonMarkZonedOut),
nameof(IRibbonSetMark8.RibbonMarkJoyful),
nameof(IRibbonSetMark8.RibbonMarkAngry),
nameof(IRibbonSetMark8.RibbonMarkSmiley),
nameof(IRibbonSetMark8.RibbonMarkTeary),
nameof(IRibbonSetMark8.RibbonMarkUpbeat),
nameof(IRibbonSetMark8.RibbonMarkPeeved),
nameof(IRibbonSetMark8.RibbonMarkIntellectual),
nameof(IRibbonSetMark8.RibbonMarkFerocious),
nameof(IRibbonSetMark8.RibbonMarkCrafty),
nameof(IRibbonSetMark8.RibbonMarkScowling),
nameof(IRibbonSetMark8.RibbonMarkKindly),
nameof(IRibbonSetMark8.RibbonMarkFlustered),
nameof(IRibbonSetMark8.RibbonMarkPumpedUp),
nameof(IRibbonSetMark8.RibbonMarkZeroEnergy),
nameof(IRibbonSetMark8.RibbonMarkPrideful),
nameof(IRibbonSetMark8.RibbonMarkUnsure),
nameof(IRibbonSetMark8.RibbonMarkHumble),
nameof(IRibbonSetMark8.RibbonMarkThorny),
nameof(IRibbonSetMark8.RibbonMarkVigor),
nameof(IRibbonSetMark8.RibbonMarkSlump),
};
internal static bool[] RibbonBits(this IRibbonSetMark8 set)
{
return new[]
{
set.RibbonMarkLunchtime,
set.RibbonMarkSleepyTime,
set.RibbonMarkDusk,
set.RibbonMarkDawn,
set.RibbonMarkCloudy,
set.RibbonMarkRainy,
set.RibbonMarkStormy,
set.RibbonMarkSnowy,
set.RibbonMarkBlizzard,
set.RibbonMarkDry,
set.RibbonMarkSandstorm,
set.RibbonMarkMisty,
set.RibbonMarkDestiny,
set.RibbonMarkFishing,
set.RibbonMarkCurry,
set.RibbonMarkUncommon,
set.RibbonMarkRare,
set.RibbonMarkRowdy,
set.RibbonMarkAbsentMinded,
set.RibbonMarkJittery,
set.RibbonMarkExcited,
set.RibbonMarkCharismatic,
set.RibbonMarkCalmness,
set.RibbonMarkIntense,
set.RibbonMarkZonedOut,
set.RibbonMarkJoyful,
set.RibbonMarkAngry,
set.RibbonMarkSmiley,
set.RibbonMarkTeary,
set.RibbonMarkUpbeat,
set.RibbonMarkPeeved,
set.RibbonMarkIntellectual,
set.RibbonMarkFerocious,
set.RibbonMarkCrafty,
set.RibbonMarkScowling,
set.RibbonMarkKindly,
set.RibbonMarkFlustered,
set.RibbonMarkPumpedUp,
set.RibbonMarkZeroEnergy,
set.RibbonMarkPrideful,
set.RibbonMarkUnsure,
set.RibbonMarkHumble,
set.RibbonMarkThorny,
set.RibbonMarkVigor,
set.RibbonMarkSlump,
};
}
internal static string[] RibbonNames(this IRibbonSetMark8 _) => RibbonSetNamesMark8;
}
}