class CombatSequence extends HTMLElement { constructor() { super(); this.attachShadow({ mode: 'open' }); } connectedCallback() { this.render(); } static get observedAttributes() { return ['sequence-id', 'accuracy', 'hits', 'shots', 'suspicion']; } attributeChangedCallback(name, oldValue, newValue) { if (oldValue !== newValue) { this.render(); } } render() { this.shadowRoot.innerHTML = `
Combat Sequence
${this.getAttribute('sequence-id') || 'Unknown'}
${Math.round((parseFloat(this.getAttribute('accuracy')) || 0) * 100)}%
${this.getAttribute('hits') || 0} hits ${this.getAttribute('shots') || 0} shots
Suspicion level ${this.getAttribute('suspicion') || 0}/100
`; } getAccuracyClass() { const accuracy = parseFloat(this.getAttribute('accuracy')) || 0; return accuracy > 0.6 ? 'high-accuracy' : 'normal-accuracy'; } } customElements.define('combat-sequence', CombatSequence);