Compare commits

...
Author SHA1 Message Date
Charzard4261 52133711ad Added a check before setting the Monitor's Block State, as it was causing a crash for some people. Unsure on the root cause, but this should prevent the crash. 2024-05-22 22:53:34 +01:00
Hiroku 4e1b82917b Merge branch 'Roaming-Gholdengo-Request' into 'main'
Lets Gholdengo maintain its roaming aspect

See merge request cable-mc/cobblemon!1025
2024-05-20 00:11:17 +00:00
Frank The FarmerandHiroku 3b1d257241 Lets Gholdengo maintain its roaming aspect 2024-05-20 00:11:16 +00:00
Hiroku 0b8f916648 Merge branch 'dimension-condition-uses-id-not-effects' into 'main'
Change dimension spawn condition to check with IDs not effects

See merge request cable-mc/cobblemon!1026
2024-05-20 00:11:02 +00:00
David Sadler 5ad7d5406a Change dimension spawn condition to check with IDs not effects 2024-05-19 18:45:34 +01:00
Paul 6ec008ee83 Merge remote-tracking branch 'origin/main' into 1.5-fixy
# Conflicts:
#	CHANGELOG.md
2024-05-19 11:19:13 +10:00
Hiroku f4d2226ec2 Merge branch '1.5.1' into 'main'
Moar 🐛🔫

Closes #847 and #799

See merge request cable-mc/cobblemon!1023
2024-05-18 01:50:12 +00:00
apion 0fc5d5e9d7 Fixed bad null handling 2024-05-17 21:41:58 -04:00
Hiroku 972c0f6430 Merge branch 'dubwool-dye' into 'main'
Make wooloos dyable

Closes #824

See merge request cable-mc/cobblemon!1021
2024-05-18 01:40:13 +00:00
ApionandHiroku 86db95a7dc Make wooloos dyable 2024-05-18 01:40:13 +00:00
apion be95b79e4d Removed unnecessary override 2024-05-17 21:20:20 -04:00
apion 5753443ab2 Optimized a player lookup 2024-05-17 20:39:27 -04:00
apion c6b7186032 Merge branch 'refs/heads/main' into 1.5.1
# Conflicts:
#	CHANGELOG.md
2024-05-17 20:35:50 -04:00
apion 32f3be2687 Changelog 2024-05-17 20:33:24 -04:00
apion 9012d78806 Apparently Kotlin uses .equals when using ==, === is Java == behavior 2024-05-17 20:30:18 -04:00
apion fffdfb7654 Fixes bug with InvMove, closes #847 2024-05-17 20:28:57 -04:00
Hiroku b314733f0b Merge branch 'Frank's-Bug-Fixing-Farm' into 'main'
Frank's bug fixing farm

See merge request cable-mc/cobblemon!1019
2024-05-17 10:44:01 +00:00
Frank The FarmerandHiroku d5aa07fe91 Frank's bug fixing farm 2024-05-17 10:44:00 +00:00
apion 27bedc2d2c Closes #799 2024-05-16 21:59:36 -04:00
Hiroku 86744c23a5 Merge branch '1.5.1' into 'main'
Fix recoil evo bug

Closes #844

See merge request cable-mc/cobblemon!1022
2024-05-17 01:41:41 +00:00
apion 8d1a64136f Fix recoil evo bug 2024-05-16 20:33:19 -04:00
Paul bc550dd32c Fixed unlocked evolutions getting re-checked and eating held items, fixes #843 2024-05-17 10:04:54 +10:00
Paul 3009af8c42 Fixed missing cant.nopp lang key, fixes #842 2024-05-17 08:52:23 +10:00
Hiroku bfd34eb621 Merge branch '1.5.1' into 'main'
Fixes a few issues

Closes #827, #828, #826, and #832

See merge request cable-mc/cobblemon!1012
2024-05-16 22:46:10 +00:00
Hiroku 2dc2c96176 Update CHANGELOG.md [skip-ci] 2024-05-16 22:44:00 +00:00
Hiroku df4db17cfd Removed println 2024-05-16 22:40:56 +00:00
apion 45bec488f1 Fixed bug with pasture block 2024-05-15 20:41:32 -04:00
apion 9287374504 Merge branch 'refs/heads/main' into 1.5.1 2024-05-15 18:24:56 -04:00
apion 90c5180712 Revert "update Forge to current RB, update Fabric deps to latest"
This reverts commit 7139d4708b.
2024-05-15 18:17:29 -04:00
apion f2a36cd74a Merge branch 'refs/heads/main' into 1.5.1
# Conflicts:
#	CHANGELOG.md
2024-05-15 14:51:45 -04:00
Nick 158aa05f24 Merge branch 'fix/downgrade-loom' into 'main'
fix: resolve mapping issues by downgrading loom

See merge request cable-mc/cobblemon!1015
2024-05-15 15:38:09 +00:00
Apion 8924d0fe0f Merge branch 'navneetset-main-patch-27693' into 'main'
Fix PC store downsizing not working with .resize()

See merge request cable-mc/cobblemon!1016
2024-05-15 12:12:04 +00:00
PebblesandApion d510eaa462 Fix PC store downsizing not working with .resize() 2024-05-15 12:12:04 +00:00
Hiroku 8b63057d9d Merge branch 'we-ballin' into 'main'
Cherish, Dream, Beast, and Ancient Origin Send Out Particles

See merge request cable-mc/cobblemon!1018
2024-05-15 10:26:08 +00:00
Hiroku d572b3c505 Missed a bit [skip-ci] 2024-05-15 10:25:21 +00:00
Hiroku 8edc60224a Merge branch 'main' into 'we-ballin'
# Conflicts:
#   CHANGELOG.md
2024-05-15 10:24:54 +00:00
Hiroku a634c4f046 Merge branch 'update-libs' into 'main'
Update libs

See merge request cable-mc/cobblemon!1017
2024-05-15 10:23:14 +00:00
MoeBoy76 7139d4708b update Forge to current RB, update Fabric deps to latest 2024-05-15 11:11:02 +10:00
dhi_holo 50e99736a3 Partial Fix
Origin Ball now plays correctly in resource pack, but not in the mod itself, updated jsons to match, so all that's left is working out why the mod refuses to read the new jsons even though the new jsons are read in the files, in intellij, and in github desktop.
2024-05-15 10:43:09 +10:00
MoeBoy76 68c4acf0eb Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon 2024-05-15 09:21:22 +10:00
broccoli 5b5e7109f5 fix: resolve mapping issues by downgrading loom
fixes regression in fd7b82dbe3
2024-05-14 23:17:16 +01:00
Hiroku 37596523db Merge branch 'tmetcalfe89/abstract-stat-ratio-requirement' into 'main'
abstracted stat ratio requirement

See merge request cable-mc/cobblemon!1011
2024-05-14 20:15:13 +00:00
tmetcalfe89 eb80c20dbf updated readme 2024-05-14 09:11:16 -07:00
apion 7ab3951613 Fix gilded chest item drops 2024-05-14 11:16:33 -04:00
apion e6d51c4d56 A little more fossil machine clean up 2024-05-14 10:26:25 -04:00
Apion 3813ec3c92 Merge branch 'sound' into 'main'
Renamed Relic Coin Sack sound assets. Added new sounds for Relic Coin Pouches.

See merge request cable-mc/cobblemon!1013
2024-05-14 14:12:24 +00:00
apion b9364304ca Changelog teehee 2024-05-14 09:47:35 -04:00
Sterrezo 9be212d2b8 Renamed Relic Coin Sack sound assets. Added new sounds for Relic Coin Pouches.
Renamed all sounds called "coin_pouch..." to "relic_coin_sack..." Added new sounds for breaking and placing Relic Coin Pouches with a new sound group for them.
2024-05-14 13:27:11 +02:00
tmetcalfe89 2559257b3a added licenses 2024-05-14 01:16:30 -07:00
apion 8236c6fb11 Merge branch 'refs/heads/main' into 1.5.1 2024-05-14 04:13:40 -04:00
apion 2041d43db4 Hopefully fixed some other bugs 2024-05-14 03:53:35 -04:00
Apion a1687e8304 Merge branch 'tmetcalfe89/ensure-defeat-count' into 'main'
Ensure update total defeat count on battle win

See merge request cable-mc/cobblemon!1010
2024-05-14 07:25:09 +00:00
JazzMcNade 94d92b6fc0 Fixes #827
Jade can now view the contents of the analyzer block
2024-05-14 01:53:56 -05:00
tmetcalfe89 3aa95b9339 abstracted stat ratio requirement 2024-05-13 23:39:01 -07:00
tmetcalfe89 4e97f70801 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into tmetcalfe89/ensure-defeat-count 2024-05-13 22:39:56 -07:00
dhi_holo 404ca565f5 4 balls maybe working
Send out particles for Cherish, Dream, Beast, and Ancient Origin balls

Needs testing on one issue before MR
2024-05-14 15:35:32 +10:00
MoeBoy76 93db0e1cda Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon 2024-05-14 08:57:15 +10:00
apion 4a4d292228 Fixes #828 2024-05-13 17:01:38 -04:00
apion 0fef9eec3d Fixes #826 2024-05-13 17:01:27 -04:00
apion 5f3dc395ec Fixes #832 2024-05-13 12:17:47 -04:00
Hiroku 1bf9d36dbd Merge branch 'wheres-the-tag-drake' into 'main'
Updated fossils.json Item Tag

Closes #834

See merge request cable-mc/cobblemon!1009
2024-05-13 09:45:38 +00:00
dhi_holo b19c5ed125 Updated fossils.json Item Tag
Sorted the fossils tag to match the order on Bulbapedia (just to make sure all other fossils were there, and because it looks a little nicer), and added Fossilized Drake to the tag
2024-05-13 17:51:19 +10:00
Paul e3cca0d9cf SpawnAction#complete returns R instead of Boolean 2024-05-13 15:08:55 +10:00
tmetcalfe89 1aa55f8199 replaced entity ref with originalPokemon 2024-05-12 21:49:58 -07:00
Paul 4c16b2ce2e Track friendship on client entities, tweaks to dataTracker initializing, MoLang in pose & quirk conditions 2024-05-13 12:47:53 +10:00
Hiroku 920e314444 Merge branch '830-only-player-entity-can-send-out-pokemon' into 'main'
Remove unnecessary cast of phaseTarget to PlayerEntity in PokemonRenderer.renderTransition

Closes #830

See merge request cable-mc/cobblemon!1008
2024-05-12 10:23:34 +00:00
David Sadler 3e4fdc0f22 Remove unnecessary cast of phaseTarget to PlayerEntity in PokemonRenderer.renderTransition 2024-05-12 11:04:52 +01:00
Hiroku 209ac71e06 Merge branch 'FossilTankFixes' into 'main'
Fix for using incorrect item count when applying organic material with right click.

See merge request cable-mc/cobblemon!1007
2024-05-12 08:05:27 +00:00
JazzMcNade ecfc77f311 Updated Changelog 2024-05-12 02:49:19 -05:00
JazzMcNade e64de3aa7d Fixed a bug in which adding organic material was adding the full count of the stack currently in hand 2024-05-12 01:29:55 -05:00
Nick fd7b82dbe3 Merge branch 'build/gradle-updates' into 'main'
gradle and build improvements

See merge request cable-mc/cobblemon!1006
2024-05-11 23:40:09 +00:00
broccolaiandNick 7ef48402fb gradle and build improvements 2024-05-11 23:40:09 +00:00
Nick 81ac6f3b44 Snapshot = true 2024-05-11 16:39:06 -07:00
Paul 347e10d7e4 Snapshot = false 2024-05-12 08:20:46 +10:00
Paul 32270b6176 Attempt at fixing data migration error in species features 2024-05-11 14:39:49 +10:00
Hiroku a0a26a98b5 Merge branch 'V-lpen-main-patch-49919' into 'main'
Update dragapult.json

See merge request cable-mc/cobblemon!996
2024-05-11 04:37:18 +00:00
Hiroku 85836f19b2 Merge branch 'held_item_back' into 'main'
Fixed held items without consumable tags from being consumed or swapped in battle.

See merge request cable-mc/cobblemon!1005
2024-05-11 04:36:47 +00:00
Hiroku 9f251b7070 Update CHANGELOG.md 2024-05-11 04:36:13 +00:00
Segfault Guy 86ddb6d743 Fixed held items without consumable tags from being consumed or swapped in battle. 2024-05-11 00:15:26 -04:00
Paul 9c8a00bbdc Fixed bad moveset JSON for Kyurem 2024-05-11 13:04:50 +10:00
Hiroku 04abf2bd25 Update CHANGELOG.md [skip-ci] 2024-05-11 00:27:36 +00:00
Paul e6553655a6 Changelog update heading [skip-ci] 2024-05-11 10:19:43 +10:00
Paul 5f33d16a75 More changelog cleanup 2024-05-11 09:53:00 +10:00
Hiroku 468f84862e Merge branch '1.5-structure-fixes' into 'main'
Deleted Duplicate Loot Table

See merge request cable-mc/cobblemon!1003
2024-05-10 22:27:50 +00:00
Nick 5b2d542fca Merge branch 'Myslippy-main-patch-94569' into 'main'
Update CHANGELOG.md

See merge request cable-mc/cobblemon!1002
2024-05-10 20:06:14 +00:00
Myslippy 95db34c55e Update CHANGELOG.md 2024-05-10 19:41:41 +00:00
Paul 15da48c5c0 Merge remote-tracking branch 'origin/main' 2024-05-10 18:42:29 +10:00
Paul ead62763c1 Changelog cleanup 2024-05-10 18:42:22 +10:00
apion 247c475c2d Fix oversight in incendium fix 2024-05-09 23:44:04 -04:00
Hiroku 44aab4f0e7 Merge branch 'spawn-fixes' into 'main'
Spawn fixes

See merge request cable-mc/cobblemon!1001
2024-05-10 03:02:48 +00:00
Frank The FarmerandHiroku 94edae591c Spawn fixes 2024-05-10 03:02:48 +00:00
Hiroku c83f045b4d Merge branch 'incendium-fix' into 'main'
Fixes #823

Closes #823

See merge request cable-mc/cobblemon!999
2024-05-10 00:16:23 +00:00
apion b5d7786ff7 Fixes #823 2024-05-09 20:05:03 -04:00
Paul 9283794e26 Merge remote-tracking branch 'origin/main' 2024-05-10 09:53:11 +10:00
Hiroku 55580fb564 Merge branch 'sound' into 'main'
Flamethrower sound fixes

See merge request cable-mc/cobblemon!998
2024-05-09 23:52:44 +00:00
Paul 472c9be634 Applied pt-pt translations 2024-05-10 09:49:07 +10:00
Sterrezo a247344ae4 Removed unused audio files 2024-05-10 01:41:03 +02:00
FrankTheFarmer 1fd0a9775c Flamethrower is flamethrowering now 2024-05-10 09:39:32 +10:00
Hiroku 9d9495f1f9 Merge branch 'fix-adorn-compat' into 'main'
Fixed adorn compat

See merge request cable-mc/cobblemon!997
2024-05-09 22:56:26 +00:00
apion 88e301d7c8 Fixed adorn compat 2024-05-09 18:53:44 -04:00
Hiroku b0e16a7f26 Merge branch 'FossilTankCreateFix' into 'main'
Fossil Tank Create Fix

See merge request cable-mc/cobblemon!993
2024-05-09 22:07:43 +00:00
Hiroku 54b5b3cbbc Merge branch 'implement_pokemon' into 'main'
Forgot to merge request

See merge request cable-mc/cobblemon!992
2024-05-09 22:07:14 +00:00
Frank The FarmerandHiroku 7850bc5263 Forgot to merge request 2024-05-09 22:07:14 +00:00
V-lpen 8ce5a927b9 Update dragapult.json 2024-05-09 19:19:22 +00:00
Test 24c34af8bf remove random color from ui text 2024-05-08 22:25:19 +00:00
Hiroku 7402426656 Merge branch 'tmetcalfe89/fletchinder-name-ru' into 'main'
in Russian translation the fletchinder was called fletchling

See merge request cable-mc/cobblemon!990
2024-05-08 20:47:41 +00:00
Hiroku c658e496cc Merge branch 'GildedChestHopperInteractionFix' into 'main'
Hoppers can now interact with all inventory slots in a Gilded Chest, Closes #822

Closes #822

See merge request cable-mc/cobblemon!994
2024-05-08 20:40:42 +00:00
JazzMcNade f3300806a3 Hoppers can now interact with all inventory slots in a Gilded Chest 2024-05-08 02:12:53 -05:00
JazzMcNade 8fee4de49b Graceful transition to new inventory, fixed item scatterer 2024-05-08 01:28:41 -05:00
JazzMcNade 5b951ef511 Added Anti-item clogging technology to the fossil tank 2024-05-07 23:43:40 -05:00
tmetcalfe89 6e0850331a held item too 2024-05-06 12:40:22 -07:00
tmetcalfe89 79b1771e7e quick fix 2024-05-06 10:00:50 -07:00
JazzMcNade c9b2c44083 Fixed create chute crash and item duping when chutes attempt to put items in a restoration tank. Refactored RestorationTankEntity to use SimpleInventory 2024-05-05 20:19:09 -05:00
Hiroku c370076337 Merge branch 'bye-j16' into 'main'
Bye J16

See merge request cable-mc/cobblemon!988
2024-05-05 03:34:07 +00:00
MoeBoy76 a0b263e392 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon 2024-05-03 10:45:11 +10:00
MoeBoy76 d05ae4d535 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into bye-j16 2024-05-03 10:19:18 +10:00
MoeBoy76 3cebfb38ef fix mixin compat level being set to Java 16 for no reason 2024-05-03 10:18:58 +10:00
Apion d69f1f17b6 Merge branch 'implement_pokemon' into 'main'
Daily Implementation Mission

See merge request cable-mc/cobblemon!987
2024-05-02 06:59:35 +00:00
Frank The FarmerandApion 3ba89472fa Daily Implementation Mission 2024-05-02 06:59:35 +00:00
MoeBoy76 573608b6fc Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon 2024-05-02 16:04:01 +10:00
MoeBoy76 f092584f83 changelog blank line at end [skip-ci] 2024-05-02 16:03:52 +10:00
Apion a76146f8e9 Merge branch 'JSON-Poser-Tweaks' into 'main'
Json poser tweaks

See merge request cable-mc/cobblemon!986
2024-05-02 05:53:59 +00:00
Frank The FarmerandApion 548daa84e4 Json poser tweaks 2024-05-02 05:53:59 +00:00
Apion 7f1dd4546b Merge branch 'can-moe-scrape' into 'main'
Blueberry DLC

Closes #757, #649, and #758

See merge request cable-mc/cobblemon!953
2024-05-02 05:48:29 +00:00
MoeBoy76andApion a129c361df Blueberry DLC 2024-05-02 05:48:29 +00:00
Hiroku 5d5508a71e Merge branch '1.5-structure-fixes' into 'main'
1.5 structure fixes

See merge request cable-mc/cobblemon!984
2024-04-29 12:29:34 +00:00
Hiroku 5e5684d9fd Merge branch 'implement_pokemon' into 'main'
A couple fixes

See merge request cable-mc/cobblemon!985
2024-04-29 12:29:16 +00:00
Frank The FarmerandHiroku a1623c04b7 A couple fixes 2024-04-29 12:29:15 +00:00
Hiroku 97e51eb7b5 Merge branch 'removing-items-is-hard' into 'main'
Update is_held_item.json

See merge request cable-mc/cobblemon!983
2024-04-29 05:44:20 +00:00
dhi_holo ba75dcdf31 Update is_held_item.json
why is removing held items so damn annoying, can't we just get vera to fasttrack the sprites instead /j
2024-04-29 15:19:59 +10:00
Paul 9bf8c0e3ec Fixed MOVING data tracker field not using the new logic that drives the pose 2024-04-29 11:25:12 +10:00
Hiroku 0c62c247ec Merge branch '1.5-bug-fixes' into 'main'
(misleading branch name) Run config changes

See merge request cable-mc/cobblemon!980
2024-04-29 00:16:52 +00:00
Hiroku c70e8872ce Merge branch 'implement_pokemon' into 'main'
Implementation yet again

See merge request cable-mc/cobblemon!982
2024-04-29 00:10:19 +00:00
Frank The FarmerandHiroku ce323ddfbf Implementation yet again 2024-04-29 00:10:19 +00:00
Hiroku ffe7978560 Merge branch 'no-more-heldies' into 'main'
Commented out the Held Items

See merge request cable-mc/cobblemon!981
2024-04-28 07:44:29 +00:00
dhi_holo a58632752a Commented out the Held Items
(just the ones without sprites, ofc, just trying to scare public git readers)
2024-04-28 17:21:23 +10:00
apion 0b93481dbf Remove unneeded imports 2024-04-27 13:10:21 -04:00
apion dda004a66c Change default run configs to generate with a uuid and username 2024-04-27 13:05:44 -04:00
apion 9648a91f4a Fixed fabric server run config, split client and server run folders 2024-04-26 20:35:50 -04:00
Hiroku e0c4bf7fb2 Merge branch 'implement_pokemon' into 'main'
Today's implementation fixes

See merge request cable-mc/cobblemon!977
2024-04-26 23:23:50 +00:00
Frank The FarmerandHiroku ed919f63f0 Today's implementation fixes 2024-04-26 23:23:49 +00:00
Apion 239acc0623 Merge branch '1.5-structure-fixes' into 'main'
One more try

See merge request cable-mc/cobblemon!978
2024-04-26 22:12:46 +00:00
Hiroku 8f1127be46 Merge branch 'pve-fix' into 'main'
Fix BattleBuilder's Successful-ness

See merge request cable-mc/cobblemon!976
2024-04-26 00:44:27 +00:00
Hiroku 26a8bf1ca5 Merge branch 'idev-botarium-crash-fix' into 'main'
Fix for a very specific issue where Botarium and Cobblemon will have mapping...

See merge request cable-mc/cobblemon!975
2024-04-25 23:43:58 +00:00
Stampede d3da8c99a8 Simplify battle success fix and apply to 1v1s 2024-04-25 16:41:56 -05:00
Stampede d106deb7f6 Fix PvE battles not returning successful even it was 2024-04-25 14:32:57 -05:00
Waterpicker f1d1e87e47 Fix for a very specific issue where Botarium and Cobblemon will have mapping conflicts indev when the project uses mojang due to how kotlin syntax works. 2024-04-25 12:20:48 -05:00
Paul 2d9d6e172c Updated pt_pt 2024-04-25 19:19:07 +10:00
Paul 3c03b0e210 Updated many translations (de_de, en_pt, es_es, es_mx, fr_ca, fr_fr, ja_jp, ko_kr, pl_pl, ru_ru) 2024-04-25 19:03:35 +10:00
Nick 724c674992 Fix packet/mixin issues related to forge, bump KFF version, and build details 2024-04-24 22:07:31 -07:00
Paul 99eb317a87 Fixed Kabuto animations 2024-04-25 13:32:06 +10:00
Hiroku 43a2c2f55d Merge branch 'implement_pokemon' into 'main'
Implementation stuff

See merge request cable-mc/cobblemon!973
2024-04-25 02:00:16 +00:00
Frank The FarmerandHiroku 4db9a35f2b Implementation stuff 2024-04-25 02:00:16 +00:00
Hiroku 8228ac517b Merge branch 'interpreter_my_beloved' into 'main'
Misc interpreter refactor fixes

See merge request cable-mc/cobblemon!972
2024-04-24 02:48:02 +00:00
Segfault Guy c7ae41bf7b Merge branch 'main' into interpreter_my_beloved 2024-04-23 22:43:06 -04:00
Segfault Guy 1653be5fa8 Misc refactor fixes. 2024-04-23 22:42:00 -04:00
Hiroku b0497065f4 Merge branch '1.5-spawns-and-fixes' into 'main'
1.5 spawns and fixes

See merge request cable-mc/cobblemon!968
2024-04-24 02:34:03 +00:00
Paul dfc1a39f58 Merge branch 'refs/heads/main' into 1.5-spawns-and-fixes
# Conflicts:
#	CHANGELOG.md
2024-04-24 12:30:17 +10:00
Paul 9a92e074a2 Fixed instant particle emitter not defaulting the number of particles the way it does in Snowstorm 2024-04-24 11:38:59 +10:00
Hiroku 44b195f0a6 Updated changelog with exact counts for structures [skip-ci] 2024-04-22 23:34:40 +00:00
Hiroku 7c21e6feb5 Merge branch '1.5-Structures' into 'main'
1.5 structures

See merge request cable-mc/cobblemon!971
2024-04-22 22:33:21 +00:00
Paul f246d90e4c Merge remote-tracking branch 'origin/main' 2024-04-22 09:11:59 +10:00
Hiroku df22cc5b3e Merge branch 'advancement-description-inconsistencies-fixes' into 'main'
Update en_us.json

Closes #809

See merge request cable-mc/cobblemon!969
2024-04-21 23:11:49 +00:00
Paul 3fbe2102a0 Fixed curves not working properly at the particle level if they weren't always on screen, closes #806 2024-04-22 09:11:39 +10:00
dhi_holo 21b667f5d8 Update en_us.json
Corrects two advancement descriptions to be accurate and match formatting of all other advancements.

