Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.compile.nullAnalysis.mode": "disabled"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package generations.gg.generations.core.generationscore.common.world.entity

import com.cobblemon.mod.common.api.dialogue.Dialogues
import com.cobblemon.mod.common.util.openDialogue
import generations.gg.generations.core.generationscore.common.GenerationsCore
import generations.gg.generations.core.generationscore.common.client.render.rarecandy.BlockObjectInstance
import generations.gg.generations.core.generationscore.common.client.render.rarecandy.instanceOrNull
Expand Down Expand Up @@ -37,10 +39,16 @@ class ZygardeCellEntity : Entity {
}

override fun interact(player: Player, hand: InteractionHand): InteractionResult {
if(hand != InteractionHand.MAIN_HAND) return InteractionResult.PASS;
val serverPlayer = player.instanceOrNull<ServerPlayer>() ?: return InteractionResult.PASS;
if (hand != InteractionHand.MAIN_HAND) return InteractionResult.PASS
val serverPlayer = player.instanceOrNull<ServerPlayer>() ?: return InteractionResult.PASS
val stack = player.mainHandItem.takeIf { it.`is`(GenerationsItems.ZYGARDE_CUBE) } ?: return InteractionResult.PASS

if (serverPlayer.isShiftKeyDown) {
val dialogue = Dialogues.dialogues[GenerationsCore.id("zygarde_cell")] ?: return InteractionResult.PASS
serverPlayer.openDialogue(dialogue)
return InteractionResult.SUCCESS
}

//Note: I'm treating Boolean? like a tristate here. True and null allow while false doesn't. This is to allow an alternate overflow message when taking a cell when full.
val allowed = if(stack.damageValue != ZygardeCubeItem.FULL) true else if(GenerationsCore.CONFIG.legendary.enableZygardeCubeOverflow) null else false
if (allowed != false) {
Expand All @@ -58,7 +66,6 @@ class ZygardeCellEntity : Entity {
1.0f
)


remove(RemovalReason.DISCARDED)

player.cooldowns.addCooldown(stack.item, 20)
Expand All @@ -81,4 +88,4 @@ class ZygardeCellEntity : Entity {
override fun isPickable(): Boolean {
return true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class LunarShrineBlock(properties: Properties) : ShrineBlock(properties = proper
// player.getItemInHand(hand).shrink(1)
PokemonUtil.spawn(key.createProperties(70), level, shrine.blockPos.above())

return ItemInteractionResult.SUCCESS
return ItemInteractionResult.CONSUME
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
"isVisible": "q.player.has_in_party('cobblemon:zygarde')",
"action": "q.dialogue.set_page('select_zygarde_dissolve');"
},
{
"text": "Delete Cells",
"value": "delete_cells",
"isVisible": "q.player.selected_item.damage > 0",
"action": [
"v.cells_to_delete = q.player.selected_item.damage;",
"q.dialogue.set_page('confirm_delete_cells');"
]
},
{
"text": "Close",
"value": "close",
Expand All @@ -42,6 +51,48 @@
]
}
},
{
"id": "confirm_delete_cells",
"speaker": "player",
"lines": [
"Are you sure? This cannot be undone!",
{
"type": "expression",
"expression": "'All ' + v.cells_to_delete + ' cells will be permanently deleted.'"
}
],
"input": {
"type": "option",
"options": [
{
"text": "Yes, delete them",
"value": "confirm",
"action": [
"q.player.selected_item.damage(-v.cells_to_delete);",
"q.dialogue.set_page('cells_deleted');"
]
},
{
"text": "No, keep them",
"value": "cancel",
"action": "q.dialogue.set_page('main_menu');"
}
]
}
},
{
"id": "cells_deleted",
"speaker": "player",
"lines": [
"All cells have been deleted from your Zygarde Cube."
],
"input": {
"type": "auto-continue",
"delay": 2,
"allowSkip": false,
"action": "q.dialogue.close();"
}
},
{
"id": "select_zygarde_modify",
"speaker": "player",
Expand Down Expand Up @@ -501,20 +552,20 @@
"action": [
"v.form = '10%';",
"v.cells_needed = 10;",
"v.ability = 'aurabreak';",
"v.ability_string_cheese = 'Aura Break';",
"v.ability = 'aurabreak';",
"v.ability_string_cheese = 'Aura Break';",
"q.dialogue.set_page('confirm_create');"
]
},
{
{
"text": "10% PowerConstruct",
"value": "60",
"isVisible": "q.player.selected_item.damage >= 60",
"action": [
"v.form = '10%';",
"v.cells_needed = 60;",
"v.ability = 'powerconstruct';",
"v.ability_string_cheese = 'Power Construct';",
"v.ability = 'powerconstruct';",
"v.ability_string_cheese = 'Power Construct';",
"q.dialogue.set_page('confirm_create');"
]
},
Expand All @@ -525,8 +576,8 @@
"action": [
"v.form = '50%';",
"v.cells_needed = 50;",
"v.ability = 'aurabreak';",
"v.ability_string_cheese = 'Aura Break';",
"v.ability = 'aurabreak';",
"v.ability_string_cheese = 'Aura Break';",
"q.dialogue.set_page('confirm_create');"
]
},
Expand All @@ -537,8 +588,8 @@
"action": [
"v.form = '50%';",
"v.cells_needed = 100;",
"v.ability = 'powerconstruct';",
"v.ability_string_cheese = 'Power Construct';",
"v.ability = 'powerconstruct';",
"v.ability_string_cheese = 'Power Construct';",
"q.dialogue.set_page('confirm_create');"
]
},
Expand Down