Added ShowdownInterpreter Instructions

This commit is contained in:
Renaissance authored and Hiroku committed 2023-03-24 06:08:00 +00:00
1 parent 94b28c025a
commit fa04e168ac
3 files changed
+171 -14

No files matched your search

+1 -2
View File
@@ -2,8 +2,7 @@
## [1.3.1](#1-3-1)
### Additions
- Added battle messages for the effects of the moves Bind, Court Change and Protect.
- Added battle messages for the effects of the ability Sturdy.
- Added battle messages interpretation for 50+ moves and abilities.
- Added battle messages for healing with Black Sludge.
- Added the ``/pc`` command which opens up the PC UI the same way interacting with the block would, this will be a cheat command in the Minecraft permission system or use the permission ``cobblemon.command.pc`` if a permission mod is present.
- You can now click the right and left arrow keys to move navigate PC boxes.
@@ -94,14 +94,17 @@ object ShowdownInterpreter {
updateInstructions["|-fieldstart|"] = this::handleFieldStartInstructions
updateInstructions["|-fieldend|"] = this::handleFieldEndInstructions
updateInstructions["|-ability|"] = this::handleAbilityInstructions
//To-Do updateInstructions["|-endability|"] = this::handleEndAbilityInstruction
updateInstructions["|-nothing"] = { battle, _, _ ->
battle.dispatchGo { battle.broadcastChatMessage(battleLang("nothing")) }
}
updateInstructions["|-clearallboost"] = { battle, _, _ ->
battle.dispatchGo { battle.broadcastChatMessage(battleLang("clearallboost")) }
}
// ToDo -singleturn|p2a: 596a8320-3330-466b-8f0b-005016b4b1a7|Protect
// ToDo |-singlemove|p2a: a234d8ef-e558-4e37-846b-5df82ccf8256|Rage
updateInstructions["|-singleturn|"] = this::handleSingleTurnInstruction
updateInstructions["|-singlemove|"] = this::handleSingleMoveInstruction
updateInstructions["|-prepare|"] = this::handlePrepareInstruction
updateInstructions["|-swapboost"] = this::handleSwapBoostInstruction
updateInstructions["|-swapsideconditions|"] = this::handleSilently
updateInstructions["|-unboost|"] = { battle, line, remainingLines -> boostInstruction(battle, line, remainingLines, false) }
updateInstructions["|-boost|"] = { battle, line, remainingLines -> boostInstruction(battle, line, remainingLines, true) }
@@ -769,6 +772,56 @@ object ShowdownInterpreter {
}
}
private fun handleSingleTurnInstruction(battle: PokemonBattle, rawMessage: String, remainingLines: MutableList<String>) {
battle.dispatchGo{
val message = BattleMessage(rawMessage)
val pokemon = message.actorAndActivePokemon(0, battle)?.second ?: return@dispatchGo
val pokemonName = pokemon.battlePokemon?.getName() ?: return@dispatchGo
val effect = message.effectAt(1) ?: return@dispatchGo
val lang = when(effect.id) {
"protect" -> battleLang("singleturn.protect", pokemonName)
"endure" -> battleLang("singleturn.endure", pokemonName)
"craftyshield" -> battleLang("singleturn.crafty_shield", pokemonName)
"powder" -> battleLang("singleturn.powder", pokemonName)
"followme" -> battleLang("singleturn.follow_me", pokemonName)
"snatch" -> battleLang("singleturn.snatch", pokemonName)
"quickguard" -> battleLang("singleturn.quick_guard", pokemonName)
"wideguard" -> battleLang("singleturn.wide_guard", pokemonName)
"roost" -> battleLang("singleturn.roost", pokemonName)
"matblock" -> battleLang("singleturn.mat_block", pokemonName)
"maxguard" -> battleLang("singleturn.max_guard", pokemonName)
"instruct" -> battleLang("singleturn.instruct", pokemonName, message.actorAndActivePokemonFromOptional(battle)?.second?.battlePokemon?.getName() ?: return@dispatchGo)
"focuspunch" -> battleLang("singleturn.focus_punch", pokemonName)
"electrify" -> battleLang("singleturn.electrify", pokemonName)
"beakblast" -> battleLang("singleturn.beak_blast", pokemonName)
"helpinghand" -> battleLang("singleturn.helping_hand", pokemonName, message.actorAndActivePokemonFromOptional(battle)?.second?.battlePokemon?.getName() ?: return@dispatchGo)
"magiccoat" -> battleLang("singleturn.magic_coat", pokemonName)
"ragepowder" -> battleLang("singleturn.rage_powder", pokemonName)
"shelltrap" -> battleLang("singleturn.shell_trap", pokemonName)
"spotlight" -> battleLang("singleturn.spotlight", pokemonName)
else -> battle.createUnimplemented(message)
}
battle.broadcastChatMessage(lang)
}
}
private fun handleSingleMoveInstruction(battle: PokemonBattle, rawMessage: String, remainingLines: MutableList<String>) {
battle.dispatchGo {
val message = BattleMessage(rawMessage)
val pokemon = message.actorAndActivePokemon(0, battle)?.second ?: return@dispatchGo
val pokemonName = pokemon.battlePokemon?.getName() ?: return@dispatchGo
val effect = message.effectAt(1) ?: return@dispatchGo
val lang = when (effect.id) {
"destinybond" -> battleLang("singlemove.destiny_bond", pokemonName)
"glaiverush" -> battleLang("singlemove.glaive_rush", pokemonName)
"grudge" -> battleLang("singlemove.grudge", pokemonName)
"rage" -> battleLang("singlemove.rage", pokemonName)
else -> battle.createUnimplemented(message)
}
battle.broadcastChatMessage(lang)
}
}
private fun handleActivateInstructions(battle: PokemonBattle, rawMessage: String, remainingLines: MutableList<String>){
battle.dispatchGo{
val message = BattleMessage(rawMessage)
@@ -795,6 +848,8 @@ object ShowdownInterpreter {
"quickclaw" -> battleLang("item.quick_claw.end", pokemonName)
"bind" -> battleLang("activate.bind", pokemonName, message.actorAndActivePokemonFromOptional(battle)?.second?.battlePokemon?.getName() ?: return@dispatchGo)
"courtchange" -> battleLang("activate.court_change", pokemonName)
"guardsplit" -> battleLang("activate.guard_split", pokemonName)
"spite" -> battleLang("activate.spite", pokemonName, message.argumentAt(2)!!, message.argumentAt(3)!!)
else -> battle.createUnimplemented(message)
}
battle.broadcastChatMessage(lang)
@@ -852,21 +907,74 @@ object ShowdownInterpreter {
}
private fun handleAbilityInstructions(battle: PokemonBattle, rawMessage: String, remainingLines: MutableList<String>) {
battle.dispatchWaiting {
battle.dispatchGo {
val message = BattleMessage(rawMessage)
val battlePokemon = message.actorAndActivePokemon(0, battle)?.second?.battlePokemon ?: return@dispatchWaiting
val pokemonName = battlePokemon.getName()
val pokemon = message.actorAndActivePokemon(0, battle)?.second ?: return@dispatchGo
val pokemonName = pokemon.battlePokemon?.getName() ?: return@dispatchGo
val effect = message.effectAt(1) ?: return@dispatchGo
//val abilityId = message.argumentAt(1) ?: return@dispatchWaiting
val effect = message.effect() ?: return@dispatchWaiting
//val effect = message.effect() ?: return@dispatchWaiting
val feedback = when (effect.id) {
"speedboost" -> battleLang("ability.speed_boost", pokemonName)
"sturdy" -> battleLang("ability.sturdy", pokemonName)
else -> battle.createUnimplemented(message)
"intimidate" -> battleLang("ability.intimidate", pokemonName)
"unnerve" -> battleLang("ability.unnerve", pokemonName)
"anticipation" -> battleLang("ability.anticipation", pokemonName)
"airlock" -> battleLang("ability.air_lock")
"cloudnine" -> battleLang("ability.air_lock") //Cloud Nine shares the same text as Air Lock
else -> battleLang("ability.generic", pokemonName, message.argumentAt(1)!!)
}
battle.broadcastChatMessage(feedback)
}
}
private fun handlePrepareInstruction(battle: PokemonBattle, rawMessage: String, remainingLines: MutableList<String>) {
battle.dispatchGo {
val message = BattleMessage(rawMessage)
val pokemon = message.actorAndActivePokemon(0, battle)?.second ?: return@dispatchGo
val pokemonName = pokemon.battlePokemon?.getName() ?: return@dispatchGo
val effect = message.effectAt(1) ?: return@dispatchGo
//Prevents spam when the move Role Play is used
val lang = when(effect.id) {
"bounce" -> battleLang("prepare.bounce", pokemonName)
"dig" -> battleLang("prepare.dig", pokemonName)
"dive" -> battleLang("prepare.dive", pokemonName)
"fly" -> battleLang("prepare.fly", pokemonName)
"freezeshock" -> battleLang("prepare.freeze_shock", pokemonName)
"geomancy" -> battleLang("prepare.geomancy", pokemonName)
"iceburn" -> battleLang("prepare.ice_burn", pokemonName)
"meteorbeam" -> battleLang("prepare.meteor_beam", pokemonName)
"phantomforce" -> battleLang("prepare.phantom_force", pokemonName)
"razorwind" -> battleLang("prepare.razor_wind", pokemonName)
"shadowforce" -> battleLang("prepare.phantom_force", pokemonName) //Phantom Force and Shadow Force share the same text
"skullbash" -> battleLang("prepare.skull_bash", pokemonName)
"skyattack" -> battleLang("prepare.sky_attack", pokemonName)
"skydrop" -> battleLang("prepare.sky_drop", pokemonName)
"solarbeam" -> battleLang("prepare.solar_beam", pokemonName)
"solarblade" -> battleLang("prepare.solar_beam", pokemonName) //Solar Beam and Solar Blade share the same text
else -> battle.createUnimplemented(message)
}
battle.broadcastChatMessage(lang)
}
}
private fun handleSwapBoostInstruction(battle: PokemonBattle, rawMessage: String, remainingLines: MutableList<String>) {
battle.dispatchGo {
val message = BattleMessage(rawMessage)
val pokemon = message.actorAndActivePokemon(0, battle)?.second ?: return@dispatchGo
val pokemonName = pokemon.battlePokemon?.getName() ?: return@dispatchGo
val targetPokemonName = message.actorAndActivePokemonFromOptional(battle)?.second?.battlePokemon?.getName() ?: return@dispatchGo
val effect = message.effectAt(1) ?: return@dispatchGo
val lang = when(effect.id) {
"guardswap" -> battleLang("swapboost.generic", pokemonName, targetPokemonName)
"heartswap" -> battleLang("swapboost.generic", pokemonName, targetPokemonName)
"powerswap" -> battleLang("swapboost.generic", pokemonName, targetPokemonName)
else -> battle.createUnimplemented(message)
}
battle.broadcastChatMessage(lang)
}
}
private fun handleEndInstruction(battle: PokemonBattle, rawMessage: String, remainingLines: MutableList<String>) {
battle.dispatchWaiting {
val message = BattleMessage(rawMessage)
@@ -1145,7 +1253,7 @@ object ShowdownInterpreter {
"ingrain" -> battleLang("heal.ingrain", battlePokemon.getName())
"grassyterrain" -> battleLang("heal.grassy_terrain", battlePokemon.getName())
"leftovers" -> battleLang("heal.leftovers", battlePokemon.getName())
"blacksludge" -> battleLang("heal.black_sludge", battlePokemon.getName())
"raindish" -> battleLang("heal.rain_dish", battlePokemon.getName())
else -> battle.createUnimplementedSplit(publicMessage, privateMessage)
}
}
@@ -320,7 +320,6 @@
"cobblemon.command.pokemonedit": "Edited %2$s's %1$s.",
"cobblemon.command.teach": "%2$s's %1$s learnt %3$s.",
"cobblemon.command.teach.already_knows": "%1$s already knows %2$s!",
"cobblemon.command.teach.cant_learn": "%1$s can't learn %2$s!",
"cobblemon.command.healpokemon.heal": "Fully healed %1$s's party.",
"cobblemon.command.friendship": "%1$s has %2$s friendship.",
"cobblemon.command.givepokemon.nospecies": "Error: You need to include a Pokémon name or 'random'",
@@ -330,7 +329,7 @@
"advancements.cobblemon.root": "The World of Cobblemon!",
"advancements.cobblemon.obtain_leftovers": "Reduce, Reuse, Recycle!",
"advancements.cobblemon.obtain_leftovers.description": "Keep the leftovers after eating an apple.",
"advancements.cobblemon.obtain_leftovers.description": "Keep the leftovers after eating an apple.",
"advancements.cobblemon.root.description": "Choose a starter Pokémon and set out on a new adventure",
"advancements.cobblemon.harvest_apricorn": "Is it a Fruit or is it a Nut?",
"advancements.cobblemon.harvest_apricorn.description": "Right-click to harvest a fully-grown Apricorn",
@@ -474,13 +473,63 @@
"cobblemon.battle.activate.trapped": "%1$s can no longer escape!",
"cobblemon.battle.activate.bind": "%1$s was squeezed by %2$s!",
"cobblemon.battle.activate.court_change": "%1$s swapped the battle effects affecting each side of the field!",
"cobblemon.battle.activate.guard_split": "%1$s shared its guard with the target!",
"cobblemon.battle.activate.spite": "It reduced the PP of %1$s's %2$s by %3$s!",
"cobblemon.battle.prepare.bounce": "%1$s sprang up!",
"cobblemon.battle.prepare.dig": "%1$s burrowed its way under the ground!",
"cobblemon.battle.prepare.dive": "%1$s hid underwater!",
"cobblemon.battle.prepare.fly": "%1$s flew up high!",
"cobblemon.battle.prepare.freeze_shock": "%1$s became cloaked in a freezing light!",
"cobblemon.battle.prepare.geomancy": "%1$s is absorbing power!",
"cobblemon.battle.prepare.ice_burn": "%1$s became cloaked in freezing air!",
"cobblemon.battle.prepare.meteor_beam": "%1$s is overflowing with space power!",
"cobblemon.battle.prepare.phantom_force": "%1$s vanished instantly!",
"cobblemon.battle.prepare.razor_wind": "%1$s whipped up a whirlwind!",
"cobblemon.battle.prepare.skull_bash": "%1$s tucked in its head!",
"cobblemon.battle.prepare.sky_attack": "%1$s became cloaked in a harsh light!",
"cobblemon.battle.prepare.sky_drop": "%1$s took its target into the sky!",
"cobblemon.battle.prepare.solar_beam": "%1$s absorbed light!",
"cobblemon.battle.swapboost.generic": "%1$s swapped stat boosts with %2$s!",
"cobblemon.battle.singleturn.protect": "%1$s protected itself!",
"cobblemon.battle.singleturn.endure": "%1$s braced itself!",
"cobblemon.battle.singleturn.crafty_shield": "Crafty Shield protected %1$s's team!",
"cobblemon.battle.singleturn.powder": "%1$s is covered in powder!",
"cobblemon.battle.singleturn.follow_me": "%1$s became the center of attention!",
"cobblemon.battle.singleturn.snatch": "%1$s is waiting for a target to make a move!",
"cobblemon.battle.singleturn.quick_guard": "Quick Guard protected %1$s's team!",
"cobblemon.battle.singleturn.wide_guard": "Wide Guard protected %1$s's team!",
"cobblemon.battle.singleturn.roost": "(%1$s loses Flying type this turn.)",
"cobblemon.battle.singleturn.mat_block": "%1$s intends to flip up a mat and block incoming attacks!",
"cobblemon.battle.singleturn.max_guard": "%1$s protected itself!",
"cobblemon.battle.singleturn.instruct": "%1$s followed %2$s's instructions!",
"cobblemon.battle.singleturn.focus_punch": "%1$s is tightening its focus!",
"cobblemon.battle.singleturn.electrify": "%1$s's moves have been electrified!",
"cobblemon.battle.singleturn.beak_blast": "%1$s started heating up its beak!",
"cobblemon.battle.singleturn.helping_hand": "%2$s is ready to help %1$s!",
"cobblemon.battle.singleturn.magic_coat": "%1$s shrouded itself with Magic Coat!",
"cobblemon.battle.singleturn.rage_powder": "%1$s became the center of attention!",
"cobblemon.battle.singleturn.shell_trap": "%1$s set a shell trap!",
"cobblemon.battle.singleturn.spotlight": "%1$s became the center of attention!",
"cobblemon.battle.singlemove.destiny_bond": "%1$s is hoping to take its attacker down with it!",
"cobblemon.battle.singlemove.glaive_rush": "%1$s throws itself into a reckless charge!",
"cobblemon.battle.singlemove.grudge": "%1$s wants its target to bear a grudge!",
"cobblemon.battle.singlemove.rage": "%1$s goes into a rage!",
"cobblemon.battle.end.bind": "%1$s is no longer being squeezed!",
"cobblemon.battle.set_hp.pain_split": "The battlers shared their pain!",
"cobblemon.battle.ability.sturdy": "%1$s endured the hit!",
"cobblemon.battle.ability.speed_boost": "%1$s's Speed Boost Activated!",
"cobblemon.battle.ability.speed_boost": "%1$s's Speed Boost activated!",
"cobblemon.battle.ability.intimidate": "%1$s's Intimidate activated!",
"cobblemon.battle.ability.unnerve": "%1$s made the opponent too nervous to eat berries!",
"cobblemon.battle.ability.anticipation": "%1$s shuddered in anticipation!",
"cobblemon.battle.ability.air_lock": "The effects of the weather disappeared.",
"cobblemon.battle.ability.generic": "%1$s's %2$s activated!",
"cobblemon.battle.errors.busy": "%1$s is busy!",
"cobblemon.battle.error.in_battle": "%1$s is already in a battle.",
@@ -527,7 +576,7 @@
"cobblemon.battle.heal.ingrain": "%1$s absorbed nutrients with its roots!",
"cobblemon.battle.heal.grassy_terrain": "%1$s's HP was restored.",
"cobblemon.battle.heal.leftovers": "%1$s restored a little HP using its Leftovers!",
"cobblemon.battle.heal.black_sludge": "%1$s restored a little HP using its Black Sludge!",
"cobblemon.battle.heal.rain_dish": "%1$s restored HP from Rain Dish!",
"cobblemon.battle.heal.generic": "%1$s restored its HP.",
"cobblemon.experience.gained": "%1$s received %2$s experience.",
@@ -1696,6 +1745,7 @@
"cobblemon.move.populationbomb": "Population Bomb",
"cobblemon.move.pounce": "Pounce",
"cobblemon.move.pound": "Pound",
"cobblemon.move.pound.desc": "No additional effect.",
"cobblemon.move.powder": "Powder",
"cobblemon.move.powder.desc": "The user covers the target in a combustible powder. If the target uses a Fire-type move, the powder explodes and damages the target.",
"cobblemon.move.powdersnow": "Powder Snow",