kipyin / pokemaster

Checkout kipyin/pokemaster2 !
https://github.com/kipyin/pokemaster2
2 stars 2 forks source link

Feature: add weathers support #17

Closed kipyin closed 5 years ago

kipyin commented 5 years ago

Feature Description and Rationale

Weathers (on Bulbapedia) are part of the battle mechanisms. By changing the battle environment, they can "activate Abilities, modify certain moves, and potentially damage the Pokémon in battle or affecting their stats." In the games, weathers have a duration, which determines how long the weather lasts.

Usage Examples

>>> from pokemaster.weather import Weather
>>> # Creates a 'Harsh Sunlight' weather that lasts 5 turns:
>>> harsh_sunlight = Weather('Harsh Sunlight', duration=5)
>>> harsh_sunlight
Weather(name='harsh-sunlight', duration=5)
>>> # Default weather
>>> clear_skies = Weather('clear-skies')
>>> clear_skies
Weather(name='clear-skies', duration=inf)

Implementation Suggestions

@attr.s(auto_attribs=True, slots=True)
class Weather:
    name: str = attr.ib(
        validator=weather_name_validator, converter=weather_name_converter
    )
    duration: Union[int, float] = float('inf')
kipyin commented 5 years ago

Maybe we should add all the weather descriptions? Such as all the descriptions for Harsh Sunlight?

SUPPORTED_WEATHERS: Final = {
    "clear-skies": {},
    "harsh-sunlight": {
        3: {
            "naturally": "The sunlight is strong.",
            "sunny-day": "The sunlight got bright!",
            "drought": "(Wild/Foe) <Pokémon>'s Drought intensified the sun's rays!",
            "after-turn": "The sunlight is strong.",
            "end": "The sunlight faded.",
        },
        4: {...},
    },
    ...
}
kipyin commented 5 years ago

Basically, description = SUPPORTED_WEATHERS[weather_name][generation][activating_event]