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 97c08bcf8e..83f0a8fd26 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 @@ -68,6 +68,7 @@ object ShowdownInterpreter { updateInstructionParser["cant"] = { _, _, message, _ -> CantInstruction(message) } updateInstructionParser["-clearallboost"] = { _, _, message, _ -> ClearAllBoostInstruction(message) } updateInstructionParser["-clearnegativeboost"] = { _, _, message, _ -> ClearNegativeBoostInstruction(message) } + updateInstructionParser["-clearboost"] = { _, _, message, _ -> ClearBoostInstruction(message) } updateInstructionParser["-copyboost"] = { _, _, message, _ -> CopyBoostInstruction(message) } updateInstructionParser["-crit"] = { _, instructionSet, message, _ -> CritInstruction(message, instructionSet) } updateInstructionParser["-curestatus"] = { _, _, message, _ -> CureStatusInstruction(message) } diff --git a/common/src/main/kotlin/com/cobblemon/mod/common/battles/interpreter/instructions/ClearBoostInstruction.kt b/common/src/main/kotlin/com/cobblemon/mod/common/battles/interpreter/instructions/ClearBoostInstruction.kt new file mode 100644 index 0000000000..4b3a059994 --- /dev/null +++ b/common/src/main/kotlin/com/cobblemon/mod/common/battles/interpreter/instructions/ClearBoostInstruction.kt @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2023 Cobblemon Contributors + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +package com.cobblemon.mod.common.battles.interpreter.instructions + +import com.cobblemon.mod.common.api.battles.interpreter.BattleContext +import com.cobblemon.mod.common.api.battles.interpreter.BattleMessage +import com.cobblemon.mod.common.api.battles.model.PokemonBattle +import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction +import com.cobblemon.mod.common.util.battleLang + +/** + * Format: |-clearboost|POKEMON + * + * Clear the boosts from the target POKEMON. + * @author Yaseen + * @since October 26th, 2024 + */ +class ClearBoostInstruction(val message: BattleMessage): InterpreterInstruction { + + override fun invoke(battle: PokemonBattle) { + val battlePokemon = message.battlePokemon(0, battle) ?: return + + battle.dispatchWaiting(1.5F) { + val pokemonName = battlePokemon.getName() + val lang = battleLang("clearboost", pokemonName) + battle.broadcastChatMessage(lang) + battlePokemon.contextManager.clear(BattleContext.Type.BOOST, BattleContext.Type.UNBOOST) + battle.minorBattleActions[battlePokemon.uuid] = message + } + } +} \ No newline at end of file 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 b10a52afae..7f7fc92ad5 100644 --- a/common/src/main/resources/assets/cobblemon/lang/en_us.json +++ b/common/src/main/resources/assets/cobblemon/lang/en_us.json @@ -1298,6 +1298,7 @@ "cobblemon.battle.clearallboost": "All stat changes were eliminated!", "cobblemon.battle.clearallnegativeboost": "%1$s's negative stat changes were removed!", "cobblemon.battle.clearallnegativeboost.zeffect": "%1$s's returned its decreased stats to normal using its Z-Power!", + "cobblemon.battle.clearboost": "%1$s's stat changes were removed!", "cobblemon.battle.unboost.slight": "%1$s's %2$s fell.", "cobblemon.battle.unboost.sharp": "%1$s's %2$s harshly fell.", "cobblemon.battle.unboost.severe": "%1$s's %2$s severely fell.",