Repository: hsahovic/poke-env

Issue:
Showdown team parser doesn't support gmax syntax
**Summary**:
When using `Teambuilder#parse_showdown_team`, the nickname will be parsed incorrectly when parsing a gmax pokemon.


**Actual outcome**:
Nickname will be parsed as "Gigantamax: Yes".


**Expected outcome**
Nickname parsed as "Coalossal". Potentially a gmax flag set as True/False/None.


**Example**:
```
Coalossal @ Weakness Policy  
Ability: Steam Engine  
Level: 50  
Gigantamax: Yes  
EVs: 252 HP / 252 SpA / 4 SpD  
Modest Nature  
IVs: 0 Atk  
- Heat Wave  
- Meteor Beam  
- Protect  
- Solar Beam  
```

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/hsahovic/poke-env/pull/127?src=pr&el=h1) Report
> Merging [#127](https://codecov.io/gh/hsahovic/poke-env/pull/127?src=pr&el=desc) (e860d30) into [master](https://codecov.io/gh/hsahovic/poke-env/commit/872e49883a144a1046124e7b1f263f2728430647?el=desc) (872e498) will **increase** coverage by `0.03%`.
> The diff coverage is `100.00%`.


```diff
@@            Coverage Diff             @@
##           master     #127      +/-   ##
==========================================
+ Coverage   84.98%   85.01%   +0.03%     
==========================================
  Files          34       34              
  Lines        2950     2957       +7     
==========================================
+ Hits         2507     2514       +7     
  Misses        443      443              
```


Patch:
diff --git a/fixture_data/gmax.showdown b/fixture_data/gmax.showdown
new file mode 100644
index 0000000..252929c
--- /dev/null
+++ b/fixture_data/gmax.showdown
@@ -0,0 +1,60 @@
+Coalossal @ Weakness Policy
+Ability: Steam Engine
+Level: 50
+Gigantamax: Yes
+EVs: 252 HP / 1 Atk / 252 SpA / 4 SpD
+Modest Nature
+IVs: 0 Atk
+- Heat Wave
+- Meteor Beam
+- Protect
+- Solar Beam
+
+Corviknight @ Choice Band
+Ability: Mirror Armor
+Gigantamax: Yes
+EVs: 248 HP / 252 Atk / 1 Def / 8 SpA
+Brave Nature
+- Air Slash
+- Bulk Up
+- Flash Cannon
+- Iron Head
+
+Venusaur @ Choice Band
+Ability: Chlorophyll
+Gigantamax: Yes
+EVs: 252 HP / 4 Atk / 1 SpA / 252 Spe
+Hasty Nature
+- Double-Edge
+- Leaf Storm
+- Protect
+- Sleep Powder
+
+Snorlax @ Aguav Berry
+Ability: Gluttony
+EVs: 252 HP / 252 Atk / 1 Def / 4 SpA
+Brave Nature
+- Curse
+- Fire Blast
+- Gunk Shot
+- Heavy Slam
+
+Butterfree-Gmax @ Figy Berry
+Ability: Tinted Lens
+Gigantamax: Yes
+EVs: 248 HP / 8 Atk / 1 SpA / 252 SpD
+Gentle Nature
+- Baton Pass
+- Double-Edge
+- Giga Drain
+- Protect
+
+Gengar-Gmax @ Life Orb
+Ability: Cursed Body
+EVs: 252 Atk / 1 Def / 4 SpD / 252 Spe
+Jolly Nature
+- Disable
+- Explosion
+- Focus Punch
+- Haze
+
diff --git a/fixture_data/teams.json b/fixture_data/teams.json
index 5d9ee2e..403ae8e 100644
--- a/fixture_data/teams.json
+++ b/fixture_data/teams.json
@@ -1,4 +1,10 @@
 {
+    "gen8nationaldexag": [
+        {
+            "showdown-file": "gmax.showdown",
+            "packed-format": "Coalossal||weaknesspolicy|steamengine|heatwave,meteorbeam,protect,solarbeam|Modest|252,1,,252,4,||,0,,,,||50|,,,G]Corviknight||choiceband|mirrorarmor|airslash,bulkup,flashcannon,ironhead|Brave|248,252,1,8,,|||||,,,G]Venusaur||choiceband|chlorophyll|doubleedge,leafstorm,protect,sleeppowder|Hasty|252,4,,1,,252|||||,,,G]Snorlax||aguavberry|gluttony|curse,fireblast,gunkshot,heavyslam|Brave|252,252,1,4,,|||||]Butterfree-Gmax||figyberry|tintedlens|batonpass,doubleedge,gigadrain,protect|Gentle|248,8,,1,252,|||||,,,G]Gengar-Gmax||lifeorb|cursedbody|disable,explosion,focuspunch,haze|Jolly|,252,1,,4,252|||||"
+        }
+    ],
     "gen8ubers": [
         {
             "showdown-file": "clefable dugtrio.showdown",
diff --git a/src/poke_env/teambuilder/teambuilder.py b/src/poke_env/teambuilder/teambuilder.py
index b5f6f91..19ecb33 100644
--- a/src/poke_env/teambuilder/teambuilder.py
+++ b/src/poke_env/teambuilder/teambuilder.py
@@ -77,6 +77,8 @@ class Teambuilder(ABC):
                 current_mon.moves.append(line)
             elif line.startswith("Shiny"):
                 current_mon.shiny = line.strip().endswith("Yes")
+            elif line.startswith("Gigantamax"):
+                current_mon.gmax = line.strip().endswith("Yes")
             elif line.strip().endswith(" Nature"):
                 nature = line.strip().replace(" Nature", "")
                 current_mon.nature = nature
diff --git a/src/poke_env/teambuilder/teambuilder_pokemon.py b/src/poke_env/teambuilder/teambuilder_pokemon.py
index 2cfa4e3..1466858 100644
--- a/src/poke_env/teambuilder/teambuilder_pokemon.py
+++ b/src/poke_env/teambuilder/teambuilder_pokemon.py
@@ -43,6 +43,7 @@ class TeambuilderPokemon:
         level=None,
         happiness=None,
         hiddenpowertype=None,
+        gmax=None,
     ):
         self.nickname = nickname
         self.species = species
@@ -54,6 +55,7 @@ class TeambuilderPokemon:
         self.level = level
         self.happiness = happiness
         self.hiddenpowertype = hiddenpowertype
+        self.gmax = gmax
 
         if evs is not None:
             self.evs = evs
@@ -96,8 +98,12 @@ class TeambuilderPokemon:
 
     @property
     def formatted_endstring(self) -> str:
-        if self.hiddenpowertype:
+        if self.hiddenpowertype and self.gmax:
+            return ",%s,,G" % self.hiddenpowertype
+        elif self.hiddenpowertype:
             return ",%s," % self.hiddenpowertype
+        elif self.gmax:
+            return ",,,G"
         return ""
 
     @property


Test patch:
diff --git a/unit_tests/teambuilder/test_teambuilder_pokemon.py b/unit_tests/teambuilder/test_teambuilder_pokemon.py
index 509f2a8..ec327d3 100644
--- a/unit_tests/teambuilder/test_teambuilder_pokemon.py
+++ b/unit_tests/teambuilder/test_teambuilder_pokemon.py
@@ -17,9 +17,10 @@ def test_teambuilder_pokemon_formatting():
         level=84,
         happiness=134,
         hiddenpowertype="water",
+        gmax=True,
     )
     assert (
         tp.formatted
         == "testy|dragonair|choiceband|shedskin|tackle,watergun,hiddenpower|Adamant||M|\
-|S|84|134,water,"
+|S|84|134,water,,G"
     )