summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-08-27 15:21:47 +0200
committerDaniel Weipert <code@drogueronin.de>2023-08-27 15:21:47 +0200
commit8e829d4497efd6a23514901a1a6724fe7579c6b5 (patch)
treea829ba890ad0dfafdf7689fc8e6e0c5f22a0670e
parent5582c3c07069f7766aabd81f3a4a3f97def134e9 (diff)
box in healing centers!
-rw-r--r--db/_generated/areas/candy-town.json2
-rw-r--r--db/_generated/areas/cotton-town.json2
-rw-r--r--db/_generated/areas/timber-town.json2
-rw-r--r--db/areas/candy-town.json7
-rw-r--r--db/areas/cotton-town.json4
-rw-r--r--db/areas/timber-town.json20
-rw-r--r--index.html7
-rw-r--r--resources/css/menu.css5
-rw-r--r--resources/css/town.css4
-rw-r--r--resources/js/game.js12
-rw-r--r--resources/js/ui.js59
11 files changed, 114 insertions, 10 deletions
diff --git a/db/_generated/areas/candy-town.json b/db/_generated/areas/candy-town.json
index 4991f3a..271f1ff 100644
--- a/db/_generated/areas/candy-town.json
+++ b/db/_generated/areas/candy-town.json
@@ -1 +1 @@
-{"locations":{"scoop_store":{"type":"shop","items":[{"item_name":"potion","price":20,"cost":5},{"item_name":"revive","price":100,"cost":20},{"item_name":"tuxeball","price":50,"cost":10}],"modules\/tuxemon.economy":"spyder_candy_scoop"}},"connections":{"route6":{"conditions":[],"modules\/tuxemon.slug":"route6"},"sea-route-c":{"conditions":[],"modules\/tuxemon.slug":"routec"}},"modules\/tuxemon.slug":"candy_town","encounters":[],"requiredEncounters":0,"trainers":[],"environment":null,"map":"<svg\n version=\"1.1\"\n xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n viewbox=\"0 0 640 640\"\n>\n <image href=\"\/db\/maps\/Candy_Town.png\" \/>\n\n <rect data-location=\"scoop_store\" x=\"17\" y=\"144\" width=\"80\" height=\"64\" stroke=\"red\" fill=\"transparent\" \/>\n <rect data-area=\"hospital\" x=\"127\" y=\"431\" width=\"210\" height=\"130\" stroke=\"red\" fill=\"transparent\" \/>\n<\/svg>\n"} \ No newline at end of file
+{"locations":{"scoop_store":{"type":"shop","items":[{"item_name":"potion","price":20,"cost":5},{"item_name":"revive","price":100,"cost":20},{"item_name":"tuxeball","price":50,"cost":10},{"item_name":"super_potion","price":40}],"modules\/tuxemon.economy":"spyder_candy_scoop"}},"connections":{"route6":{"conditions":[],"modules\/tuxemon.slug":"route6"},"sea-route-c":{"conditions":[],"modules\/tuxemon.slug":"routec"}},"modules\/tuxemon.slug":"candy_town","encounters":[],"requiredEncounters":0,"trainers":[],"environment":null,"map":"<svg\n version=\"1.1\"\n xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n viewbox=\"0 0 640 640\"\n>\n <image href=\"\/db\/maps\/Candy_Town.png\" \/>\n\n <rect data-location=\"scoop_store\" x=\"17\" y=\"144\" width=\"80\" height=\"64\" stroke=\"red\" fill=\"transparent\" \/>\n <rect data-area=\"hospital\" x=\"127\" y=\"431\" width=\"210\" height=\"130\" stroke=\"red\" fill=\"transparent\" \/>\n<\/svg>\n"} \ No newline at end of file
diff --git a/db/_generated/areas/cotton-town.json b/db/_generated/areas/cotton-town.json
index 1cd83cc..721acde 100644
--- a/db/_generated/areas/cotton-town.json
+++ b/db/_generated/areas/cotton-town.json
@@ -1 +1 @@
-{"locations":{"healing_center":{"type":"healingCenter","price":10},"cotton_scoop":{"type":"shop","modules\/tuxemon.economy":"cotton_scoop","items":[{"item_name":"potion","price":20,"cost":5},{"item_name":"revive","price":100,"cost":20},{"item_name":"tuxeball","price":50,"cost":10}]}},"connections":{"route1":{"conditions":[],"modules\/tuxemon.slug":"route1"},"route2":{"conditions":[],"modules\/tuxemon.slug":"route2"},"dryads-grove":{"conditions":["area.hospital-floor-3.complete"],"modules\/tuxemon.slug":"dryadsgrove"}},"modules\/tuxemon.slug":"cotton_town","encounters":[],"requiredEncounters":0,"trainers":[],"environment":null,"map":"<svg\n version=\"1.1\"\n xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n viewbox=\"0 0 640 640\"\n>\n <image href=\"\/db\/maps\/Cotton_town.png\" \/>\n\n <text x=\"275\" y=\"445\">Healing Center<\/text>\n <rect data-location=\"healing_center\" x=\"288\" y=\"368\" width=\"80\" height=\"64\" stroke=\"red\" fill=\"transparent\" \/>\n\n <text x=\"470\" y=\"573\">Shop<\/text>\n <rect data-location=\"cotton_scoop\" x=\"448\" y=\"496\" width=\"80\" height=\"64\" stroke=\"red\" fill=\"transparent\" \/>\n<\/svg>\n"} \ No newline at end of file
+{"locations":{"healing_center":{"type":"healingCenter","price":10},"cotton_scoop":{"type":"shop","items":[{"item_name":"potion","price":20,"cost":5},{"item_name":"revive","price":100,"cost":20},{"item_name":"tuxeball","price":50,"cost":10}],"modules\/tuxemon.economy":"cotton_scoop"}},"connections":{"route1":{"conditions":[],"modules\/tuxemon.slug":"route1"},"route2":{"conditions":[],"modules\/tuxemon.slug":"route2"},"dryads-grove":{"conditions":["area.hospital-floor-3.complete"],"modules\/tuxemon.slug":"dryadsgrove"}},"modules\/tuxemon.slug":"cotton_town","encounters":[],"requiredEncounters":0,"trainers":[],"environment":null,"map":"<svg\n version=\"1.1\"\n xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n viewbox=\"0 0 640 640\"\n>\n <image href=\"\/db\/maps\/Cotton_town.png\" \/>\n\n <text x=\"275\" y=\"445\">Healing Center<\/text>\n <rect data-location=\"healing_center\" x=\"288\" y=\"368\" width=\"80\" height=\"64\" stroke=\"red\" fill=\"transparent\" \/>\n\n <text x=\"470\" y=\"573\">Shop<\/text>\n <rect data-location=\"cotton_scoop\" x=\"448\" y=\"496\" width=\"80\" height=\"64\" stroke=\"red\" fill=\"transparent\" \/>\n<\/svg>\n"} \ No newline at end of file
diff --git a/db/_generated/areas/timber-town.json b/db/_generated/areas/timber-town.json
index 94f9544..57906eb 100644
--- a/db/_generated/areas/timber-town.json
+++ b/db/_generated/areas/timber-town.json
@@ -1 +1 @@
-{"locations":{"healing_center":{"type":"healingCenter","price":20},"scoop_store":{"type":"shop","modules\/tuxemon.economy":"spyder_timber_scoop","items":[{"item_name":"potion","price":20,"cost":5},{"item_name":"revive","price":100,"cost":20},{"item_name":"tuxeball","price":50,"cost":10},{"item_name":"wood_booster","price":1000},{"item_name":"fire_booster","price":1000},{"item_name":"earth_booster","price":1000},{"item_name":"metal_booster","price":1000},{"item_name":"water_booster","price":1000}]}},"connections":{"route5":{"conditions":[],"modules\/tuxemon.slug":"route5"},"tunnel-b":{"conditions":[],"modules\/tuxemon.slug":"tunnel"}},"modules\/tuxemon.slug":"timber_town","encounters":[],"requiredEncounters":0,"trainers":[],"environment":null,"map":"<svg\n version=\"1.1\"\n xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n viewbox=\"0 0 640 640\"\n>\n <image href=\"\/db\/maps\/Timber_Town.png\" \/>\n\n <rect data-location=\"healing_center\" x=\"96\" y=\"48\" width=\"80\" height=\"64\" stroke=\"red\" fill=\"transparent\" \/>\n <rect data-location=\"scoop_store\" x=\"191\" y=\"127\" width=\"82\" height=\"66\" stroke=\"red\" fill=\"transparent\" \/>\n<\/svg>\n"} \ No newline at end of file
+{"locations":{"healing_center":{"type":"healingCenter","price":20},"scoop_store":{"type":"shop","modules\/tuxemon.economy":"spyder_timber_scoop","items":[{"item_name":"potion","price":20,"cost":5},{"item_name":"revive","price":100,"cost":20},{"item_name":"tuxeball","price":50,"cost":10},{"item_name":"tuxeball_wood","price":150},{"item_name":"tuxeball_fire","price":150},{"item_name":"tuxeball_earth","price":150},{"item_name":"tuxeball_metal","price":150},{"item_name":"tuxeball_water","price":150},{"item_name":"wood_booster","price":1000},{"item_name":"fire_booster","price":1000},{"item_name":"earth_booster","price":1000},{"item_name":"metal_booster","price":1000},{"item_name":"water_booster","price":1000}]}},"connections":{"route5":{"conditions":[],"modules\/tuxemon.slug":"route5"},"tunnel-b":{"conditions":[],"modules\/tuxemon.slug":"tunnel"}},"modules\/tuxemon.slug":"timber_town","encounters":[],"requiredEncounters":0,"trainers":[],"environment":null,"map":"<svg\n version=\"1.1\"\n xmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n viewbox=\"0 0 640 640\"\n>\n <image href=\"\/db\/maps\/Timber_Town.png\" \/>\n\n <rect data-location=\"healing_center\" x=\"96\" y=\"48\" width=\"80\" height=\"64\" stroke=\"red\" fill=\"transparent\" \/>\n <rect data-location=\"scoop_store\" x=\"191\" y=\"127\" width=\"82\" height=\"66\" stroke=\"red\" fill=\"transparent\" \/>\n<\/svg>\n"} \ No newline at end of file
diff --git a/db/areas/candy-town.json b/db/areas/candy-town.json
index abdd488..8cfab40 100644
--- a/db/areas/candy-town.json
+++ b/db/areas/candy-town.json
@@ -2,7 +2,12 @@
"locations": {
"scoop_store": {
"type": "shop",
- "items": [],
+ "items": [
+ {
+ "item_name": "super_potion",
+ "price": 40
+ }
+ ],
"modules/tuxemon.economy": "spyder_candy_scoop"
}
},
diff --git a/db/areas/cotton-town.json b/db/areas/cotton-town.json
index 6c55b07..f1bc9e6 100644
--- a/db/areas/cotton-town.json
+++ b/db/areas/cotton-town.json
@@ -6,8 +6,8 @@
},
"cotton_scoop": {
"type": "shop",
- "modules/tuxemon.economy": "cotton_scoop",
- "items": []
+ "items": [],
+ "modules/tuxemon.economy": "cotton_scoop"
}
},
diff --git a/db/areas/timber-town.json b/db/areas/timber-town.json
index 2121446..f28d687 100644
--- a/db/areas/timber-town.json
+++ b/db/areas/timber-town.json
@@ -10,6 +10,26 @@
"modules/tuxemon.economy": "spyder_timber_scoop",
"items": [
{
+ "item_name": "tuxeball_wood",
+ "price": 150
+ },
+ {
+ "item_name": "tuxeball_fire",
+ "price": 150
+ },
+ {
+ "item_name": "tuxeball_earth",
+ "price": 150
+ },
+ {
+ "item_name": "tuxeball_metal",
+ "price": 150
+ },
+ {
+ "item_name": "tuxeball_water",
+ "price": 150
+ },
+ {
"item_name": "wood_booster",
"price": 1000
},
diff --git a/index.html b/index.html
index 78addfc..636857c 100644
--- a/index.html
+++ b/index.html
@@ -182,7 +182,12 @@
<template id="tpl___healing-center">
<div class="healing-center">
<div>Price for Full Heal per Tuxemon: <span data-template-slot="price"></span></div>
- <button data-template-slot="heal" class="menu-button">Select to Heal</button>
+ <div><button data-template-slot="heal" class="menu-button">Select to Heal</button></div>
+ <div>
+ <button data-template-slot="box.withdraw" class="menu-button">Box Withdraw</button>
+ <button data-template-slot="box.deposit" class="menu-button">Box Deposit</button>
+ <button data-template-slot="box.view" class="menu-button">Box View</button>
+ </div>
</div>
</template>
diff --git a/resources/css/menu.css b/resources/css/menu.css
index eb718f8..ba6d8bc 100644
--- a/resources/css/menu.css
+++ b/resources/css/menu.css
@@ -227,6 +227,11 @@
text-align: right;
}
+.monster-stats button {
+ width: 100%;
+ margin-top: 1rem;
+}
+
.gender-icon {
line-height: 1em;
}
diff --git a/resources/css/town.css b/resources/css/town.css
index 06f6f02..72eea60 100644
--- a/resources/css/town.css
+++ b/resources/css/town.css
@@ -3,7 +3,9 @@
-.healing-center {
+.healing-center {}
+
+.healing-center > div {
padding: 1rem;
}
diff --git a/resources/js/game.js b/resources/js/game.js
index 3e7a4c8..1fdde7d 100644
--- a/resources/js/game.js
+++ b/resources/js/game.js
@@ -961,10 +961,18 @@ const Game = {
caughtMonster.level = Memory.state.opponent.activeMonster.level;
caughtMonster.hp = Memory.state.opponent.activeMonster.hp;
- Memory.state.player.monsters.push(caughtMonster);
-
Game.log(`Caught ${caughtMonster.name}!`);
+ if (Memory.state.player.monsters.length < 6) {
+ Memory.state.player.monsters.push(caughtMonster);
+
+ Game.log(`Added ${caughtMonster.name} to Party!`);
+ } else {
+ Memory.state.monsters.push(caughtMonster);
+
+ Game.log(`Transfered ${caughtMonster.name} to Box!`, 1);
+ }
+
await Game.encounterWildMonster();
Memory.saveToLocalStorage();
diff --git a/resources/js/ui.js b/resources/js/ui.js
index e69fd83..3275835 100644
--- a/resources/js/ui.js
+++ b/resources/js/ui.js
@@ -788,6 +788,65 @@ const UI = {
UI.drawPopup(monsterSelectionPopup);
}));
+ template.querySelector('[data-template-slot="box.withdraw"]').addEventListener('click', UI.wrapCallback(() => {
+ if (Memory.state.monsters.length === 0) {
+ alert('No Tuxemon to withdraw in Box!');
+ return;
+ }
+ if (Memory.state.player.monsters.length === 6) {
+ alert('Not enough space in party!');
+ return;
+ }
+
+ const boxPopup = UI.createPopup();
+ const monsterSelection = UI.createMonsterSelection(Memory.state.monsters);
+ monsterSelection.addEventListener('monster:selected', UI.wrapCallback((event) => {
+ Memory.state.player.monsters.push(event.detail.monster);
+ Memory.state.monsters.splice(Memory.state.monsters.findIndex((monster) => monster === event.detail.monster), 1);
+ event.detail.node.remove();
+
+ if (Memory.state.player.monsters.length === 6) {
+ boxPopup.remove();
+ }
+ }))
+
+ boxPopup.querySelector('.popup').appendChild(monsterSelection);
+ UI.drawPopup(boxPopup);
+ }));
+
+ template.querySelector('[data-template-slot="box.deposit"]').addEventListener('click', UI.wrapCallback(() => {
+ if (Memory.state.player.monsters.length === 1) {
+ alert('Can\'t deposit last Tuxemon!');
+ return;
+ }
+
+ const boxPopup = UI.createPopup();
+ const monsterSelection = UI.createMonsterSelection(Memory.state.player.monsters);
+ monsterSelection.addEventListener('monster:selected', UI.wrapCallback((event) => {
+ Memory.state.monsters.push(event.detail.monster);
+ Memory.state.player.monsters.splice(Memory.state.player.monsters.findIndex((monster) => monster === event.detail.monster), 1);
+ event.detail.node.remove();
+
+ if (Memory.state.player.monsters.length === 1) {
+ boxPopup.remove();
+ }
+ }))
+
+ boxPopup.querySelector('.popup').appendChild(monsterSelection);
+ UI.drawPopup(boxPopup);
+ }));
+
+ template.querySelector('[data-template-slot="box.view"]').addEventListener('click', UI.wrapCallback(() => {
+ const boxPopup = UI.createPopup();
+ const monsterSelection = UI.createMonsterSelection(Memory.state.monsters);
+ monsterSelection.addEventListener('monster:selected', UI.wrapCallback((event) => {
+ UI.openStatsMenu(event.detail.monster);
+ }))
+
+ boxPopup.querySelector('.popup').appendChild(monsterSelection);
+ UI.drawPopup(boxPopup);
+ }));
+
popup.querySelector('.popup').appendChild(template);
UI.drawPopup(popup);
},