From 3a1389d719581d2524b6403d5dc2ff506c877a03 Mon Sep 17 00:00:00 2001 From: MoeBoy76 Date: Fri, 17 Nov 2023 10:18:44 +1100 Subject: [PATCH 01/26] start of missing battle messages --- common/src/main/resources/assets/cobblemon/lang/en_us.json | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 4dd04e85ff..cbc9985745 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -1083,6 +1083,7 @@ "cobblemon.battle.zpower": "%1$s surrounded itself with its Z-Power!", "cobblemon.battle.zbroken": "%1$s couldn't fully protect itself and got hurt!", + "cobblemon.battle.zbroken.guardianofalola": "%1$s couldn't fully protect itself and got hurt!", "cobblemon.battle.terastallize": "%1$s has Terastallized into the %2$s-type!", From d83a1086d3b963e7ac4dec43d81b5084c94a8243 Mon Sep 17 00:00:00 2001 From: jeffw773 <49732785+jeffw773@users.noreply.github.com> Date: Thu, 16 Nov 2023 22:17:35 -0800 Subject: [PATCH 02/26] - Added start.futuresight --- common/src/main/resources/assets/cobblemon/lang/en_us.json | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index cbc9985745..1101722433 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -800,6 +800,7 @@ "cobblemon.battle.start.dynamax": "%1$s Dynamaxed!", "cobblemon.battle.start.gmax": "%1$s Gigantamaxed!", "cobblemon.battle.start.encore": "%1$s must do an encore!", + "cobblemon.battle.start.futuresight": "%1$s foresaw an attack!", "cobblemon.battle.fieldstart.electricterrain": "An electric current ran across the battlefield!", "cobblemon.battle.fieldstart.grassyterrain": "Grass grew to cover the battlefield!", From c7dee1bd538cb7441ac85ef40f7842a7484aa85a Mon Sep 17 00:00:00 2001 From: jeffw773 <49732785+jeffw773@users.noreply.github.com> Date: Thu, 16 Nov 2023 23:00:03 -0800 Subject: [PATCH 03/26] - Added some more -start flags --- .../main/resources/assets/cobblemon/lang/en_us.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 1101722433..f2e6cbd42a 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -801,6 +801,16 @@ "cobblemon.battle.start.gmax": "%1$s Gigantamaxed!", "cobblemon.battle.start.encore": "%1$s must do an encore!", "cobblemon.battle.start.futuresight": "%1$s foresaw an attack!", + "cobblemon.battle.start.ingrain": "%1$s planted its roots!", + "cobblemon.battle.start.healblock": "%1$s was prevented from healing!", + "cobblemon.battle.start.mimic": "%1$s learned %2$s!", + "cobblemon.battle.start.octolock": "%1$s can no longer escape because of Octolock!", + "cobblemon.battle.start.burnup": "%1$s burned itself out!", + "cobblemon.battle.start.conversion": "Converted type to %1$s's!", + "cobblemon.battle.start.conversion2": "Converted type to %1$s's!", + "cobblemon.battle.start.doomdesire": "%1$s chose Doom Desire as its destiny!", + "cobblemon.battle.start.doubleshock": "%1$s used up all of its electricity!", + "cobblemon.battle.fieldstart.electricterrain": "An electric current ran across the battlefield!", "cobblemon.battle.fieldstart.grassyterrain": "Grass grew to cover the battlefield!", From 683473c34c51512266c1ac47961fb79d2038e420 Mon Sep 17 00:00:00 2001 From: JazzMcNade Date: Fri, 17 Nov 2023 02:43:36 -0600 Subject: [PATCH 04/26] - Added activate.electricterrain --- common/src/main/resources/assets/cobblemon/lang/en_us.json | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index f2e6cbd42a..8c96dbe8b9 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -917,6 +917,7 @@ "cobblemon.battle.activate.infestation": "%1$s has become infested!", "cobblemon.battle.activate.phantomforce": "It broke through %1$s's protection!", "cobblemon.battle.activate.matblock": "%1$s was blocked by the kicked-up mat!", + "cobblemon.battle.activate.electricterrain": "%1$s surrounds itself with electrified terrain!", "cobblemon.battle.prepare.bounce": "%1$s sprang up!", "cobblemon.battle.prepare.dig": "%1$s burrowed its way under the ground!", From ca319764f0eaff88c572aa1390ef1213e533befa Mon Sep 17 00:00:00 2001 From: jmmcp Date: Fri, 17 Nov 2023 19:00:12 -0500 Subject: [PATCH 05/26] Added -activate langs for Ingrain, Mist, Poltergeist, Powder, Quash, Quick Guard, Safeguard, and Sketch. --- .../cobblemon/mod/common/battles/ShowdownInterpreter.kt | 4 ++++ .../src/main/resources/assets/cobblemon/lang/en_us.json | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index 8e5b4a6000..bb65ecb177 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -1017,6 +1017,10 @@ object ShowdownInterpreter { val moveName = message.moveAt(2)?.displayName ?: run { println(message.argumentAt(2)); "(Unrecognized: ${message.argumentAt(2)})".text() } battleLang("activate.forewarn", sourceName, moveName) } + // Includes held item of the target + "poltergeist" -> battleLang("activate.poltergeist", pokemonName, message.argumentAt(2)!!) + // Includes sketched move + "sketch" -> battleLang("activate.sketch", pokemonName, message.argumentAt(2)!!) "focussash", "focusband" -> battleLang("activate.focusband", pokemonName, message.effectAt(1)!!.typelessData) "maxguard", "protect" -> battleLang("activate.protect", pokemonName) "shadowforce", "hyperspacefury", "hyperspacehole" -> battleLang("activate.phantomforce", pokemonName) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 8c96dbe8b9..bc4e66b9cd 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -918,6 +918,14 @@ "cobblemon.battle.activate.phantomforce": "It broke through %1$s's protection!", "cobblemon.battle.activate.matblock": "%1$s was blocked by the kicked-up mat!", "cobblemon.battle.activate.electricterrain": "%1$s surrounds itself with electrified terrain!", + "cobblemon.battle.activate.ingrain": "%1$s anchored itself with its roots!", + "cobblemon.battle.activate.mist": "%1$s is protected by the mist!", + "cobblemon.battle.activate.poltergeist": "%1$s is about to be attacked by its %2$s!", + "cobblemon.battle.activate.powder": "When the flame touched the powder on the Pokémon, it exploded!", + "cobblemon.battle.activate.quash": "%1$s's move was postponed!", + "cobblemon.battle.activate.quickguard": "Quick Guard protected %1$s", + "cobblemon.battle.activate.safeguard": "%1$s is protected by Safeguard!", + "cobblemon.battle.activate.sketch": "%1$s sketched %2$s!", "cobblemon.battle.prepare.bounce": "%1$s sprang up!", "cobblemon.battle.prepare.dig": "%1$s burrowed its way under the ground!", From d1b651a8760745e09891ae7cf57a4e226f91e168 Mon Sep 17 00:00:00 2001 From: JazzMcNade Date: Fri, 17 Nov 2023 21:13:55 -0600 Subject: [PATCH 06/26] Added -activate langs for Grudge, Speedswap and Switcheroo. --- .../com/cobblemon/mod/common/battles/ShowdownInterpreter.kt | 4 ++++ common/src/main/resources/assets/cobblemon/lang/en_us.json | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index bb65ecb177..b4048c319e 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -1017,6 +1017,10 @@ object ShowdownInterpreter { val moveName = message.moveAt(2)?.displayName ?: run { println(message.argumentAt(2)); "(Unrecognized: ${message.argumentAt(2)})".text() } battleLang("activate.forewarn", sourceName, moveName) } + "grudge" -> { + val moveName = message.moveAt(2)?.displayName ?: run { println(message.argumentAt(2)); "(Unrecognized: ${message.argumentAt(2)})".text() } + battleLang("activate.grudge", pokemonName, moveName) + } // Includes held item of the target "poltergeist" -> battleLang("activate.poltergeist", pokemonName, message.argumentAt(2)!!) // Includes sketched move diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index bc4e66b9cd..1c46d13bd8 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -926,7 +926,10 @@ "cobblemon.battle.activate.quickguard": "Quick Guard protected %1$s", "cobblemon.battle.activate.safeguard": "%1$s is protected by Safeguard!", "cobblemon.battle.activate.sketch": "%1$s sketched %2$s!", - + "cobblemon.battle.activate.grudge": "%1$s's %2$s lost all of its PP due to the grudge!", + "cobblemon.battle.activate.speedswap": "%1$s switched Speed with its target!", + "cobblemon.battle.activate.switcheroo": "%1$s switched items with its target!", + "cobblemon.battle.prepare.bounce": "%1$s sprang up!", "cobblemon.battle.prepare.dig": "%1$s burrowed its way under the ground!", "cobblemon.battle.prepare.shelltrap": "%1$s set a shell trap!", From 87e8fcd7f7b44395de59498ba26ec36ced4eb3ff Mon Sep 17 00:00:00 2001 From: JazzMcNade Date: Fri, 17 Nov 2023 22:47:41 -0600 Subject: [PATCH 07/26] Added -end lang for Healblock and Skydrop. Added -fail for Skydrop --- common/src/main/resources/assets/cobblemon/lang/en_us.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 1c46d13bd8..f4b7d89cc7 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -1027,6 +1027,8 @@ "cobblemon.battle.end.substitute": "%1$s's substitute faded!", "cobblemon.battle.end.uproar": "%1$s calmed down.", "cobblemon.battle.end.powertrick": "%1$s switched its Attack and Defense!", + "cobblemon.battle.end.healblock": "%1$s's Heal Block wore off!", + "cobblemon.battle.end.skydrop": "%1$s was freed from the Sky Drop!", "cobblemon.battle.block.uproar": "But the uproar kept %1$s awake!", @@ -1036,6 +1038,7 @@ "cobblemon.battle.fail.teatime": "But nothing happened!", "cobblemon.battle.fail.slp": "But the target is already asleep!", "cobblemon.battle.fail.uproar": "%1$s can't sleep in an uproar!", + "cobblemon.battle.fail.skydrop": "%1$s is too heavy to be lifted!", "cobblemon.battle.sethp.painsplit": "The battlers shared their pain!", From 3b97a0c847e1258c27c550aaefacee23319b6ed6 Mon Sep 17 00:00:00 2001 From: jmmcp Date: Sat, 18 Nov 2023 16:02:58 -0500 Subject: [PATCH 08/26] Added -activate langs for Skill Swap and Wide Guard, -enditem langs for Corrosive Gas and Bug Bite, -fail lang for Aura Wheel, and allow for effectID to pass through as null in handle fail instruction for fails that don't have an effect, such as Baton Pass and Bide. --- .../com/cobblemon/mod/common/battles/ShowdownInterpreter.kt | 5 +++-- common/src/main/resources/assets/cobblemon/lang/en_us.json | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index b4048c319e..eeef2f7b6f 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -832,11 +832,12 @@ object ShowdownInterpreter { battle.dispatchWaiting(1.5F){ val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting val pokemonName = pokemon.getName() - val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting + val effectID = message.effectAt(1)?.id val lang = when (effectID) { + null -> battleLang("fail") // Some moves fail with no effect, so we default to generic fail lang (Example: Baton Pass when unable to switch) "shedtail" -> battleLang("fail.substitute", pokemonName) - "hyperspacefury" -> battleLang("fail.darkvoid", pokemonName) + "hyperspacefury", "aurawheel" -> battleLang("fail.darkvoid", pokemonName) // Moves that can only be used by one species and fail when any others try "corrosivegas" -> battleLang("fail.healblock", pokemonName) else -> battleLang("fail.$effectID", pokemonName) } diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index f4b7d89cc7..0f65d16487 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -929,6 +929,8 @@ "cobblemon.battle.activate.grudge": "%1$s's %2$s lost all of its PP due to the grudge!", "cobblemon.battle.activate.speedswap": "%1$s switched Speed with its target!", "cobblemon.battle.activate.switcheroo": "%1$s switched items with its target!", + "cobblemon.battle.activate.skillswap": "%1$s swapped Abilities with its target!", + "cobblemon.battle.activate.wideguard": "Wide Guard protected %1$s!", "cobblemon.battle.prepare.bounce": "%1$s sprang up!", "cobblemon.battle.prepare.dig": "%1$s burrowed its way under the ground!", @@ -1085,6 +1087,8 @@ "cobblemon.battle.enditem.powerherb": "%1$s became fully charged due to its Power Herb!", "cobblemon.battle.enditem.mirrorherb": "%1$s copied stat changes with its Mirror Herb!", "cobblemon.battle.enditem.whiteherb": "%1$s returned its status to normal using its White Herb!", + "cobblemon.battle.enditem.corrosivegas": "%3$s corroded %1$s's %2$s!", + "cobblemon.battle.enditem.stealeat": "%3$s stole and ate its target's %2$s!", "cobblemon.battle.heal.zeffect": "%1$s's HP was restored by the Z-Power!", "cobblemon.battle.heal.wish": "%1$s's wish came true!", From 09bc174401d7b6fec186de4769f84037c7ce0a3f Mon Sep 17 00:00:00 2001 From: JazzMcNade Date: Sun, 19 Nov 2023 04:26:13 -0600 Subject: [PATCH 09/26] Added code to display enditem.incinerate's message when it occurs. --- .../mod/common/battles/ShowdownInterpreter.kt | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index eeef2f7b6f..2216f9b129 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -1590,11 +1590,26 @@ object ShowdownInterpreter { */ fun handleEndItemInstruction(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList) { battle.dispatchGo { + val moveEffect = message.effect()?.id val battlePokemon = message.getBattlePokemon(0, battle) ?: return@dispatchGo - val item = message.effectAt(1) ?: return@dispatchGo + val itemEffect = message.effectAt(1) ?: return@dispatchGo + val itemText = message.argumentAt(1)!! + val pokemonName = battlePokemon.getName() + + val lang = when (moveEffect) { + "incinerate" -> { + battleLang("enditem.${moveEffect}", pokemonName, itemText.asTranslated()) + } + else -> null + } + + if(lang != null) { + battle.broadcastChatMessage(lang) + } + battlePokemon.heldItemManager.handleEndInstruction(battlePokemon, battle, message) battle.minorBattleActions[battlePokemon.uuid] = message - battlePokemon.contextManager.remove(item.id, BattleContext.Type.ITEM) + battlePokemon.contextManager.remove(itemEffect.id, BattleContext.Type.ITEM) if (message.hasOptionalArgument("eat")) { battlePokemon.entity?.playSound(CobblemonSounds.BERRY_EAT, 1F, 1F) } From a96ecfcdf2e7f88514f085734bb4212024323906 Mon Sep 17 00:00:00 2001 From: jmmcp Date: Sun, 19 Nov 2023 18:20:07 -0500 Subject: [PATCH 10/26] Added -fail instructions for Burn Up and Double Shock, as well as lang for healing moves and weight based moves against Dynamaxed mons failing --- .../com/cobblemon/mod/common/battles/ShowdownInterpreter.kt | 3 ++- common/src/main/resources/assets/cobblemon/lang/en_us.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index eeef2f7b6f..ba6e64a427 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -835,10 +835,11 @@ object ShowdownInterpreter { val effectID = message.effectAt(1)?.id val lang = when (effectID) { - null -> battleLang("fail") // Some moves fail with no effect, so we default to generic fail lang (Example: Baton Pass when unable to switch) + null, "burnup", "doubleshock" -> battleLang("fail") // Moves that use default fail lang. (Null included for moves that fail with no effect, for example: Baton Pass.) "shedtail" -> battleLang("fail.substitute", pokemonName) "hyperspacefury", "aurawheel" -> battleLang("fail.darkvoid", pokemonName) // Moves that can only be used by one species and fail when any others try "corrosivegas" -> battleLang("fail.healblock", pokemonName) + "dynamax" -> battleLang("fail.grassknot", pokemonName) // Covers weight moves that fail against dynamaxed Pokémon else -> battleLang("fail.$effectID", pokemonName) } battle.broadcastChatMessage(lang.red()) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 0f65d16487..7a5ce1be4e 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -1041,6 +1041,8 @@ "cobblemon.battle.fail.slp": "But the target is already asleep!", "cobblemon.battle.fail.uproar": "%1$s can't sleep in an uproar!", "cobblemon.battle.fail.skydrop": "%1$s is too heavy to be lifted!", + "cobblemon.battle.fail.heal": "%1$s's HP is full!", + "cobblemon.battle.fail.grassknot": "%1$s shook its head. It seems like it can't use this move...", "cobblemon.battle.sethp.painsplit": "The battlers shared their pain!", @@ -1080,7 +1082,6 @@ "cobblemon.battle.enditem.incinerate": "%1$s's %2$s was burned up!", "cobblemon.battle.enditem.airballoon": "%1$s's Air Balloon popped!", "cobblemon.battle.enditem.redcard": "%1$s held up its Red Card against %3$s!", - "cobblemon.battle.enditem.pluck": "%3$s stole and ate %1$s's %2$s!", "cobblemon.battle.enditem.berryjuice": "%1$s's Berry Juice activated!", "cobblemon.battle.enditem.generic": "%1$s used its %2$s!", "cobblemon.battle.enditem.mentalherb": "%1$s shook off mental effects due to its Mental Herb!", From a1e94b8200833a59a205f653a17ee131be1b40eb Mon Sep 17 00:00:00 2001 From: jmmcp Date: Wed, 22 Nov 2023 01:04:11 -0500 Subject: [PATCH 11/26] Added -activate langs for eerie spell and crafty shield. --- .../com/cobblemon/mod/common/battles/ShowdownInterpreter.kt | 2 +- common/src/main/resources/assets/cobblemon/lang/en_us.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index afee793d30..c23015f310 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -1005,7 +1005,7 @@ object ShowdownInterpreter { // Includes a 3rd argument being the magnitude level as a number "magnitude" -> battleLang("activate.magnitude", message.argumentAt(2)?.toIntOrNull() ?: 1) // Includes spited move and the PP it was reduced by - "spite" -> battleLang("activate.spite", pokemonName, message.argumentAt(2)!!, message.argumentAt(3)!!) + "spite", "eeriespell" -> battleLang("activate.spite", pokemonName, message.argumentAt(2)!!, message.argumentAt(3)!!) // Don't need additional lang, announced elsewhere "toxicdebris", "shedskin" -> return@dispatch GO "matblock" -> battleLang("activate.matblock", message.effectAt(2)!!.rawData) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 7a5ce1be4e..4740b980f3 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -931,6 +931,7 @@ "cobblemon.battle.activate.switcheroo": "%1$s switched items with its target!", "cobblemon.battle.activate.skillswap": "%1$s swapped Abilities with its target!", "cobblemon.battle.activate.wideguard": "Wide Guard protected %1$s!", + "cobblemon.battle.activate.craftyshield": "Crafty Shield protected %1$s!", "cobblemon.battle.prepare.bounce": "%1$s sprang up!", "cobblemon.battle.prepare.dig": "%1$s burrowed its way under the ground!", From e4c0eab8e25f6fe371a884102cb2d4d76a66432a Mon Sep 17 00:00:00 2001 From: jmmcp Date: Sun, 26 Nov 2023 00:02:04 -0500 Subject: [PATCH 12/26] Added -fieldactivate langs for Fairy Lock and Teatime, as well as a new handler for -invertboost instructions. --- .../mod/common/battles/ShowdownInterpreter.kt | 16 ++++++++++++++++ .../resources/assets/cobblemon/lang/en_us.json | 3 +++ 2 files changed, 19 insertions(+) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index c23015f310..b2fc15d50b 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -105,6 +105,7 @@ object ShowdownInterpreter { updateInstructions["|t:|"] = {_, _, _ -> } updateInstructions["|pp_update|"] = this::handlePpUpdateInstruction updateInstructions["|-immune"] = this::handleImmuneInstruction + updateInstructions["|-invertboost|"] = this::handleInvertBoostInstruction updateInstructions["|-status|"] = this::handleStatusInstruction updateInstructions["|-end|"] = this::handleEndInstruction updateInstructions["|-miss|"] = this::handleMissInstruction @@ -655,6 +656,21 @@ object ShowdownInterpreter { } } + /** + * Format: + * |-invertboost|POKEMON|MOVE + * + * The POKEMON had its stat changes inverted. + */ + private fun handleInvertBoostInstruction(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList) { + battle.dispatchWaiting { + val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting + val name = pokemon.getName() + battle.broadcastChatMessage(battleLang("invertboost", name)) + battle.minorBattleActions[pokemon.uuid] = message + } + } + /** * Format: * |move|POKEMON|MOVE|TARGET diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 4740b980f3..979303eaa3 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -836,6 +836,8 @@ "cobblemon.battle.fieldactivate.perishsong": "All Pokémon that heard the song will faint in three turns!", "cobblemon.battle.fieldactivate.iondeluge": "A deluge of ions showers the battlefield!", + "cobblemon.battle.fieldactivate.fairylock": "No one will be able to run away during the next turn!", + "cobblemon.battle.fieldactivate.teatime": "It's teatime! Everyone dug in to their Berries!", "cobblemon.battle.sidestart.stealthrock": "Polished stones float in the air around %1$s team!", "cobblemon.battle.sidestart.spikes": "Spikes were scattered on the ground all around %1$s team!", @@ -1063,6 +1065,7 @@ "cobblemon.battle.error.insufficient_pokemon.personal": "You have %1 usable Pokémon but you need %2.", "cobblemon.battle.error.pokemon_is_trapped": "[Unavailable choice] Can't switch: The active Pokémon is trapped", "cobblemon.battle.immune": "But %1$s is immune!", + "cobblemon.battle.invertboost": "%1$s's stat changes were inverted!", "cobblemon.battle.missed": "But it missed.", "cobblemon.battle.hit_count": "Hit %1$s times!", "cobblemon.battle.hit_count_singular": "Hit 1 time!", From c0a77aca2363f7ac6f735702d27bb52e31416e19 Mon Sep 17 00:00:00 2001 From: jeffw773 <49732785+jeffw773@users.noreply.github.com> Date: Sun, 26 Nov 2023 00:02:37 -0800 Subject: [PATCH 13/26] - Added battle language for Stockpile --- .../com/cobblemon/mod/common/battles/ShowdownInterpreter.kt | 1 + common/src/main/resources/assets/cobblemon/lang/en_us.json | 1 + 2 files changed, 2 insertions(+) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index b2fc15d50b..51c2258665 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -933,6 +933,7 @@ object ShowdownInterpreter { val lang = when (effectID) { "confusion", "perish3" -> return@dispatch GO // Skip "perish2", "perish1", "perish0" -> battleLang("start.perish", pokemon.getName(), effectID.last().digitToInt()) + "stockpile1", "stockpile2", "stockpile3" -> battleLang("start.stockpile", pokemon.getName(), effectID.last().digitToInt()) "dynamax" -> battleLang("start.${message.effectAt(2)?.id ?: effectID}", pokemon.getName()).yellow() "curse" -> battleLang("start.curse", message.getSourceBattlePokemon(battle)!!.getName(), pokemon.getName()) "disable" -> battleLang("start.disable", pokemon.getName(), message.effectAt(2)!!.rawData) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 979303eaa3..3204a7cf09 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -810,6 +810,7 @@ "cobblemon.battle.start.conversion2": "Converted type to %1$s's!", "cobblemon.battle.start.doomdesire": "%1$s chose Doom Desire as its destiny!", "cobblemon.battle.start.doubleshock": "%1$s used up all of its electricity!", + "cobblemon.battle.start.stockpile": "%1$s stockpiled %2$s!", "cobblemon.battle.fieldstart.electricterrain": "An electric current ran across the battlefield!", From 80ce5bab58a06f13a7b24150e2912c9f5cef2f4e Mon Sep 17 00:00:00 2001 From: jeffw773 <49732785+jeffw773@users.noreply.github.com> Date: Sun, 26 Nov 2023 01:25:15 -0800 Subject: [PATCH 14/26] - Added battle language for powertrick and powershift --- common/src/main/resources/assets/cobblemon/lang/en_us.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 3204a7cf09..de8adeb9c4 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -811,6 +811,8 @@ "cobblemon.battle.start.doomdesire": "%1$s chose Doom Desire as its destiny!", "cobblemon.battle.start.doubleshock": "%1$s used up all of its electricity!", "cobblemon.battle.start.stockpile": "%1$s stockpiled %2$s!", + "cobblemon.battle.start.powertrick": "%1$s switched its Attack and Defense!", + "cobblemon.battle.start.powershift": "%1$s swapped its offensive stats with its defensive stats!", "cobblemon.battle.fieldstart.electricterrain": "An electric current ran across the battlefield!", From 5b83e49669754c272a24bfabbcb61990e010b581 Mon Sep 17 00:00:00 2001 From: jmmcp Date: Sun, 26 Nov 2023 19:38:59 -0500 Subject: [PATCH 15/26] Added -start lang for type changing moves Camouflage, Conversion, and Conversion2, as well as -sidestart and -sideend langs for Lucky Chant and Mist. --- .../mod/common/battles/ShowdownInterpreter.kt | 1 + .../main/resources/assets/cobblemon/lang/en_us.json | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index b2fc15d50b..181c16eb4b 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -936,6 +936,7 @@ object ShowdownInterpreter { "dynamax" -> battleLang("start.${message.effectAt(2)?.id ?: effectID}", pokemon.getName()).yellow() "curse" -> battleLang("start.curse", message.getSourceBattlePokemon(battle)!!.getName(), pokemon.getName()) "disable" -> battleLang("start.disable", pokemon.getName(), message.effectAt(2)!!.rawData) + "typechange" -> battleLang("start.typechange", pokemon.getName(), message.effectAt(2)!!.rawData) // Covers generic typechange moves like Conversion, Conversion2, and Camouflage else -> battleLang("start.$effectID", pokemon.getName()) } battle.broadcastChatMessage(lang) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 979303eaa3..04a38193fe 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -806,8 +806,7 @@ "cobblemon.battle.start.mimic": "%1$s learned %2$s!", "cobblemon.battle.start.octolock": "%1$s can no longer escape because of Octolock!", "cobblemon.battle.start.burnup": "%1$s burned itself out!", - "cobblemon.battle.start.conversion": "Converted type to %1$s's!", - "cobblemon.battle.start.conversion2": "Converted type to %1$s's!", + "cobblemon.battle.start.typechange": "%1$s transformed into the %2$s type!", "cobblemon.battle.start.doomdesire": "%1$s chose Doom Desire as its destiny!", "cobblemon.battle.start.doubleshock": "%1$s used up all of its electricity!", @@ -847,7 +846,9 @@ "cobblemon.battle.sidestart.lightscreen": "Light Screen made %1$s team stronger against special moves!", "cobblemon.battle.sidestart.auroraveil": "Aurora Veil made %1$s team stronger against physical and special moves!", "cobblemon.battle.sidestart.tailwind": "The Tailwind blew from behind %1$s team!", - "cobblemon.battle.sidestart.safeguard": "%1$s's team cloaked itself in a mystical veil!", + "cobblemon.battle.sidestart.safeguard": "%1$s team cloaked itself in a mystical veil!", + "cobblemon.battle.sidestart.luckychant": "Lucky Chant shielded %1$s team from critical hits!", + "cobblemon.battle.sidestart.mist": "%1$s team became shrouded in mist!", "cobblemon.battle.sideend.stealthrock": "The pointed stones disappeared from around %1$s team!", "cobblemon.battle.sideend.spikes": "The spikes disappeared from the ground around %1$s team!", @@ -857,7 +858,9 @@ "cobblemon.battle.sideend.lightscreen": "%1$s team's Light Screen wore off!", "cobblemon.battle.sideend.auroraveil": "%1$s team's Aurora Veil wore off!", "cobblemon.battle.sideend.tailwind": "%1$s team's Tailwind petered out!", - "cobblemon.battle.sideend.safeguard": "%1$s's team is no longer protected by Safeguard!", + "cobblemon.battle.sideend.safeguard": "%1$s team is no longer protected by Safeguard!", + "cobblemon.battle.sideend.luckychant": "%1$s team's Lucky Chant wore off!", + "cobblemon.battle.sideend.mist": "%1$s team is no longer protected by mist!", "cobblemon.battle.cant.generic": "%1$s can't use %2$s!", "cobblemon.battle.cant.truant": "%1$s is loafing around!", @@ -934,6 +937,7 @@ "cobblemon.battle.activate.skillswap": "%1$s swapped Abilities with its target!", "cobblemon.battle.activate.wideguard": "Wide Guard protected %1$s!", "cobblemon.battle.activate.craftyshield": "Crafty Shield protected %1$s!", + "cobblemon.battle.activate.tidyup": "Tidying up complete!", "cobblemon.battle.prepare.bounce": "%1$s sprang up!", "cobblemon.battle.prepare.dig": "%1$s burrowed its way under the ground!", From 769a1862e4f1aff972552f5b295b87ce39aa33de Mon Sep 17 00:00:00 2001 From: jmmcp Date: Mon, 27 Nov 2023 22:25:54 -0500 Subject: [PATCH 16/26] Added -copyboost lang, new copyboost instruction handler, new copy method to ContextManager, silent optional argument check to -clearnegativeboost instruction handler, and tweaked -enditem instruction handler in CobblemonHeldItemManager to allow for cases with null source (example: Fling). --- .../mod/common/battles/ShowdownInterpreter.kt | 43 ++++++++++++------- .../battles/interpreter/ContextManager.kt | 9 ++++ .../helditem/CobblemonHeldItemManager.kt | 6 ++- .../assets/cobblemon/lang/en_us.json | 2 + 4 files changed, 43 insertions(+), 17 deletions(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index fecaa02dc6..919a71381f 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -98,6 +98,7 @@ object ShowdownInterpreter { updateInstructions["|-singlemove|"] = this::handleSingleMoveInstruction updateInstructions["|-prepare|"] = this::handlePrepareInstruction updateInstructions["|-swapboost"] = this::handleSwapBoostInstruction + updateInstructions["|-copyboost|"] = this::handleCopyBoostInstruction updateInstructions["|-swapsideconditions|"] = this::handleSilently updateInstructions["|-unboost|"] = { battle, line, remainingLines -> boostInstruction(battle, line, remainingLines, false) } updateInstructions["|-boost|"] = { battle, line, remainingLines -> boostInstruction(battle, line, remainingLines, true) } @@ -667,6 +668,7 @@ object ShowdownInterpreter { val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting val name = pokemon.getName() battle.broadcastChatMessage(battleLang("invertboost", name)) + pokemon.contextManager.add(getContextFromAction(message, BattleContext.Type.BOOST, battle)) battle.minorBattleActions[pokemon.uuid] = message } } @@ -1218,6 +1220,27 @@ object ShowdownInterpreter { } } + /** + * Format: + * |-copyboost|SOURCE|TARGET|[from]EFFECT + * + * Copies any stat changes from the TARGET Pokémon to the SOURCE Pokémon due to EFFECT. + */ + private fun handleCopyBoostInstruction(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList) { + battle.dispatchWaiting { + val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting + val pokemonName = pokemon.getName() + val targetPokemon = message.getBattlePokemon(1, battle) ?: return@dispatchWaiting + val targetPokemonName = targetPokemon.getName() + val lang = battleLang("copyboost.generic", pokemonName, targetPokemonName) + battle.broadcastChatMessage(lang) + + pokemon.contextManager.copy(targetPokemon.contextManager, BattleContext.Type.BOOST) + pokemon.contextManager.copy(targetPokemon.contextManager, BattleContext.Type.UNBOOST) + battle.minorBattleActions[pokemon.uuid] = message + } + } + /** * Format: * |-end|POKEMON|EFFECT @@ -1621,23 +1644,9 @@ object ShowdownInterpreter { */ fun handleEndItemInstruction(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList) { battle.dispatchGo { - val moveEffect = message.effect()?.id + // All logic regarding broadcasting battle messages is handled in CobblemonHeldItemManager val battlePokemon = message.getBattlePokemon(0, battle) ?: return@dispatchGo val itemEffect = message.effectAt(1) ?: return@dispatchGo - val itemText = message.argumentAt(1)!! - val pokemonName = battlePokemon.getName() - - val lang = when (moveEffect) { - "incinerate" -> { - battleLang("enditem.${moveEffect}", pokemonName, itemText.asTranslated()) - } - else -> null - } - - if(lang != null) { - battle.broadcastChatMessage(lang) - } - battlePokemon.heldItemManager.handleEndInstruction(battlePokemon, battle, message) battle.minorBattleActions[battlePokemon.uuid] = message battlePokemon.contextManager.remove(itemEffect.id, BattleContext.Type.ITEM) @@ -1767,6 +1776,10 @@ object ShowdownInterpreter { private fun handleClearNegativeBoostInstructions(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList) { val battlePokemon = message.getBattlePokemon(0, battle) ?: return val pokemonName = battlePokemon.getName() + // Checks if instruction is meant to be silent, in which case we do nothing + if (message.hasOptionalArgument("silent")) { + return + } battle.dispatchWaiting(1.5F) { val lang = when { message.hasOptionalArgument("zeffect") -> battleLang("clearallnegativeboost.zeffect", pokemonName) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/interpreter/ContextManager.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/interpreter/ContextManager.kt index 1a071bb6a7..62554129f5 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/interpreter/ContextManager.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/interpreter/ContextManager.kt @@ -73,6 +73,15 @@ class ContextManager { } } + /** Copies all the [BattleContext]s belonging to the [bucketTypes] buckets of the [with] manager's respective buckets. */ + fun copy(with: ContextManager, vararg bucketTypes: BattleContext.Type) { + bucketTypes.forEach { bucketType -> + val newContexts = with.buckets[bucketType]?.toMutableList() + this.clear(bucketType) + newContexts?.let { this.add(*it.toTypedArray()) } + } + } + /** Gets all [BattleContext]s belonging to the [bucketType] bucket. */ fun get(bucketType: BattleContext.Type) : Collection? { return buckets[bucketType] diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/helditem/CobblemonHeldItemManager.kt b/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/helditem/CobblemonHeldItemManager.kt index f1cf00333b..cc12668151 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/helditem/CobblemonHeldItemManager.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/helditem/CobblemonHeldItemManager.kt @@ -126,10 +126,12 @@ object CobblemonHeldItemManager : BaseCobblemonHeldItemManager() { this.take(pokemon, itemID) return } - val sourceName = battleMessage.getSourceBattlePokemon(battle)?.getName() ?: return // there MUST be a source + val source = battleMessage.getSourceBattlePokemon(battle) + val sourceName = source?.getName() val effect = battleMessage.effect() val text = when { - effect?.id != null -> battleLang("enditem.${effect.id}", battlerName, itemName, sourceName) + effect?.id != null && sourceName != null -> battleLang("enditem.${effect.id}", battlerName, itemName, sourceName) // Moves that have a source, for example: Knock Off + effect?.id != null && sourceName == null -> battleLang("enditem.${effect.id}", battlerName, itemName) // Moves that do not have a source, for example: Fling else -> when (itemID) { "boosterenergy", "electricseed", "grassyseed", "mistyseed", "psychicseed", "roomservice" -> battleLang("enditem.generic", battlerName, itemName) else -> battleLang("enditem.$itemID", battlerName) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 3ddd801760..80edf5eb09 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -964,6 +964,8 @@ "cobblemon.battle.swapboost.generic": "%1$s swapped stat boosts with %2$s!", + "cobblemon.battle.copyboost.generic": "%1$s copied %2$s's stat changes!", + "cobblemon.battle.singleturn.protect": "%1$s protected itself!", "cobblemon.battle.singleturn.endure": "%1$s braced itself!", "cobblemon.battle.singleturn.craftyshield": "Crafty Shield protected %1$s's team!", From f080fb5639172afeca6d080f39890db01b155436 Mon Sep 17 00:00:00 2001 From: jeffw773 <49732785+jeffw773@users.noreply.github.com> Date: Mon, 27 Nov 2023 20:07:34 -0800 Subject: [PATCH 17/26] - Added Substitute Start Language --- common/src/main/resources/assets/cobblemon/lang/en_us.json | 1 + 1 file changed, 1 insertion(+) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index de8adeb9c4..487070c533 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -813,6 +813,7 @@ "cobblemon.battle.start.stockpile": "%1$s stockpiled %2$s!", "cobblemon.battle.start.powertrick": "%1$s switched its Attack and Defense!", "cobblemon.battle.start.powershift": "%1$s swapped its offensive stats with its defensive stats!", + "cobblemon.battle.start.substitute": "%1$s put in a substitute!", "cobblemon.battle.fieldstart.electricterrain": "An electric current ran across the battlefield!", From 1dffbd1b37c24943cc8deaac6739f1a1c6082313 Mon Sep 17 00:00:00 2001 From: jmmcp Date: Mon, 27 Nov 2023 23:10:10 -0500 Subject: [PATCH 18/26] Added -start langs for embargo and general typeadd moves. --- .../com/cobblemon/mod/common/battles/ShowdownInterpreter.kt | 2 ++ common/src/main/resources/assets/cobblemon/lang/en_us.json | 2 ++ 2 files changed, 4 insertions(+) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index 919a71381f..5ed8568c29 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -940,6 +940,8 @@ object ShowdownInterpreter { "curse" -> battleLang("start.curse", message.getSourceBattlePokemon(battle)!!.getName(), pokemon.getName()) "disable" -> battleLang("start.disable", pokemon.getName(), message.effectAt(2)!!.rawData) "typechange" -> battleLang("start.typechange", pokemon.getName(), message.effectAt(2)!!.rawData) // Covers generic typechange moves like Conversion, Conversion2, and Camouflage + "typeadd" -> battleLang("start.typeadd", pokemon.getName(), message.effectAt(2)!!.rawData) // Covers generic typechange moves like Forest's Curse + "mimic" -> battleLang("start.mimic", pokemon.getName(), message.effectAt(2)!!.rawData) else -> battleLang("start.$effectID", pokemon.getName()) } battle.broadcastChatMessage(lang) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 80edf5eb09..83b2b9c7fc 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -816,6 +816,8 @@ "cobblemon.battle.start.stockpile": "%1$s stockpiled %2$s!", "cobblemon.battle.start.powertrick": "%1$s switched its Attack and Defense!", "cobblemon.battle.start.powershift": "%1$s swapped its offensive stats with its defensive stats!", + "cobblemon.battle.start.embargo": "%1$s can't use items anymore!", + "cobblemon.battle.start.typeadd": "%2$s type was added to %1$s!", "cobblemon.battle.fieldstart.electricterrain": "An electric current ran across the battlefield!", From a8567f919087b008f033fa701515760ce432cfc8 Mon Sep 17 00:00:00 2001 From: jmmcp Date: Mon, 27 Nov 2023 23:39:27 -0500 Subject: [PATCH 19/26] Added check for optional effects in handleStartInstruction to allow for proper handling of moves like Reflect Type. --- .../mod/common/battles/ShowdownInterpreter.kt | 33 ++++++++++++------- .../assets/cobblemon/lang/en_us.json | 1 + 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index 5ed8568c29..0dc35018e5 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -924,6 +924,10 @@ object ShowdownInterpreter { val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatch GO val effectID = message.effectAt(1)?.id ?: return@dispatch GO + val optionalEffect = message.effect() + val optionalPokemon = message.getSourceBattlePokemon(battle) + val optionalPokemonName = optionalPokemon?.getName() + // skip adding contexts for every time the perish counter decrements if (!effectID.contains("perish")) { // don't need to add unique: showdown won't send -start instruction if volatile status is already present @@ -932,19 +936,24 @@ object ShowdownInterpreter { battle.minorBattleActions[pokemon.uuid] = message if (!message.hasOptionalArgument("silent")) { - val lang = when (effectID) { - "confusion", "perish3" -> return@dispatch GO // Skip - "perish2", "perish1", "perish0" -> battleLang("start.perish", pokemon.getName(), effectID.last().digitToInt()) - "stockpile1", "stockpile2", "stockpile3" -> battleLang("start.stockpile", pokemon.getName(), effectID.last().digitToInt()) - "dynamax" -> battleLang("start.${message.effectAt(2)?.id ?: effectID}", pokemon.getName()).yellow() - "curse" -> battleLang("start.curse", message.getSourceBattlePokemon(battle)!!.getName(), pokemon.getName()) - "disable" -> battleLang("start.disable", pokemon.getName(), message.effectAt(2)!!.rawData) - "typechange" -> battleLang("start.typechange", pokemon.getName(), message.effectAt(2)!!.rawData) // Covers generic typechange moves like Conversion, Conversion2, and Camouflage - "typeadd" -> battleLang("start.typeadd", pokemon.getName(), message.effectAt(2)!!.rawData) // Covers generic typechange moves like Forest's Curse - "mimic" -> battleLang("start.mimic", pokemon.getName(), message.effectAt(2)!!.rawData) - else -> battleLang("start.$effectID", pokemon.getName()) + val lang = when (optionalEffect?.id) { + "reflecttype" -> optionalPokemonName?.let { battleLang("start.reflecttype", pokemon.getName(), it) } + else -> when (effectID) { + "confusion", "perish3" -> return@dispatch GO // Skip + "perish2", "perish1", "perish0" -> battleLang("start.perish", pokemon.getName(), effectID.last().digitToInt()) + "stockpile1", "stockpile2", "stockpile3" -> battleLang("start.stockpile", pokemon.getName(), effectID.last().digitToInt()) + "dynamax" -> battleLang("start.${message.effectAt(2)?.id ?: effectID}", pokemon.getName()).yellow() + "curse" -> battleLang("start.curse", message.getSourceBattlePokemon(battle)!!.getName(), pokemon.getName()) + "disable" -> battleLang("start.disable", pokemon.getName(), message.effectAt(2)!!.rawData) + "typechange" -> battleLang("start.typechange", pokemon.getName(), message.effectAt(2)!!.rawData) // Covers generic typechange moves like Conversion, Conversion2, and Camouflage + "typeadd" -> battleLang("start.typeadd", pokemon.getName(), message.effectAt(2)!!.rawData) // Covers generic typechange moves like Forest's Curse + "mimic" -> battleLang("start.mimic", pokemon.getName(), message.effectAt(2)!!.rawData) + else -> battleLang("start.$effectID", pokemon.getName()) + } + } + if (lang != null) { + battle.broadcastChatMessage(lang) } - battle.broadcastChatMessage(lang) } WaitDispatch(1F) } diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 6fab404e90..c190456471 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -819,6 +819,7 @@ "cobblemon.battle.start.substitute": "%1$s put in a substitute!", "cobblemon.battle.start.embargo": "%1$s can't use items anymore!", "cobblemon.battle.start.typeadd": "%2$s type was added to %1$s!", + "cobblemon.battle.start.reflecttype": "%1$s's type became the same as %2$s's type!", "cobblemon.battle.fieldstart.electricterrain": "An electric current ran across the battlefield!", From f695a9970507a7d5e72be25e6f98ecb828665285 Mon Sep 17 00:00:00 2001 From: jmmcp Date: Tue, 28 Nov 2023 00:31:13 -0500 Subject: [PATCH 20/26] Added -swapboost langs for Guard Swap, Power Swap, and Heart Swap, as well as -start lang for Tar Shot. --- .../cobblemon/mod/common/battles/ShowdownInterpreter.kt | 9 ++++++++- .../src/main/resources/assets/cobblemon/lang/en_us.json | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index 0dc35018e5..5075c5dba6 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -1222,7 +1222,14 @@ object ShowdownInterpreter { val pokemonName = pokemon.getName() val targetPokemon = message.getBattlePokemon(1, battle) ?: return@dispatchWaiting val targetPokemonName = targetPokemon.getName() - val lang = battleLang("swapboost.generic", pokemonName, targetPokemonName) + val effectID = message.effect()?.id ?: return@dispatchWaiting + val lang = when (effectID) { + "guardswap" -> battleLang("swapboost.guardswap", pokemonName) + "powerswap" -> battleLang("swapboost.powerswap", pokemonName) + "heartswap" -> battleLang("swapboost.heartswap", pokemonName) + else -> battleLang("swapboost.generic", pokemonName, targetPokemonName) + } + battle.broadcastChatMessage(lang) pokemon.contextManager.swap(targetPokemon.contextManager, BattleContext.Type.BOOST) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index c190456471..d6dbd3d66e 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -820,6 +820,7 @@ "cobblemon.battle.start.embargo": "%1$s can't use items anymore!", "cobblemon.battle.start.typeadd": "%2$s type was added to %1$s!", "cobblemon.battle.start.reflecttype": "%1$s's type became the same as %2$s's type!", + "cobblemon.battle.start.tarshot": "%1$s became weaker to fire!", "cobblemon.battle.fieldstart.electricterrain": "An electric current ran across the battlefield!", @@ -967,6 +968,9 @@ "cobblemon.battle.prepare.solarbeam": "%1$s absorbed light!", "cobblemon.battle.swapboost.generic": "%1$s swapped stat boosts with %2$s!", + "cobblemon.battle.swapboost.guardswap": "%1$s switched all changes to its Defense and Sp. Def with its target!", + "cobblemon.battle.swapboost.powerswap": "%1$s switched all changes to its Attack and Sp. Atk with its target!", + "cobblemon.battle.swapboost.heartswap": "%1$s switched stat changes with its target!", "cobblemon.battle.copyboost.generic": "%1$s copied %2$s's stat changes!", From 9e1c491d9c7b405789331318fc9841ffc11aec11 Mon Sep 17 00:00:00 2001 From: jeffw773 <49732785+jeffw773@users.noreply.github.com> Date: Mon, 27 Nov 2023 22:11:42 -0800 Subject: [PATCH 21/26] - Moe said it was okay --- .../mod/common/battles/ShowdownInterpreter.kt | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index 0dc35018e5..c3daf66a92 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -89,13 +89,14 @@ object ShowdownInterpreter { updateInstructions["|-fieldstart|"] = this::handleFieldStartInstructions updateInstructions["|-fieldend|"] = this::handleFieldEndInstructions updateInstructions["|-ability|"] = this::handleAbilityInstructions - //To-Do updateInstructions["|-endability|"] = this::handleEndAbilityInstruction + updateInstructions["|-endability|"] = this::handleEndAbilityInstruction updateInstructions["|-nothing"] = { battle, _, _ -> battle.dispatchGo { battle.broadcastChatMessage(battleLang("nothing")) } } updateInstructions["|-clearallboost"] = this::handleClearAllBoostInstructions updateInstructions["|-singleturn|"] = this::handleSingleTurnInstruction updateInstructions["|-singlemove|"] = this::handleSingleMoveInstruction + updateInstructions["|-transform|"] = this::handleTransformInstruction updateInstructions["|-prepare|"] = this::handlePrepareInstruction updateInstructions["|-swapboost"] = this::handleSwapBoostInstruction updateInstructions["|-copyboost|"] = this::handleCopyBoostInstruction @@ -977,6 +978,24 @@ object ShowdownInterpreter { } } + /** + * Format: + * |-transform|POKEMON|MOVE + * + * The Pokémon POKEMON used move MOVE which causes a temporary effect lasting the duration of the turn. + */ + private fun handleTransformInstruction(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList) { + battle.dispatchWaiting(1.5F) { + val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting + val pokemonName = pokemon.getName() + val sourceName = message.getSourceBattlePokemon(battle)?.getName() ?: return@dispatchWaiting + val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting + val lang = battleLang("singleturn.$effectID", pokemonName, sourceName) + battle.broadcastChatMessage(lang) + battle.minorBattleActions[pokemon.uuid] = message + } + } + /** * Format: * |-singlemove|POKEMON|MOVE @@ -994,6 +1013,23 @@ object ShowdownInterpreter { } } + /** + * Format: + * |-endability|POKEMON|MOVE + * + * The Pokémon POKEMON used move MOVE which causes a temporary effect lasting the duration of the move. + */ + private fun handleEndAbilityInstruction(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList) { + battle.dispatchWaiting(1.5F) { + val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting + val pokemonName = pokemon.getName() + val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting + val lang = battleLang("endability.$effectID", pokemonName) + battle.broadcastChatMessage(lang) + battle.minorBattleActions[pokemon.uuid] = message + } + } + /** * Format: * |-block|POKEMON|EFFECT|MOVE|ATTACKER From 31b185b96cf1828a8143a02f3db9ddcc50ef3cec Mon Sep 17 00:00:00 2001 From: jeffw773 <49732785+jeffw773@users.noreply.github.com> Date: Tue, 28 Nov 2023 00:06:52 -0800 Subject: [PATCH 22/26] - Added -endability and -transform handlers --- .../mod/common/battles/ShowdownInterpreter.kt | 19 ++++++++++--------- .../assets/cobblemon/lang/en_us.json | 2 ++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index 7445e05691..6bc2d774ba 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -980,17 +980,18 @@ object ShowdownInterpreter { /** * Format: - * |-transform|POKEMON|MOVE + * |-transform|POKEMON|POKEMON * - * The Pokémon POKEMON used move MOVE which causes a temporary effect lasting the duration of the turn. + * The Pokémon POKEMON used Transform to turn into Target Pokemon POKEMON */ private fun handleTransformInstruction(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList) { battle.dispatchWaiting(1.5F) { val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting val pokemonName = pokemon.getName() - val sourceName = message.getSourceBattlePokemon(battle)?.getName() ?: return@dispatchWaiting - val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting - val lang = battleLang("singleturn.$effectID", pokemonName, sourceName) + val targetPokemon = message.getBattlePokemon(1, battle) ?: return@dispatchWaiting + val targetPokemonName = targetPokemon.getName() + + val lang = battleLang("transform", pokemonName, targetPokemonName) battle.broadcastChatMessage(lang) battle.minorBattleActions[pokemon.uuid] = message } @@ -1015,16 +1016,16 @@ object ShowdownInterpreter { /** * Format: - * |-endability|POKEMON|MOVE + * |-endability|POKEMON * - * The Pokémon POKEMON used move MOVE which causes a temporary effect lasting the duration of the move. + * The Pokémon POKEMON's Ability was surpressed */ private fun handleEndAbilityInstruction(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList) { battle.dispatchWaiting(1.5F) { val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting val pokemonName = pokemon.getName() - val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting - val lang = battleLang("endability.$effectID", pokemonName) + + val lang = battleLang("endability", pokemonName) battle.broadcastChatMessage(lang) battle.minorBattleActions[pokemon.uuid] = message } diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index d6dbd3d66e..74a27c098c 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -757,6 +757,8 @@ "cobblemon.battle.turn": "It is now turn %1$s", "cobblemon.battle.side_subject.ally": "your", "cobblemon.battle.side_subject.opponent": "the opposing", + "cobblemon.battle.transform": "%1$s transformed into %2$s", + "cobblemon.battle.endability": "%1$s's Ability was suppressed!", "cobblemon.battle.weather.raindance.start": "It started to rain!", "cobblemon.battle.weather.raindance.upkeep": "Rain continues to fall.", From a87bd35fd6c9713556797c0e3be18bfa34eb85b7 Mon Sep 17 00:00:00 2001 From: MoeBoy76 Date: Thu, 30 Nov 2023 11:38:39 +1100 Subject: [PATCH 23/26] changelog time --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54ebd30ac7..250e1d9e90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ - Fixed Shroomish not using its idle. - Fixed a possible visual duplication of sent out Pokémon. - Fixed battle text for Trace, Receiver, and Power of Alchemy. +- Fixed battle text for moves that were missing. ### Developer - Fixed the `SpawnEvent` not respecting usage of `Cancelable#cancel`. From 006e86f3c31ef1606b15b3fdd55dfb409872a79a Mon Sep 17 00:00:00 2001 From: apion Date: Thu, 30 Nov 2023 11:37:52 -0500 Subject: [PATCH 24/26] Fix my review threads --- .../mod/common/battles/ShowdownInterpreter.kt | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index 017ac58fd2..f7ce62cb74 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -935,9 +935,12 @@ object ShowdownInterpreter { battle.minorBattleActions[pokemon.uuid] = message if (!message.hasOptionalArgument("silent")) { - val lang = when (optionalEffect?.id) { - "reflecttype" -> optionalPokemonName?.let { battleLang("start.reflecttype", pokemon.getName(), it) } - else -> when (effectID) { + var lang: MutableText? = null + if (optionalEffect?.id == "reflecttype") { + lang = optionalPokemonName?.let { battleLang("start.reflecttype", pokemon.getName(), it) } + } + else { + when (effectID) { "confusion", "perish3" -> return@dispatch GO // Skip "perish2", "perish1", "perish0" -> battleLang("start.perish", pokemon.getName(), effectID.last().digitToInt()) "stockpile1", "stockpile2", "stockpile3" -> battleLang("start.stockpile", pokemon.getName(), effectID.last().digitToInt()) @@ -1082,12 +1085,14 @@ object ShowdownInterpreter { } // Includes revealed move "forewarn" -> { - val moveName = message.moveAt(2)?.displayName ?: run { println(message.argumentAt(2)); "(Unrecognized: ${message.argumentAt(2)})".text() } - battleLang("activate.forewarn", sourceName, moveName) + val moveName = message.moveAt(2)?.displayName + moveName?.let { battleLang("activate.forewarn", sourceName, it) } + } "grudge" -> { - val moveName = message.moveAt(2)?.displayName ?: run { println(message.argumentAt(2)); "(Unrecognized: ${message.argumentAt(2)})".text() } - battleLang("activate.grudge", pokemonName, moveName) + val moveName = message.moveAt(2)?.displayName + moveName?.let { battleLang("activate.grudge", pokemonName, it) } + } // Includes held item of the target "poltergeist" -> battleLang("activate.poltergeist", pokemonName, message.argumentAt(2)!!) @@ -1098,7 +1103,9 @@ object ShowdownInterpreter { "shadowforce", "hyperspacefury", "hyperspacehole" -> battleLang("activate.phantomforce", pokemonName) else -> battleLang("activate.${effect.id}", pokemonName, sourceName) } - battle.broadcastChatMessage(lang) + if (lang != null) { + battle.broadcastChatMessage(lang) + } WaitDispatch(1F) } } @@ -1259,9 +1266,7 @@ object ShowdownInterpreter { val targetPokemonName = targetPokemon.getName() val effectID = message.effect()?.id ?: return@dispatchWaiting val lang = when (effectID) { - "guardswap" -> battleLang("swapboost.guardswap", pokemonName) - "powerswap" -> battleLang("swapboost.powerswap", pokemonName) - "heartswap" -> battleLang("swapboost.heartswap", pokemonName) + "guardswap", "powerswap", "heartswap" -> battleLang("swapboost$effectID", pokemonName) else -> battleLang("swapboost.generic", pokemonName, targetPokemonName) } From 7c860d8f91545a63e3544bc67cc85e9257a3ed97 Mon Sep 17 00:00:00 2001 From: apion Date: Thu, 30 Nov 2023 12:39:09 -0500 Subject: [PATCH 25/26] Fix some of seg's review threads --- .../mod/common/battles/ShowdownInterpreter.kt | 37 +++++++++++-------- .../assets/cobblemon/lang/en_us.json | 1 - 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index f7ce62cb74..4354c348f3 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -667,7 +667,20 @@ object ShowdownInterpreter { val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting val name = pokemon.getName() battle.broadcastChatMessage(battleLang("invertboost", name)) - pokemon.contextManager.add(getContextFromAction(message, BattleContext.Type.BOOST, battle)) + + val newUnboosts = pokemon.contextManager.get(BattleContext.Type.BOOST)?.map { + getContextFromAction(message, BattleContext.Type.UNBOOST, battle) + }?.toTypedArray() + val newBoosts = pokemon.contextManager.get(BattleContext.Type.UNBOOST)?.map { + getContextFromAction(message, BattleContext.Type.BOOST, battle) + }?.toTypedArray() + pokemon.contextManager.clear(BattleContext.Type.BOOST, BattleContext.Type.UNBOOST) + newBoosts?.let { + pokemon.contextManager.add(*it) + } + newUnboosts?.let { + pokemon.contextManager.add(*it) + } battle.minorBattleActions[pokemon.uuid] = message } } @@ -940,16 +953,13 @@ object ShowdownInterpreter { lang = optionalPokemonName?.let { battleLang("start.reflecttype", pokemon.getName(), it) } } else { - when (effectID) { + lang = when (effectID) { "confusion", "perish3" -> return@dispatch GO // Skip - "perish2", "perish1", "perish0" -> battleLang("start.perish", pokemon.getName(), effectID.last().digitToInt()) - "stockpile1", "stockpile2", "stockpile3" -> battleLang("start.stockpile", pokemon.getName(), effectID.last().digitToInt()) + "perish2", "perish1", "perish0", + "stockpile1", "stockpile2", "stockpile3" -> battleLang("start.${effectID.dropLast(1)}", pokemon.getName(), effectID.last().digitToInt()) "dynamax" -> battleLang("start.${message.effectAt(2)?.id ?: effectID}", pokemon.getName()).yellow() "curse" -> battleLang("start.curse", message.getSourceBattlePokemon(battle)!!.getName(), pokemon.getName()) - "disable" -> battleLang("start.disable", pokemon.getName(), message.effectAt(2)!!.rawData) - "typechange" -> battleLang("start.typechange", pokemon.getName(), message.effectAt(2)!!.rawData) // Covers generic typechange moves like Conversion, Conversion2, and Camouflage - "typeadd" -> battleLang("start.typeadd", pokemon.getName(), message.effectAt(2)!!.rawData) // Covers generic typechange moves like Forest's Curse - "mimic" -> battleLang("start.mimic", pokemon.getName(), message.effectAt(2)!!.rawData) + "disable", "typechange", "typeadd", "mimic" -> battleLang("start.$effectID", pokemon.getName(), message.effectAt(2)!!.rawData) else -> battleLang("start.$effectID", pokemon.getName()) } } @@ -1293,8 +1303,7 @@ object ShowdownInterpreter { val lang = battleLang("copyboost.generic", pokemonName, targetPokemonName) battle.broadcastChatMessage(lang) - pokemon.contextManager.copy(targetPokemon.contextManager, BattleContext.Type.BOOST) - pokemon.contextManager.copy(targetPokemon.contextManager, BattleContext.Type.UNBOOST) + pokemon.contextManager.copy(targetPokemon.contextManager, BattleContext.Type.BOOST, BattleContext.Type.UNBOOST) battle.minorBattleActions[pokemon.uuid] = message } } @@ -1834,16 +1843,14 @@ object ShowdownInterpreter { private fun handleClearNegativeBoostInstructions(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList) { val battlePokemon = message.getBattlePokemon(0, battle) ?: return val pokemonName = battlePokemon.getName() - // Checks if instruction is meant to be silent, in which case we do nothing - if (message.hasOptionalArgument("silent")) { - return - } battle.dispatchWaiting(1.5F) { val lang = when { message.hasOptionalArgument("zeffect") -> battleLang("clearallnegativeboost.zeffect", pokemonName) else -> battleLang("clearallnegativeboost", pokemonName) } - battle.broadcastChatMessage(lang) + if (!message.hasOptionalArgument("silent")) { + battle.broadcastChatMessage(lang) + } battlePokemon.contextManager.clear(BattleContext.Type.UNBOOST) battle.minorBattleActions[battlePokemon.uuid] = message diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 59017a561a..12b55f12f7 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -1144,7 +1144,6 @@ "cobblemon.battle.zpower": "%1$s surrounded itself with its Z-Power!", "cobblemon.battle.zbroken": "%1$s couldn't fully protect itself and got hurt!", - "cobblemon.battle.zbroken.guardianofalola": "%1$s couldn't fully protect itself and got hurt!", "cobblemon.battle.terastallize": "%1$s has Terastallized into the %2$s-type!", From 8dc0a7f72d5095d49570ac4676dfb98b675c03f0 Mon Sep 17 00:00:00 2001 From: Segfault Guy Date: Fri, 1 Dec 2023 00:03:26 -0500 Subject: [PATCH 26/26] Interpreter trimmings and fixes. --- .../mod/common/battles/ShowdownInterpreter.kt | 81 +++++++------------ .../helditem/CobblemonHeldItemManager.kt | 6 +- .../assets/cobblemon/lang/en_us.json | 10 +-- 3 files changed, 35 insertions(+), 62 deletions(-) diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt index 4354c348f3..b499c5c7bc 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownInterpreter.kt @@ -668,19 +668,18 @@ object ShowdownInterpreter { val name = pokemon.getName() battle.broadcastChatMessage(battleLang("invertboost", name)) + // update and invert BOOST and UNBOOST contexts + val context = getContextFromAction(message, BattleContext.Type.BOOST, battle) val newUnboosts = pokemon.contextManager.get(BattleContext.Type.BOOST)?.map { - getContextFromAction(message, BattleContext.Type.UNBOOST, battle) + BasicContext(it.id, context.turn, BattleContext.Type.UNBOOST, context.origin) }?.toTypedArray() val newBoosts = pokemon.contextManager.get(BattleContext.Type.UNBOOST)?.map { - getContextFromAction(message, BattleContext.Type.BOOST, battle) + BasicContext(it.id, context.turn, BattleContext.Type.BOOST, context.origin) }?.toTypedArray() + pokemon.contextManager.clear(BattleContext.Type.BOOST, BattleContext.Type.UNBOOST) - newBoosts?.let { - pokemon.contextManager.add(*it) - } - newUnboosts?.let { - pokemon.contextManager.add(*it) - } + newBoosts?.let { pokemon.contextManager.add(*it) } + newUnboosts?.let { pokemon.contextManager.add(*it) } battle.minorBattleActions[pokemon.uuid] = message } } @@ -939,6 +938,7 @@ object ShowdownInterpreter { val optionalEffect = message.effect() val optionalPokemon = message.getSourceBattlePokemon(battle) val optionalPokemonName = optionalPokemon?.getName() + val extraEffect = message.effectAt(2)?.typelessData ?: Text.literal("UNKOWN") // skip adding contexts for every time the perish counter decrements if (!effectID.contains("perish")) { @@ -948,24 +948,18 @@ object ShowdownInterpreter { battle.minorBattleActions[pokemon.uuid] = message if (!message.hasOptionalArgument("silent")) { - var lang: MutableText? = null - if (optionalEffect?.id == "reflecttype") { - lang = optionalPokemonName?.let { battleLang("start.reflecttype", pokemon.getName(), it) } - } - else { - lang = when (effectID) { + val lang = if (optionalEffect?.id == "reflecttype" && optionalPokemonName != null) + battleLang("start.reflecttype", pokemon.getName(), optionalPokemonName) + else + when (effectID) { "confusion", "perish3" -> return@dispatch GO // Skip "perish2", "perish1", "perish0", "stockpile1", "stockpile2", "stockpile3" -> battleLang("start.${effectID.dropLast(1)}", pokemon.getName(), effectID.last().digitToInt()) "dynamax" -> battleLang("start.${message.effectAt(2)?.id ?: effectID}", pokemon.getName()).yellow() "curse" -> battleLang("start.curse", message.getSourceBattlePokemon(battle)!!.getName(), pokemon.getName()) - "disable", "typechange", "typeadd", "mimic" -> battleLang("start.$effectID", pokemon.getName(), message.effectAt(2)!!.rawData) - else -> battleLang("start.$effectID", pokemon.getName()) + else -> battleLang("start.$effectID", pokemon.getName(), extraEffect) } - } - if (lang != null) { - battle.broadcastChatMessage(lang) - } + battle.broadcastChatMessage(lang) } WaitDispatch(1F) } @@ -981,7 +975,7 @@ object ShowdownInterpreter { battle.dispatchWaiting(1.5F) { val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting val pokemonName = pokemon.getName() - val sourceName = message.getSourceBattlePokemon(battle)?.getName() ?: return@dispatchWaiting + val sourceName = message.getSourceBattlePokemon(battle)?.getName() ?: Text.literal("UNKOWN") val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting val lang = battleLang("singleturn.$effectID", pokemonName, sourceName) battle.broadcastChatMessage(lang) @@ -1046,17 +1040,16 @@ object ShowdownInterpreter { * Format: * |-block|POKEMON|EFFECT|MOVE|ATTACKER * - * An effect targeted at POKEMON was blocked by EFFECT. This may optionally specify that the effect was a MOVE from ATTACKER. [of]SOURCE will note the owner of the EFFECT, in the case that it's not EFFECT (for instance, an ally with Aroma Veil.) + * An effect targeted at POKEMON was blocked by EFFECT. This may optionally specify that the effect was a MOVE from ATTACKER. + * + * (of)SOURCE will note the owner of the EFFECT, in the case that it's not EFFECT (for instance, an ally with Aroma Veil.) */ private fun handleBlockInstructions(battle: PokemonBattle, message: BattleMessage, remainingLines: MutableList) { battle.dispatchWaiting(1.5F) { val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchWaiting val pokemonName = pokemon.getName() val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting - val lang = when (effectID) { - "matblock" -> battleLang("block.matblock", message.effectAt(2)!!.rawData) - else -> battleLang("block.$effectID", pokemonName) - } + val lang = battleLang("block.$effectID", pokemonName) battle.broadcastChatMessage(lang) battle.minorBattleActions[pokemon.uuid] = message @@ -1074,6 +1067,7 @@ object ShowdownInterpreter { val pokemonName = pokemon.getName() val sourceName = message.getSourceBattlePokemon(battle)?.getName() ?: Text.literal("UNKOWN") val effect = message.effectAt(1) ?: return + val extraEffect = message.effectAt(2)?.typelessData ?: Text.literal("UNKOWN") broadcastOptionalAbility(battle, effect, pokemonName) battle.dispatch{ @@ -1084,38 +1078,20 @@ object ShowdownInterpreter { // Includes a 3rd argument being the magnitude level as a number "magnitude" -> battleLang("activate.magnitude", message.argumentAt(2)?.toIntOrNull() ?: 1) // Includes spited move and the PP it was reduced by - "spite", "eeriespell" -> battleLang("activate.spite", pokemonName, message.argumentAt(2)!!, message.argumentAt(3)!!) + "spite", "eeriespell" -> battleLang("activate.spite", pokemonName, extraEffect, message.argumentAt(3)!!) // Don't need additional lang, announced elsewhere "toxicdebris", "shedskin" -> return@dispatch GO - "matblock" -> battleLang("activate.matblock", message.effectAt(2)!!.rawData) // Add activation to each Pokemon's history "destinybond" -> { battle.activePokemon.mapNotNull { it.battlePokemon?.uuid }.forEach { battle.minorBattleActions[it] = message } battleLang("activate.destinybond", pokemonName) } - // Includes revealed move - "forewarn" -> { - val moveName = message.moveAt(2)?.displayName - moveName?.let { battleLang("activate.forewarn", sourceName, it) } - - } - "grudge" -> { - val moveName = message.moveAt(2)?.displayName - moveName?.let { battleLang("activate.grudge", pokemonName, it) } - - } - // Includes held item of the target - "poltergeist" -> battleLang("activate.poltergeist", pokemonName, message.argumentAt(2)!!) - // Includes sketched move - "sketch" -> battleLang("activate.sketch", pokemonName, message.argumentAt(2)!!) - "focussash", "focusband" -> battleLang("activate.focusband", pokemonName, message.effectAt(1)!!.typelessData) + "focussash", "focusband" -> battleLang("activate.focusband", pokemonName, effect.typelessData) "maxguard", "protect" -> battleLang("activate.protect", pokemonName) "shadowforce", "hyperspacefury", "hyperspacehole" -> battleLang("activate.phantomforce", pokemonName) - else -> battleLang("activate.${effect.id}", pokemonName, sourceName) - } - if (lang != null) { - battle.broadcastChatMessage(lang) + else -> battleLang("activate.${effect.id}", pokemonName, sourceName, extraEffect) } + battle.broadcastChatMessage(lang) WaitDispatch(1F) } } @@ -1179,7 +1155,7 @@ object ShowdownInterpreter { /** * Format: - * |-ability|POKEMON|ABILITY|[from]EFFECT + * |-ability|POKEMON|ABILITY|(from)EFFECT * * The ABILITY of the POKEMON has been changed due to a move/ability EFFECT. * @@ -1276,10 +1252,9 @@ object ShowdownInterpreter { val targetPokemonName = targetPokemon.getName() val effectID = message.effect()?.id ?: return@dispatchWaiting val lang = when (effectID) { - "guardswap", "powerswap", "heartswap" -> battleLang("swapboost$effectID", pokemonName) + "guardswap", "powerswap", "heartswap" -> battleLang("swapboost.$effectID", pokemonName) else -> battleLang("swapboost.generic", pokemonName, targetPokemonName) } - battle.broadcastChatMessage(lang) pokemon.contextManager.swap(targetPokemon.contextManager, BattleContext.Type.BOOST) @@ -1677,7 +1652,7 @@ object ShowdownInterpreter { /** * Format: - * |-item|POKEMON|ITEM|[from]EFFECT + * |-item|POKEMON|ITEM|(from)EFFECT * * The ITEM held by the POKEMON has been changed or revealed due to a move or ability EFFECT. * @@ -1700,7 +1675,7 @@ object ShowdownInterpreter { /** * Format: - * |-enditem|POKEMON|ITEM|[from]EFFECT + * |-enditem|POKEMON|ITEM|(from)EFFECT * * The ITEM held by POKEMON has been destroyed by a move or ability, and it now holds no item. * diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/helditem/CobblemonHeldItemManager.kt b/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/helditem/CobblemonHeldItemManager.kt index cc12668151..da37a85846 100644 --- a/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/helditem/CobblemonHeldItemManager.kt +++ b/common/src/main/kotlin/com/cobblemon/mod/common/pokemon/helditem/CobblemonHeldItemManager.kt @@ -126,12 +126,10 @@ object CobblemonHeldItemManager : BaseCobblemonHeldItemManager() { this.take(pokemon, itemID) return } - val source = battleMessage.getSourceBattlePokemon(battle) - val sourceName = source?.getName() + val sourceName = battleMessage.getSourceBattlePokemon(battle)?.getName() ?: Text.of("UNKNOWN") val effect = battleMessage.effect() val text = when { - effect?.id != null && sourceName != null -> battleLang("enditem.${effect.id}", battlerName, itemName, sourceName) // Moves that have a source, for example: Knock Off - effect?.id != null && sourceName == null -> battleLang("enditem.${effect.id}", battlerName, itemName) // Moves that do not have a source, for example: Fling + effect?.id != null -> battleLang("enditem.${effect.id}", battlerName, itemName, sourceName) else -> when (itemID) { "boosterenergy", "electricseed", "grassyseed", "mistyseed", "psychicseed", "roomservice" -> battleLang("enditem.generic", battlerName, itemName) else -> battleLang("enditem.$itemID", battlerName) diff --git a/common/src/main/resources/assets/cobblemon/lang/en_us.json b/common/src/main/resources/assets/cobblemon/lang/en_us.json index 12b55f12f7..e3f53143e6 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -924,7 +924,7 @@ "cobblemon.battle.activate.trick":"%1$s switched items with its target!", "cobblemon.battle.activate.quickclaw": "%1$s can act faster than normal, thanks to its Quick Claw!", "cobblemon.battle.activate.focusband": "%1$s hung on using its %2$s!", - "cobblemon.battle.activate.forewarn": "%1$s's %2$s was revealed!", + "cobblemon.battle.activate.forewarn": "%2$s's %3$s was revealed!", "cobblemon.battle.activate.disguise": "It's disguise served it as a decoy!", "cobblemon.battle.activate.liquidooze": "%1$s sucked up the liquid ooze!", "cobblemon.battle.activate.whirlpool": "%1$s became trapped in the vortex!", @@ -935,17 +935,17 @@ "cobblemon.battle.activate.substitute": "The substitute took damage for %1$s!", "cobblemon.battle.activate.infestation": "%1$s has become infested!", "cobblemon.battle.activate.phantomforce": "It broke through %1$s's protection!", - "cobblemon.battle.activate.matblock": "%1$s was blocked by the kicked-up mat!", + "cobblemon.battle.activate.matblock": "%3$s was blocked by the kicked-up mat!", "cobblemon.battle.activate.electricterrain": "%1$s surrounds itself with electrified terrain!", "cobblemon.battle.activate.ingrain": "%1$s anchored itself with its roots!", "cobblemon.battle.activate.mist": "%1$s is protected by the mist!", - "cobblemon.battle.activate.poltergeist": "%1$s is about to be attacked by its %2$s!", + "cobblemon.battle.activate.poltergeist": "%1$s is about to be attacked by its %3$s!", "cobblemon.battle.activate.powder": "When the flame touched the powder on the Pokémon, it exploded!", "cobblemon.battle.activate.quash": "%1$s's move was postponed!", "cobblemon.battle.activate.quickguard": "Quick Guard protected %1$s", "cobblemon.battle.activate.safeguard": "%1$s is protected by Safeguard!", - "cobblemon.battle.activate.sketch": "%1$s sketched %2$s!", - "cobblemon.battle.activate.grudge": "%1$s's %2$s lost all of its PP due to the grudge!", + "cobblemon.battle.activate.sketch": "%1$s sketched %3$s!", + "cobblemon.battle.activate.grudge": "%1$s's %3$s lost all of its PP due to the grudge!", "cobblemon.battle.activate.speedswap": "%1$s switched Speed with its target!", "cobblemon.battle.activate.switcheroo": "%1$s switched items with its target!", "cobblemon.battle.activate.skillswap": "%1$s swapped Abilities with its target!",