mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
Update units ruleset validation (#10781)
* Update units ruleset validation Removed check for 0 rangedAttack ranged units. Definition here:75af329b16/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt (L349)
Renamed obseleteTech to upgradeTech * Undo renaming * Removed duplicate check See93224f1491/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt (L51-L53)
--------- Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
This commit is contained in:
parent
b56a168e86
commit
1d97ededbd
@ -669,10 +669,8 @@ class RulesetValidator(val ruleset: Ruleset) {
|
||||
private fun checkUnitRulesetInvariant(unit: BaseUnit, lines: RulesetErrorList) {
|
||||
if (unit.upgradesTo == unit.name || (unit.upgradesTo != null && unit.upgradesTo == unit.replaces))
|
||||
lines += "${unit.name} upgrades to itself!"
|
||||
if (!unit.isCivilian() && unit.strength == 0)
|
||||
if (unit.isMilitary() && unit.strength == 0) // Should only match ranged units with 0 strength
|
||||
lines += "${unit.name} is a military unit but has no assigned strength!"
|
||||
if (unit.isRanged() && unit.rangedStrength == 0 && !unit.hasUnique(UniqueType.CannotAttack))
|
||||
lines += "${unit.name} is a ranged unit but has no assigned rangedStrength!"
|
||||
}
|
||||
|
||||
/** Collects all RulesetSpecific checks for a BaseUnit */
|
||||
@ -683,9 +681,6 @@ class RulesetValidator(val ruleset: Ruleset) {
|
||||
for (obsoleteTech: String in unit.techsAtWhichNoLongerAvailable())
|
||||
if (!ruleset.technologies.containsKey(obsoleteTech))
|
||||
lines += "${unit.name} obsoletes at tech ${obsoleteTech} which does not exist!"
|
||||
for (obsoleteTech: String in unit.techsAtWhichAutoUpgradeInProduction())
|
||||
if (!ruleset.technologies.containsKey(obsoleteTech))
|
||||
lines += "${unit.name} upgrades at tech ${obsoleteTech} which does not exist!"
|
||||
if (unit.upgradesTo != null && !ruleset.units.containsKey(unit.upgradesTo!!))
|
||||
lines += "${unit.name} upgrades to unit ${unit.upgradesTo} which does not exist!"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user