@zerospacegg/iolin
Version:
Pure TypeScript implementation of ZeroSpace game data processing (PKL-free)
290 lines • 8.78 kB
JavaScript
/**
* Grell Classes - Separate file to avoid circular imports
* Contains all Grell-specific class definitions for buildings and units
*/
import { FactionTalent, Passive, Topbar } from "../engine/ability.js";
import { BaseBuilding, ExtractorBuilding, ProductionBuilding, SpecialBuilding, SupplyBuilding, TechBuilding, } from "../engine/building.js";
import { MainFaction } from "../engine/faction.js";
import { ArmyUnit, BuilderUnit, HarvesterUnit, HeroUnit } from "../engine/unit.js";
/**
* Dedicated passive for Grell biomass healing
*/
class BiomassHealPassive extends Passive {
get type() {
return "ability";
}
constructor(props) {
super({ description: "Heals when on biomass" });
this.name = "Biomass Heal";
if (props?.parentUUID) {
this.parentUUID = props.parentUUID;
}
if (props?.parentId) {
this.parentId = props.parentId;
}
}
}
/**
* Dedicated passive for Grell biomass spreading
*/
class BiomassSpreadPassive extends Passive {
get type() {
return "ability";
}
constructor(radius, props) {
super({ description: `Spreads biomass in a ${radius} radius` });
this.name = "Biomass Spread";
if (props?.parentUUID) {
this.parentUUID = props.parentUUID;
}
if (props?.parentId) {
this.parentId = props.parentId;
}
}
}
/**
* Dedicated passive for Grell building healing (patch 19202990)
*/
class BuildingHealPassive extends Passive {
get type() {
return "ability";
}
constructor(healPerSecond = 4, props) {
super({ description: `Heals ${healPerSecond} HP per second` });
this.name = "Building Heal";
if (props?.parentUUID) {
this.parentUUID = props.parentUUID;
}
if (props?.parentId) {
this.parentId = props.parentId;
}
}
}
/**
* Grell-specific talent that automatically sets abilityOf to "grell"
*/
export class GrellTalent extends FactionTalent {
get type() {
return "ability";
}
constructor(props) {
super(props);
this.factionName = "Grell";
}
get abilityOf() {
return "grell";
}
}
/**
* Grell Topbar class with faction-specific settings
*/
export class GrellTopbar extends Topbar {
get type() {
return "ability";
}
constructor(props) {
super(props);
this.description = "";
// Ensure description from props overrides the default empty string
if (props?.description) {
this.description = props.description;
}
}
get abilityOf() {
return "grell";
}
get faction() {
return "grell";
}
get factionName() {
return "Grell";
}
get subtype() {
return "topbar";
}
}
/**
* Main Grell Faction class
*/
export class GrellFaction extends MainFaction {
get type() {
return "faction";
}
constructor() {
super();
this.uuid = "";
this.faction = GrellFaction.factionSlug;
this.factionName = GrellFaction.factionName;
}
}
GrellFaction.factionSlug = "grell";
GrellFaction.factionName = "Grell";
/**
* Grell Army Unit class
*/
export class GrellArmyUnit extends ArmyUnit {
constructor(props) {
super(props);
this.faction = "grell";
this.factionName = "Grell";
// TODO: Re-enable biomass passives after fixing constructor timing
// this.setupGrellPassives();
}
setupGrellPassives() {
// this.passives.biomassHeal = new BiomassHealPassive({ parentUUID: this.uuid });
}
}
/**
* Grell Builder Unit class
*/
export class GrellBuilderUnit extends BuilderUnit {
constructor() {
super();
this.faction = "grell";
this.factionName = "Grell";
}
}
/**
* Grell Harvester Unit class
*/
export class GrellHarvesterUnit extends HarvesterUnit {
constructor() {
super();
this.faction = "grell";
this.factionName = "Grell";
}
}
/**
* Grell Hero Unit class
*/
export class GrellHeroUnit extends HeroUnit {
constructor() {
super();
this.faction = "grell";
this.factionName = "Grell";
}
}
/**
* Grell Base Building class (Root Colony)
*/
export class GrellBaseBuilding extends BaseBuilding {
constructor() {
super();
this.providesBiomass = 750; // Default biomass for Grell buildings
this.faction = "grell";
this.factionName = "Grell";
// NOTE: setupGrellPassives() should be called AFTER uuid is set in concrete classes
}
setupGrellPassives() {
if (this.providesBiomass && this.providesBiomass > 0) {
this.passives.spreadsBiomass = new BiomassSpreadPassive(this.providesBiomass, { parentUUID: this.uuid, parentId: this.id });
}
this.passives.buildingHeal = new BuildingHealPassive(4, { parentUUID: this.uuid, parentId: this.id });
}
get buildingType() {
return "base";
}
}
/**
* Grell Extractor Building class (Grell Extractor)
*/
export class GrellExtractorBuilding extends ExtractorBuilding {
constructor() {
super();
this.providesBiomass = 0; // Extractors don't spread biomass
this.faction = "grell";
this.factionName = "Grell";
}
get buildingType() {
return "extractor";
}
}
/**
* Grell Supply Building class (Nourishing Pod)
*/
export class GrellSupplyBuilding extends SupplyBuilding {
constructor() {
super();
this.providesBiomass = 750; // Default biomass for Grell buildings
this.faction = "grell";
this.factionName = "Grell";
// TODO: Re-enable biomass passives after fixing constructor timing
// this.setupGrellPassives();
}
setupGrellPassives() {
if (this.providesBiomass && this.providesBiomass > 0) {
this.passives.spreadsBiomass = new BiomassSpreadPassive(this.providesBiomass, { parentUUID: this.uuid, parentId: this.id });
}
this.passives.buildingHeal = new BuildingHealPassive(4, { parentUUID: this.uuid, parentId: this.id });
}
get buildingType() {
return "supply";
}
}
/**
* Grell Production Building class (Incubators, Nests)
*/
export class GrellProductionBuilding extends ProductionBuilding {
constructor() {
super();
this.providesBiomass = 750; // Default biomass for Grell buildings
this.faction = "grell";
this.factionName = "Grell";
// TODO: Re-enable biomass passives after fixing constructor timing
// this.setupGrellPassives();
}
setupGrellPassives() {
if (this.providesBiomass && this.providesBiomass > 0) {
this.passives.spreadsBiomass = new BiomassSpreadPassive(this.providesBiomass, { parentUUID: this.uuid, parentId: this.id });
}
this.passives.buildingHeal = new BuildingHealPassive(4, { parentUUID: this.uuid, parentId: this.id });
}
get buildingType() {
return "production";
}
}
/**
* Grell Tech Building class (Augmentation Pools)
*/
export class GrellTechBuilding extends TechBuilding {
constructor() {
super();
this.providesBiomass = 750; // Default biomass for Grell buildings
this.faction = "grell";
this.factionName = "Grell";
// TODO: Re-enable biomass passives after fixing constructor timing
// this.setupGrellPassives();
}
setupGrellPassives() {
if (this.providesBiomass && this.providesBiomass > 0) {
this.passives.spreadsBiomass = new BiomassSpreadPassive(this.providesBiomass, { parentUUID: this.uuid, parentId: this.id });
}
this.passives.buildingHeal = new BuildingHealPassive(4, { parentUUID: this.uuid, parentId: this.id });
}
get buildingType() {
return "tech";
}
}
/**
* Grell Special Building class (Cultivator)
*/
export class GrellSpecialBuilding extends SpecialBuilding {
constructor() {
super();
this.providesBiomass = 750; // Default biomass for Grell buildings
this.faction = "grell";
this.factionName = "Grell";
// TODO: Re-enable biomass passives after fixing constructor timing
// this.setupGrellPassives();
}
setupGrellPassives() {
if (this.providesBiomass && this.providesBiomass > 0) {
this.passives.spreadsBiomass = new BiomassSpreadPassive(this.providesBiomass, { parentUUID: this.uuid, parentId: this.id });
}
this.passives.buildingHeal = new BuildingHealPassive(4, { parentUUID: this.uuid, parentId: this.id });
}
get buildingType() {
return "special";
}
}
//# sourceMappingURL=grell.js.map