Show enemies on minimap

This commit is contained in:
dazedanon 2025-12-21 13:01:22 -06:00
parent 863de15b4f
commit 58b3345f6a

View file

@ -954,7 +954,7 @@
const lineHeight = 24;
const padding = 15;
const panelWidth = 120;
const panelHeight = 35 + 4 * lineHeight + padding;
const panelHeight = 35 + 5 * lineHeight + padding;
// Create legend sprite
this._legendPanel = new Sprite();
@ -1029,15 +1029,25 @@
ctx.stroke();
bitmap.drawText('Locked', legendX + dotSize + 8, startY + lineHeight * 2 + 2, 80, 18, 'left');
// Exit/Transfer marker (eerie green)
ctx.fillStyle = '#7cfc00';
// Enemy marker (blood red)
ctx.fillStyle = '#dc143c';
ctx.beginPath();
ctx.arc(legendX + dotSize/2, startY + lineHeight * 3 + dotSize/2 + 5, dotSize/2, 0, Math.PI * 2);
ctx.fill();
ctx.strokeStyle = '#2a1a00';
ctx.lineWidth = 1;
ctx.stroke();
bitmap.drawText('Passage', legendX + dotSize + 8, startY + lineHeight * 3 + 2, 80, 18, 'left');
bitmap.drawText('Enemy', legendX + dotSize + 8, startY + lineHeight * 3 + 2, 80, 18, 'left');
// Exit/Transfer marker (eerie green)
ctx.fillStyle = '#7cfc00';
ctx.beginPath();
ctx.arc(legendX + dotSize/2, startY + lineHeight * 4 + dotSize/2 + 5, dotSize/2, 0, Math.PI * 2);
ctx.fill();
ctx.strokeStyle = '#2a1a00';
ctx.lineWidth = 1;
ctx.stroke();
bitmap.drawText('Passage', legendX + dotSize + 8, startY + lineHeight * 4 + 2, 80, 18, 'left');
// Position panel to the left of the map
this._legendPanelOffset = 20; // Gap between map and panel
@ -1378,6 +1388,18 @@
ctx.stroke();
} else if (this.isMapTransfer(event)) {
// Skip - transfers are drawn as numbered markers by createExitMarkers()
} else if (this.isEnemyEvent(event)) {
// Draw enemy marker (blood red)
ctx.fillStyle = '#dc143c';
ctx.shadowColor = '#dc143c';
ctx.shadowBlur = 4;
ctx.beginPath();
ctx.arc(ex, ey, markerSize, 0, Math.PI * 2);
ctx.fill();
ctx.shadowBlur = 0;
ctx.strokeStyle = '#4a0a0a';
ctx.lineWidth = 2;
ctx.stroke();
} else if (this.isImportantEvent(event)) {
// Draw NPC marker (warm gold)
ctx.fillStyle = '#daa520';
@ -1497,6 +1519,43 @@
return this.isLockedDoorOrChest(event);
};
// Check if an event is an enemy (triggers battle)
Scene_Map.prototype.isEnemyEvent = function(event) {
if (!event) return false;
// Get the current active page - if no page is active, event is not visible
const page = event.page();
if (!page) return false;
// Must have a character graphic on the current page (enemy is visible)
if (!page.image || !page.image.characterName) return false;
// Get the event data
const eventData = event.event();
if (!eventData) return false;
// Check for <EnemySymbol> tag in the event note (this game's primary enemy marker)
const note = eventData.note || '';
if (note.includes('<EnemySymbol>')) return true;
// Check event name for specific enemy patterns used in this game
const name = eventData.name;
if (name.includes('エネミーシンボル')) return true; // "Enemy Symbol"
if (name.includes('ボス') && !name.includes('移動')) return true; // "Boss" but not transfer events
// Check the current page for Battle Processing command (code 301)
const list = page.list;
if (!list) return false;
for (const cmd of list) {
if (cmd.code === 301) { // Battle Processing command
return true;
}
}
return false;
};
// Determine if an event is "important" (NPC, not decoration/ambient)
Scene_Map.prototype.isImportantEvent = function(event) {
if (!event) return false;