Decouple travel and cooking fuel mechanics
- Travel is now free (no fuel cost for sailing between locations) - Fuel is only consumed for cooking whale oil (2 fuel per whale) - Updated TransitionScene to show "The wind carries your sails..." when no fuel cost - Removed fuel checks from MapScene travel methods - Added fuel validation in HuntingScene - can't process whales without fuel - This sets up the penguin burning mechanic for when cooking fuel runs low 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -366,6 +366,24 @@ export default class HuntingScene extends Phaser.Scene {
|
||||
whale.setData('alive', false);
|
||||
harpoon.setData('active', false);
|
||||
|
||||
// Check if enough fuel to process the whale
|
||||
if (this.inventory.fuel < 2) {
|
||||
// Not enough fuel to cook the oil!
|
||||
this.tweens.add({
|
||||
targets: whale,
|
||||
alpha: 0,
|
||||
y: whale.y + 50,
|
||||
duration: 1000,
|
||||
onComplete: () => {
|
||||
whale.destroy();
|
||||
}
|
||||
});
|
||||
harpoon.destroy();
|
||||
|
||||
this.showMessage('Whale hit but no fuel to process it! Need 2 fuel to cook whale oil.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Whale death animation
|
||||
this.tweens.add({
|
||||
targets: whale,
|
||||
@@ -381,13 +399,16 @@ export default class HuntingScene extends Phaser.Scene {
|
||||
// Remove harpoon
|
||||
harpoon.destroy();
|
||||
|
||||
// Consume fuel for processing
|
||||
this.inventory.fuel -= 2;
|
||||
|
||||
// Reward
|
||||
this.inventory.whaleOil += 1;
|
||||
this.whalesHunted++;
|
||||
this.updateStats();
|
||||
|
||||
// Show success message
|
||||
this.showMessage(`Whale hunted! +1 Whale Oil (Total: ${this.inventory.whaleOil})`);
|
||||
this.showMessage(`Whale hunted! +1 Whale Oil, -2 Fuel (Oil: ${this.inventory.whaleOil}, Fuel: ${this.inventory.fuel})`);
|
||||
|
||||
// Success flash
|
||||
const flash = this.add.rectangle(400, 300, 800, 600, 0xffffff, 0.3);
|
||||
|
||||
@@ -155,43 +155,31 @@ export default class MapScene extends Phaser.Scene {
|
||||
}
|
||||
|
||||
goToHunting() {
|
||||
if (this.inventory.fuel < 20) {
|
||||
this.showMessage('Not enough fuel to reach the hunting grounds! You need at least 20 units.');
|
||||
return;
|
||||
}
|
||||
// Go to transition scene, then to hunting scene
|
||||
// Sailing is free - fuel is only for cooking
|
||||
this.scene.start('TransitionScene', {
|
||||
inventory: this.inventory,
|
||||
destination: 'hunting',
|
||||
fuelCost: 20,
|
||||
fuelCost: 0,
|
||||
nextScene: 'HuntingScene'
|
||||
});
|
||||
}
|
||||
|
||||
goToAntarctic() {
|
||||
if (this.inventory.fuel < 30) {
|
||||
this.showMessage('Not enough fuel to reach Antarctic islands! You need at least 30 units.');
|
||||
return;
|
||||
}
|
||||
// Go to transition scene, then to map (antarctic scene not yet implemented)
|
||||
// Sailing is free - fuel is only for cooking
|
||||
this.scene.start('TransitionScene', {
|
||||
inventory: this.inventory,
|
||||
destination: 'antarctic',
|
||||
fuelCost: 30,
|
||||
fuelCost: 0,
|
||||
nextScene: 'MapScene' // Will change to 'AntarcticScene' when implemented
|
||||
});
|
||||
}
|
||||
|
||||
goToPort() {
|
||||
if (this.inventory.fuel < 10) {
|
||||
this.showMessage('Not enough fuel to return to port! You need at least 10 units. Consider... alternatives.');
|
||||
return;
|
||||
}
|
||||
// Go to transition scene, then to map (port scene not yet implemented)
|
||||
// Sailing is free
|
||||
this.scene.start('TransitionScene', {
|
||||
inventory: this.inventory,
|
||||
destination: 'port',
|
||||
fuelCost: 10,
|
||||
fuelCost: 0,
|
||||
nextScene: 'MapScene' // Will change to 'PortScene' when implemented
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,11 +45,19 @@ export default class TransitionScene extends Phaser.Scene {
|
||||
wordWrap: { width: 660 }
|
||||
}).setOrigin(0.5);
|
||||
|
||||
// Fuel cost display
|
||||
this.add.text(400, 500, `Fuel consumed: ${this.fuelCost} units`, {
|
||||
fontSize: '16px',
|
||||
fill: '#ffff00'
|
||||
}).setOrigin(0.5);
|
||||
// Fuel cost display (only if there's a cost)
|
||||
if (this.fuelCost > 0) {
|
||||
this.add.text(400, 500, `Fuel consumed: ${this.fuelCost} units`, {
|
||||
fontSize: '16px',
|
||||
fill: '#ffff00'
|
||||
}).setOrigin(0.5);
|
||||
} else {
|
||||
this.add.text(400, 500, 'The wind carries your sails...', {
|
||||
fontSize: '16px',
|
||||
fill: '#cccccc',
|
||||
fontStyle: 'italic'
|
||||
}).setOrigin(0.5);
|
||||
}
|
||||
|
||||
// Continue button
|
||||
const continueBtn = this.add.rectangle(400, 540, 200, 50, 0x2d5f8e);
|
||||
@@ -72,8 +80,10 @@ export default class TransitionScene extends Phaser.Scene {
|
||||
});
|
||||
|
||||
continueBtn.on('pointerdown', () => {
|
||||
// Deduct fuel
|
||||
this.inventory.fuel -= this.fuelCost;
|
||||
// Deduct fuel (if any cost)
|
||||
if (this.fuelCost > 0) {
|
||||
this.inventory.fuel -= this.fuelCost;
|
||||
}
|
||||
|
||||
// Proceed to next scene
|
||||
this.scene.start(this.nextScene, { inventory: this.inventory });
|
||||
|
||||
Reference in New Issue
Block a user