Index: binaries/data/mods/public/simulation/components/Attack.js =================================================================== --- binaries/data/mods/public/simulation/components/Attack.js +++ binaries/data/mods/public/simulation/components/Attack.js @@ -2,40 +2,6 @@ var g_AttackTypes = ["Melee", "Ranged", "Capture"]; -Attack.prototype.statusEffectsSchema = - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - ""; - -Attack.prototype.bonusesSchema = - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - ""; - Attack.prototype.preferredClassesSchema = "" + "" + @@ -140,7 +106,7 @@ "" + // TODO: it shouldn't be stretched "" + "" + - Attack.prototype.bonusesSchema + + BuildBonusesSchema() + Attack.prototype.preferredClassesSchema + Attack.prototype.restrictedClassesSchema + "" + @@ -182,7 +148,7 @@ "" + BuildDamageTypesSchema("damage strength") + "" + - Attack.prototype.bonusesSchema + + BuildBonusesSchema() + "" + "" + "" + @@ -217,8 +183,8 @@ "" + "" + "" + - Attack.prototype.statusEffectsSchema + - Attack.prototype.bonusesSchema + + BuildStatusEffectsSchema() + + BuildBonusesSchema() + Attack.prototype.preferredClassesSchema + Attack.prototype.restrictedClassesSchema + "" + @@ -232,7 +198,7 @@ "" + // TODO: it shouldn't be stretched "" + "" + - Attack.prototype.bonusesSchema + + BuildBonusesSchema() + Attack.prototype.preferredClassesSchema + Attack.prototype.restrictedClassesSchema + "" + @@ -245,7 +211,7 @@ BuildDamageTypesSchema("damage strength") + "" + "" + // TODO: how do these work? - Attack.prototype.bonusesSchema + + BuildBonusesSchema() + Attack.prototype.preferredClassesSchema + Attack.prototype.restrictedClassesSchema + "" + Index: binaries/data/mods/public/simulation/components/DeathDamage.js =================================================================== --- binaries/data/mods/public/simulation/components/DeathDamage.js +++ binaries/data/mods/public/simulation/components/DeathDamage.js @@ -1,23 +1,5 @@ function DeathDamage() {} -DeathDamage.prototype.bonusesSchema = - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - "" + - ""; - DeathDamage.prototype.Schema = "When a unit or building is destroyed, it inflicts damage to nearby units." + "" + @@ -36,7 +18,7 @@ "" + BuildDamageTypesSchema("damage strength") + "" + - DeathDamage.prototype.bonusesSchema; + BuildBonusesSchema(); DeathDamage.prototype.Init = function() { Index: binaries/data/mods/public/simulation/components/tests/test_Attack.js =================================================================== --- binaries/data/mods/public/simulation/components/tests/test_Attack.js +++ binaries/data/mods/public/simulation/components/tests/test_Attack.js @@ -1,3 +1,4 @@ +Engine.LoadHelperScript("Attack.js"); Engine.LoadHelperScript("DamageBonus.js"); Engine.LoadHelperScript("DamageTypes.js"); Engine.LoadHelperScript("Player.js"); Index: binaries/data/mods/public/simulation/components/tests/test_Damage.js =================================================================== --- binaries/data/mods/public/simulation/components/tests/test_Damage.js +++ binaries/data/mods/public/simulation/components/tests/test_Damage.js @@ -1,3 +1,4 @@ +Engine.LoadHelperScript("Attack.js"); Engine.LoadHelperScript("DamageBonus.js"); Engine.LoadHelperScript("DamageTypes.js"); Engine.LoadHelperScript("Player.js"); Index: binaries/data/mods/public/simulation/components/tests/test_DeathDamage.js =================================================================== --- binaries/data/mods/public/simulation/components/tests/test_DeathDamage.js +++ binaries/data/mods/public/simulation/components/tests/test_DeathDamage.js @@ -1,3 +1,4 @@ +Engine.LoadHelperScript("Attack.js"); Engine.LoadHelperScript("DamageBonus.js"); Engine.LoadHelperScript("DamageTypes.js"); Engine.LoadHelperScript("ValueModification.js"); Index: binaries/data/mods/public/simulation/helpers/Attack.js =================================================================== --- /dev/null +++ binaries/data/mods/public/simulation/helpers/Attack.js @@ -0,0 +1,52 @@ +/** + * Builds a RelaxRNG schema for status effects. + * @return - RelaxNG schema string. + */ +function BuildStatusEffectsSchema() +{ + let schema = + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + ""; + return schema; +}; + +/** + * Builds a RelaxRNG schema for bonuses. + * @return - RelaxNG schema string. + */ +function BuildBonusesSchema() +{ + let schema = + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + ""; + return schema; +}; + +Engine.RegisterGlobal("BuildStatusEffectsSchema", BuildStatusEffectsSchema); +Engine.RegisterGlobal("BuildBonusesSchema", BuildBonusesSchema);