init: add basic, improved, radiant tiers as properties for each element

This commit is contained in:
2025-08-08 21:01:20 +02:00
parent cb8fedf327
commit 7ffb584cd2
3 changed files with 21 additions and 17 deletions

View File

@@ -39,6 +39,10 @@ Tier.prototype.toString = function() {
function Element(name, hue) {
this.name = name;
this.hue = hue;
this.basic = new Grist(this, Grist.Tiers.basic);
this.improved = new Grist(this, Grist.Tiers.basic);
this.radiant = new Grist(this, Grist.Tiers.basic);
};
Element.prototype.displayName = function() {
@@ -59,6 +63,17 @@ function Grist(element, tier) {
Grist.Tier = Tier;
Grist.Element = Element;
// Color values are 0-1 floats
Grist.Tiers = {
basic: new Tier('basic', 0.5, 'uncommon'),
improved: new Tier('improved', 0.75, 'rare'),
radiant: new Tier('radiant', 1.0, 'epic')
};
Grist.Tiers.forEach = function(f) {
[Grist.Tiers.basic, Grist.Tiers.improved, Grist.Tiers.radiant].forEach(f);
}
// Hues are 0-255
// -1 means white, as special case
Grist.Types = {
@@ -82,17 +97,6 @@ Grist.Primitives = [
Grist.Types.universal
];
// Color values are 0-1 floats
Grist.Tiers = {
basic: new Tier('basic', 0.5, 'uncommon'),
improved: new Tier('improved', 0.75, 'rare'),
radiant: new Tier('radiant', 1.0, 'epic')
};
Grist.Tiers.forEach = function(f) {
[Grist.Tiers.basic, Grist.Tiers.improved, Grist.Tiers.radiant].forEach(f);
}
Grist.forEach = function(f) {
Grist.Tiers.forEach(tier => {
Grist.Elements.forEach(element => {