I think I made the branch name longer than the changes, looking at it in githubdesktop I'm not so sure now xD
2024-04-21 16:35:29 +10:00
Paul eb88a43769 Fixed bedrock particle rotation velocity being treated as blocks per tick instead of blocks per second, closes #807 2024-04-21 15:32:07 +10:00
Paul c41a6766ef Fixed lookat_y camera mode 2024-04-21 15:31:19 +10:00
Paul 842de0e92c Fixed woopsy with automaton armor trim advancement 2024-04-21 15:30:50 +10:00
Veraxiel 04b516765d Edited Moon Stone Ore gen. Updated changelog. 2024-04-21 00:44:28 -04:00
Paul 3faad69484 Oops remove that TODO 2024-04-21 12:36:13 +10:00
Paul 74e2f8429c Fixed expiration events not running for particles when they expire on collision. Closes #805 2024-04-21 12:35:53 +10:00
Paul 10219fbf38 Made vivillon advancement description consistent on punctuation. Closes #809 2024-04-21 12:33:15 +10:00
Hiroku cf68ccc29e Merge branch 'sound' into 'main'
Removed an unused sound file

See merge request cable-mc/cobblemon!966
2024-04-21 02:29:58 +00:00
Hiroku f78847f917 Merge branch 'mistrim' into 'main'
Trim Recipe Fixes

See merge request cable-mc/cobblemon!967
2024-04-21 02:29:17 +00:00
Village 8768c4c541 differentiate badly poisoned in ui 2024-04-17 21:50:03 -04:00
Veraxiel 2bf0fd625b Tweaked some spawns, flipped the Poison Barb sprite for looking too much like a sword when held. 2024-04-17 19:49:53 -04:00
dhi_holo 65e3052e69 Removed Missing Textures
Automaton Trims now work when trimming same material (Iron Armour, Iron Trim Material, same for diamond, gold, and netherite)
2024-04-16 17:00:28 +10:00
dhi_holo be7192ae2c Trim Recipe Fixes
+ Adds duplication recipe
+ Adds advancement to unlock duplication recipe
- Renamed smithing recipe to match Vanilla
+ Adds advancement to unlock smithing recipe
2024-04-16 16:14:45 +10:00
Sterrezo 1c921a372b Removed an unused sound file
My guess is it was put there when battle effects or particles were being worked on. As far as I can tell it's not used anywhere.
2024-04-15 23:14:01 +02:00
Nick cf3587557d Merge branch 'ui-icon' into 'main'
Update shiny icon

See merge request cable-mc/cobblemon!963
2024-04-15 19:14:48 +00:00
TestandNick bbd44c0010 Update shiny icon 2024-04-15 19:14:48 +00:00
Nick bb05177985 Merge branch 'imposter_fix' into 'main'
Imposter fixes

See merge request cable-mc/cobblemon!965
2024-04-15 19:14:18 +00:00
Segfault GuyandNick 31143359ee Imposter fixes 2024-04-15 19:14:18 +00:00
Nick c8f0140870 Merge branch '1.5-Structures' into 'main'
found a spelling error smh

See merge request cable-mc/cobblemon!964
2024-04-15 19:13:00 +00:00
MyslippyandNick 0b9ca3a97c found a spelling error smh 2024-04-15 19:12:59 +00:00
Hiroku 450ebfc44e Merge branch 'scripts/public-spawn-writer-script' into 'main'
public spawn writer script open beta

See merge request cable-mc/cobblemon!961
2024-04-13 01:26:36 +00:00
Hiroku 253bde945f Merge branch 'gilded-chest-crash-fix' into 'main'
Fixes gilded chest encounter from crashing when party is empty.

See merge request cable-mc/cobblemon!962
2024-04-13 01:06:14 +00:00
Islana 3622946974 Fixes gilded chest encounter from crashing when party is empty. 2024-04-12 19:52:33 -04:00
Hiroku 4077feca35 Merge branch '1.5-Structures' into 'main'
It wasnt the last D:

See merge request cable-mc/cobblemon!960
2024-04-11 02:37:44 +00:00
Waldleufer bf330c112b Allowing any combination of Folder and File Name [skip-ci] 2024-04-10 21:47:26 +02:00
Hiroku 5797a2e568 Merge branch '1.5-Structures' into 'main'
1.5 structures

See merge request cable-mc/cobblemon!959
2024-04-10 00:16:49 +00:00
Hiroku 8b8fa06472 Update 0999_gimmighoul.json 2024-04-09 01:24:18 +00:00
Hiroku 0459780171 Update 0442_spiritomb.json 2024-04-09 00:22:21 +00:00
Hiroku e27bf7fc4b Merge branch 'ys/forfeit' into 'main'
PVP Forfeit Option

Closes #142

See merge request cable-mc/cobblemon!957
2024-04-08 14:28:57 +00:00
Paul 36007caf16 Merge remote-tracking branch 'origin/main' into ys/forfeit
# Conflicts:
#	common/src/main/resources/assets/cobblemon/lang/en_us.json
2024-04-08 22:55:49 +10:00
Hiroku f00b16ab1a Merge branch 'better_victory_msg' into 'main'
Fix capture messages and improve win/defeat messages.

See merge request cable-mc/cobblemon!958
2024-04-08 12:25:37 +00:00
Hiroku ac93c89d2c Merge branch '1.5-more-spawn-and-drops' into 'main'
1.5 more spawn and drops

See merge request cable-mc/cobblemon!954
2024-04-08 12:22:00 +00:00
Hiroku 1c5f6a8f54 Merge branch 'implement_pokemon' into 'main'
Hisui Starters, some model, animation, & texture fixes, and more!

See merge request cable-mc/cobblemon!956
2024-04-08 04:09:18 +00:00
Segfault Guy f66358e358 Fix capture messages and improve win/defeat messages. 2024-04-07 22:53:50 -04:00
Tyzillion 446706e6cd Moved my conditions from PokemonEntity to EntityExtensions. 2024-04-07 22:50:42 -04:00
Segfault Guy 967fd2e0ec Force Showdown loss on forfeit. 2024-04-07 22:48:38 -04:00
Tyzillion 57d2b51264 Sorry, found another error in the changelog. 2024-04-07 22:29:21 -04:00
Tyzillion 4baa43ccb4 Quick changelog amend. 2024-04-07 22:26:28 -04:00
Tyzillion c9be0104dd Updated Changelog. 2024-04-07 22:14:04 -04:00
Tyzillion 55a179f548 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-04-07 22:11:23 -04:00
Tyzillion beaea0e88c Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-04-07 22:11:05 -04:00
Tyzillion fb54ff8054 Revamped Torkoal's particles. Made the particles only appear in battle. Hoping in the future when it gets more animations to add quirks that have it spew smoke. 2024-04-07 22:10:52 -04:00
Hiroku c273192ba2 Merge branch 'tumbleshatter' into 'main'
Reduces Tumblestone blocks to a 2x2 recipe, makes Tumblestone blocks drop the tumblestones on break

See merge request cable-mc/cobblemon!955
2024-04-08 02:06:33 +00:00
dhi_holo acfc3b1acc Tumbleshatter
Tumblestone Blocks now shatter back into tumblestones on breaking, unless using silk touch
2024-04-08 09:44:38 +10:00
dhi_holo e45e7a589b Reduces Tumblestone blocks to a 2x2 recipe
(this is for future content)
2024-04-08 09:09:31 +10:00
FrankTheFarmerReal 0fc3bf9de7 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-04-08 07:15:42 +10:00
FrankTheFarmerReal b6af9381f0 Ferroseed line is not from gen 2 🤔 2024-04-08 07:14:59 +10:00
Sterrezo ee64810970 Cry checker script fix 2024-04-07 23:05:51 +02:00
Tyzillion a7152f3e35 Added ambient Bubble particles to Krabby that play during sunset with no rain. 2024-04-07 14:09:11 -04:00
Tyzillion 46290554c5 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-04-07 14:08:38 -04:00
Tyzillion 771a2c0727 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-04-07 14:08:03 -04:00
Segfault Guy 4e456e030d Merge branch 'main' into ys/forfeit
Conflicts:
	common/src/main/kotlin/com/cobblemon/mod/common/api/battles/model/PokemonBattle.kt
	common/src/main/kotlin/com/cobblemon/mod/common/battles/ShowdownActionRequest.kt
	common/src/main/resources/assets/cobblemon/lang/en_us.json
2024-04-07 13:33:34 -04:00
FrankTheFarmerReal 9d69c593b8 Hitbox and Look animation fixes. Stopped Ferroseed and Whirlipede turbo spins. 2024-04-08 00:05:29 +10:00
Hiroku 6e58f4be59 Merge branch 'illusion' into 'main'
Illusion and Transform Entity Effects

Closes #769, #744, #741, #297, and #123

See merge request cable-mc/cobblemon!929
2024-04-07 01:33:47 +00:00
FrankTheFarmerReal f1807dc27c Many many fix 2024-04-06 22:13:33 +10:00
Tyzillion cb8e96230e Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-04-06 04:48:37 -04:00
Paul dc6b3ada9b Fixed F3-T crash on Fabric. Closes #780 2024-04-06 13:28:39 +10:00
Paul ccdb8803b2 Merge remote-tracking branch 'origin/main' into implement_pokemon 2024-04-06 12:00:24 +10:00
Paul fd917438a1 Fixed Pokémon pathing over snow layers and carpets. Closes #783 2024-04-06 11:44:39 +10:00
Tyzillion 4a0e567554 Fixed starterconfig to use right features 2024-04-05 16:18:46 -04:00
Tyzillion bb6b67e4aa Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-04-05 16:16:23 -04:00
FrankTheFarmerReal 8bf5492409 10 Fixes + Retextures implemented 2024-04-05 23:46:02 +10:00
FrankTheFarmerReal e6573f3c3b Sneasel hitbox fixes 2024-04-05 15:28:53 +10:00
Tyzillion 86d8fa1806 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-04-05 00:10:56 -04:00
Hiroku de65320610 Merge branch 'SortFaintedToBottom_Fix' into 'main'
Sort fainted to bottom fix

See merge request cable-mc/cobblemon!932
2024-04-05 02:57:21 +00:00
Hiroku 3828991a71 Update BattleActor.kt 2024-04-05 01:32:00 +00:00
Paul 129ea86829 Licenses 2024-04-05 11:10:51 +10:00
Hiroku 216270b798 Merge branch 'bugs_and_tweaks' into 'main'
Bugs and tweaks

Closes #782

See merge request cable-mc/cobblemon!931
2024-04-05 01:03:00 +00:00
Hiroku ad1674a1bc Merge branch 'main' into 'illusion'
# Conflicts:
#   common/src/main/kotlin/com/cobblemon/mod/common/pokemon/Pokemon.kt
2024-04-05 00:46:37 +00:00
FrankTheFarmerReal 2b80d99614 Commented out some faint poses for pokemon that don't have faint animations currently. 2024-04-04 22:56:26 +10:00
FrankTheFarmerReal 723302ed39 Fixed Shieldon animation crash 2024-04-04 22:42:15 +10:00
FrankTheFarmerReal 79bec94f55 Restored missing Hippowdon sound 2024-04-04 22:41:39 +10:00
FrankTheFarmerReal d7a7d421a0 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-04-04 21:52:50 +10:00
FrankTheFarmerReal 49632b6f85 Revised SingleBoneLookAnimation. Can properly invert X and Y axis and define range limits. 2024-04-04 21:50:13 +10:00
Tyzillion 308a41a5fc Gave Lapras funny placeholder Quadruped walk. hehe 2024-04-04 07:20:16 -04:00
Paul a5486be16f Removed a test log message 2024-04-04 20:40:33 +10:00
Paul 94c9f865e7 Fixed poser issues for gen8 fossils, Omanyte line, Wingull line, Hippowdown, Chespin line 2024-04-04 20:06:28 +10:00
Paul 3385b9c8bf Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-04-04 19:38:39 +10:00
Veraxiel cdfc894d49 Removed spawns not supposed to be there. 2024-04-03 16:55:13 -04:00
Veraxiel 784e2c0fb8 Updates to spawns and some tags. 2024-04-03 16:52:18 -04:00
Waldleufer e6a487dc52 Handling custom file name groupings and custom output folders in the public spawn writer [skip-ci] 2024-04-03 22:28:37 +02:00
Waldleufer bdb79a32cc Generated a bunch of drops. 2024-04-03 20:51:57 +02:00
Waldleufer 5d6a227c49 Merge branch 'main' into 1.5-more-spawn-and-drops 2024-04-03 19:37:40 +02:00
FrankTheFarmerReal 2bca651f75 PLEASE REVIEW: SingleBoneLookAnimation changes to support min and max ranges for yaw. Dugtrio and Dodrio examples. 2024-04-03 23:22:59 +10:00
FrankTheFarmerReal cbde864cc1 diglett and dugtrio hitbox fixes 2024-04-03 23:17:55 +10:00
FrankTheFarmerReal 4b3a5d7ca9 Flaaffy head bone correction 2024-04-03 20:04:30 +10:00
FrankTheFarmerReal e55c08648f Expanded constructor for SingleBoneLook and added Grimmsnarl sight cone restrictions. 2024-04-03 13:15:38 +10:00
FrankTheFarmerReal 052f8fd94a Some placeholder animations 2024-04-03 08:50:57 +10:00
Tyzillion cd4f7fc7aa Forgot to merge main into branch. 2024-04-02 17:19:33 -04:00
Tyzillion c90400bba6 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
2024-04-02 17:17:32 -04:00
Tyzillion d390764717 changed pattern aspect to region_bias. Updated all that needed to be updated with the new aspect name. Made the region bias pokemon share animations with their normal variants. 2024-04-02 17:15:51 -04:00
Lily 0880d127a7 Merge branch 'main' into bugs_and_tweaks
# Conflicts:
#	common/src/main/resources/assets/cobblemon/lang/en_us.json
2024-04-02 16:13:39 -04:00
Nick 30466a6063 Merge branch 'shifting-shadows' into 'main'
Scale shadows on sendout/recall

See merge request cable-mc/cobblemon!949
2024-04-02 18:50:13 +00:00
MiaandNick fd59b81bff Scale shadows on sendout/recall 2024-04-02 18:50:13 +00:00
FrankTheFarmerReal ba82a6bc56 Some placeholder animations 2024-04-02 16:16:28 +10:00
Lily abf64e6047 Merge branch 'main' into bugs_and_tweaks 2024-04-01 22:06:23 -04:00
Lily c463278498 Fix outdated advancement name 2024-04-01 22:04:42 -04:00
Paul a37fdf709a Fixed Inkay evo method. Fixes #787 2024-04-01 18:51:55 +10:00
Paul 5023f28d04 Fixed underwalking the target position leading to walking in place. Fixes #790 2024-04-01 18:40:57 +10:00
FrankTheFarmerReal 49444eea50 Updated walk animations for Armaldo and Hoothoot 2024-04-01 15:36:56 +10:00
FrankTheFarmerReal 470fb80e08 Cutiefly, Flabebe, Flittle, and Scatterbug are now shoulder mountable 2024-04-01 15:22:29 +10:00
FrankTheFarmerReal a2aa6deddb Fixed Roselia battle idle not playing 2024-04-01 14:26:12 +10:00
Paul 0d4ef20b4a Merge remote-tracking branch 'origin/main' into implement_pokemon
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/entity/pokemon/PokemonEntity.kt
2024-04-01 11:55:37 +10:00
Hiroku 67de28386a Merge branch 'ball-animation-changes' into 'main'
Breakout Animation, Overhauled Sendout Logic

