import Model from "./model.js";
import { startLowercase, titleCase } from "../string_utils.js";
/**
* The animals and pets that accompany a character. In a larger encounter, these relationships
* can be generalized to the group as a whole, but it’s relevant to know who owns what.
*
* (Is it? I’m not sure it matters. Look at the examples.)
*/
export class Companions extends Model {
constructor(params) {
super(params);
this.character = params.character;
this.horse = params.horse;
this.motorcycle = params.motorcycle;
this.dogs = [];
this._class = "Companions";
}
toString() {
let str = "";
str += this.character.toString().replace("</p>", "");
if (this.horse) {
str += ` ${titleCase(this.character.personal)}’s riding ${startLowercase(this.horse.toHtml())} `;
if (this.horse.bag.totalValue()) {
str += `Equipped with ${startLowercase(this.horse.bag.toString())}`;
}
str += "</p>";
}
if (this.motorcycle) {
str += ` Owns a motorcycle</p>`;
}
return str;
}
}