30 lines
1.3 KiB
JavaScript
30 lines
1.3 KiB
JavaScript
import {formatDiceMnemonic} from "./formatDiceMnemonic.js";
|
|
import {formatSpeedMnemonic} from "./formatSpeedMnemonic.js";
|
|
|
|
export function createProfileSection(data) {
|
|
let profile = document.createElement('div');
|
|
profile.className = 'creature_profile';
|
|
let profileHTML = `
|
|
<h3>Profile</h3>
|
|
<table>
|
|
<tr><td><b>NUMBER</b></td> <td>${formatDiceMnemonic(data.number)}</td></tr>
|
|
<tr><td><b>MORALE</b></td> <td>${formatDiceMnemonic(data.morale)}</td></tr>
|
|
<tr><td><b>HIT DICE</b></td> <td>${formatDiceMnemonic(data['hit dice'])}</td></tr>
|
|
<tr><td><b>ARMOUR</b></td> <td>${data.armour}</td></tr>
|
|
<tr><td><b>ENVIRON</b></td> <td>${data.environ.join(', ')}</td></tr>
|
|
`;
|
|
if(data['land speed']){
|
|
profileHTML += `<tr><td><b>LAND SPEED</b></td> <td>${formatSpeedMnemonic(data['land speed'])}</td></tr>`;
|
|
}
|
|
if(data['water speed']){
|
|
profileHTML += `<tr><td><b>WATER SPEED</b></td> <td>${formatSpeedMnemonic(data['water speed'])}</td></tr>`;
|
|
}
|
|
if(data['air speed']){
|
|
profileHTML += `<tr><td><b>AIR SPEED</b></td> <td>${formatSpeedMnemonic(data['air speed'])}</td></tr>`;
|
|
}
|
|
profileHTML += '</table>';
|
|
|
|
profile.innerHTML = profileHTML;
|
|
return profile;
|
|
}
|