See merge request cable-mc/cobblemon!943
2024-04-01 01:03:16 +00:00
Hiroku cd37d3538e Formatting 2024-04-01 00:39:38 +00:00
Tyzillion 137fed9152 Removed cry sound effect from Gimmighoul surprise animation so that it doesn't play the cry twice when encountering a closed Gimmighoul. Fixed Archen quirk sound being on wrong quirk. 2024-03-31 15:29:01 -04:00
Tyzillion 42ea462937 Hopefully fixed Xatu's t-posing while flying. 2024-03-31 11:14:19 -04:00
Tyzillion f32852db9d Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-03-31 11:08:30 -04:00
Tyzillion 4294360cb9 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-03-31 11:08:15 -04:00
FrankTheFarmerReal d54565dbb5 Fixed Rookidee and Corvisquire T posing underwater 2024-03-31 23:12:08 +10:00
FrankTheFarmerReal 0e005ea1ba Galarian Rapidash will now stop T posing when asleep, but will have to sleep with its eyes open :( 2024-03-31 22:58:16 +10:00
FrankTheFarmerReal d2e32bc26a Gave temporary walk animation to Salazzle 2024-03-31 22:47:16 +10:00
FrankTheFarmerReal 92d5005a62 Restored Lechonk's cry 2024-03-31 22:34:43 +10:00
Hiroku 3d03ee5eb3 Merge branch 'gilded_chest_names' into 'main'
Preserve and display custom names for gilded chests

Closes #792

See merge request cable-mc/cobblemon!945
2024-03-31 12:11:57 +00:00
Paul 0b685ed453 Actually that one field is nullable 2024-03-31 21:47:10 +10:00
Hiroku 115e990df6 Update GildedChestBlock.kt 2024-03-31 10:19:16 +00:00
Hiroku 2ee38f0a29 Merge branch '1.5-Structures' into 'main'
fixed spelling error in gilded chest loot table

See merge request cable-mc/cobblemon!948
2024-03-31 10:18:03 +00:00
FrankTheFarmerReal 99dc9930b8 Fixed Timburr and Gurdurr quirks 2024-03-31 18:52:28 +10:00
Hiroku 425c41bc4b Merge branch 'waterloggable-tumblestones' into 'main'
Make tumblestones waterloggable

Closes #793

See merge request cable-mc/cobblemon!946
2024-03-31 07:22:48 +00:00
Hiroku 9f7a99b583 Merge branch '1.5-Structures' into 'main'
1.5 structures

See merge request cable-mc/cobblemon!947
2024-03-31 07:22:22 +00:00
FrankTheFarmerReal 7b008fe0ec Fixed broken animations for Chinchou, Lanturn, Gallade, and Magikarp 2024-03-31 14:09:12 +10:00
FrankTheFarmerReal ffa9ae4e86 Updated animations for Unovan and Hisuian Petilil 2024-03-31 13:37:07 +10:00
miasmus d60d828e93 make tumblestones waterloggable 2024-03-30 23:00:08 -04:00
FrankTheFarmerReal fcbc7ee72b Updated more walk speeds 2024-03-31 12:13:50 +10:00
Tyzillion 7319fdf29b Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-03-30 21:53:27 -04:00
miasmus 5d7e6f6487 Preserve and display custom names for gilded chests 2024-03-30 19:38:38 -04:00
Segfault Guy d8ad55506d Update Showdown w/ illusion and party bug fixes. 2024-03-30 16:00:18 -04:00
Segfault Guy adef71c23f Merge branch 'main' into illusion 2024-03-30 15:52:10 -04:00
Segfault Guy 9b49f5e01f Add licenses. 2024-03-30 15:37:37 -04:00
Segfault Guy 23c52fd106 Fix transform with shiny aspect. 2024-03-30 15:22:33 -04:00
Segfault Guy d118fe4ee8 Fix interpreter instructions pulling real BattlePokemon name before illusion is dispatched. 2024-03-30 15:09:17 -04:00
Segfault Guy 7b2b860e52 Fix ClientBattlePokemon syncing for transform and illusion. 2024-03-30 14:35:30 -04:00
FrankTheFarmerReal d733eaae2f Updated behaviours for Dreepy line and Flabebe line. 2024-03-31 00:25:40 +10:00
FrankTheFarmerReal 0c8fe42087 Fixed portraits for Lunatone, Solrock, and Salazzle 2024-03-30 23:38:26 +10:00
FrankTheFarmerReal 5e88116e08 Adjusted movement speed of Anorith and Armaldo. Fixed Hisuian Goodra crash 2024-03-30 23:30:45 +10:00
Flarkinater 76d9137ae4 Merge branch 'main' into ball-animation-changes 2024-03-29 22:09:21 -04:00
Flarkinater 9f6c44fd75 Sendout location is only shifted vertically when necessary 2024-03-29 22:08:40 -04:00
Flarkinater 6c086f5555 Fixed merge conflict goofs 2024-03-29 21:58:26 -04:00
FrankTheFarmerReal ef96814900 Restored cries for Gardevoir and Rowlet 2024-03-30 11:37:52 +10:00
Tyzillion f6161d8687 Misc fixes and implemented region pattern evolution methods. 2024-03-29 17:31:08 -04:00
Tyzillion 8aa5d3a72c Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-03-29 11:27:37 -04:00
Waldleufer 353de8b8a3 ✨ Polishing ✨ [skip-ci] 2024-03-29 16:23:21 +01:00
Waldleufer 0423dd4939 hint at potential partial implementations that are not checked of in the spreadsheet. [skip-ci] 2024-03-29 16:19:38 +01:00
Waldleufer fe02ea6fa9 Polished Cry Checker Skript to help verify implemented cries [skip-ci] 2024-03-29 16:08:18 +01:00
Tyzillion 90f7454ffb Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-03-29 08:52:39 -04:00
FrankTheFarmerReal 04f53040a3 Many long pokemon are no longer partly rendered in the PC 2024-03-29 22:50:16 +10:00
Tyzillion 69e21672eb Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2024-03-29 08:36:41 -04:00
FrankTheFarmerReal 4f2e3ecb0f Fixed Conkeldurr using Gurdurr's animations. Also updated the whole line's animations. 2024-03-29 22:27:30 +10:00
FrankTheFarmerReal 1acc41da8c Gimmighoul, Pupitar, and Tyranitar will now appear using the spawnallpokemon command 2024-03-29 20:50:56 +10:00
FrankTheFarmerReal a6917162a7 Updated animations on Quaxwell and Quaquaval 2024-03-29 17:47:53 +10:00
FrankTheFarmerReal 111cb3a2f3 Fixed cries and T poses for Unovan and Hisuian Oshawott 2024-03-29 16:21:03 +10:00
FrankTheFarmerReal 8ac9f38b06 Petilil pivot changes and Stonjourner walk speed adjusted 2024-03-29 15:12:47 +10:00
FrankTheFarmerReal 48193160b9 Texture updates for Forretress, Sizzlipede, and Centiskorch 2024-03-29 14:31:14 +10:00
FrankTheFarmerReal 83100dec11 Tweaked Anorith and Armaldo again 2024-03-29 14:14:52 +10:00
Flarkinater 100bf7fee4 Merge remote-tracking branch 'origin/main' into ball-animation-changes
# Conflicts:
#	common/src/main/kotlin/com/cobblemon/mod/common/client/render/pokemon/PokemonRenderer.kt
2024-03-29 00:05:58 -04:00
Flarkinater be043a0ea1 Fixed minor issue with shifting Pokemon vertically during suffocation sendout check 2024-03-28 23:41:24 -04:00
Flarkinater a902f4a8a3 Fixed suffocation avoidance when sending out Pokemon adjacent to a wall, other related fixes 2024-03-28 23:05:30 -04:00
Flarkinater 442f54839f Improved spacing when targeting walls and above blocks 2024-03-28 22:09:41 -04:00
FrankTheFarmerReal a87b5090b0 Added Anorith and Armaldo animations 2024-03-29 11:48:05 +10:00
FrankTheFarmerReal f0c8d08a04 Pivot fixes for Kirlia and Obstagoon 2024-03-29 09:22:20 +10:00
FrankTheFarmerReal 4fdc738b9e Updated many Pokemon walk speeds 2024-03-29 08:55:53 +10:00
FrankTheFarmerReal 920c5fd01a Rowlet, Dartrix, and Parasect retextures 2024-03-28 21:46:16 +10:00
FrankTheFarmerReal 7d8c8a724f Fixed some aquatic pokemon drowning 2024-03-28 19:45:28 +10:00
Veraxiel 0f5f5d4eed Changed fossil machine recipes. Updated some tags. 2024-03-28 05:37:35 -04:00
FrankTheFarmerReal 30744c42a4 Changelog: Changelog changed 2024-03-28 18:14:39 +10:00
FrankTheFarmerReal 821bb79c14 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-03-28 16:19:51 +10:00
FrankTheFarmerReal f5171a4a8a PNG fixes for Flygon and Archen 2024-03-28 16:19:16 +10:00
Tyzillion 061c9a1c52 Fixed Darmanitan zen crash 2024-03-28 01:15:45 -04:00
FrankTheFarmerReal da45f7d040 Fixes that just keep happening 2024-03-28 14:41:37 +10:00
Flarkinater 92653c1307 When targeting a wall, Pokemon are sent out far enough away to avoid suffocation, based on their size. Wailord rejoice! 2024-03-27 23:42:24 -04:00
Flarkinater c372114da5 Improved avoidance of unsafe locations when sending out Pokemon 2024-03-27 23:26:07 -04:00
FrankTheFarmerReal 230ab53369 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon
# Conflicts:
#	CHANGELOG.md
2024-03-28 11:38:38 +10:00
FrankTheFarmerReal ac43853baa Changelog updates 2024-03-28 11:36:09 +10:00
Tyzillion 0de5f82971 More fixes 2024-03-27 21:24:46 -04:00
Tyzillion ec084cffbc AHHHHHHHHHHHHHHHH 2024-03-27 17:41:44 -04:00
Tyzillion f8ae312c0a Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-03-27 17:28:34 -04:00
Tyzillion abce88fab6 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-03-27 17:28:21 -04:00
FrankTheFarmerReal 69fb39f148 Hisuian Typhlosion's flames are now hidden outside of battle 2024-03-27 20:44:23 +10:00
FrankTheFarmerReal 70838464d5 Litwick also wants to be shouldermountable 2024-03-27 20:14:28 +10:00
FrankTheFarmerReal 3cdb6e05c3 Kommo-o pose and model updates 2024-03-27 17:23:00 +10:00
FrankTheFarmerReal 87822bc2f7 Ralts, Roggenrola, Charcadet, and Sizzlepede are now shoulderable 2024-03-27 16:37:36 +10:00
FrankTheFarmerReal dffb944f3e Squirtle can now ride on your shoulder 2024-03-27 13:02:47 +10:00
FrankTheFarmerReal 613f3044bc Zorua and Zoroark hitbox fixes 2024-03-27 11:38:44 +10:00
FrankTheFarmerReal 342b9cb31e Fixed Dragapult height and Sliggoo's evolution not requiring rain 2024-03-27 11:23:39 +10:00
FrankTheFarmerReal 4679cfb07f -Updated UI positions and model scale of the Goomy line 2024-03-27 10:32:04 +10:00
FrankTheFarmerReal 9bb701abc8 -Updated scale values and regional data for many pokemon 2024-03-27 08:15:19 +10:00
FrankTheFarmerReal d070a7b75a -Fixed floating dragonair and T-posing sleeping Mawile 2024-03-26 20:40:24 +10:00
FrankTheFarmerReal 00a4b88437 -Model & Texture fixes for Gimmighoul, Lurantis, and Jangmo-o line
-Hisuian Samurott animation fix to prevent floating
2024-03-26 20:16:57 +10:00
FrankTheFarmerReal 005a98742e -Updated UI poses and data for several pokemon 2024-03-26 18:56:55 +10:00
FrankTheFarmerReal 94168a65f0 -Updated Walk Speed for some Pokemon 2024-03-26 16:26:20 +10:00
FrankTheFarmerReal 39d626b349 -Texture fixes for Aggron, Copperajah, Dracozolt, Gimmighoul and Lilligant 2024-03-26 14:06:45 +10:00
Tyzillion db6852134c Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-03-25 17:03:22 -04:00
FrankTheFarmerReal 7170825848 -Darmanitan revamp and Krokorok texture fixes 2024-03-25 16:32:52 +10:00
Flarkinater 43da7ecece First attempt at canceling sendouts into unsafe locations (cactus, fire if the Pokemon isn't immune) 2024-03-24 23:41:22 -04:00
FrankTheFarmerReal 5b1531b894 -License Changes 2024-03-25 11:14:59 +10:00
Segfault Guy af9f1accf8 Fix Cant and Damage instructions. 2024-03-23 20:41:36 -04:00
Tyzillion 3b87846562 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-03-23 16:09:42 -04:00
Tyzillion dfd4450e11 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2024-03-23 15:18:08 -04:00
Waldleufer 7c42f8e37f Added check for minimum audio length to cry checker script [skip-ci] 2024-03-23 18:45:18 +01:00
FrankTheFarmerReal 4060dbd596 - Fixed Wartortle, Blissey, and Hisuian Sliggo crashes
- Implemented a bunch of pokemon
- Specifically added darumaka changes
2024-03-23 23:26:53 +10:00
Islana 04b7500887 Fixes battlebuilder from sending out fainted pokemon, causing a softlock. 2024-03-22 00:45:39 -04:00
Islana fe3d2a29b9 Fixes battlebuilder from sending out fainted pokemon, causing a softlock. 2024-03-21 20:07:41 -04:00
Lily ad81202d49 Updated the display case to allow cleaner rotations 2024-03-21 15:54:06 -04:00
Lily acbacfa8cf Fixed certain evolutions not working 2024-03-21 15:30:15 -04:00
Lily 9740267f91 Fixed a bug causing items to disappear from display cases 2024-03-21 14:28:34 -04:00
Lily fcca3b1d68 Fix armor trim name inconsistency. Closes #782 2024-03-21 14:11:32 -04:00
Segfault Guy 767e279cf1 Merge branch 'main' into illusion 2024-03-21 00:25:45 -04:00
Segfault Guy 6ace08aaa6 Fix illusion battle interactions. 2024-03-21 00:19:28 -04:00
Tyzillion 7dc00c3e88 Merge branch 'main' of https://gitlab.com/cable-mc/cobblemon into implement_pokemon 2024-03-19 13:19:11 -04:00
Sterrezo d000790996 Uhh some cries
Implemented cries for Scyther, Electabuzz, Lapras, Omastar, Aerodactyl.
I have to wait for the next animation push.
2024-03-19 14:12:32 +01:00
Sterrezo 663624c434 Implemented most Gen 1 cries for 1.5
Omitted Tangela because it's missing animation.json. Don't know how to work around that.
Script update is from a different branch, used it for implementation.
2024-03-18 16:18:02 +01:00
Segfault Guy ba8e40d5a7 Implement illusion and transform entity effects. No pokemon can be trusted. 2024-03-18 00:00:43 -04:00
Flarkinater f99168f1c3 Pokeball items no longer drift backwards when thrown directly overhead 2024-02-24 06:33:34 -05:00
Flarkinater adce1d8838 Fixed Pokemon not appearing when sent out from shoulder 2024-02-24 05:58:35 -05:00
Flarkinater e95c82b5af Greatly improved send-out location targeting 2024-02-24 05:16:44 -05:00
Flarkinater dd273ffef2 Added beam mode for sending out Pokemon with no delay 2024-02-23 19:18:11 -05:00
Segfault Guy acf467c8a3 Track battle time. 2024-02-19 22:51:16 -05:00
Segfault Guy 0ff5b95c44 Hello, I'm the Interpreter critic. I refactor it so you don't have to! 2024-02-19 21:12:51 -05:00
Flarkinater 82548b5383 Pokémon recoil when hit by a ball 2024-02-13 22:48:27 -05:00
Segfault Guy 8d7ebeef4f Merge branch 'main' into illusion 2024-02-13 21:15:49 -05:00
Flarkinater ad73202e17 Adjusted timing on breaking free animation + sound 2024-02-13 18:50:08 -05:00
Flarkinater 2965a04742 Implemented existing "break free" animation when capture fails 2024-02-12 23:02:55 -05:00
Segfault Guy d9de8f2678 Update showdown to send UUID of Zoroark on switch. 2024-01-06 22:03:00 -05:00
Yaseen 65aec87382 mute battle 2023-05-20 16:54:49 +01:00
Yaseen 21198eab29 more forfeit stuff 2023-05-20 16:54:14 +01:00
Yaseen c4c060cbbf Dont wait for action if one of the players has forfeited 2023-04-28 15:36:45 +01:00
Yaseen 6cf7c681d4 Merge branch 'main' into ys/forfeit 2023-04-28 00:28:30 +01:00
Yaseen c420fd4705 Attempt to add forfeit button and showdown action 2023-04-28 00:26:52 +01:00
Yaseen 1278654e9f merge main 2023-04-28 00:26:09 +01:00
2526 changed files with 175444 additions and 25537 deletions
+3
View File
@@ -21,6 +21,8 @@ build
# other
eclipse
run
runClient
runServer
# Files from Forge MDK
forge*changelog.txt
@@ -34,6 +36,7 @@ common/src/main/resources/assets/cobblemon/showdown
*/generated/resources/*
/fabric/src/generated/resources/cobblemon-common.accesswidener
/.ignored/
common/.fabric
# MacOS
.DS_Store
+237 -69
View File
@@ -1,40 +1,80 @@
# Changelog
## [1.5.0](#1-5-0)
## [1.5.1](#1-5-1)
### Additions
- Added over (number here) ruin structures, where you can find Pokémon-themed Armor Trims and Pottery Sherds, Tumblestones, and more.
- Added (number here) fossil structures, where you can brush Suspicious Sand/Gravel for Fossils.
- Added the Data Monitor, Fossil Compartment, and Restoration Tank. Placed in the correct formation, you can use these to create a Restoration Machine where you can bring fossils back to life.
- Added 3 variants of Tumblestones, which can be planted near Lava or Magma to grow harvestable Tumblestone Clusters.
- Added unique send out particles for Cherish, Dream, Beast, and Ancient Origin balls.
- Made Wooloo and Dubwool dye-able like sheep
### Changes
- Sounds for Relic Coin Sacks have been correctly renamed. Relic Coin Pouches received new sounds for breaking and placing.
- Readjusted Petilil portraits
- Changed "dimensions" spawn condition to check with dimension IDs instead of effects, so custom dimension IDs can be used.
### Fixes
- Fixed a bug in which adding organic material to the fossil tank via right click was adding the full count of the stack currently in hand
- Fixed a niche issue where some properties of entities were not initialized correctly, causing Pokémon that appeared to be level 1 until you battle them.
- Fixed Fossilized Drake being missing from the Fossils item tag.
- Fixed Gilded Chest block entity not being cleared on block break
- Fixed sherd brokenness on Forge/Supplementaries incompat
- Fixed Fossil Compartment crash with Jade / WAILA forks
- Fixed PCStore#resize not allowing PC boxes size reduction.
- Fixed pasture block PC lookups when the player is offline.
- Fixed an untranslated battle message that occurs when using a move that just ran out of PP (e.g. Fire Blast that just got spited mid-turn).
- Fixed held items being eaten even when the held item evolutions are already unlocked.
- Fixed Hisuian Decidueye not being Grass/Fighting
- Fixed both Decidueye forms learning both Triple Arrows and Spirit Shackle
- Fixed Pineco being unable to evolve into Shulker Forretress
- Fixed Kabutops T-posing when underwater. It still does not have proper swimming animations yet though.
- Fixed Pidgey's missing walk animation.
- Fixed recoil evo condition.
- Fixed issue where poser debug tools didnt work on JSON posers
- Fixed issue where gilded chests dont close when going far away
### Developer
- Changed SpawnAction#complete to return a nullable generic R (the spawn action result) instead of a boolean. More information this way.
### Data Pack & Resource Pack Creators
- Added support for MoLang conditions for quirks and poses.
- Changed the AttackDefenceRatio requirement to StatCompare and StatEqual.
## [1.5.0 - The Ruins and Revival Update (May 12th, 2024)](#1-5-0)
#### "You're telling me that Mojang has added archaeology to the game? Hmm... that gives me an idea."
### Additions
- Added 17 ruin structures, where you can find Pokémon-themed Armor Trims and Pottery Sherds, Tumblestones, and more.
- Added 23 fossil structures, where you can brush Suspicious Sand/Gravel for [Fossils](https://wiki.cobblemon.com/index.php/Fossil). You can add [custom fossils using datapacks](https://wiki.cobblemon.com/index.php/Fossils_File).
- Added the Data Monitor, Fossil Compartment, and Restoration Tank blocks. Placed in the correct formation, you can use these to create a [Restoration Machine](https://wiki.cobblemon.com/index.php/Resurrection_Machine) where you can bring fossils back to life. Use organic material to fill the tank first!
- Added 3 variants of [Tumblestone](https://wiki.cobblemon.com/index.php/Tumblestone), which can be planted near Lava or Magma to grow harvestable Tumblestone Clusters.
- Added Tumblestone Blocks, a storage block crafted from 9 Tumblestones.
- Added Ancient Poké Balls, which are aesthetic variants crafted from Tumblestones.
- Added the Ancient Feather, Wing, and Jet Balls, which fly further than regular Poké Balls.
- Added the Ancient Heavy, Leaden, and Gigaton Balls, which are heavier and don't fly as far as regular Poké Balls. These will receive more functionality in a future update.
- Added Original Trainer functionality. To edit the OT through commands, you must specify originaltrainertype=<Player/NPC>, and originaltrainer=<Username or UUID/NPC Name>
- Added visual effects for many Poké Balls when sending out or capturing Pokémon.
- Added a new send-out ball toss animation that showcases the ball used for the Pokémon.
- Added simple move animations for Pokémon in battle with a proof of concept (Flamethrower) for more complicated animations. More and more specific animations will come in future updates.
- Added Original Trainer to the summary menu. To edit the OT through commands, you must specify originaltrainertype=<Player/NPC>, and originaltrainer=<Username or UUID/NPC Name>
- Added support for planting Apricorn trees, berries, and mints in [Botany Pots](https://modrinth.com/mod/botany-pots)
- Added the hidden "True Vivillionaire" advancement.
- The "Poké Ball" Vivillon variant is now obtainable by evolving a Spewpa after obtaining the "Aspiring Vivillionaire" advancement.
- Added dynamic lighting support for any Species or Forms when using [LambDynamicLights](https://modrinth.com/mod/lambdynamiclights) or [Dynamic Lights Reforged](https://www.curseforge.com/minecraft/mc-mods/dynamiclights-reforged), at this time we don't ship with any defaults for this feature but addon creators can make use of this feature.
- Added a Display Case block! Use it to display your archaeological findings, or other items.
- Added 6 Pokémon-themed Pottery Sherds, obtained from ruin structures.
- Added the [Display Case](https://wiki.cobblemon.com/index.php/Display_Case) block. Use it to display your archaeological findings, Poké Balls, or other items.
- Added 6 Pokémon-themed Pottery Sherds, obtained from ruin structures. Sherds... sh-erds. Weird word.
- Added a Pokémon-themed armor trim, obtained from ruin structures.
- You can now find Nether Fire Stone Ore in, surprisingly, the Nether.
- You'll also find Terracotta Sun Stone Ore in Badlands biomes.
- Added effects for many Poké Balls when sending out Pokémon or capturing.
- Added a new send-out ball toss animation that showcases the ball used for the Pokémon.
- Added simple move animations for Pokémon in battle with a proof of concept for more complicated animations.
- Added Nether Fire Stone Ore to, surprisingly, the Nether.
- Added Terracotta Sun Stone Ore to Badlands biomes.
- Added the EV Boosting Feathers.
- Added Type Gems.
- Added various new tags for searchability and better compatibility.
- Added the [Ability Capsule](https://bulbapedia.bulbagarden.net/wiki/Ability_Capsule) and [Patch](https://bulbapedia.bulbagarden.net/wiki/Ability_Patch), these have no acquisition method for now and only work as intended with the traditional ability format of 1 to 2 common abilities and 1 hidden ability.
- Added Gilded Chests, available in all Apricorn colors.
- Added Relic Coins, Relic Coin Pouches, and Relic Coin Sacks.
- Added various new tags for searchability and better compatibility.
- Added Type Gems. These items hold no functionality for now. Start collecting though...
- Added 6 custom Pottery Sherds, obtained from ruin structures.
- Added cries to Meowth, Alolan Meowth, Galaraian Meowth,
- Completed the advancement for placing a Tumblestone near Lava or Magma to make it grow.
- Added [Gilded Chests](https://wiki.cobblemon.com/index.php/Gilded_Chest), available in all Apricorn colors.
- Added Relic Coins, Relic Coin Pouches, and Relic Coin Sacks. Gimmighoul might be interested in these.
- Added Type Gems. These will have additional uses later, so you should start collecting them.
- Added new held items: Ability Shield, Absorb Bulb, Air Balloon, Binding Band, Blunder Policy, Cell Battery, Covert Cloak, Damp Rock, Eject Button, Eviolite, Expert Belt, Float Stone, Focus Sash, Heat Rock, Icy Rock, Iron Ball, Light Ball, Loaded Dice, Red Card, Shell Bell, Sticky Barb, Smooth Rock, Soothe Bell and Weakness Policy.
- Added Hisui starters to the starter selection menu. They come inside of ancient Poké Balls.
- Added a bubble quirk to Krabby that only plays during clear sunsets. It looks familiar...
- Added forfeit option to PVP battles.
- Added visual changes for entities affected by Illusion, Imposter, or Transform in battle.
- Added shoulder mounting for Squirtle, Ralts, Roggenrola, Charcadet, Sizzlipede, Litwick, Cutiefly, Flabebe, Flittle, and Scatterbug
- Added species data for Hydrapple, Iron Boulder, Iron Crown, Pecharunt, Raging Bolt, and Terapagos
- Added various new tags for search-ability and better mod compatibility.
- Added the [Ability Capsule](https://bulbapedia.bulbagarden.net/wiki/Ability_Capsule) and [Patch](https://bulbapedia.bulbagarden.net/wiki/Ability_Patch). These have no way of getting them (for now) and only work as intended with the traditional ability format of 1 to 2 common abilities and 1 hidden ability.
### Pokémon Added
#### Gen 2
@@ -43,8 +83,9 @@
- Qwilfish
- Heracross
- Skarmory
- Ferroseed
- Ferrothorn
- Larvitar
- Pupitar
- Tyranitar
#### Gen 3
- Lileep
@@ -53,6 +94,16 @@
- Armaldo
- Tropius
- Roselia
- Aron
- Lairon
- Aggron
- Solrock
- Lunatone
- Makuhita
- Hariyama
- Trapinch
- Vibrava
- Flygon
#### Gen 4
- Shieldon
@@ -61,6 +112,8 @@
- Rampardos
- Budew
- Roserade
- Hippopotas
- Hippowdon
#### Gen 5
- Tirtouga
@@ -87,6 +140,9 @@
- Hydreigon
- Larvesta
- Volcarona
- Alomomola
- Ferroseed
- Ferrothorn
#### Gen 6
- Tyrunt
@@ -96,6 +152,11 @@
- Goomy
- Sliggoo
- Goodra
- Carbink
- Flabébé
- Floette
- Florges
- Klefki
#### Gen 7
- Turtonator
@@ -106,6 +167,8 @@
- Jangmo-o
- Hakamo-o
- Kommo-o
- Alolan Diglett
- Alolan Dugtrio
#### Gen 8
- Gossifleur
@@ -115,6 +178,12 @@
- Dracozolt
- Dracovish
- Basculegion
- Hisuian Decidueye
- Hisuian Typhlosion
- Hisuian Samurott
- Hisuian Lilligant
- Hisuian Sliggoo
- Hisuian Goodra
- Hisuian Zorua
- Hisuian Zoroark
- Hisuian Voltorb
@@ -129,77 +198,173 @@
- Dreepy
- Drakloak
- Dragapult
- Hisuian Sliggoo
- Hisuian Goodra
- Impidimp
- Morgrem
- Grimmsnarl
#### Gen 9
- Gimmighoul.
- Gimmighoul
- Using Relic Coins, you can increase Gimmighoul's Coin Stash. Upon reaching 999, it can be evolved into Gholdengo.
- Additionally, if you give Gimmighoul a Netherite Scrap, you can increase its Netherite Stash. Who knows what might happen if it fills up?
- Additionally, if you give Gimmighoul a Netherite Scrap, you can increase its Netherite Stash. But what will that do to when you evolve it?
- Gholdengo
#### Cobblemon Exclusives
- Hisui Bias Rowlet
- Hisui Bias Dartrix
- Hisui Bias Cyndaquil
- Hisui Bias Quilava
- Hisui Bias Oshawott
- Hisui Bias Dewott
- Hisui Bias Goomy
- Hisui Bias Petilil
These are our compromise for having both regular and Hisuian forms of these Pokémon in the game. Hisui Biased variations will evolve into the Hisuian evolutions under most conditions. They are otherwise purely cosmetic differences.
### Added cries to the following Pokémon
- Alolan Raticate
- Vulpix, Ninetales
- Zubat, Golbat, Crobat
- Meowth, Persian
- Psyduck, Golduck
- Growlithe, Arcanine
- Geodude, Graveler, Golem
- Doduo, Dodrio
- Seel, Dewgong
- Muk, Grimer
- Krabby, Kingler
- Voltorb, Electrode, Hisuian Voltorb, Hisuian Electrode
- Tangela, Tangrowth
- Snorlax
- Cubone, Marowak
- Koffing, Weezing
- Aerodactyl
- Elekid, Electabuzz, Electivire
- Omanyte, Omastar
- Kabuto, Kabutops
- Lapras
- Scyther
- Hisui Bias Cyndaquil, Hisui Bias Quilava
- Igglybuff
- Yanma, Yanmega
- Gligar, Gliscor
- Qwilfish, Hisuian Qwilfish, Overqwil
- Sneasel, Hisuian Sneasel, Weavile, Sneasler
- Larvitar, Pupitar, Tyranitar
- Swinub, Piloswine, Mamoswine
- Aron, Lairon, Aggron
- Trapinch, Vibrava, Flygon
- Cacnea, Cacturne
- Barboach, Whiscash
- Lileep, Cradily
- Anorith, Armaldo
- Tropius
- Chimecho
- Bidoof, Bibarel
- Buizel, Floatzel
- Gible, Gabite, Garchomp
- Hisui Bias Oshawott, Hisui Bias Dewott
- Petilil, Lilligant, Hisui Bias Petilil, Hisuian Lilligant
- Basculin, Basculegion
- Sandile, Krokolok, Krookodile
- Darumaka, Darmanitan
- Archen, Archeops
- Zorua, Zoroark, Hisuian Zorua, Hisuian Zoroark
- Tyrunt, Tyrantrum
- Amaura Aurorus
- Carbink
- Goomy, Sliggoo, Goodra, Hisui Bias Goomy, Hisuian Sliggoo, Hisuian Goodra
- Klefki
- Hisui Bias Rowlet, Hisui Bias Dartrix
- Komala
- Impidimp, Morgrem, Grimmsnarl
- Cufant, Copperajah
- Dreepy, Drakloak, Dragapult
- Dracozolt, Arctozolt, Dracovish, Arctovish
- Lechonk, Oinkologne
- Maushold family of three and four
### Changes
- Alolan Pikachu and Exeggcute changed to Alola Bias.
- Pokémon now transition more smoothly between different poses.
- Updated models for Mimikyu, Alcremie, Squirtle, Wartortle, Blastoise, Omanyte, Omastar, Growlithe, Swinub, Piloswine, Basculine, Rowlet, Dartrix, Decidueye, Kabuto, Kabutops, Piplup, Prinplup, Elekid, Electabuzz, Cubone, Marowak, Paras, Drifloon, Drifblim, Venonat, Venomoth, Yanma, Yanmega, and Raboot.
- Updated animations for Diglett, Dugtrio, Dragonite, Omanyte, Omastar, Pinsir, Falinks, Lechonk, Litwick, Lampent, Chandelure, Carnivine, Galarian Meowth, Galarian Rapidash, Venonat, Venomoth, Phanphy, Donphan, Dratini, Dragonair, Happiny, Chansey, Blissey, Volbeat, Illumise, Numel, Drifloon, and Drifblim.
- Updated models for Mimikyu, Alcremie, Squirtle, Wartortle, Blastoise, Pidgey, Pidgeotto, Pidgeot, Omanyte, Omastar, Growlithe, Arcanine, Nidoran Male, Nidoran Female, Lapras, Swinub, Piloswine, Basculin, Rowlet, Dartrix, Decidueye, Kabuto, Kabutops, Piplup, Prinplup, Elekid, Electabuzz, Cubone, Marowak, Paras, Mawile, Drifloon, Drifblim, Venonat, Venomoth, Yanma, Yanmega, Psyduck, Dusknoir, Diglett, Dugtrio, Natu, Xatu, Oshawott, Samurott, Torchic, Grovyle, Sceptile, Sizzlipede, Mismagius, and Raboot.
- Updated animations for Squirtle, Wartortle, Blastoise, Pidgey, Pidgeotto, Diglett, Dugtrio, Magikarp, Dragonite, Omanyte, Omastar, Kabuto, Pinsir, Chinchou, Lanturn, Ralts, Kirlia, Gardevoir, Gallade, Buizel, Garchomp, Pumpkaboo, Falinks, Lechonk, Litwick, Lampent, Chandelure, Carnivine, Galarian Meowth, Galarian Rapidash, Venonat, Venomoth, Phanphy, Donphan, Dratini, Dragonair, Happiny, Chansey, Blissey, Volbeat, Illumise, Numel, Sizzlipede, Centiskorch, Obstagoon, Timburr, Gurdurr, Conkeldurr, Drifloon, and Drifblim.
- Resized Drifloon.
- Added more held items to the held item tag, and Metal Coat to the held item tab.
- Added all ores to the modloader ore tags, and added tags for each ore type to the mod (both blocks and items).
- Changed the Destiny Knot to be crafted with a Ghast Tear, rather than a diamond.
- You can now punch grown apricorns to harvest them.
- Changed the Destiny Knot to be crafted with a Ghast Tear rather than a diamond. We have big plans for the Destiny Knot...
- You can now punch grown apricorns to harvest them. We saw so many content creators breaking apricorns with their fists that it was making us die inside.
- The "Poké Ball" Vivillon variant is now obtainable by evolving a Spewpa after obtaining the "Aspiring Vivillionaire" advancement.
- Renamed the "Vivillionaire" advancement to "Aspiring Vivillionaire"
- Removed the Inferno, Forsaken, Poké Ball, and Void patterns from the Aspiring Vivillionaire advancement.
- Updated movesets to add Gen 9 DLC moves.
- Updated the biome tags for Spewpa's evolutions into the various Vivillon patterns. You should mostly be getting one evolution option at a time now.
- Apricorn Sprouts can now be planted directly on Apricorn leaves to create a new Apricorn of the same color.
- Added tooltips to interaction GUIs to make it clearer what they do.
- Poké Ball recipes now use tags for their center ingredient, rather than specificied Copper Ingot, Iron Ingot, Gold Ingot, and Diamond, allowing for further datapack customisation.
- Starter Toast now closes once corresponding button is pressed once.
- Moved some items in the vanilla Food & Drinks category.
- Poké Ball recipes now use tags for their center ingredient, rather than specifically Copper Ingots, Iron Ingots, Gold Ingots, and Diamonds, allowing for further datapack customisation and mod compatibility.
- Starter Toast now closes once the corresponding button is pressed once.
- Moved some items into the vanilla Food & Drinks category.
- Stacked Cobblemon Potion Bases can now be quick moved into Brewing Stands.
- Changed Healer recipe to swap the Max Revive for a Revive.
- Upped the rate that Gastly drop Ghast Tears from 2.5% to 5%.
- Changed the Healing Machine recipe to swap the Max Revive for a Revive so that it is a bit easier to craft.
- Upped the rate that Gastly drop Ghast Tears from 2.5% to 5%, further helping the crafting of a Healing Machine.
- Pokémon with a low Blaze Powder drop chance now drop it more frequently in the Nether.
- Reorganised a few advancements.
- Pokémon entity shadows now scale when the Pokémon is being sent out or recalled.
- Remade Torkoal particles, now they only appear when in battle.
- Improved the shiny icon within summary and PC interfaces.
- Changed the Poison Barb sprite so that it doesn't look like a sword when held. It's a Poison Barb, not a Poison Sword. Wait, that gives me an idea.
- Moon Stone ore generates more frequently in Taigas and has been added to Magical and Spooky biomes. Ooo... Sorry.
- Density, Season, and Nether biome tags have been moved and renamed within the biome tags directory.
- Added particles to Lucario when in battle. Lucario is special.
- Movesets updated for Blueberry DLC.
### Fixes
- Resized Snorlax.
- Re-added the recipe for the Iron Vitamin.
- Cleaned up empty evolutions declaration in species files (no, I'm not listing all 169 by name).
- Fixed Exeggcute not being able to evolve.
- Fixed battle lang for Poison Touch Ability
- Fixed Cubone not being able to evolve into Alolan Marowak.
- Re-added the recipe for the Iron vitamin. Well, technically it's a mineral.
- Fixed Exeggcute and Pikachu not being able to evolve.
- Fixed evolution priority for Exeggcute and Pikachu regional evolutions. Using a thunder stone on Kantonian Pikachu on the beach will give Alolan Raichu. A second thunder stone would then give Kantonian Raichu.
- Fixed battle text for the Poison Touch Ability.
- Finally found Sudowoodo and Bonsly. They were missing spawn data. Same with Drifloon and Litwick. Uh... sorry about that.
- Fixed Squawkabilly forms not being recognized.
- Fixed the bounce animation for Poké Balls being delayed by like, a full second.
- Note blocks now play the correct sound on the Apricorn Plank based blocks.
- Fixed the bounce animation for Poké Balls being delayed by like, a full second. It's enough to drive you mad.
- Note blocks now play the correct sound on the Apricorn Plank-based blocks.
- Fixed an issue with transformed parts in posers causing whacky positional issues.
- Fixed Poké Balls freezing in an open state if you look away when it's meant to close.
- Adds a translation string name to the Empty Pokeball entity.
- Fixed very many issues with Bedrock particle effects.
- Fixed Arbok patterns not being as specific in spawning as they were intended.
- Fixed Poké Balls freezing in an open state if you're looking away at the moment that it's meant to close. This actually fixes some other things but it's hard to explain.
- Fixed thrown Poké Balls technically having no name.
- Fixed very many issues with Bedrock particle effects. There are probably many more. Life goes on.
- Fixed Arbok patterns not being as specific in spawning as they were intended to be.
- Fixed Pokémon not avoiding danger at all when pathfinding.
- Fixed Sobble line not being able to swim or breathe underwater.
- Fixed incompatibility with [Just Enough Resources](https://modrinth.com/mod/just-enough-resources-jer).
- Fixed incompatibility with [Visual Overhaul](https://modrinth.com/mod/visual-overhaul).
- Fixed an issue that allowed Pokemon to spawn on rails.
- Fixed Pokémon pathing over snow layers and carpets.
- Fixed the Sobble line not being able to swim or breathe underwater.
- Fixed mod incompatibility with [Just Enough Resources](https://modrinth.com/mod/just-enough-resources-jer).
- Fixed mod incompatibility with [Visual Overhaul](https://modrinth.com/mod/visual-overhaul).
- Fixed an issue that allowed Pokémon to spawn on rails.
- Fixed the data set on Pokémon when abilities are given via properties such as in ``/spawnpokemon``.
- Fixed sometimes Pokémon losing hidden abilities when evolving, this fix will only take effect to newly created Pokémon.
- Fixed Pokémon sometimes losing hidden abilities when evolving. This fix will only take effect for newly created Pokémon because of technical reasons that were explained to me but which I then forgot.
- Fixed capture messages not displaying in battle.
- Fixed the Illusion ability causing the wrong Pokémon to be targeted in battle.
- Fixed battles started with fainted party members causing a soft-lock on defeat.
- Fixed some issues with eyes in the faint animations of Hitmonlee and Phantump
- Fixed missing evolution moves, for example Stone Axe for Kleavor.
- Cleaned up empty evolutions declaration in species data (And no, I'm not listing all 169. No I don't care what you pay me, I'm not doing it).
- Fixed non-consumable held items being consumed or swapped in battle permanently.
### Developer
- Significantly changed the way properties in PokemonEntity work. This could break some plugins (not in a big way, but changes will be needed).
- Rebuilt the scheduling API to more clearly force side choices and temporal frames of reference for tasks.
- Added dialogue API and data registry.
- Significantly changed the way the properties in PokemonEntity work. This could break some plugins (not in a big way, but changes will be needed for some things).
- Rebuilt the scheduling API to more clearly force side choices and temporal frames of reference for tasks. The developers say that how it works is cool but I stopped listening.
- Added dialogue API and data registry. This is powerful, and there is a full example in the Cobblemon mod you can trigger using /opendialogue \<username\> cobblemon:example. The example JSON is inside the data folder of the mod.
- Opened up the ItemDropEntry class to allow for it to be extended.
- Added a new "advancement" evolution variant that takes an advancement identifier and succeeds if the player has the advancement.
- Made spawning API capable of non-entity spawning
- Made PokemonProperties.parse more interoperable with Java.
- Made the spawning API capable of non-entity spawning. You can make it 'spawn' commands if you want. Go nuts.
- Made PokemonProperties.parse more interoperable with Java. Save yourself and stop using Java.
- Added the ``HeldItemEvent``, this comes with 2 implementation ``HeldItemEvent.Pre`` and ``HeldItemEvent.Post``.
- API to support dynamic lighting in any mod that implements this feature has been added to all Species & Forms, see LightingData class for details.
- Corrections to the ability implementation have been made that make ``Ability.forced`` function as intended and never reroll an ability for a Pokémon, please check your implementations to ensure the corrected behavior is intended for your use case.
- ``Pokemon.ability`` no longer has a public setter, please migrate to using ``Pokemon#updateAbility``, this handles the ability coordinate storage for you when necessary.
- ``Pokemon.ability`` no longer has a public setter. Please migrate to using ``Pokemon#updateAbility``, this handles the ability coordinate storage for you when necessary.
- ``Ability.forced``, ``Ability.index`` and ``Ability.priority`` have all had their setters internalized, there is no longer any need to manually adjust these migrate to the method mentioned above to handle that process for you.
- ``AbilityChanger`` has been added to API alongside some implementations, this is subject to change as the ability capsule and patch currently only expect the traditional behaviour in the Pokémon games of 1 to 2 regular abilities and 1 hidden.
- ``Pokemon#rollAbility`` has been added, this rerolls a legal ability for the Pokémon.
- `docs/cobblemon-tags` tags and spawn-presets can now be auto-generated from the current tags in the cobblemon mod with the `generateSpawnPresetList.py` and `generateTagList.py` scripts.
- ``AbilityChanger`` has been added to API alongside some implementations, this is subject to change as the ability capsule and patch currently only expect the traditional behaviour in the Pokémon games of 1 or 2 regular abilities and 1 hidden ability.
- ``Pokemon#rollAbility`` has been added which rerolls for a legal ability for the Pokémon.
- `docs/cobblemon-tags` tags and spawn-presets can now be auto-generated from the current tags in the Cobblemon mod with the `generateSpawnPresetList.py` and `generateTagList.py` scripts.
- `public_spawns_to_json.py` script has been added to give the powerful spawn.json generator a simplistic UI.
- Updated Showdown with Gen 9 DLC.
- Changed mixins to be Java 17 for compatibility level instead of 16, removing a warning from startup logs.
### Datapack & Resourcepack Creators
- The maximum amount of fossils that can fit in the Fossil Analyzer can be adjusted in the config.
@@ -369,6 +534,7 @@
Thank you so much to all of our community translators that bring the mod to the rest of the world!
## [1.4.0 - The Friends and Farms Update (October 13th, 2023)](#1-4-0)
#### "No, we don't provide the friends."
### Additions
- Added pasture blocks, used to let your PC Pokémon roam around an area.
- Added nicknaming from the summary menu of a Pokémon (click their name).
@@ -909,6 +1075,7 @@ Thank you so much to all of our community translators that bring the mod to the
- All the translators that contributed are amazing.
## [1.3.0 - The Foundation Update (March 17th, 2023)](#1-3-0)
#### "Now we can start doing the really cool stuff."
### Dependencies
- Upgraded Fabric API dependence to 0.75.1+1.19.2
@@ -1058,6 +1225,7 @@ Thank you so much to all of our community translators that bring the mod to the
- Thank you to all of the fantastic volunteer translators for taking the time to help with this!
## [1.2.0 - The Customization Update (January 1st, 2023)](#1-2-0)
#### "There are going to be so many fakemon..."
### Additions
- Added models for Natu and Xatu, Murkrow and Honchkrow, Wailmer and Wailord.
- Added new PC interface and it is beautiful.
@@ -1171,4 +1339,4 @@ Thank you so much to all of our community translators that bring the mod to the
- Added species, ability, and move translations for `ko_ko`, `jp_jp`, `fr_fr`, `es_es`, `it_it`, and `zh_cn`.
## [1.0.0 (November 12th, 2022)](#1-0-0)
- Initial release.
- Initial release.
-10
View File
@@ -1,10 +0,0 @@
import ca.stellardrift.build.configurate.ConfigFormats
import ca.stellardrift.build.configurate.catalog.PolyglotVersionCatalogExtension
plugins {
id("ca.stellardrift.polyglot-version-catalogs") version "5.0.1"
}
extensions.configure<PolyglotVersionCatalogExtension> {
from(ConfigFormats.YAML, file("../gradle/libs.versions.yml"))
}
@@ -1,32 +0,0 @@
plugins {
id("cobblemon.base-conventions")
id("com.github.johnrengelman.shadow")
}
val bundle: Configuration by configurations.creating {
isCanBeConsumed = false
isCanBeResolved = true
}
tasks {
jar {
archiveBaseName.set("Cobblemon-${project.name}")
archiveClassifier.set("dev-slim")
}
shadowJar {
archiveClassifier.set("dev-shadow")
archiveBaseName.set("Cobblemon-${project.name}")
configurations = listOf(bundle)
mergeServiceFiles()
}
remapJar {
dependsOn(shadowJar)
inputFile.set(shadowJar.flatMap { it.archiveFile })
archiveBaseName.set("Cobblemon-${project.name}")
archiveVersion.set("${rootProject.version}")
}
}
@@ -1,21 +0,0 @@
plugins {
`java-library`
}
tasks {
val collectJars by registering(Copy::class) {
val tasks = subprojects.filter { it.path != ":common" }.map { it.tasks.named("remapJar") }
dependsOn(tasks)
from(tasks)
into(buildDir.resolve("libs"))
}
assemble {
dependsOn(collectJars)
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
+2 -3
View File
@@ -1,13 +1,12 @@
plugins {
base
id("cobblemon.root-conventions")
id ("net.nemerosa.versioning") version "2.8.2"
}
group = "com.cobblemon.mod"
version = "${project.property("mod_version")}+${project.property("mc_version")}"
val isSnapshot = project.property("snapshot")?.equals("true") ?: false
if (isSnapshot) {
version = "$version-${versioning.info.branch}-${versioning.info.build}"
val fixedBranchName = versioning.info.branch.substringAfter("/")
version = "$version-${fixedBranchName}-${versioning.info.build}"
}
+18 -24
View File
@@ -1,5 +1,5 @@
import extensions.isSnapshot
import extensions.version
import utilities.isSnapshot
import utilities.version
import java.time.OffsetDateTime
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter
@@ -20,7 +20,7 @@ plugins {
id("net.kyori.blossom")
id("org.jetbrains.gradle.plugin.idea-ext")
id ("net.nemerosa.versioning") version "2.8.2"
id("net.nemerosa.versioning") version "2.8.2"
}
architectury {
@@ -34,31 +34,26 @@ repositories {
}
dependencies {
implementation(libs.stdlib)
implementation(libs.reflect)
modImplementation(libs.fabricLoader)
//Flywheel has no common dep so just pick one and don't use any platform specific code in common
// modCompileOnly(libs.flywheelFabric)
implementation(libs.bundles.kotlin)
modImplementation(libs.fabric.loader)
modApi(libs.molang)
compileOnlyApi(libs.jeiApi)
modCompileOnly(libs.adornFabric)
modCompileOnly(libs.lambDynamicLights) { isTransitive = false }
// For Showdown
// Integrations
compileOnlyApi(libs.jei.api)
modCompileOnly(libs.bundles.fabric.integrations.compileOnly) {
isTransitive = false
}
// Flywheel has no common dep so just pick one and don't use any platform specific code in common
// modCompileOnly(libs.flywheelFabric)
// Showdown
modCompileOnly(libs.graal)
//shadowCommon group: 'commons-io', name: 'commons-io', version: '2.6'
// Data Storage
modCompileOnly(libs.bundles.mongo)
// For datastore
modCompileOnly(libs.mongoDriverCore)
modCompileOnly(libs.mongoDriverSync)
testImplementation(libs.fabricJunit)
testImplementation(libs.junitParams)
testImplementation(libs.mockito)
testImplementation(libs.mockk)
testImplementation(libs.classgraph)
// Unit Testing
testImplementation(libs.bundles.unitTesting)
}
tasks.withType<Test> {
@@ -94,7 +89,6 @@ sourceSets {
property("gitCommit", versioning.info.commit)
property("branch", versioning.info.branch)
System.getProperty("buildNumber")?.let { property("buildNumber", it) }
property("timestamp", OffsetDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ofPattern("MM/dd/yyyy hh:mm:ss")) + " UTC")
}
}
}
@@ -26,7 +26,6 @@ public final class CrashReportMixin {
cobblemon.add("Is Snapshot", CobblemonBuildDetails.SNAPSHOT);
cobblemon.add("Git Commit", CobblemonBuildDetails.INSTANCE.smallCommitHash() + " (" + "https://gitlab.com/cable-mc/cobblemon/-/commit/" + CobblemonBuildDetails.GIT_COMMIT + ")");
cobblemon.add("Branch", CobblemonBuildDetails.BRANCH);
cobblemon.add("Timestamp", CobblemonBuildDetails.TIMESTAMP);
cobblemon.addStackTrace(builder);
builder.append("\n\n");
@@ -0,0 +1,33 @@
/*
* 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.mixin.invoker;
import com.cobblemon.mod.common.integration.adorn.AdornCompatibility;
import java.util.List;
import juuxel.adorn.block.variant.BlockVariantSet;
import juuxel.adorn.block.variant.BlockVariantSets;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//This is a yucky hack but better than what we were doing before
@Mixin(BlockVariantSets.class)
public abstract class AdornRegisterInvoker {
@Final
@Shadow(remap = false)
private static List<BlockVariantSet> variantSets;
@Inject(method = "register()V", at = @At("HEAD"), remap = false)
void register(CallbackInfo ci) {
variantSets.add(AdornCompatibility.INSTANCE);
}
}
@@ -10,7 +10,6 @@ object CobblemonBuildDetails {
const val GIT_COMMIT = "{{ gitCommit | default("Not Specified") }}"
const val BRANCH = "{{ branch | default("Not Specified") }}"
const val TIMESTAMP = "{{ timestamp }}"
fun smallCommitHash(): String {
return this.GIT_COMMIT.substring(0, 7)
@@ -102,7 +102,6 @@ import com.cobblemon.mod.common.pokemon.properties.HiddenAbilityPropertyType
import com.cobblemon.mod.common.pokemon.properties.UncatchableProperty
import com.cobblemon.mod.common.pokemon.properties.tags.PokemonFlagProperty
import com.cobblemon.mod.common.pokemon.stat.CobblemonStatProvider
import com.cobblemon.mod.common.sherds.CobblemonSherds
import com.cobblemon.mod.common.starter.CobblemonStarterHandler
import com.cobblemon.mod.common.trade.TradeManager
import com.cobblemon.mod.common.util.DataKeys
@@ -141,8 +140,8 @@ import kotlin.reflect.jvm.javaField
import kotlin.math.roundToInt
object Cobblemon {
const val MODID = "cobblemon"
const val VERSION = "1.4.0"
const val MODID = CobblemonBuildDetails.MOD_ID
const val VERSION = CobblemonBuildDetails.VERSION
const val CONFIG_PATH = "config/$MODID/main.json"
val LOGGER: Logger = LogManager.getLogger()
@@ -179,7 +178,6 @@ object Cobblemon {
if(CobblemonBuildDetails.SNAPSHOT) {
this.LOGGER.info(" - Git Commit: ${smallCommitHash()} (https://gitlab.com/cable-mc/cobblemon/-/commit/${CobblemonBuildDetails.GIT_COMMIT})")
this.LOGGER.info(" - Branch: ${CobblemonBuildDetails.BRANCH}")
this.LOGGER.info(" - Timestamp: ${CobblemonBuildDetails.TIMESTAMP}")
}
implementation.registerPermissionValidator()
@@ -236,7 +234,7 @@ object Cobblemon {
val player = event.player
val block = player.world.getBlockState(event.pos).block
player.party().forEach { pokemon ->
pokemon.evolutions
pokemon.lockedEvolutions
.filterIsInstance<BlockClickEvolution>()
.forEach { evolution ->
evolution.attemptEvolution(pokemon, BlockClickEvolution.BlockInteractionContext(block, player.world))
@@ -417,7 +415,6 @@ object Cobblemon {
).ifSuccessful { it.mute = true }
}
CobblemonSherds.registerSherds()
}
fun getLevel(dimension: RegistryKey<World>): World? {
@@ -234,7 +234,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
"relic_coin_pouch",
CoinPouchBlock(
AbstractBlock.Settings.create()
.sounds(CobblemonSounds.COIN_POUCH_SOUNDS)
.sounds(CobblemonSounds.RELIC_COIN_POUCH_SOUNDS)
.pistonBehavior(PistonBehavior.DESTROY)
.strength(0.4f)
.nonOpaque(), true
@@ -245,7 +245,7 @@ object CobblemonBlocks : PlatformRegistry<Registry<Block>, RegistryKey<Registry<
"relic_coin_sack",
CoinPouchBlock(
AbstractBlock.Settings.create()
.sounds(CobblemonSounds.COIN_POUCH_SOUNDS)
.sounds(CobblemonSounds.RELIC_COIN_SACK_SOUNDS)
.pistonBehavior(PistonBehavior.DESTROY)
.strength(0.4f), false
))
@@ -667,8 +667,8 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
val CHOICE_SPECS = heldItem("choice_specs")
@JvmField
val CLEANSE_TAG = heldItem("cleanse_tag")
@JvmField
val CLEAR_AMULET = heldItem("clear_amulet")
// @JvmField
// val CLEAR_AMULET = heldItem("clear_amulet")
@JvmField
val COVERT_CLOAK = heldItem("covert_cloak")
@JvmField
@@ -697,16 +697,16 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
val FOCUS_BAND = heldItem("focus_band")
@JvmField
val FOCUS_SASH = heldItem("focus_sash")
@JvmField
val GRIP_CLAW = heldItem("grip_claw")
// @JvmField
// val GRIP_CLAW = heldItem("grip_claw")
@JvmField
val HARD_STONE = heldItem("hard_stone")
@JvmField
val HEAVY_DUTY_BOOTS = heldItem("heavy_duty_boots")
@JvmField
val IRON_BALL = heldItem("iron_ball")
@JvmField
val LAGGING_TAIL = heldItem("lagging_tail")
// @JvmField
// val LAGGING_TAIL = heldItem("lagging_tail")
@JvmField
val LEFTOVERS = heldItem("leftovers")
@JvmField
@@ -719,12 +719,12 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
val LOADED_DICE = heldItem("loaded_dice")
@JvmField
val LUCKY_EGG = heldItem("lucky_egg")
@JvmField
val LUMINOUS_MOSS = heldItem("luminous_moss")
// @JvmField
// val LUMINOUS_MOSS = heldItem("luminous_moss")
@JvmField
val MAGNET = heldItem("magnet")
@JvmField
val METRONOME = heldItem("metronome")
// @JvmField
// val METRONOME = heldItem("metronome")
@JvmField
val MIRACLE_SEED = heldItem("miracle_seed")
@JvmField
@@ -747,10 +747,10 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
val POWER_LENS = heldItem("power_lens")
@JvmField
val POWER_WEIGHT = heldItem("power_weight")
@JvmField
val PROTECTIVE_PADS = heldItem("protective_pads")
@JvmField
val PUNCHING_GLOVE = heldItem("punching_glove")
// @JvmField
// val PROTECTIVE_PADS = heldItem("protective_pads")
// @JvmField
// val PUNCHING_GLOVE = heldItem("punching_glove")
@JvmField
val QUICK_CLAW = heldItem("quick_claw")
@JvmField
@@ -759,16 +759,16 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
val RING_TARGET = heldItem("ring_target")
@JvmField
val ROCKY_HELMET = heldItem("rocky_helmet")
@JvmField
val ROOM_SERVICE = heldItem("room_service")
// @JvmField
// val ROOM_SERVICE = heldItem("room_service")
@JvmField
val SAFETY_GOGGLES = heldItem("safety_goggles")
@JvmField
val SCOPE_LENS = heldItem("scope_lens")
// @JvmField
// val SCOPE_LENS = heldItem("scope_lens")
@JvmField
val SHARP_BEAK = heldItem("sharp_beak")
@JvmField
val SHED_SHELL = heldItem("shed_shell")
// @JvmField
// val SHED_SHELL = heldItem("shed_shell")
@JvmField
val SHELL_BELL = heldItem("shell_bell")
@JvmField
@@ -785,24 +785,24 @@ object CobblemonItems : PlatformRegistry<Registry<Item>, RegistryKey<Registry<It
val SOOTHE_BELL = heldItem("soothe_bell")
@JvmField
val STICKY_BARB = heldItem("sticky_barb")
@JvmField
val TERRAIN_EXTENDER = heldItem("terrain_extender")
@JvmField
val THROAT_SPRAY = heldItem("throat_spray")
// @JvmField
// val TERRAIN_EXTENDER = heldItem("terrain_extender")
// @JvmField
// val THROAT_SPRAY = heldItem("throat_spray")
@JvmField
val TOXIC_ORB = heldItem("toxic_orb")
@JvmField
val TWISTED_SPOON = heldItem("twisted_spoon")
@JvmField
val UTILITY_UMBRELLA = heldItem("utility_umbrella")
// @JvmField
// val UTILITY_UMBRELLA = heldItem("utility_umbrella")
@JvmField
val WEAKNESS_POLICY = heldItem("weakness_policy")
@JvmField
val WIDE_LENS = heldItem("wide_lens")
// @JvmField
// val WIDE_LENS = heldItem("wide_lens")
@JvmField
val WISE_GLASSES = heldItem("wise_glasses")
@JvmField
val ZOOM_LENS = heldItem("zoom_lens")
// @JvmField
// val ZOOM_LENS = heldItem("zoom_lens")
@JvmField
val MENTAL_HERB = compostableHeldItem("mental_herb", null, 1F)
@JvmField
@@ -14,25 +14,7 @@ import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
import com.cobblemon.mod.common.client.net.PlayerInteractOptionsHandler
import com.cobblemon.mod.common.client.net.SetClientPlayerDataHandler
import com.cobblemon.mod.common.client.net.animation.PlayPoseableAnimationHandler
import com.cobblemon.mod.common.client.net.battle.BattleApplyPassResponseHandler
import com.cobblemon.mod.common.client.net.battle.BattleCaptureEndHandler
import com.cobblemon.mod.common.client.net.battle.BattleCaptureShakeHandler
import com.cobblemon.mod.common.client.net.battle.BattleCaptureStartHandler
import com.cobblemon.mod.common.client.net.battle.BattleChallengeExpiredHandler
import com.cobblemon.mod.common.client.net.battle.BattleChallengeNotificationHandler
import com.cobblemon.mod.common.client.net.battle.BattleEndHandler
import com.cobblemon.mod.common.client.net.battle.BattleFaintHandler
import com.cobblemon.mod.common.client.net.battle.BattleHealthChangeHandler
import com.cobblemon.mod.common.client.net.battle.BattleInitializeHandler
import com.cobblemon.mod.common.client.net.battle.BattleMadeInvalidChoiceHandler
import com.cobblemon.mod.common.client.net.battle.BattleMakeChoiceHandler
import com.cobblemon.mod.common.client.net.battle.BattleMessageHandler
import com.cobblemon.mod.common.client.net.battle.BattleMusicHandler
import com.cobblemon.mod.common.client.net.battle.BattlePersistentStatusHandler
import com.cobblemon.mod.common.client.net.battle.BattleQueueRequestHandler
import com.cobblemon.mod.common.client.net.battle.BattleSetTeamPokemonHandler
import com.cobblemon.mod.common.client.net.battle.BattleSwitchPokemonHandler
import com.cobblemon.mod.common.client.net.battle.BattleUpdateTeamPokemonHandler
import com.cobblemon.mod.common.client.net.battle.*
import com.cobblemon.mod.common.client.net.callback.move.OpenMoveCallbackHandler
import com.cobblemon.mod.common.client.net.callback.party.OpenPartyCallbackHandler
import com.cobblemon.mod.common.client.net.callback.partymove.OpenPartyMoveCallbackHandler
@@ -305,6 +287,8 @@ object CobblemonNetwork : NetworkManager {
this.createClientBound(BattleMadeInvalidChoicePacket.ID, BattleMadeInvalidChoicePacket::decode, BattleMadeInvalidChoiceHandler)
this.createClientBound(BattleMusicPacket.ID, BattleMusicPacket::decode, BattleMusicHandler)
this.createClientBound(BattleChallengeExpiredPacket.ID, BattleChallengeExpiredPacket::decode, BattleChallengeExpiredHandler)
this.createClientBound(BattleReplacePokemonPacket.ID, BattleReplacePokemonPacket::decode, BattleReplacePokemonHandler)
this.createClientBound(BattleTransformPokemonPacket.ID, BattleTransformPokemonPacket::decode, BattleTransformPokemonHandler)
@@ -122,13 +122,18 @@ object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, RegistryKey<Regi
val FOSSIL_MACHINE_UNPROTECTED = this.create("fossil_machine.unprotected")
@JvmField
val COIN_POUCH_BREAK = this.create("coin_pouch.break")
val RELIC_COIN_SACK_BREAK = this.create("relic_coin_sack.break")
@JvmField
val COIN_POUCH_HIT = this.create("coin_pouch.hit")
val RELIC_COIN_SACK_HIT = this.create("relic_coin_sack.hit")
@JvmField
val COIN_POUCH_STEP = this.create("coin_pouch.step")
val RELIC_COIN_SACK_STEP = this.create("relic_coin_sack.step")
@JvmField
val COIN_POUCH_PLACE = this.create("coin_pouch.place")
val RELIC_COIN_SACK_PLACE = this.create("relic_coin_sack.place")
@JvmField
val RELIC_COIN_POUCH_BREAK = this.create("relic_coin_pouch.break")
@JvmField
val RELIC_COIN_POUCH_PLACE = this.create("relic_coin_pouch.place")
@JvmField
val TUMBLESTONE_BREAK = this.create("tumblestone.break")
@JvmField
@@ -189,13 +194,22 @@ object CobblemonSounds : PlatformRegistry<Registry<SoundEvent>, RegistryKey<Regi
val GILDED_CHEST_PLACE = this.create("gilded_chest.place")
@JvmField
val COIN_POUCH_SOUNDS = BlockSoundGroup(1f, 1f,
COIN_POUCH_BREAK,
COIN_POUCH_STEP,
COIN_POUCH_PLACE,
COIN_POUCH_HIT,
COIN_POUCH_STEP
val RELIC_COIN_SACK_SOUNDS = BlockSoundGroup(1f, 1f,
RELIC_COIN_SACK_BREAK,
RELIC_COIN_SACK_STEP,
RELIC_COIN_SACK_PLACE,
RELIC_COIN_SACK_HIT,
RELIC_COIN_SACK_STEP
)
@JvmField
val RELIC_COIN_POUCH_SOUNDS = BlockSoundGroup(1f, 1f,
RELIC_COIN_POUCH_BREAK,
RELIC_COIN_SACK_STEP,
RELIC_COIN_POUCH_PLACE,
RELIC_COIN_SACK_HIT,
RELIC_COIN_SACK_STEP
)
@JvmField
val IMPACT_NORMAL = this.create("impact.normal")
@JvmField
@@ -135,28 +135,31 @@ class BattleMessage(rawMessage: String) {
return this.actorAndActivePokemon(pnx, battle)
}
/*
Example:
|-curestatus|p1: a8e5710e-6835-4387-99d3-331b45f848e6|slp|[msg]
|-curestatus|p1: 0686b20d-3019-4167-92e2-786834245743|slp|[msg]
// Function used to grab BattlePokemon (As we need to be able to grab non active pokemon to cure their status)
// by using playerNumber(actorID) and pokemon uuid(pokemonID)
/**
* Queries an argument at the given [index] for a 'pnx' and uuid that will be parsed into a [BattlePokemon].
*
* @param index The index of the argument referencing the [BattlePokemon].
* @param battle The [PokemonBattle] being queried.
* @return The [BattlePokemon] if the argument exists and is successfully parsed; otherwise null.
*/
fun getBattlePokemon(index: Int, battle: PokemonBattle): BattlePokemon? {
val actorAndPokemonID = this.argumentAt(index)?.takeIf { it.length >= 2 }?.split(": ") ?: return null
if (actorAndPokemonID.count() < 2) return null
val actorID = actorAndPokemonID[0]
val pokemonID = actorAndPokemonID[1]
return this.getBattlePokemon(actorID, pokemonID, battle)
fun battlePokemon(index: Int, battle: PokemonBattle): BattlePokemon? {
val (actorID, pokemonID) = this.pnxAndUuid(index) ?: return null
return this.battlePokemon(actorID, pokemonID, battle)
}
fun getSourceBattlePokemon(battle: PokemonBattle): BattlePokemon? {
val sourcePokemonArgument = this.optionalArguments.get("of") ?: return null
val actorAndPokemonID = sourcePokemonArgument.takeIf { it.length >= 2 }?.split(": ") ?: return null
if (actorAndPokemonID.count() < 2) return null
val actorID = actorAndPokemonID[0]
val pokemonID = actorAndPokemonID[1]
return this.getBattlePokemon(actorID, pokemonID, battle)
/**
* Queries an optional argument identified by [optionalArg] for a 'pnx' and uuid that will be parsed into a [BattlePokemon].
*
* @param optionalArg The id of the optional argument referencing the [BattlePokemon].
* @param battle The [PokemonBattle] being queried.
* @return The [BattlePokemon] if the argument exists and is successfully parsed; otherwise null.
*/
fun battlePokemonFromOptional(battle: PokemonBattle, optionalArg: String = "of"): BattlePokemon? {
val optional = this.optionalArguments.get(optionalArg) ?: return null
val pokemonID = optional.takeIf { it.length >= 2 }?.split(":")?.takeIf { it.size == 2 } ?: return null
val pnx = pokemonID[0].takeIf { it.matches(PNX_MATCHER) || it.matches(PN_MATCHER) } ?: return null
val uuid = pokemonID[1].trim()
return this.battlePokemon(pnx, uuid, battle)
}
/**
@@ -167,7 +170,7 @@ class BattleMessage(rawMessage: String) {
*/
fun pnxAndUuid(index: Int): Pair<String, String>? {
val argument = this.argumentAt(index)?.takeIf { it.length >= 2 }?.split(":")?.takeIf { it.size == 2 } ?: return null
val pnx = argument[0].takeIf { it.matches(PNX_MATCHER) } ?: return null
val pnx = argument[0].takeIf { it.matches(PNX_MATCHER) || it.matches(PN_MATCHER) } ?: return null
val uuid = argument[1].trim()
return pnx to uuid
}
@@ -234,7 +237,7 @@ class BattleMessage(rawMessage: String) {
null
}
private fun getBattlePokemon(pnx: String, pokemonID: String, battle: PokemonBattle): BattlePokemon? = try {
private fun battlePokemon(pnx: String, pokemonID: String, battle: PokemonBattle): BattlePokemon? = try {
battle.getBattlePokemon(pnx, pokemonID)
} catch (_: Exception) {
null
@@ -8,13 +8,11 @@
package com.cobblemon.mod.common.api.battles.model
import com.bedrockk.molang.runtime.MoLangEnvironment
import com.bedrockk.molang.runtime.struct.QueryStruct
import com.bedrockk.molang.runtime.value.DoubleValue
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.Cobblemon.LOGGER
import com.cobblemon.mod.common.CobblemonNetwork
import com.cobblemon.mod.common.Environment
import com.cobblemon.mod.common.api.battles.interpreter.BattleMessage
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
@@ -22,8 +20,6 @@ import com.cobblemon.mod.common.api.battles.model.actor.EntityBackedBattleActor
import com.cobblemon.mod.common.api.battles.model.actor.FleeableBattleActor
import com.cobblemon.mod.common.api.events.CobblemonEvents
import com.cobblemon.mod.common.api.events.battles.BattleFledEvent
import com.cobblemon.mod.common.api.molang.MoLangFunctions.addFunction
import com.cobblemon.mod.common.api.molang.MoLangFunctions.getQueryStruct
import com.cobblemon.mod.common.api.net.NetworkPacket
import com.cobblemon.mod.common.api.tags.CobblemonItemTags
import com.cobblemon.mod.common.api.text.red
@@ -41,10 +37,10 @@ import com.cobblemon.mod.common.battles.dispatch.WaitDispatch
import com.cobblemon.mod.common.battles.interpreter.ContextManager
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
import com.cobblemon.mod.common.battles.runner.ShowdownService
import com.cobblemon.mod.common.battles.ForfeitActionResponse
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.net.messages.client.battle.BattleEndPacket
import com.cobblemon.mod.common.net.messages.client.battle.BattleMessagePacket
import com.cobblemon.mod.common.net.messages.client.battle.BattleMusicPacket
import com.cobblemon.mod.common.pokemon.evolution.progress.DefeatEvolutionProgress
import com.cobblemon.mod.common.pokemon.evolution.progress.LastBattleCriticalHitsEvolutionProgress
import com.cobblemon.mod.common.pokemon.evolution.requirements.DefeatRequirement
@@ -107,6 +103,11 @@ open class PokemonBattle(
var turn: Int = 1
private set
private var ticks: Int = 0
set(value) { field = value.coerceAtMost(Int.MAX_VALUE) } // go outside
/** The current duration of the battle in seconds. */
val time: Int get() = ticks % 20
var dispatchResult = GO
val dispatches = ConcurrentLinkedDeque<BattleDispatch>()
@@ -166,7 +167,7 @@ open class PokemonBattle(
fun getActor(player: ServerPlayerEntity) = actors.firstOrNull { it.isForPlayer(player) }
/**
* Gets a BattleActor and an [ActiveBattlePokemon] from a pnx key, e.g. p2a
* Gets a [BattleActor] and an [ActiveBattlePokemon] from a pnx key, e.g. p2a
*
* Returns null if either the pn or x is invalid.
*/
@@ -179,6 +180,11 @@ open class PokemonBattle(
return actor to pokemon
}
/**
* Gets a [BattlePokemon] from a pnx key and uuid.
*
* Returns null if the pnx key is invalid or the uuid does not exist.
*/
fun getBattlePokemon(pnx: String, pokemonID: String): BattlePokemon {
val actor = actors.find { it.showdownId == pnx.substring(0, 2) }
?: throw IllegalStateException("Invalid pnx: $pnx - unknown actor")
@@ -220,7 +226,7 @@ open class PokemonBattle(
val facedFainted = opponentPokemon.facedOpponents.contains(faintedPokemon)
val pokemon = opponentPokemon.effectedPokemon
if (facedFainted) {
pokemon.evolutions.forEach { evolution ->
pokemon.lockedEvolutions.forEach { evolution ->
evolution.requirements.filterIsInstance<DefeatRequirement>().forEach { defeatRequirement ->
if (defeatRequirement.target.matches(faintedPokemon.effectedPokemon)) {
val progress = pokemon.evolutionProxy.current().progressFirstOrCreate({ it is DefeatEvolutionProgress && it.currentProgress().target == defeatRequirement.target }) { DefeatEvolutionProgress() }
@@ -390,8 +396,9 @@ open class PokemonBattle(
return
}
if (started && isPvW && !ended && dispatches.isEmpty()) {
checkFlee()
if (started) {
ticks++
if (isPvW && !ended && dispatches.isEmpty()) checkFlee()
}
}
@@ -433,13 +440,24 @@ open class PokemonBattle(
}
fun checkForInputDispatch() {
val readyToInput = actors.any { !it.mustChoose && it.responses.isNotEmpty() } && actors.none { it.mustChoose }
if (checkForfeit()) return // ignore actors that are still choosing, their choices don't matter anymore
val readyToInput = (actors.any { !it.mustChoose && it.responses.isNotEmpty() } && actors.none { it.mustChoose })
if (readyToInput && captureActions.isEmpty()) {
actors.filter { it.responses.isNotEmpty() }.forEach { it.writeShowdownResponse() }
actors.forEach { it.responses.clear() ; it.request = null }
}
}
/** Forces Showdown to end the battle when a [BattleActor] chooses to forfeit. */
private fun checkForfeit(): Boolean {
val forfeit = actors.find { it.responses.any { it is ForfeitActionResponse } }
return forfeit?.let {
this.dispatchWaiting { this.broadcastChatMessage(battleLang("forfeit", it.getName()).red()) }
writeShowdownAction(">forcelose ${it.showdownId}")
true
} ?: false
}
/**
* Creates a [Text] representation of an error to interpret a battle message.
* This also logs the error, the goal of this function is to make sure users see missing interpretations and report them to us.
@@ -0,0 +1,97 @@
/*
* 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.api.entity.pokemon
import com.cobblemon.mod.common.api.pokemon.PokemonProperties
import com.cobblemon.mod.common.api.pokemon.PokemonSpecies
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.entity.pokemon.effects.IllusionEffect
import com.cobblemon.mod.common.entity.pokemon.effects.TransformEffect
import com.cobblemon.mod.common.pokemon.FormData
import com.cobblemon.mod.common.pokemon.Species
import com.cobblemon.mod.common.util.DataKeys
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import net.minecraft.nbt.NbtCompound
import java.util.concurrent.CompletableFuture
import kotlin.reflect.KClass
/**
* Represents a temporary alteration to how a [PokemonEntity] is rendered and behaves. May include a temporary visual effect
* when applied.
*
* @author Segfault Guy
* @since March 5th, 2024
*/
interface EntityEffect {
/**
* Starts this effect for the provided [PokemonEntity].
*
* @return A [CompletableFuture] that completes after the effect has been applied. Or null if the effect failed to start.
*/
fun start(entity: PokemonEntity): CompletableFuture<PokemonEntity>?
/**
* Ends this effect for the provided [PokemonEntity].
*
* @return A [CompletableFuture] that completes after the effect has been reverted. Or null if the effect failed to end.
*/
fun end(entity: PokemonEntity): CompletableFuture<PokemonEntity>?
/** Saves this effect to NBT. */
fun saveToNbt(): NbtCompound
/** Loads this effect from NBT. */
fun loadFromNBT(nbt: NbtCompound)
companion object {
private val effects = mutableMapOf<String, KClass<out EntityEffect>>()
private val defaults = mutableMapOf<String, () -> EntityEffect>()
init {
register(IllusionEffect.ID, IllusionEffect::class, ::IllusionEffect)
register(TransformEffect.ID, TransformEffect::class, ::TransformEffect)
}
fun <T : EntityEffect> register(id: String, type: KClass<T>, default: () -> T) {
effects[id] = type
defaults[id] = default
}
fun createDefault(id: String): EntityEffect? = defaults[id]?.invoke()
fun loadFromNbt(nbt: NbtCompound): EntityEffect? {
if (nbt.contains(DataKeys.ENTITY_EFFECT_ID)) {
val id = nbt.getString(DataKeys.ENTITY_EFFECT_ID)
return createDefault(id)?.also { it.loadFromNBT(nbt) }
}
return null
}
}
}
/** An [EntityEffect] that modifies the dimensions of a [PokemonEntity]. */
interface PhysicalEffect : EntityEffect {
val scale: Float
}
/** An [EntityEffect] that alters the physical appearance of a [PokemonEntity] to match a [mock]. */
interface MocKEffect : PhysicalEffect {
val mock: PokemonProperties
val exposedSpecies: Species?
get() = this.mock.species?.let { PokemonSpecies.getByIdentifier(it.asIdentifierDefaultingNamespace()) }
val exposedForm: FormData?
get() = this.mock.form?.let {
formID -> this.exposedSpecies?.forms?.firstOrNull { it.formOnlyShowdownId().equals(formID, true) } }
?: this.exposedSpecies?.standardForm
}
@@ -52,21 +52,24 @@ abstract class MultiblockBlock(properties: Settings) : BlockWithEntity(propertie
if(hand == Hand.OFF_HAND) {
return ActionResult.SUCCESS
}
val entity = world.getBlockEntity(pos) as MultiblockEntity?
if (entity?.multiblockStructure != null) {
return entity.multiblockStructure!!.onUse(state, world, pos, player, hand, hit)
if (!world.isClient) {
val entity = world.getBlockEntity(pos) as MultiblockEntity?
if (entity?.multiblockStructure != null) {
return entity.multiblockStructure!!.onUse(state, world, pos, player, hand, hit)
}
}
return super.onUse(state, world, pos, player, hand, hit)
}
override fun onBreak(world: World, pos: BlockPos, state: BlockState, player: PlayerEntity?) {
super.onBreak(world, pos, state, player)
if (!world.isClient) {
val entity = world.getBlockEntity(pos)
if (entity is MultiblockEntity && entity.multiblockStructure != null) {
entity.multiblockStructure!!.onBreak(world, pos, state, player)
}
entity?.markRemoved()
}
super.onBreak(world, pos, state, player)
}
override fun createBlockEntity(pos: BlockPos, state: BlockState): BlockEntity? {
@@ -78,6 +81,7 @@ abstract class MultiblockBlock(properties: Settings) : BlockWithEntity(propertie
return BlockRenderType.MODEL
}
//This is done so a block picked with NBT doesnt absolutely DESTROY multiblocks
override fun getPickStack(world: BlockView, pos: BlockPos, state: BlockState): ItemStack {
val blockEntity = world.getBlockEntity(pos) as? MultiblockEntity ?: return ItemStack.EMPTY
return if (blockEntity.multiblockStructure == null) super.getPickStack(world, pos, state) else ItemStack.EMPTY
@@ -397,7 +397,7 @@ open class PokemonProperties {
return false
}
}
nickname?.takeIf { it != pokemon.nickname }?.let { return false }
nickname?.takeIf { it.string != pokemon.nickname?.string }?.let { return false }
form?.takeIf { !it.equals(pokemon.form.name, true) }?.let { return false }
friendship?.takeIf { it != pokemon.friendship }?.let { return false }
pokeball?.takeIf { it != pokemon.caughtBall.name.toString() }?.let { return false }
@@ -437,7 +437,7 @@ open class PokemonProperties {
}
} catch (_: InvalidIdentifierException) {}
}
nickname?.takeIf { it != properties.nickname }?.let { return false }
nickname?.takeIf { it.string != properties.nickname?.string }?.let { return false }
form?.takeIf { !it.equals(properties.form, true) }?.let { return false }
friendship?.takeIf { it != properties.friendship }?.let { return false }
pokeball?.takeIf { it != properties.pokeball }?.let { return false }
@@ -48,6 +48,11 @@ fun interface PokemonPropertyExtractor {
@JvmField
val STATUS = add { pokemon, properties -> properties.status = pokemon.status?.status?.showdownName }
@JvmField
val ILLUSION = mutableListOf(SPECIES, FORM, ASPECTS, GENDER, NICKNAME, SHINY)
@JvmField
val TRANSFORM = mutableListOf(SPECIES, FORM, ASPECTS, GENDER)
fun add(extractor: PokemonPropertyExtractor): PokemonPropertyExtractor {
ALL.add(extractor)
return extractor
@@ -153,7 +153,7 @@ interface Evolution : EvolutionLike {
pokemon.getOwnerPlayer()?.sendMessage(lang("experience.learned_move", pokemon.getDisplayName(), move.displayName))
}
// we want to instantly tick for example you might only evolve your Bulbasaur at level 34 so Venusaur should be immediately available
pokemon.evolutions.filterIsInstance<PassiveEvolution>().forEach { evolution -> evolution.attemptEvolution(pokemon) }
pokemon.lockedEvolutions.filterIsInstance<PassiveEvolution>().forEach { evolution -> evolution.attemptEvolution(pokemon) }
pokemon.getOwnerPlayer()?.playSound(CobblemonSounds.EVOLVING, SoundCategory.NEUTRAL, 1F, 1F)
CobblemonEvents.EVOLUTION_COMPLETE.post(EvolutionCompleteEvent(pokemon, this))
}
@@ -49,6 +49,25 @@ enum class Stats(override val identifier: Identifier, override val displayName:
*/
val BATTLE_ONLY: Set<Stat> = EnumSet.of(EVASION, ACCURACY)
/** Gets the [Stat] from the respective Showdown id. */
fun getStat(statKey: String) = when(statKey) {
"atk" -> ATTACK
"def" -> DEFENCE
"spa" -> SPECIAL_ATTACK
"spd" -> SPECIAL_DEFENCE
"spe" -> SPEED
"evasion" -> EVASION
else -> ACCURACY
}
/** Gets the severity lang key from the respective boost/unboost stage. */
fun getSeverity(stages: Int) = when(stages) {
0 -> "cap.single"
1 -> "slight"
2 -> "sharp"
else -> "severe"
}
}
}
@@ -123,10 +123,8 @@ class RotateYCameraMode : ParticleCameraMode {
viewDirection: Vec3d
): Quaternionf {
val i = if (angle == 0F) 0F else MathHelper.lerp(deltaTicks, prevAngle, angle)
val q2 = RotationAxis.POSITIVE_Y.rotationDegrees(/*180 - */cameraYaw)
val q2 = RotationAxis.POSITIVE_Y.rotationDegrees(-cameraYaw)
q2.hamiltonProduct(RotationAxis.POSITIVE_Z.rotationDegrees(i))
return q2
}
@@ -191,9 +189,10 @@ class LookAtY : ParticleCameraMode {
cameraPitch: Float,
viewDirection: Vec3d
): Quaternionf {
val rotation = Quaternionf(0F, 0F, 0F, 1F)
rotation.hamiltonProduct(RotationAxis.POSITIVE_Y.rotationDegrees(-cameraYaw))
return rotation
val i = if (angle == 0F) 0F else MathHelper.lerp(deltaTicks, prevAngle, angle)
val q2 = RotationAxis.POSITIVE_Y.rotationDegrees(-cameraYaw)
q2.hamiltonProduct(RotationAxis.POSITIVE_Z.rotationDegrees(i))
return q2
}
override fun <T> encode(ops: DynamicOps<T>) = CODEC.encodeStart(ops, this)
@@ -65,7 +65,7 @@ class DynamicParticleRotation(
override val type = ParticleRotationType.DYNAMIC
override fun <T> encode(ops: DynamicOps<T>) = CODEC.encodeStart(ops, this)
override fun getInitialRotation(runtime: MoLangRuntime) = runtime.resolveDouble(startRotation)
override fun getInitialAngularVelocity(runtime: MoLangRuntime) = runtime.resolveDouble(speed)
override fun getInitialAngularVelocity(runtime: MoLangRuntime) = runtime.resolveDouble(speed) / 20
override fun getAngularAcceleration(runtime: MoLangRuntime, angularVelocity: Double): Double {
val acceleration = runtime.resolveDouble(acceleration)
val nextVelocity = angularVelocity + acceleration
@@ -35,11 +35,13 @@ class TimeRange : IntRanges {
"night" to TimeRange(12542..23459),
"noon" to TimeRange(5000..6999),
"midnight" to TimeRange(17000..18999),
"dawn" to TimeRange(22300..23999, 0..166),
"dawn" to TimeRange(22300..23999, 0..999),
"dusk" to TimeRange(11834..13701),
"twilight" to TimeRange(11834..13701, 22300..23999, 0..166),
"morning" to TimeRange(0..4999),
"afternoon" to TimeRange(7000..12039)
"morning" to TimeRange(23000..23999, 0..4999),
"afternoon" to TimeRange(7000..12999),
"predawn" to TimeRange(19000..22999),
"evening" to TimeRange(13000..16999)
)
}
@@ -78,7 +78,7 @@ abstract class SpawningCondition<T : SpawningContext> {
return false
} else if (ctx.position.z < minZ.orMin() || ctx.position.z > maxZ.orMax()) {
return false
} else if (dimensions != null && dimensions!!.isNotEmpty() && ctx.world.dimension.effects !in dimensions!!) {
} else if (dimensions != null && dimensions!!.isNotEmpty() && ctx.world.dimensionKey.value !in dimensions!!) {
return false
} else if (moonPhase != null && ctx.moonPhase !in moonPhase!!) {
return false
@@ -30,8 +30,8 @@ import net.minecraft.server.world.ServerWorld
*/
interface SpawningContextCalculator<I : SpawningContextInput, O : SpawningContext> {
companion object {
val isAirCondition: (BlockState) -> Boolean = { it.isAir || (!it.isSolid && !it.isLiquid) }
val isSolidCondition: (BlockState) -> Boolean = { it.isSolid && !it.isIn(BlockTags.LEAVES) }
val isAirCondition: (BlockState) -> Boolean = { it.isAir || (!it.isSolid && !it.fluidState.isIn(FluidTags.WATER)) }
val isSolidCondition: (BlockState) -> Boolean = { it.isSolid }
val isWaterCondition: (BlockState) -> Boolean = { it.fluidState.isIn(FluidTags.WATER) && it.fluidState.isStill }
val isLavaCondition: (BlockState) -> Boolean = { it.fluidState.isIn(FluidTags.LAVA) && it.fluidState.isStill }
@@ -34,15 +34,19 @@ abstract class SpawnAction<R>(
/**
* Runs the spawn action and processes any non-null result.
*/
open fun complete(): Boolean {
open fun complete(): R? {
if (future.isDone) {
return null
}
ctx.influences.forEach { it.affectAction(this) }
val result = run()
return if (result != null) {
if (result != null) {
future.complete(result)
true
} else {
future.completeExceptionally(Exception("Nothing was spawned."))
false
}
return result
}
}
@@ -48,7 +48,7 @@ abstract class SpawnDetailPreset {
var weightMultipliers: MutableList<WeightMultiplier>? = null
var weight: Float? = null
var percentage: Float? = null
var mergeMode = MergeMode.KEEP
var mergeMode = MergeMode.INSERT
open fun apply(spawnDetail: SpawnDetail) {
bucket?.let { spawnDetail.bucket = it }
@@ -260,7 +260,7 @@ open class PartyStore(override val uuid: UUID) : PokemonStore<PartyPosition>() {
return@mapNotNull if (clone) {
BattlePokemon.safeCopyOf(it)
} else {
BattlePokemon(it)
BattlePokemon.playerOwned(it)
}
}.sortedBy { if (it.uuid == leadingPokemon) 0 else (indexOf(it.originalPokemon) + 1) }
@@ -124,7 +124,7 @@ open class PlayerPartyStore(
}
// Passive evolutions
pokemon.evolutions.filterIsInstance<PassiveEvolution>().forEach { it.attemptEvolution(pokemon) }
pokemon.lockedEvolutions.filterIsInstance<PassiveEvolution>().forEach { it.attemptEvolution(pokemon) }
val removeList = mutableListOf<Evolution>()
pokemon.evolutionProxy.server().forEach {
if (!it.test(pokemon) && it is LevelUpEvolution && !it.permanent)
@@ -99,7 +99,7 @@ open class PCStore(
this.lockedSize = lockNewSize
if (boxes.size > newSize) {
// reduce
val slicedBoxes = boxes.slice(boxes.size until newSize)
val slicedBoxes = boxes.slice(newSize until boxes.size)
boxes.removeAll(slicedBoxes)
slicedBoxes.flatMap { it.asIterable() }.forEach(overflowHandler)
} else {
@@ -17,6 +17,8 @@ class ActiveBattlePokemon(val actor: BattleActor, var battlePokemon: BattlePokem
fun getSide() = actor.getSide()
var position: Pair<ServerWorld, Vec3d>? = null
var illusion: BattlePokemon? = null
override fun getAllActivePokemon() = battle.activePokemon
override fun getActorShowdownId() = actor.showdownId
override fun getActorPokemon() = actor.activePokemon
@@ -71,7 +71,6 @@ object BattleBuilder {
player1Actor.battleTheme = player2.getBattleTheme()
player2Actor.battleTheme = player1.getBattleTheme()
}
errors
} else {
errors
}
@@ -100,11 +99,19 @@ object BattleBuilder {
fleeDistance: Float = Cobblemon.config.defaultFleeDistance,
party: PartyStore = player.party()
): BattleStartResult {
val playerTeam = party.toBattleTeam(clone = cloneParties, checkHealth = !healFirst, leadingPokemon = leadingPokemon)
val playerTeam = party.toBattleTeam(clone = cloneParties, checkHealth = !healFirst, leadingPokemon = leadingPokemon).sortedBy { it.health <= 0 }
val playerActor = PlayerBattleActor(player.uuid, playerTeam)
val wildActor = PokemonBattleActor(pokemonEntity.pokemon.uuid, BattlePokemon(pokemonEntity.pokemon), fleeDistance)
val errors = ErroredBattleStart()
if(playerTeam.isNotEmpty() && playerTeam[0].health <= 0){
errors.participantErrors[playerActor] += BattleStartError.insufficientPokemon(
player = player,
requiredCount = battleFormat.battleType.slotsPerActor,
hadCount = playerActor.pokemonList.size
)
}
if (playerActor.pokemonList.size < battleFormat.battleType.slotsPerActor) {
errors.participantErrors[playerActor] += BattleStartError.insufficientPokemon(
player = player,
@@ -132,7 +139,6 @@ object BattleBuilder {
}
playerActor.battleTheme = pokemonEntity.getBattleTheme()
}
errors
} else {
errors
}
@@ -44,10 +44,10 @@ class BattleCaptureAction(
pokeBallEntity.captureFuture.thenAccept { successful ->
if (successful) {
targetPokemon.battlePokemon?.gone = true
battle.dispatchWaiting(2F) { battle.broadcastChatMessage(lang("capture.succeeded", pokemonName).green()) }
battle.writeShowdownAction(">capture ${targetPokemon.getPNX()}")
battle.broadcastChatMessage(lang("capture.succeeded", pokemonName).green())
} else {
battle.broadcastChatMessage(lang("capture.broke_free", pokemonName).red())
battle.dispatchWaiting(2F) { battle.broadcastChatMessage(lang("capture.broke_free", pokemonName).red()) }
}
battle.sendUpdate(BattleCaptureEndPacket(targetPokemon.getPNX(), successful))
battle.finishCaptureAction(this)
@@ -95,7 +95,8 @@ enum class ShowdownActionResponseType(val loader: (PacketByteBuf) -> ShowdownAct
DEFAULT({ DefaultActionResponse() }),
FORCE_PASS({ ForcePassActionResponse() }),
PASS({ PassActionResponse }),
HEAL_ITEM({ HealItemActionResponse("potion") });
HEAL_ITEM({ HealItemActionResponse("potion") }),
FORFEIT({ ForfeitActionResponse() });
}
abstract class ShowdownActionResponse(val type: ShowdownActionResponseType) {
@@ -265,6 +266,11 @@ class BagItemActionResponse(val bagItem: BagItem, val target: BattlePokemon, val
}
}
class ForfeitActionResponse : ShowdownActionResponse(ShowdownActionResponseType.FORFEIT) {
override fun isValid(activeBattlePokemon: ActiveBattlePokemon, showdownMoveSet: ShowdownMoveset?, forceSwitch: Boolean) = true
override fun toShowdownString(activeBattlePokemon: ActiveBattlePokemon, showdownMoveSet: ShowdownMoveset?) = "forfeit"
}
class ShowdownMoveset {
lateinit var moves: List<InBattleMove>
var trapped = false
File diff suppressed because it is too large Load Diff
@@ -19,33 +19,29 @@ import com.cobblemon.mod.common.battles.dispatch.WaitDispatch
import com.cobblemon.mod.common.util.battleLang
/**
* Format:
* |-ability|POKEMON|ABILITY|(from)EFFECT
* Format: |-ability|POKEMON|ABILITY|(from)EFFECT
*
* The ABILITY of the POKEMON has been changed due to a move/ability EFFECT.
* The ABILITY of POKEMON has been changed due to a move/ability EFFECT.
*
* Format:
* |-ability|POKEMON|ABILITY
* Alt format: |-ability|POKEMON|ABILITY
*
* POKEMON has just switched-in, and its ability ABILITY is being announced to have a long-term effect.
* POKEMON has just switched-in, and its ABILITY is being announced to have a long-term effect.
* @author Xylopia
* @since January 31st, 2023
*/
class AbilityInstruction(val instructionSet: InstructionSet, val message: BattleMessage) : InterpreterInstruction, CauserInstruction {
override fun invoke(battle: PokemonBattle) {
val pokemon = message.getBattlePokemon(0, battle) ?: return
val pokemonName = pokemon.getName()
val pokemon = message.battlePokemon(0, battle) ?: return
val effect = message.effectAt(1) ?: return
val optionalEffect = message.effect()
val optionalPokemon = message.getSourceBattlePokemon(battle)
val optionalPokemonName = optionalPokemon?.getName()
val optionalPokemon = message.battlePokemonFromOptional(battle)
// If there is an optional effect causing the activation, broadcast that instead of the standard effect
if (optionalEffect != null) {
ShowdownInterpreter.broadcastAbility(battle, optionalEffect, pokemonName)
} else {
ShowdownInterpreter.broadcastAbility(battle, effect, pokemonName)
}
ShowdownInterpreter.broadcastAbility(battle, optionalEffect ?: effect, pokemon)
battle.dispatch {
val pokemonName = pokemon.getName()
val optionalPokemonName = optionalPokemon?.getName()
ShowdownInterpreter.lastCauser[battle.battleId] = message
val lang = when (optionalEffect?.id) {
@@ -20,21 +20,24 @@ import com.cobblemon.mod.common.util.battleLang
import net.minecraft.text.Text
/**
* Format:
* |-activate|POKEMON|EFFECT
* Format: |-activate|POKEMON|EFFECT
*
* A miscellaneous effect has activated.This is triggered whenever an effect could not be better described by one of the other minor messages.
* A miscellaneous EFFECT has activated for POKEMON. This is triggered whenever an effect could not be better described
* by one of the other minor messages.
*
* @author Hunter
* @since September 25th, 2022
*/
class ActivateInstruction(val instructionSet: InstructionSet, val message: BattleMessage) : InterpreterInstruction, CauserInstruction {
override fun invoke(battle: PokemonBattle) {
val pokemon = message.getBattlePokemon(0, battle) ?: return
val pokemonName = pokemon.getName()
val sourceName = message.getSourceBattlePokemon(battle)?.getName() ?: Text.literal("UNKNOWN")
val pokemon = message.battlePokemon(0, battle) ?: return
val effect = message.effectAt(1) ?: return
val extraEffect = message.effectAt(2)?.typelessData ?: Text.literal("UNKNOWN")
ShowdownInterpreter.broadcastOptionalAbility(battle, effect, pokemonName)
ShowdownInterpreter.broadcastOptionalAbility(battle, effect, pokemon)
battle.dispatch{
val pokemonName = pokemon.getName()
val sourceName = message.battlePokemonFromOptional(battle)?.getName() ?: Text.literal("UNKNOWN")
ShowdownInterpreter.lastCauser[battle.battleId] = message
battle.minorBattleActions[pokemon.uuid] = message
@@ -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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.asTranslated
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |bagitem|POKEMON|ITEM
*
* POKEMON had ITEM used on it from the 'bag'.
* @author landonjw
* @since July 31st, 2023
*/
class BagItemInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchGo {
val pokemon = message.pokemonByUuid(0, battle)!!
val item = message.argumentAt(1)!!
val ownerName = pokemon.actor.getName()
val itemName = item.asTranslated()
battle.broadcastChatMessage(battleLang("bagitem.use", ownerName, itemName, pokemon.getName()))
}
}
}
@@ -0,0 +1,38 @@
/*
* 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.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: |-block|POKEMON|EFFECT|MOVE|ATTACKER|(of)SOURCE
*
* An effect targeted at POKEMON was blocked by EFFECT. This may optionally specify that the effect was a MOVE from ATTACKER.
*
* An optional SOURCE will note the owner of the EFFECT, in the case that it's not EFFECT (for instance, an ally with Aroma Veil.)
* @author jeffw773
* @since November 6th, 2023
*/
class BlockInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(1.5F) {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val pokemonName = pokemon.getName()
val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting
val lang = battleLang("block.$effectID", pokemonName)
battle.broadcastChatMessage(lang)
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,52 @@
/*
* 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.api.pokemon.stats.Stats
import com.cobblemon.mod.common.battles.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InstructionSet
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-boost|POKEMON|STAT|AMOUNT or |-unboost|POKEMON|STAT|AMOUNT
*
* POKEMON has gained or lost AMOUNT in STAT, using the standard rules for stat changes in-battle.
* STAT is a standard three-letter abbreviation fot the stat in question.
* @author Hiroku
* @since August 20th, 2022
*/
class BoostInstruction(val instructionSet: InstructionSet, val message: BattleMessage, val remainingLines: Iterator<BattleMessage>, val isBoost: Boolean = true): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val pokemon = message.battlePokemon(0, battle) ?: return
val statKey = message.argumentAt(1) ?: return
val stages = message.argumentAt(2)?.toInt() ?: return
val stat = Stats.getStat(statKey).displayName
val severity = Stats.getSeverity(stages)
val rootKey = if (isBoost) "boost" else "unboost"
battle.dispatchWaiting {
val lang = when {
message.hasOptionalArgument("zeffect") -> battleLang("$rootKey.$severity.zeffect", pokemon.getName(), stat)
else -> battleLang("$rootKey.$severity", pokemon.getName(), stat)
}
battle.broadcastChatMessage(lang)
val boostBucket = if (isBoost) BattleContext.Type.BOOST else BattleContext.Type.UNBOOST
val context = ShowdownInterpreter.getContextFromAction(message, boostBucket, battle)
// TODO: replace with context that tracks detailed information such as # of stages
repeat(stages) { pokemon.contextManager.add(context) }
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,51 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.pokemon.status.Statuses
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.api.text.text
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
import com.cobblemon.mod.common.util.lang
/**
* Formats: |cant|POKEMON|REASON and |cant|POKEMON|REASON|MOVE
*
* The POKEMON could not perform a move because of the indicated REASON.
* @author Deltric
* @since January 22nd, 2022
*/
class CantInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting
val name = pokemon.getName()
// Move may be null as it's not always given
val moveName = message.moveAt(2)?.displayName ?: run { "(Unrecognized: ${message.argumentAt(2)})".text() }
val lang = when (effectID) {
// TODO: in the games they use a generic image because there is a popup of the ability and the sprite of the mon, it may be good to have a similar system here
"armortail", "damp", "dazzling", "queenlymajesty" -> battleLang("cant.generic", name, moveName)
"par", "slp", "frz" -> {
val status = Statuses.getStatus(effectID)?.name?.path ?: return@dispatchWaiting
lang("status.$status.is", name)
}
else -> battleLang("cant.$effectID", name, moveName)
}
battle.broadcastChatMessage(lang.red())
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,34 @@
/*
* 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: |-clearallboost|
*
* Clears all boosts from all Pokémon on both sides.
* @author Segfault Guy
* @since April 26th, 2023
*/
class ClearAllBoostInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(1.5F) {
battle.activePokemon.forEach {
it.battlePokemon?.contextManager?.clear(BattleContext.Type.BOOST, BattleContext.Type.UNBOOST)
}
battle.broadcastChatMessage(battleLang("clearallboost"))
}
}
}
@@ -0,0 +1,43 @@
/*
* 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: |-clearnegativeboost|POKEMON
*
* Clear the negative boosts from the target POKEMON (usually as the result of a zeffect).
* @author Segfault Guy
* @since September 10th, 2023
*/
class ClearNegativeBoostInstruction(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 = when {
message.hasOptionalArgument("zeffect") -> battleLang("clearallnegativeboost.zeffect", pokemonName)
else -> battleLang("clearallnegativeboost", pokemonName)
}
if (!message.hasOptionalArgument("silent")) {
battle.broadcastChatMessage(lang)
}
battlePokemon.contextManager.clear(BattleContext.Type.UNBOOST)
battle.minorBattleActions[battlePokemon.uuid] = message
}
}
}
@@ -0,0 +1,39 @@
/*
* 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: |-copyboost|SOURCE|TARGET|(from)EFFECT
*
* Copies any stat changes from the TARGET Pokémon to the SOURCE Pokémon due to EFFECT.
* @author JMMCP
* @since November 27th, 2023
*/
class CopyBoostInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val pokemonName = pokemon.getName()
val targetPokemon = message.battlePokemon(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, BattleContext.Type.UNBOOST)
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,42 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.text.yellow
import com.cobblemon.mod.common.battles.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.pokemon.evolution.progress.LastBattleCriticalHitsEvolutionProgress
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-crit|POKEMON
*
* POKEMON received a critical hit.
* @author Hunter
* @since August 18th, 2022
*/
class CritInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchGo {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchGo
battle.broadcastChatMessage(battleLang("crit").yellow())
ShowdownInterpreter.lastCauser[battle.battleId]?.let { message ->
val battlePokemon = message.battlePokemon(0, battle) ?: return@let
if (LastBattleCriticalHitsEvolutionProgress.supports(battlePokemon.effectedPokemon)) {
val progress = battlePokemon.effectedPokemon.evolutionProxy.current().progressFirstOrCreate({ it is LastBattleCriticalHitsEvolutionProgress }) { LastBattleCriticalHitsEvolutionProgress() }
progress.updateProgress(LastBattleCriticalHitsEvolutionProgress.Progress(progress.currentProgress().amount + 1))
}
}
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,58 @@
/*
* 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.interpreter.Effect
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.pokemon.status.Statuses
import com.cobblemon.mod.common.battles.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.net.messages.client.battle.BattlePersistentStatusPacket
import com.cobblemon.mod.common.util.asTranslated
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-curestatus|POKEMON|STATUS
*
* The POKEMON has recovered from its STATUS.
* @author Hiroku
* @since November 5th, 2022
*/
class CureStatusInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val maybeActivePokemon = message.actorAndActivePokemon(0, battle)?.second?.battlePokemon
val maybePartyPokemon = message.battlePokemon(0, battle)
val pokemon = maybeActivePokemon ?: maybePartyPokemon ?: return
val status = message.argumentAt(1)?.let(Statuses::getStatus) ?: return
val effect = message.effect()
ShowdownInterpreter.broadcastOptionalAbility(battle, effect, pokemon)
battle.dispatchWaiting {
val pokemonName = pokemon.getName()
pokemon.effectedPokemon.status = null
pokemon.sendUpdate()
if (maybeActivePokemon != null) {
message.pnxAndUuid(0)?.let {
battle.sendUpdate(BattlePersistentStatusPacket(it.first, null))
}
}
val lang = when (effect?.type) {
Effect.Type.ABILITY -> battleLang("curestatus.${effect.id}", pokemonName)
else -> status.removeMessage.asTranslated(pokemonName)
}
battle.broadcastChatMessage(lang)
pokemon.contextManager.remove(status.showdownName, BattleContext.Type.STATUS)
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -19,6 +19,7 @@ import com.cobblemon.mod.common.battles.dispatch.InstructionSet
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.battles.dispatch.UntilDispatch
import com.cobblemon.mod.common.battles.dispatch.WaitDispatch
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
import com.cobblemon.mod.common.net.messages.client.animation.PlayPoseableAnimationPacket
import com.cobblemon.mod.common.net.messages.client.battle.BattleHealthChangePacket
import com.cobblemon.mod.common.net.messages.client.effect.RunPosableMoLangPacket
@@ -30,6 +31,13 @@ import java.util.concurrent.CompletableFuture
import kotlin.math.roundToInt
import net.minecraft.text.Text
/**
* Format: |-damage|POKEMON|HP STATUS
*
* POKEMON has taken damage and is now at HP STATUS
* @author Hiroku
* @since March 11th, 2022
*/
class DamageInstruction(
val instructionSet: InstructionSet,
val actor: BattleActor,
@@ -37,17 +45,17 @@ class DamageInstruction(
val privateMessage: BattleMessage
) : InterpreterInstruction {
var future = CompletableFuture.completedFuture(Unit)
val battlePokemon = publicMessage.getBattlePokemon(0, actor.battle)
val expectedTarget = publicMessage.battlePokemon(0, actor.battle)
override fun invoke(battle: PokemonBattle) {
battlePokemon ?: return
val battlePokemon = publicMessage.battlePokemon(0, actor.battle) ?: return
val recoiling = privateMessage.optionalArgument("from")?.equals("recoil", true) == true
val lastCauser = instructionSet.getMostRecentCauser(comparedTo = this)
if (recoiling) {
battlePokemon.effectedPokemon.let { pokemon ->
if (RecoilEvolutionProgress.supports(pokemon)) {
val newPercentage = privateMessage.argumentAt(1)?.split("/")?.getOrNull(0)?.toIntOrNull() ?: 0
val newHealth = (pokemon.hp * (newPercentage / 100.0)).roundToInt()
val healthStr = privateMessage.argumentAt(1) ?: throw UnsupportedOperationException("Cant get recoil string")
val newHealth = "([0-9]+).*".toRegex().find(healthStr)?.groups?.get(1)?.value?.toIntOrNull() ?: throw UnsupportedOperationException("Cant get recoil string")
val difference = pokemon.currentHealth - newHealth
if (difference > 0) {
val progress = pokemon.evolutionProxy.current().progressFirstOrCreate({ it is RecoilEvolutionProgress }) { RecoilEvolutionProgress() }
@@ -58,8 +66,7 @@ class DamageInstruction(
}
val newHealth = privateMessage.argumentAt(1)?.split(" ")?.get(0) ?: return
val effect = privateMessage.effect()
val pokemonName = battlePokemon.getName()
val sourceName = privateMessage.getSourceBattlePokemon(battle)?.getName() ?: Text.literal("UNKNOWN")
val source = privateMessage.battlePokemonFromOptional(battle)
var causedFaint = newHealth == "0"
battle.dispatch {
@@ -70,7 +77,10 @@ class DamageInstruction(
}
}
source?.let { ShowdownInterpreter.broadcastOptionalAbility(battle, effect, it) }
battle.dispatch {
val pokemonName = battlePokemon.getName()
val pokemonEntity = battlePokemon.entity
if (!causedFaint && pokemonEntity != null) {
val pkt = PlayPoseableAnimationPacket(pokemonEntity.id, setOf("recoil"), emptySet())
@@ -93,8 +103,6 @@ class DamageInstruction(
)
}
ShowdownInterpreter.broadcastOptionalAbility(battle, effect, sourceName)
val newHealthRatio: Float
val remainingHealth = newHealth.split("/")[0].toInt()
@@ -108,7 +116,7 @@ class DamageInstruction(
"aftermath" -> battleLang("damage.generic", pokemonName)
"chloroblast", "steelbeam" -> battleLang("damage.mindblown", pokemonName)
"jumpkick" -> battleLang("damage.highjumpkick", pokemonName)
else -> battleLang("damage.${effect.id}", pokemonName, sourceName)
else -> battleLang("damage.${effect.id}", pokemonName, source?.getName() ?: Text.literal("UNKOWN"))
}
battle.broadcastChatMessage(lang.red())
}
@@ -0,0 +1,34 @@
/*
* 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.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: |detailschange|POKEMON|DETAILS|HP STATUS
*
* POKEMON has changed formes permanently (i.e. Mega Evolution) to DETAILS.
* @author Segfault Guy
* @since September 10th, 2023
*/
class DetailsChangeInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val battlePokemon = message.battlePokemon(0, battle) ?: return
val formName = message.argumentAt(1)?.split(',')?.get(0)?.substringAfter('-')?.lowercase() ?: return
battle.dispatchWaiting {
val pokemonName = battlePokemon.getName()
battle.broadcastChatMessage(battleLang("detailschange.$formName", pokemonName))
battle.majorBattleActions[battlePokemon.uuid] = message
}
}
}
@@ -0,0 +1,60 @@
/*
* 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.api.battles.model.actor.BattleActor
import com.cobblemon.mod.common.api.battles.model.actor.EntityBackedBattleActor
import com.cobblemon.mod.common.battles.dispatch.BattleDispatch
import com.cobblemon.mod.common.battles.dispatch.InstructionSet
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |drag|POKEMON|DETAILS|HP STATUS
*
* POKEMON has switched in (if there was an old Pokémon in that position, it is switched out).
* POKEMON|DETAILS represents all the information that can be used to tell Pokémon apart.
* The switched Pokémon has HP health points and STATUS status.
* @author Hiroku
* @since April 24th, 2022
*/
class DragInstruction(val instructionSet: InstructionSet, val battleActor: BattleActor, val publicMessage: BattleMessage, val privateMessage: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchInsert {
val (pnx, _) = publicMessage.pnxAndUuid(0)!!
val (_, activePokemon) = battle.getActorAndActiveSlotFromPNX(pnx)
val imposter = instructionSet.getNextInstruction<TransformInstruction>(this)?.expectedTarget != null
val illusion = publicMessage.battlePokemonFromOptional(battle , "is")
val pokemon = publicMessage.battlePokemon(0, battle) ?: return@dispatchInsert emptySet()
battle.broadcastChatMessage(battleLang("dragged_out", pokemon.getName()))
activePokemon.battlePokemon?.let { oldPokemon ->
oldPokemon.contextManager.clear(BattleContext.Type.VOLATILE, BattleContext.Type.BOOST, BattleContext.Type.UNBOOST)
battle.majorBattleActions[oldPokemon.uuid] = publicMessage
}
battle.majorBattleActions[pokemon.uuid] = publicMessage
val entity = if (battleActor is EntityBackedBattleActor<*>) battleActor.entity else null
setOf(
BattleDispatch {
if (entity != null) {
SwitchInstruction.createEntitySwitch(battle, battleActor, entity, pnx, activePokemon, pokemon, illusion, imposter)
} else {
SwitchInstruction.createNonEntitySwitch(battle, battleActor, pnx, activePokemon, pokemon, illusion)
}
}
)
}
}
}
@@ -0,0 +1,35 @@
/*
* 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.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: |-endability|POKEMON
*
* The POKEMON's Ability was suppressed.
* @author jeffw773
* @since November 28th, 2023
*/
class EndAbilityInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(1.5F) {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val pokemonName = pokemon.getName()
val lang = battleLang("endability", pokemonName)
battle.broadcastChatMessage(lang)
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,44 @@
/*
* 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.InstructionSet
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
import com.cobblemon.mod.common.util.lang
/**
* Format: |-end|POKEMON|EFFECT
*
* The volatile status from EFFECT inflicted on POKEMON has ended.
* @author Hiroku
* @since October 3rd, 2022
*/
class EndInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val pokemonName = pokemon.getName()
val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting
if (!message.hasOptionalArgument("silent")) {
val lang = when (effectID) {
"yawn" -> lang("status.sleep.apply", pokemonName)
else -> battleLang("end.$effectID", pokemonName)
}
battle.broadcastChatMessage(lang)
}
pokemon.contextManager.remove(effectID, BattleContext.Type.VOLATILE)
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,45 @@
/*
* 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.CobblemonSounds
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.InstructionSet
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-enditem|POKEMON|ITEM|(from)EFFECT
*
* ITEM held by POKEMON has been destroyed by a move or ability EFFECT, and it now holds no item.
*
* Alt format: |-enditem|POKEMON|ITEM
*
* POKEMON's ITEM has destroyed itself (consumed or used).
* @author Licious
* @since December 30th, 2022
*/
class EndItemInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchGo {
// All logic regarding broadcasting battle messages is handled in CobblemonHeldItemManager
val battlePokemon = message.battlePokemon(0, battle) ?: return@dispatchGo
val itemEffect = message.effectAt(1) ?: return@dispatchGo
battlePokemon.heldItemManager.handleEndInstruction(battlePokemon, battle, message)
battle.minorBattleActions[battlePokemon.uuid] = message
battlePokemon.contextManager.remove(itemEffect.id, BattleContext.Type.ITEM)
if (message.hasOptionalArgument("eat")) {
battlePokemon.entity?.playSound(CobblemonSounds.BERRY_EAT, 1F, 1F)
}
}
}
}
@@ -0,0 +1,43 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.net.messages.client.battle.BattleMadeInvalidChoicePacket
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |error|(Invalid choice) ERROR
*
* The actor needs to send a different decision due to ERROR.
* @author Yaseen
* @since April 22nd, 2023
*/
class ErrorInstruction(val battleActor: BattleActor, val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.log("Error Instruction")
battle.dispatchGo {
//TODO: some lang stuff for the error messages (Whats the protocol for adding to other langs )
//Also is it okay to ignore the team preview error for now? - You bet!
val lang = when(message.rawMessage) {
"|error|[Unavailable choice] Can't switch: The active Pokémon is trapped" -> battleLang("error.pokemon_is_trapped").red()
"|error|[Invalid choice] Can't choose for Team Preview: You're not in a Team Preview phase" -> return@dispatchGo
else -> battle.createUnimplemented(message)
}
battleActor.sendMessage(lang)
battleActor.mustChoose = true
battleActor.sendUpdate(BattleMadeInvalidChoicePacket())
}
}
}
@@ -0,0 +1,56 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.pokemon.stats.Stats
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-fail|POKEMON|ACTION
*
* ACTION has failed against POKEMON.
* @author Hunter
* @since September 25th, 2022
*/
class FailInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(1.5F){
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val pokemonName = pokemon.getName()
val effectID = message.effectAt(1)?.id
val cause = message.effect("from")
val of = message.battlePokemonFromOptional(battle)
val lang = when (effectID) {
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
"unboost" -> {
val statKey = message.argumentAt(2)
val stat = statKey?.let { Stats.getStat(it).displayName }
if (stat != null) {
battleLang("fail.$effectID.single", pokemonName, stat)
} else {
battleLang("fail.$effectID", pokemonName)
}
}
else -> battleLang("fail.$effectID", pokemonName)
}
battle.broadcastChatMessage(lang.red())
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -19,12 +19,18 @@ import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.net.messages.client.battle.BattleFaintPacket
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |faint|POKEMON
*
* POKEMON has fainted.
* @author Deltric
* @since January 22nd, 2022
*/
class FaintInstruction(battle: PokemonBattle, val message: BattleMessage) : InterpreterInstruction {
var waitTime = 2.5F
val faintingPokemon = message.getBattlePokemon(0, battle)!!
val faintingPokemon = message.battlePokemon(0, battle)!!
override fun invoke(battle: PokemonBattle) {
val faintMessage = battleLang("fainted", faintingPokemon.getName()).red()
battle.dispatchWaiting(waitTime) {
val (pnx, _) = message.pnxAndUuid(0) ?: return@dispatchWaiting
@@ -39,7 +45,8 @@ class FaintInstruction(battle: PokemonBattle, val message: BattleMessage) : Inte
faintingPokemon.contextManager.clear(BattleContext.Type.STATUS, BattleContext.Type.VOLATILE, BattleContext.Type.BOOST, BattleContext.Type.UNBOOST)
battle.majorBattleActions[faintingPokemon.uuid] = message
}
battle.dispatchGo {
battle.dispatchWaiting(0.5F) {
val faintMessage = battleLang("fainted", faintingPokemon.getName()).red()
battle.broadcastChatMessage(faintMessage)
}
}
@@ -0,0 +1,41 @@
/*
* 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.api.text.red
import com.cobblemon.mod.common.battles.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InstructionSet
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-fieldactivate|EFFECT
*
* A miscellaneous EFFECT has activated for the entire field.
* @author Segfault Guy
* @since April 5th, 2023
*/
class FieldActivateInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(2.5F) {
val effectID = message.effectAt(0)?.id ?: return@dispatchWaiting
val lang = battleLang("fieldactivate.$effectID")
battle.broadcastChatMessage(lang.red())
// share this action with all active Pokemon
battle.activePokemon.forEach {
it.battlePokemon?.contextManager?.addUnique(ShowdownInterpreter.getContextFromAction(message, BattleContext.Type.VOLATILE, battle))
}
}
}
}
@@ -0,0 +1,39 @@
/*
* 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.api.text.red
import com.cobblemon.mod.common.battles.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InstructionSet
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-fieldend|CONDITION
*
* The field CONDITION has ended.
* @author Licious
* @since February 8th, 2023
*/
class FieldEndInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(1.5F) {
val effect = message.effectAt(0) ?: return@dispatchWaiting
val lang = battleLang("fieldend.${effect.id}")
battle.broadcastChatMessage(lang)
val type = BattleContext.Type.valueOf(effect.rawData.substringAfterLast(" ").uppercase())
battle.contextManager.remove(effect.id, type)
}
}
}
@@ -0,0 +1,42 @@
/*
* 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.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
import net.minecraft.text.Text
/**
* Format: |-fieldstart|CONDITION
*
* The field CONDITION has started.
* @author Xylopia
* @since January 31st, 2023
*/
class FieldStartInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val effect = message.effectAt(0) ?: return
val source = message.battlePokemonFromOptional(battle)
source?.let { ShowdownInterpreter.broadcastOptionalAbility(battle, message.effect(), source) }
battle.dispatchWaiting(1.5F) {
// Note persistent is a CAP ability only we can ignore the flag
val lang = battleLang("fieldstart.${effect.id}", source?.getName() ?: Text.literal("UNKNOWN"))
battle.broadcastChatMessage(lang)
val type = BattleContext.Type.valueOf(effect.rawData.substringAfterLast(" ").uppercase())
battle.contextManager.add(ShowdownInterpreter.getContextFromAction(message, type, battle))
}
}
}
@@ -0,0 +1,98 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.interpreter.Effect
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
import com.cobblemon.mod.common.api.data.ShowdownIdentifiable
import com.cobblemon.mod.common.api.pokemon.status.Statuses
import com.cobblemon.mod.common.battles.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.net.messages.client.battle.BattleHealthChangePacket
import com.cobblemon.mod.common.net.messages.client.battle.BattlePersistentStatusPacket
import com.cobblemon.mod.common.pokemon.status.PersistentStatus
import com.cobblemon.mod.common.util.asTranslated
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-heal|POKEMON|HP STATUS
*
* POKEMON has healed damage and is now at HP STATUS.
* @author Licious
* @since February 6th, 2023
*/
class HealInstruction(val actor: BattleActor, val publicMessage: BattleMessage, val privateMessage: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val pnx = privateMessage.pnxAndUuid(0)?.first
val battlePokemon = privateMessage.battlePokemon(0, battle) ?: return
val rawHpAndStatus = privateMessage.argumentAt(1)?.split(" ") ?: return
val rawHpRatio = rawHpAndStatus.getOrNull(0) ?: return
val newHealth = rawHpRatio.split("/").map { it.toFloatOrNull() ?: return }
val newHealthRatio = rawHpRatio.split("/").map { it.toFloatOrNull()?.div(newHealth[1]) ?: return }
val effect = privateMessage.effect()
ShowdownInterpreter.broadcastOptionalAbility(battle, effect, battlePokemon)
battle.dispatchWaiting {
if (pnx != null) {
// dynamax changes max health
battle.sendSidedUpdate(actor, BattleHealthChangePacket(pnx, newHealth[0], newHealth[1]), BattleHealthChangePacket(pnx, newHealthRatio[0]))
}
val silent = privateMessage.hasOptionalArgument("silent")
if (!silent) {
val lang = when {
privateMessage.hasOptionalArgument("zeffect") -> battleLang("heal.zeffect", battlePokemon.getName())
privateMessage.hasOptionalArgument("wisher") -> {
val name = privateMessage.optionalArgument("wisher")!!
val showdownId = name.lowercase().replace(ShowdownIdentifiable.REGEX, "")
val wisher = actor.pokemonList.firstOrNull { it.effectedPokemon.showdownId() == showdownId }
// If no Pokémon is found this is a nickname
battleLang("heal.wish", wisher?.getName() ?: actor.nameOwned(name))
}
privateMessage.hasOptionalArgument("from") -> {
when (effect!!.type) {
Effect.Type.ITEM -> when (effect.id) {
"leftovers", "shellbell", "blacksludge" -> battleLang("heal.leftovers", battlePokemon.getName(), effect.typelessData)
else -> battleLang("heal.item", battlePokemon.getName(), effect.typelessData)
}
else -> when (effect.id) {
"drain" -> {
val drained = privateMessage.battlePokemonFromOptional(battle) ?: return@dispatchWaiting
battleLang("heal.drain", drained.getName())
}
else -> battleLang("heal.${effect.id}", battlePokemon.getName())
}
}
}
else -> {
battleLang("heal.generic", battlePokemon.getName())
}
}
battle.broadcastChatMessage(lang)
}
battle.minorBattleActions[battlePokemon.uuid] = privateMessage
battlePokemon.effectedPokemon.currentHealth = newHealth[0].toInt()
// This part is not always present
val rawStatus = rawHpAndStatus.getOrNull(1) ?: return@dispatchWaiting
val status = Statuses.getStatus(rawStatus) ?: return@dispatchWaiting
if (status is PersistentStatus && battlePokemon.effectedPokemon.status?.status != status) {
battlePokemon.effectedPokemon.applyStatus(status)
if (pnx != null) {
battle.sendUpdate(BattlePersistentStatusPacket(pnx, status))
}
if (!silent) {
status.applyMessage.let { battle.broadcastChatMessage(it.asTranslated(battlePokemon.getName())) }
}
}
}
}
}
@@ -0,0 +1,34 @@
/*
* 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.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: |-hitcount|POKEMON|NUM
*
* A multi-hit move hit the POKEMON NUM times.
* @author Licious
* @since December 30th, 2022
*/
class HitCountInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchGo {
val battlePokemon = message.battlePokemon(0, battle) ?: return@dispatchGo
val hitCount = message.argumentAt(1)?.toIntOrNull() ?: return@dispatchGo
val lang = if (hitCount == 1) battleLang("hit_count_singular") else battleLang("hit_count", hitCount)
battle.minorBattleActions[battlePokemon.uuid] = message
battle.broadcastChatMessage(lang)
}
}
}
@@ -11,6 +11,12 @@ package com.cobblemon.mod.common.battles.interpreter.instructions
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
/**
* Catch-all for instruction from Showdown that are not parsed.
*
* @author Hiroku
* @since December 25th, 2023
*/
class IgnoredInstruction : InterpreterInstruction {
override fun invoke(pokemonBattle: PokemonBattle) = Unit
}
@@ -0,0 +1,34 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-immune|POKEMON
*
* POKEMON was immune to a move.
* @author Hiroku
* @since October 3rd, 2022
*/
class ImmuneInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val name = pokemon.getName()
battle.broadcastChatMessage(battleLang("immune", name).red())
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,49 @@
/*
* 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.BasicContext
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.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-invertboost|POKEMON
*
* POKEMON had its stat changes inverted.
* @author JMMCP
* @since November 26th, 2023
*/
class InvertBoostInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val name = pokemon.getName()
battle.broadcastChatMessage(battleLang("invertboost", name))
// update and invert BOOST and UNBOOST contexts
val context = ShowdownInterpreter.getContextFromAction(message, BattleContext.Type.BOOST, battle)
val newUnboosts = pokemon.contextManager.get(BattleContext.Type.BOOST)?.map {
BasicContext(it.id, context.turn, BattleContext.Type.UNBOOST, context.origin)
}?.toTypedArray()
val newBoosts = pokemon.contextManager.get(BattleContext.Type.UNBOOST)?.map {
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) }
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,42 @@
/*
* 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.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import net.minecraft.text.Text
/**
* Format: |-item|POKEMON|ITEM|(from)EFFECT
*
* ITEM held by POKEMON has been changed or revealed due to a move or ability EFFECT.
*
* Alt format: |-item|POKEMON|ITEM
*
* POKEMON has just switched in, and its ITEM is being announced to have a long-term effect.
* @author Licious
* @since December 30th, 2022
*/
class ItemInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val source = message.battlePokemonFromOptional(battle)
source?.let { ShowdownInterpreter.broadcastOptionalAbility(battle, message.effect(), source) }
battle.dispatchGo {
val battlePokemon = message.battlePokemon(0, battle) ?: return@dispatchGo
battlePokemon.heldItemManager.handleStartInstruction(battlePokemon, battle, message)
battle.minorBattleActions[battlePokemon.uuid] = message
battlePokemon.contextManager.add(ShowdownInterpreter.getContextFromAction(message, BattleContext.Type.ITEM, battle))
}
}
}
@@ -0,0 +1,34 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.text.yellow
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-mega|POKEMON|MEGASTONE
*
* POKEMON used item MEGASTONE to Mega Evolve.
* @author Segfault Guy
* @since September 10th, 2023
*/
class MegaInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val battlePokemon = message.battlePokemon(0, battle) ?: return
battle.dispatchWaiting {
val pokemonName = battlePokemon.getName()
battle.broadcastChatMessage(battleLang("mega", pokemonName).yellow())
battle.minorBattleActions[battlePokemon.uuid] = message
}
}
}
@@ -11,22 +11,22 @@ package com.cobblemon.mod.common.battles.interpreter.instructions
import com.cobblemon.mod.common.api.battles.interpreter.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.battles.dispatch.InstructionSet
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format:
* |-miss|SOURCE|TARGET
* Format: |-miss|SOURCE|TARGET
*
* The move used by the SOURCE Pokémon missed (maybe absent) the TARGET Pokémon.
* @author Hiroku
* @since October 3rd, 2022
*/
class MissInstruction(val battle: PokemonBattle, val instructionSet: InstructionSet, val message: BattleMessage): InterpreterInstruction {
val target = message.getBattlePokemon(1, battle)
class MissInstruction(val battle: PokemonBattle, val message: BattleMessage): InterpreterInstruction {
val target = message.battlePokemon(1, battle)
override fun invoke(battle: PokemonBattle) {
battle.dispatchGo {
val pokemon = message.getBattlePokemon(0, battle) ?: return@dispatchGo
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchGo
battle.broadcastChatMessage(battleLang("missed").red())
battle.minorBattleActions[pokemon.uuid] = message
}
@@ -31,6 +31,13 @@ import com.cobblemon.mod.common.pokemon.evolution.progress.UseMoveEvolutionProgr
import com.cobblemon.mod.common.util.battleLang
import java.util.concurrent.CompletableFuture
/**
* Format: |move|POKEMON|MOVE|TARGET
*
* POKEMON has used MOVE at TARGET.
* @author Deltric
* @since January 22nd, 2022
*/
class MoveInstruction(
val instructionSet: InstructionSet,
val message: BattleMessage
@@ -46,17 +53,17 @@ class MoveInstruction(
var targetPokemon: BattlePokemon? = null
override fun invoke(battle: PokemonBattle) {
userPokemon = message.getBattlePokemon(0, battle)!!
targetPokemon = message.getBattlePokemon(2, battle)
userPokemon = message.battlePokemon(0, battle)!!
targetPokemon = message.battlePokemon(2, battle)
val targetPokemon = targetPokemon // So smart non-null casts can happen
val optionalEffect = message.effect()
val pokemonName = userPokemon.getName()
ShowdownInterpreter.broadcastOptionalAbility(battle, optionalEffect, pokemonName)
ShowdownInterpreter.broadcastOptionalAbility(battle, optionalEffect, userPokemon)
battle.dispatch { UntilDispatch { instructionSet.getMostRecentInstruction<MoveInstruction>(this)?.future?.isDone != false } }
battle.dispatch {
val pokemonName = userPokemon.getName()
ShowdownInterpreter.lastCauser[battle.battleId] = message
userPokemon.effectedPokemon.let { pokemon ->
@@ -103,7 +110,7 @@ class MoveInstruction(
}
}
val hurtTargets = subsequentInstructions.filterIsInstance<DamageInstruction>().mapNotNull { it.battlePokemon }
val hurtTargets = subsequentInstructions.filterIsInstance<DamageInstruction>().mapNotNull { it.expectedTarget }
runtime.environment.getQueryStruct().addFunction("hurt") { params ->
if (params.params.size == 0) {
return@addFunction DoubleValue(hurtTargets.isNotEmpty())
@@ -8,12 +8,20 @@
package com.cobblemon.mod.common.battles.interpreter.instructions
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: |-nothing
*
* Pathetic. Your move did absolutely nothing. You should feel bad for being bad.
* @author Hiroku
* @since August 20th, 2022
*/
class NothingInstruction() : InterpreterInstruction {
class DeprecatedInstruction(val message: BattleMessage, val function: (PokemonBattle, BattleMessage, MutableList<String>) -> Unit) : InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
function(battle, message, mutableListOf())
battle.dispatchGo { battle.broadcastChatMessage(battleLang("nothing")) }
}
}
@@ -0,0 +1,38 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.battles.dispatch.GO
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
/**
* Format: |pp_update|<side_id>: <pokemon_uuid>|...<move_id>: <move_pp>
*
* @author Licious
* @since September 22nd, 2022
*/
class PpUpdateInstruction( val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatch {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatch GO
val moveDatum = message.argumentAt(1)?.split(", ") ?: return@dispatch GO
moveDatum.forEach { moveData ->
val moveIdAndPp = moveData.split(": ")
val moveId = moveIdAndPp[0]
val movePp = moveIdAndPp[1]
val move = pokemon.effectedPokemon.moveSet.firstOrNull { move -> move.name.equals(moveId, true) } ?: return@dispatch GO
move.currentPp = movePp.toInt()
}
GO
}
}
}
@@ -0,0 +1,40 @@
/*
* 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.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: |-prepare|ATTACKER|MOVE and |-prepare|ATTACKER|MOVE|DEFENDER
*
* ATTACKER Pokémon is preparing to use a charge MOVE on DEFENDER or an unknown target.
* @author Renaissance
* @since March 24th, 2023
*/
class PrepareInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(1.5F) {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val pokemonName = pokemon.getName()
val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting
//Prevents spam when the move Role Play is used
val lang = when (effectID) {
"shadowforce" -> battleLang("prepare.phantomforce", pokemonName) //Phantom Force and Shadow Force share the same text
"solarblade" -> battleLang("prepare.solarbeam", pokemonName) //Solar Beam and Solar Blade share the same text
else -> battleLang("prepare.$effectID", pokemonName)
}
battle.broadcastChatMessage(lang)
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,32 @@
/*
* 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.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: |-mustrecharge|POKEMON
*
* POKEMON must spend the turn recharging from a previous move.
* @author Hunter
* @since September 25th, 2022
*/
class RechargeInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(2F){
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
battle.broadcastChatMessage(battleLang("recharge", pokemon.getName()))
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,48 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.text.yellow
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.net.messages.client.battle.BattleReplacePokemonPacket
import com.cobblemon.mod.common.net.messages.client.battle.BattleTransformPokemonPacket
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |replace|POKEMON|DETAILS|HP STATUS
*
* Illusion has ended for POKEMON. Syntax is the same as [SwitchInstruction].
* @author Segfault Guy
* @since March 18th, 2024
*/
class ReplaceInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val (pnx, _) = message.pnxAndUuid(0) ?: return
val (actor, activePokemon) = battle.getActorAndActiveSlotFromPNX(pnx)
val pokemon = message.battlePokemon(0, battle) ?: return
battle.dispatchGo {
val entity = pokemon.entity
entity?.let { it.effects.mockEffect?.end(it) }
battle.sendSidedUpdate(
source = actor,
allyPacket = BattleReplacePokemonPacket(pnx, pokemon, true),
opponentPacket = BattleReplacePokemonPacket(pnx, pokemon, false)
)
activePokemon.illusion = null
//lang done by EndInstruction
}
}
}
@@ -0,0 +1,57 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
import com.cobblemon.mod.common.battles.BattleRegistry
import com.cobblemon.mod.common.battles.ShowdownActionRequest
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.net.messages.client.battle.BattleMakeChoicePacket
import com.cobblemon.mod.common.net.messages.client.battle.BattleQueueRequestPacket
/**
* Format: |request|REQUEST
*
* It's time for the actor to make a decision.
* @author Deltric
* @since January 22nd, 2022
*/
class RequestInstruction(val battleActor: BattleActor, val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.log("Request Instruction")
if (message.rawMessage.contains("teamPreview")) // TODO probably change when we're allowing team preview
return
// Parse Json message and update state info for actor
val request = BattleRegistry.gson.fromJson(message.rawMessage.split("|request|")[1], ShowdownActionRequest::class.java)
request.sanitize(battle, battleActor)
if (battle.started) {
battle.dispatchGo {
// This request won't be acted on until the start of next turn
battleActor.sendUpdate(BattleQueueRequestPacket(request))
battleActor.request = request
battleActor.responses.clear()
// We need to send this out because 'upkeep' isn't received until the request is handled since the turn won't swap
if (request.forceSwitch.contains(true)) {
battle.doWhenClear {
battleActor.mustChoose = true
battleActor.sendUpdate(BattleMakeChoicePacket())
}
}
}
} else {
battleActor.request = request
battleActor.responses.clear()
}
}
}
@@ -10,16 +10,23 @@ package com.cobblemon.mod.common.battles.interpreter.instructions
import com.cobblemon.mod.common.api.battles.interpreter.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-resisted|POKEMON
*
* POKEMON resisted the attack.
* @author Hunter
* @since August 18th, 2022
*/
class ResistedInstruction(val message: BattleMessage): InterpreterInstruction {
class DeprecatedSplitInstruction(
val battleActor: BattleActor,
val publicMessage: BattleMessage,
val privateMessage: BattleMessage,
val function: (PokemonBattle, BattleActor, BattleMessage, BattleMessage) -> Unit
) : InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
function(battle, battleActor, publicMessage, privateMessage)
battle.dispatchGo {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchGo
battle.broadcastChatMessage(battleLang("resisted"))
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,38 @@
/*
* 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.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-setboost|POKEMON|STAT|AMOUNT
*
* Same as -boost and -unboost, but STAT is set to AMOUNT instead of boosted by AMOUNT.\
* @author Renaissance
* @since February 16th, 2023
*/
class SetBoostInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(1.5F) {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val pokemonName = pokemon.getName()
val effectID = message.effect()?.id ?: return@dispatchWaiting
val lang = battleLang("setboost.$effectID", pokemonName)
battle.broadcastChatMessage(lang)
pokemon.contextManager.add(ShowdownInterpreter.getContextFromAction(message, BattleContext.Type.BOOST, battle))
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,45 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.net.messages.client.battle.BattleHealthChangePacket
import com.cobblemon.mod.common.util.battleLang
import kotlin.math.roundToInt
/**
* Format: |-sethp|POKEMON|HP
*
* POKEMON now has HP hit points.
* @author Licious
* @since February 8th, 2023
*/
class SetHpInstruction(val actor: BattleActor, val publicMessage: BattleMessage, val privateMessage: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting {
val (pnx, _) = privateMessage.pnxAndUuid(0) ?: return@dispatchWaiting
val flatHp = privateMessage.argumentAt(1)?.split("/")?.getOrNull(0)?.toFloatOrNull() ?: return@dispatchWaiting
val ratioHp = publicMessage.argumentAt(1)?.split("/")?.getOrNull(0)?.toFloatOrNull()?.times(0.01F) ?: return@dispatchWaiting
val battlePokemon = privateMessage.battlePokemon(0, battle) ?: return@dispatchWaiting
battlePokemon.effectedPokemon.currentHealth = flatHp.roundToInt()
battle.sendSidedUpdate(actor, BattleHealthChangePacket(pnx, flatHp), BattleHealthChangePacket(pnx, ratioHp))
// It doesn't matter which we check when silent both have it
if (!publicMessage.hasOptionalArgument("silent")) {
val effectID = publicMessage.effect()?.id ?: return@dispatchWaiting
val lang = battleLang("sethp.$effectID")
battle.broadcastChatMessage(lang)
}
battle.minorBattleActions[battlePokemon.uuid] = publicMessage
}
}
}
@@ -0,0 +1,45 @@
/*
* 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: |-sideend|SIDE|CONDITION
*
* Indicates that the side CONDITION ended for the given SIDE.
* @author Segfault Guy
* @since April 5th, 2023
*/
class SideEndInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(2F) {
val side = if (message.argumentAt(0)?.get(1) == '1') battle.side1 else battle.side2
val effect = message.effectAt(1) ?: return@dispatchWaiting
battle.sides.forEach {
val subject = if (it == side) battleLang("side_subject.ally") else battleLang("side_subject.opponent")
val lang = battleLang("sideend.${effect.id}", subject)
it.broadcastChatMessage(lang)
}
val bucket = when(effect.rawData.substringAfterLast(" ").lowercase()) {
"reflect", "screen", "veil" -> BattleContext.Type.SCREEN
"spikes", "rock", "web" -> BattleContext.Type.HAZARD
"tailwind" -> BattleContext.Type.TAILWIND
else -> BattleContext.Type.MISC
}
side.contextManager.remove(effect.id, bucket)
}
}
}
@@ -0,0 +1,46 @@
/*
* 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.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-sidestart|SIDE|CONDITION
*
* A side CONDITION has started on SIDE.
* @author Segfault Guy
* @since April 5th, 2023
*/
class SideStartInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(2F) {
val side = if (message.argumentAt(0)?.get(1) == '1') battle.side1 else battle.side2
val effect = message.effectAt(1) ?: return@dispatchWaiting
battle.sides.forEach {
val subject = if (it == side) battleLang("side_subject.ally") else battleLang("side_subject.opponent")
val lang = battleLang("sidestart.${effect.id}", subject)
it.broadcastChatMessage(lang)
}
val bucket = when(effect.rawData.substringAfterLast(" ").lowercase()) {
"reflect", "screen", "veil" -> BattleContext.Type.SCREEN
"spikes", "rock", "web" -> BattleContext.Type.HAZARD
"tailwind" -> BattleContext.Type.TAILWIND
else -> BattleContext.Type.MISC
}
side.contextManager.add(ShowdownInterpreter.getContextFromAction(message, bucket, battle))
}
}
}
@@ -0,0 +1,35 @@
/*
* 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.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: |-singlemove|POKEMON|MOVE
*
* POKEMON used MOVE which causes a temporary effect lasting the duration of the move.
* @author Renaissance
* @since March 24th, 2023
*/
class SingleMoveInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(1.5F) {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val pokemonName = pokemon.getName()
val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting
val lang = battleLang("singlemove.$effectID", pokemonName)
battle.broadcastChatMessage(lang)
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -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.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
import net.minecraft.text.Text
/**
* Format: |-singleturn|POKEMON|MOVE
*
* POKEMON used MOVE which causes a temporary effect lasting the duration of the turn.
* @author Renaissance
* @since March 24th, 2023
*/
class SingleTurnInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(1.5F) {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val pokemonName = pokemon.getName()
val sourceName = message.battlePokemonFromOptional(battle)?.getName() ?: Text.literal("UNKOWN")
val effectID = message.effectAt(1)?.id ?: return@dispatchWaiting
val lang = battleLang("singleturn.$effectID", pokemonName, sourceName)
battle.broadcastChatMessage(lang)
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,65 @@
/*
* 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.api.text.yellow
import com.cobblemon.mod.common.battles.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.GO
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.battles.dispatch.WaitDispatch
import com.cobblemon.mod.common.util.battleLang
import net.minecraft.text.Text
/**
* Format: |-start|POKEMON|EFFECT
*
* A volatile status has been inflicted on POKEMON by EFFECT.
* @author Deltric
* @since January 21st, 2022
*/
class StartInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatch {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatch GO
val effectID = message.effectAt(1)?.id ?: return@dispatch GO
val optionalEffect = message.effect()
val optionalPokemon = message.battlePokemonFromOptional(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")) {
// don't need to add unique: showdown won't send -start instruction if volatile status is already present
pokemon.contextManager.add(ShowdownInterpreter.getContextFromAction(message, BattleContext.Type.VOLATILE, battle))
}
battle.minorBattleActions[pokemon.uuid] = message
if (!message.hasOptionalArgument("silent")) {
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.battlePokemonFromOptional(battle)!!.getName(), pokemon.getName())
else -> battleLang("start.$effectID", pokemon.getName(), extraEffect)
}
battle.broadcastChatMessage(lang)
}
WaitDispatch(1F)
}
}
}
@@ -0,0 +1,51 @@
/*
* 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.Cobblemon
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.api.pokemon.status.Statuses
import com.cobblemon.mod.common.battles.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.net.messages.client.battle.BattlePersistentStatusPacket
import com.cobblemon.mod.common.pokemon.status.PersistentStatus
import com.cobblemon.mod.common.util.asTranslated
/**
* Format: |-status|POKEMON|STATUS
*
* POKEMON has been inflicted with STATUS.
* @author Hiroku
* @since October 3rd, 2022
*/
class StatusInstruction( val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val (pnx, _) = message.pnxAndUuid(0) ?: return
val pokemon = message.battlePokemon(0, battle) ?: return
val otherPokemon = message.actorAndActivePokemonFromOptional(battle, "of")?.second?.battlePokemon
val statusLabel = message.argumentAt(1) ?: return
val status = Statuses.getStatus(statusLabel) ?: return Cobblemon.LOGGER.error("Unrecognized status: $statusLabel")
ShowdownInterpreter.broadcastOptionalAbility(battle, message.effect(), otherPokemon ?: pokemon)
battle.dispatchWaiting {
if (status is PersistentStatus) {
pokemon.effectedPokemon.applyStatus(status)
battle.sendUpdate(BattlePersistentStatusPacket(pnx, status))
}
battle.broadcastChatMessage(status.applyMessage.asTranslated(pokemon.getName()))
pokemon.contextManager.add(ShowdownInterpreter.getContextFromAction(message, BattleContext.Type.STATUS, battle))
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,32 @@
/*
* 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.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: |-supereffective|POKEMON
*
* A move was super effective against POKEMON.
* @author Hunter
* @since August 18th, 2022
*/
class SuperEffectiveInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchGo {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchGo
battle.broadcastChatMessage(battleLang("superEffective"))
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,44 @@
/*
* 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: |-swapboost|SOURCE|TARGET|STATS
*
* Swaps the boosts from STATS between the SOURCE Pokémon and TARGET Pokémon.
* @author Renaissance
* @since March 24th, 2023
*/
class SwapBoostInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchWaiting(2F) {
val pokemon = message.battlePokemon(0, battle) ?: return@dispatchWaiting
val pokemonName = pokemon.getName()
val targetPokemon = message.battlePokemon(1, battle) ?: return@dispatchWaiting
val targetPokemonName = targetPokemon.getName()
val effectID = message.effect()?.id ?: return@dispatchWaiting
val lang = when (effectID) {
"guardswap", "powerswap", "heartswap" -> battleLang("swapboost.$effectID", pokemonName)
else -> battleLang("swapboost.generic", pokemonName, targetPokemonName)
}
battle.broadcastChatMessage(lang)
pokemon.contextManager.swap(targetPokemon.contextManager, BattleContext.Type.BOOST)
pokemon.contextManager.swap(targetPokemon.contextManager, BattleContext.Type.UNBOOST)
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -0,0 +1,38 @@
/*
* 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.BattleSide
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
/**
* Format: |-swapsideconditions
*
* Swaps side conditions between sides. Used for Court Change.
* @author Segfault Guy
* @since February 19th, 2024
*/
class SwapSideConditionsInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchGo {
val sides = mutableListOf<BattleSide>()
battle.sides.forEach { side ->
if (!sides.contains(side)) {
val oppositeManager = side.getOppositeSide().contextManager
side.contextManager.swap(oppositeManager, BattleContext.Type.TAILWIND, BattleContext.Type.SCREEN, BattleContext.Type.HAZARD)
}
sides.add(side)
}
}
}
}
@@ -0,0 +1,156 @@
/*
* 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.api.battles.model.actor.BattleActor
import com.cobblemon.mod.common.api.battles.model.actor.EntityBackedBattleActor
import com.cobblemon.mod.common.battles.ActiveBattlePokemon
import com.cobblemon.mod.common.battles.dispatch.*
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
import com.cobblemon.mod.common.entity.pokemon.effects.IllusionEffect
import com.cobblemon.mod.common.net.messages.client.battle.BattleSwitchPokemonPacket
import com.cobblemon.mod.common.util.swap
import net.minecraft.entity.LivingEntity
import net.minecraft.server.world.ServerWorld
import java.util.concurrent.CompletableFuture
/**
* Format: |switch|POKEMON|DETAILS|HP STATUS
*
* POKEMON has switched in (if there was an old Pokémon at that position, it is switched out).
* POKEMON|DETAILS represents all the information that can be used to tell Pokémon apart.
* The switched Pokémon has HP health points and STATUS status.
* @author Deltric
* @since January 22nd, 2022
*/
class SwitchInstruction(val instructionSet: InstructionSet, val battleActor: BattleActor, val publicMessage: BattleMessage, val privateMessage: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val (pnx, _) = publicMessage.pnxAndUuid(0) ?: return
val (actor, activePokemon) = battle.getActorAndActiveSlotFromPNX(pnx)
val entity = if (actor is EntityBackedBattleActor<*>) actor.entity else null
val imposter = instructionSet.getNextInstruction<TransformInstruction>(this)?.expectedTarget != null
val illusion = publicMessage.battlePokemonFromOptional(battle, "is")
val pokemon = publicMessage.battlePokemon(0, battle) ?: return
if (!battle.started) {
activePokemon.battlePokemon = pokemon
activePokemon.illusion = illusion
val pokemonEntity = pokemon.entity
if (pokemonEntity == null && entity != null) {
val targetPos = battleActor.getSide().getOppositeSide().actors.filterIsInstance<EntityBackedBattleActor<*>>().firstOrNull()?.entity?.pos?.let { pos ->
val offset = pos.subtract(entity.pos)
val idealPos = entity.pos.add(offset.multiply(0.33))
idealPos
} ?: entity.pos
actor.stillSendingOutCount++
pokemon.effectedPokemon.sendOutWithAnimation(
source = entity,
battleId = battle.battleId,
level = entity.world as ServerWorld,
doCry = false,
position = targetPos,
illusion = illusion?.let { IllusionEffect(it.effectedPokemon) }
).thenApply {
actor.stillSendingOutCount--
}
}
else if (pokemonEntity != null) {
illusion?.let { IllusionEffect(it.effectedPokemon).start(pokemonEntity) }
}
} else {
battle.dispatchInsert {
pokemon.sendUpdate()
if (activePokemon.battlePokemon == pokemon) {
return@dispatchInsert emptySet() // Already switched in, Showdown does this if the pokemon is going to die before it can switch
}
activePokemon.battlePokemon?.let { oldPokemon ->
if (publicMessage.effect()?.id == "batonpass") oldPokemon.contextManager.swap(pokemon.contextManager, BattleContext.Type.BOOST, BattleContext.Type.UNBOOST)
oldPokemon.contextManager.clear(BattleContext.Type.VOLATILE, BattleContext.Type.BOOST, BattleContext.Type.UNBOOST)
battle.majorBattleActions[oldPokemon.uuid] = publicMessage
}
battle.majorBattleActions[pokemon.uuid] = publicMessage
setOf(
BattleDispatch {
if (entity != null) {
createEntitySwitch(battle, actor, entity, pnx, activePokemon, pokemon, illusion, imposter)
} else {
createNonEntitySwitch(battle, actor, pnx, activePokemon, pokemon, illusion)
}
}
)
}
}
}
companion object{
fun createEntitySwitch(
battle: PokemonBattle,
actor: BattleActor,
entity: LivingEntity,
pnx: String,
activePokemon: ActiveBattlePokemon,
newPokemon: BattlePokemon,
illusion: BattlePokemon? = null,
imposter: Boolean = false
): DispatchResult {
val pokemonEntity = activePokemon.battlePokemon?.entity
// If we can't find the entity for some reason then we're going to skip the recall animation
val sendOutFuture = CompletableFuture<Unit>()
// skip if handled by respective EntityEffect
val doCry = illusion == null && !imposter
(pokemonEntity?.recallWithAnimation() ?: CompletableFuture.completedFuture(Unit)).thenApply {
// Queue actual swap and send-in after the animation has ended
actor.pokemonList.swap(actor.activePokemon.indexOf(activePokemon), actor.pokemonList.indexOf(newPokemon))
activePokemon.battlePokemon = newPokemon
activePokemon.illusion = illusion
battle.sendSidedUpdate(actor, BattleSwitchPokemonPacket(pnx, newPokemon, true, illusion), BattleSwitchPokemonPacket(pnx, newPokemon, false, illusion))
if (newPokemon.entity != null) {
illusion?.let { IllusionEffect(it.effectedPokemon).start(newPokemon.entity!!) }
if (doCry) newPokemon.entity?.cry()
sendOutFuture.complete(Unit)
} else {
val lastPosition = activePokemon.position
// Send out at previous Pokémon's location if it is known, otherwise actor location
val world = lastPosition?.first ?: entity.world as ServerWorld
val pos = lastPosition?.second ?: entity.pos
newPokemon.effectedPokemon.sendOutWithAnimation(
source = entity,
battleId = battle.battleId,
level = world,
position = pos,
doCry = doCry,
illusion = illusion?.let { IllusionEffect(it.effectedPokemon) }
).thenAccept { sendOutFuture.complete(Unit) }
}
}
return UntilDispatch { sendOutFuture.isDone }
}
fun createNonEntitySwitch(battle: PokemonBattle, actor: BattleActor, pnx: String, activePokemon: ActiveBattlePokemon, newPokemon: BattlePokemon, illusion: BattlePokemon? = null): DispatchResult {
actor.pokemonList.swap(actor.activePokemon.indexOf(activePokemon), actor.pokemonList.indexOf(newPokemon))
activePokemon.battlePokemon = newPokemon
activePokemon.illusion = illusion
battle.sendSidedUpdate(actor, BattleSwitchPokemonPacket(pnx, newPokemon, true, illusion), BattleSwitchPokemonPacket(pnx, newPokemon, false, illusion))
return WaitDispatch(1.5F)
}
}
}
@@ -0,0 +1,36 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.text.yellow
import com.cobblemon.mod.common.api.types.ElementalTypes
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-terastallize|POKEMON|TYPE
*
* POKEMON terastallized into TYPE.
* @author Segfault Guy
* @since September 10th, 2023
*/
class TerastallizeInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val battlePokemon = message.battlePokemon(0, battle) ?: return
val type = message.effectAt(1)?.let { ElementalTypes.get(it.id) } ?: return
battle.dispatchWaiting {
val pokemonName = battlePokemon.getName()
battle.broadcastChatMessage(battleLang("terastallize", pokemonName, type.displayName).yellow())
battle.minorBattleActions[battlePokemon.uuid] = message
}
}
}
@@ -0,0 +1,66 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.battles.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.GO
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.battles.dispatch.UntilDispatch
import com.cobblemon.mod.common.entity.pokemon.effects.TransformEffect
import com.cobblemon.mod.common.net.messages.client.battle.BattleTransformPokemonPacket
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-transform|POKEMON|POKEMON
*
* POKEMON used Transform to turn into target POKEMON.
* @author jeffw773
* @since November 28th, 2023
*/
class TransformInstruction(val battle: PokemonBattle, val message: BattleMessage): InterpreterInstruction {
val expectedTarget = message.battlePokemon(0, battle)
override fun invoke(battle: PokemonBattle) {
val (pnx, _) = message.pnxAndUuid(0) ?: return
val (actor, _) = battle.getActorAndActiveSlotFromPNX(pnx)
val pokemon = message.battlePokemon(0, battle) ?: return
val targetPokemon = message.battlePokemon(1, battle) ?: return
val effect = message.effect()
ShowdownInterpreter.broadcastOptionalAbility(battle, effect, pokemon)
battle.dispatch {
val entity = pokemon.entity ?: return@dispatch GO
val future = TransformEffect(targetPokemon.effectedPokemon, battle.started).start(entity)
UntilDispatch { future?.isDone != false }
}
battle.dispatchWaiting {
val mock = pokemon.entity?.effects?.mockEffect?.mock
val pokemonName = pokemon.getName()
val targetPokemonName = targetPokemon.getName()
mock?.let {
battle.sendSidedUpdate(
source = actor,
allyPacket = BattleTransformPokemonPacket(pnx, pokemon, it, true),
opponentPacket = BattleTransformPokemonPacket(pnx, pokemon, it, false)
)
}
val lang = battleLang("transform", pokemonName, targetPokemonName)
battle.broadcastChatMessage(lang)
battle.minorBattleActions[pokemon.uuid] = message
}
}
}
@@ -24,13 +24,17 @@ import com.cobblemon.mod.common.net.messages.client.battle.BattleSetTeamPokemonP
import com.cobblemon.mod.common.util.battleLang
/**
* Format:
* |turn|NUMBER
* Format: |turn|NUMBER
*
* It is now turn NUMBER.
* @author Deltric
* @since January 22nd, 2022
*/
class TurnInstruction(val message: BattleMessage) : InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
// TODO maybe tell the client that the turn number has changed
val turnNumber = message.argumentAt(0)?.toInt() ?: return
if (!battle.started) {
battle.started = true
battle.actors.filterIsInstance<PlayerBattleActor>().forEach { actor ->
@@ -54,9 +58,6 @@ class TurnInstruction(val message: BattleMessage) : InterpreterInstruction {
}
}
// TODO maybe tell the client that the turn number has changed
val turnNumber = message.argumentAt(0)?.toInt() ?: return
battle.dispatch {
battle.sendToActors(BattleMakeChoicePacket())
battle.broadcastChatMessage(battleLang("turn", turnNumber).aqua())
@@ -12,7 +12,14 @@ import com.cobblemon.mod.common.api.battles.interpreter.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.battles.ShowdownInterpreter
/**
* Catch-all for unimplemented instructions that need to be added to the [ShowdownInterpreter].
*
* @author Hiroku
* @since December 25th, 2023
*/
class UnknownInstruction(val battleMessage: BattleMessage) : InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
battle.dispatchGo { battle.broadcastChatMessage(battleMessage.rawMessage.red()) }
@@ -13,10 +13,11 @@ import com.cobblemon.mod.common.battles.dispatch.GO
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
/**
* Format:
* |upkeep|
* Format: |upkeep|
*
* Signals the upkeep phase of the turn where the number of turns left for field conditions are updated.
* @author Hiroku
* @since March 12th, 2022
*/
class UpkeepInstruction : InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
@@ -0,0 +1,52 @@
/*
* 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.ShowdownInterpreter
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
import net.minecraft.text.Text
/**
* Format: |-weather|WEATHER
*
* Indicates WEATHER is currently in effect.
*
* If upkeep is present, it means that WEATHER was active previously and is still in effect that turn.
* Otherwise, it means that the weather has changed due to a move or ability, or has expired, in which case WEATHER will be none.
* @author Hunter
* @since September 25th, 2022
*/
class WeatherInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val weather = message.effectAt(0)?.id ?: return
val source = message.battlePokemonFromOptional(battle)
source?.let { ShowdownInterpreter.broadcastOptionalAbility(battle, message.effect(), source) }
battle.dispatchWaiting(1.5F) {
val lang = when {
message.hasOptionalArgument("upkeep") -> battleLang("weather.$weather.upkeep")
weather != "none" -> {
battle.contextManager.add(ShowdownInterpreter.getContextFromAction(message, BattleContext.Type.WEATHER, battle))
battleLang("weather.$weather.start")
}
else -> {
val oldWeather = battle.contextManager.get(BattleContext.Type.WEATHER)?.iterator()?.next()?.id ?: return@dispatchWaiting
battle.contextManager.clear(BattleContext.Type.WEATHER)
battleLang("weather.$oldWeather.end")
}
}
battle.broadcastChatMessage(lang)
}
}
}
@@ -0,0 +1,74 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.battles.model.actor.ActorType
import com.cobblemon.mod.common.api.events.CobblemonEvents
import com.cobblemon.mod.common.api.events.battles.BattleVictoryEvent
import com.cobblemon.mod.common.api.text.gold
import com.cobblemon.mod.common.api.text.plus
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.battles.ShowdownInterpreter
import com.cobblemon.mod.common.battles.actor.PlayerBattleActor
import com.cobblemon.mod.common.battles.dispatch.GO
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.battles.dispatch.WaitDispatch
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon
import com.cobblemon.mod.common.util.battleLang
import java.util.UUID
/**
* Format: |win|USER
*
* USER has won the battle.
* @author Deltric
* @since January 22nd, 2022
*/
class WinInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val user = message.argumentAt(0) ?: return
val ids = user.split("&").map { it.trim() }
val winners = ids.map { battle.getActor(UUID.fromString(it))!! }
val losers = battle.actors.filter { !winners.contains(it) }
val winnersText = winners.map { it.getName() }.reduce { acc, next -> acc + " & " + next }
val losersText = losers.map { it.getName() }.reduce { acc, next -> acc + " & " + next }
val wasCaught = battle. showdownMessages.any { "capture" in it }
battle.dispatch {
// If the battle was a PvW battle, we need to set the killer of the wild Pokémon to the player
if (battle.isPvW) {
val nonPlayerActor = battle.actors.first { it.type == ActorType.WILD }
val wildPokemon: BattlePokemon = nonPlayerActor.pokemonList.first()
if (!wasCaught && losers.any { it.uuid == wildPokemon.uuid }) {
wildPokemon.effectedPokemon.entity?.killer = (battle.actors.firstOrNull { it.type == ActorType.PLAYER } as? PlayerBattleActor)?.entity
}
}
// broadcast victory / defeat
if (!wasCaught) {
val blackedOut = battle.isPvW && losers.any { it is PlayerBattleActor }
val lang = if (blackedOut) battleLang("lose", losersText).red() else battleLang("win", winnersText).gold()
battle.broadcastChatMessage(lang)
return@dispatch WaitDispatch(2F)
}
else {
return@dispatch GO // see BattleCaptureAction
}
}
battle.dispatchGo {
battle.end()
CobblemonEvents.BATTLE_VICTORY.post(BattleVictoryEvent(battle, winners, losers, wasCaught))
ShowdownInterpreter.lastCauser.remove(battle.battleId)
}
}
}
@@ -0,0 +1,34 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-zbroken|POKEMON
*
* A z-move has broken through protect and hit POKEMON.
* @author Segfault Guy
* @since September 10th, 2023
*/
class ZBrokenInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val battlePokemon = message.battlePokemon(0, battle) ?: return
battle.dispatchWaiting {
val pokemonName = battlePokemon.getName()
battle.broadcastChatMessage(battleLang("zbroken", pokemonName).red())
battle.minorBattleActions[battlePokemon.uuid] = message
}
}
}
@@ -0,0 +1,34 @@
/*
* 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.BattleMessage
import com.cobblemon.mod.common.api.battles.model.PokemonBattle
import com.cobblemon.mod.common.api.text.yellow
import com.cobblemon.mod.common.battles.dispatch.InterpreterInstruction
import com.cobblemon.mod.common.util.battleLang
/**
* Format: |-zpower|POKEMON
*
* POKEMON has used the z-move variant of its move.
* @author Segfault Guy
* @since September 10th, 2023
*/
class ZPowerInstruction(val message: BattleMessage): InterpreterInstruction {
override fun invoke(battle: PokemonBattle) {
val battlePokemon = message.battlePokemon(0, battle) ?: return
battle.dispatchWaiting {
val pokemonName = battlePokemon.getName()
battle.broadcastChatMessage(battleLang("zpower", pokemonName).yellow())
battle.minorBattleActions[battlePokemon.uuid] = message
}
}
}
@@ -38,6 +38,14 @@ open class BattlePokemon(
effectedPokemon = pokemon.clone(),
postBattleEntityOperation = { entity -> entity.discard() }
)
fun playerOwned(pokemon: Pokemon): BattlePokemon = BattlePokemon(
originalPokemon = pokemon,
effectedPokemon = pokemon,
postBattleEntityOperation = { entity ->
entity.effects.wipe()
}
)
}
val uuid: UUID
@@ -72,10 +80,11 @@ open class BattlePokemon(
val contextManager = ContextManager()
open fun getName(): MutableText {
val displayPokemon = getIllusion()?.effectedPokemon ?: effectedPokemon
return if (actor is PokemonBattleActor || actor is MultiPokemonBattleActor) {
effectedPokemon.getDisplayName()
displayPokemon.getDisplayName()
} else {
battleLang("owned_pokemon", actor.getName(), effectedPokemon.getDisplayName())
battleLang("owned_pokemon", actor.getName(), displayPokemon.getDisplayName())
}
}
@@ -94,4 +103,6 @@ open class BattlePokemon(
fun writeVariables(struct: VariableStruct) {
effectedPokemon.writeVariables(struct)
}
fun getIllusion(): BattlePokemon? = this.actor.activePokemon.find { it.battlePokemon == this }?.illusion
}
@@ -17,6 +17,7 @@ import net.minecraft.entity.player.PlayerEntity
import net.minecraft.item.BlockItem
import net.minecraft.item.ItemPlacementContext
import net.minecraft.state.StateManager
import net.minecraft.state.property.DirectionProperty
import net.minecraft.util.ActionResult
import net.minecraft.util.Hand
import net.minecraft.util.ItemScatterer
@@ -32,6 +33,11 @@ class DisplayCaseBlock(settings: Settings) : BlockWithEntity(settings) {
init {
this.defaultState = this.stateManager.defaultState
.with(FACING, Direction.NORTH)
.with(ITEM_DIRECTION, Direction.NORTH)
}
companion object {
val ITEM_DIRECTION = DirectionProperty.of("item_facing")
}
override fun getPlacementState(ctx: ItemPlacementContext): BlockState? {
@@ -40,7 +46,10 @@ class DisplayCaseBlock(settings: Settings) : BlockWithEntity(settings) {
val blockPos = ctx.blockPos
ctx.placementDirections.forEach { direction ->
if (direction.axis.isHorizontal) {
blockState = blockState.with(FACING, direction) as BlockState
blockState = blockState
.with(FACING, direction)
.with(ITEM_DIRECTION, direction)
as BlockState
if (blockState.canPlaceAt(worldView, blockPos)) {
return blockState
}
@@ -51,6 +60,7 @@ class DisplayCaseBlock(settings: Settings) : BlockWithEntity(settings) {
override fun appendProperties(builder: StateManager.Builder<Block, BlockState>) {
builder.add(FACING)
builder.add(ITEM_DIRECTION)
}
override fun createBlockEntity(pos: BlockPos, state: BlockState): DisplayCaseBlockEntity {
@@ -80,7 +90,7 @@ class DisplayCaseBlock(settings: Settings) : BlockWithEntity(settings) {
val entity = world.getBlockEntity(pos) as DisplayCaseBlockEntity
val result = entity.updateItem(player, hand)
if ((hit.side != Direction.UP && hit.side != Direction.DOWN) && result == ActionResult.SUCCESS) {
world.setBlockState(pos, state.with(FACING, hit.side.opposite))
world.setBlockState(pos, state.with(ITEM_DIRECTION, hit.side.opposite))
}
return result
}

Some files were not shown because too many files have changed in this diff Show More