PKHeX/PKHeX.Core/Ribbons/RibbonIndex.cs

131 lines
3 KiB
C#
Raw Normal View History

namespace PKHeX.Core
{
/// <summary>
/// Ribbon Indexes for Generation 8
/// </summary>
public enum RibbonIndex
{
ChampionKalos,
ChampionG3,
ChampionSinnoh,
BestFriends,
Training,
BattlerSkillful,
BattlerExpert,
Effort,
Alert,
Shock,
Downcast,
Careless,
Relax,
Snooze,
Smile,
Gorgeous,
Royal,
GorgeousRoyal,
Artist,
Footprint,
Record,
Legend,
Country,
National,
Earth,
World,
Classic,
Premier,
Event,
Birthday,
Special,
Souvenir,
Wishing,
ChampionBattle,
ChampionRegional,
ChampionNational,
ChampionWorld,
CountMemoryContest,
CountMemoryBattle,
ChampionG6Hoenn,
ContestStar,
MasterCoolness,
MasterBeauty,
MasterCuteness,
MasterCleverness,
MasterToughness,
ChampionAlola,
BattleRoyale,
BattleTreeGreat,
BattleTreeMaster,
ChampionGalar,
TowerMaster,
MasterRank,
MarkLunchtime,
MarkSleepyTime,
MarkDusk,
MarkDawn,
MarkCloudy,
MarkRainy,
MarkStormy,
MarkSnowy,
MarkBlizzard,
MarkDry,
MarkSandstorm,
MarkMisty,
MarkDestiny,
MarkFishing,
MarkCurry,
MarkUncommon,
MarkRare,
MarkRowdy,
MarkAbsentMinded,
MarkJittery,
MarkExcited,
MarkCharismatic,
MarkCalmness,
MarkIntense,
MarkZonedOut,
MarkJoyful,
MarkAngry,
MarkSmiley,
MarkTeary,
MarkUpbeat,
MarkPeeved,
MarkIntellectual,
MarkFerocious,
MarkCrafty,
MarkScowling,
MarkKindly,
MarkFlustered,
MarkPumpedUp,
MarkZeroEnergy,
MarkPrideful,
MarkUnsure,
MarkHumble,
MarkThorny,
MarkVigor,
MarkSlump,
Pioneer,
TwinklingStar,
}
public static class RibbonIndexExtensions
{
public static bool GetRibbonIndex(this IRibbonIndex x, RibbonIndex r) => x.GetRibbon((int)r);
public static void SetRibbonIndex(this IRibbonIndex x, RibbonIndex r, bool value = true) => x.SetRibbon((int)r, value);
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 21:28:05 +00:00
public static AreaWeather8 GetWeather8(this RibbonIndex x) => x switch
{
RibbonIndex.MarkCloudy => AreaWeather8.Overcast,
RibbonIndex.MarkRainy => AreaWeather8.Raining,
RibbonIndex.MarkStormy => AreaWeather8.Thunderstorm,
RibbonIndex.MarkDry => AreaWeather8.Intense_Sun,
RibbonIndex.MarkSnowy => AreaWeather8.Snowing,
RibbonIndex.MarkBlizzard => AreaWeather8.Snowstorm,
RibbonIndex.MarkSandstorm => AreaWeather8.Sandstorm,
RibbonIndex.MarkMisty => AreaWeather8.Heavy_Fog,
_ => AreaWeather8.None,
};
}
}