-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpgrades.eps
More file actions
53 lines (46 loc) · 1.57 KB
/
Upgrades.eps
File metadata and controls
53 lines (46 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import ETK.ETKUnit as Unit;
import ETK.ETKUtils as Utils;
import ETK.ETKTimer as Timer;
import ETK.ETKConstants as Const;
import ETK.ETKCommon as Common;
const Screen = StringBuffer(256);
// Upgrades
const Damage = 0;
const Speed = 1;
const Range = 2;
object TowerUpgrade {
var icon;
var title;
var nextSet; // pointer to TowerUpgradeOptionSet
var attributes : EUDArray(10); // See CreateTowerUpgrade for reference, make constants
function getCost(upgradeValue) {
return (upgradeValue+1) * (this.attributes[Damage] + this.attributes[Speed] + this.attributes[Range]);
}
function generateToltip(upgradeValue) {
const t = Db(64);
sprintf(t, "{:s}\n(UpgradeValue: {})\n\nCost: \x1F{} Minerals\x01", this.title, upgradeValue, this.getCost(upgradeValue));
return t;
}
};
function CreateTowerUpgrade(icon, title, nextSet, attributes:EUDArray) : TowerUpgrade {
const upg = TowerUpgrade.alloc();
upg.icon = icon;
upg.title = title;
upg.nextSet = nextSet;
upg.attributes = EUDArray(10);
upg.attributes = attributes;
return upg;
}
object TowerUpgradeOptionSet {
var optionA : TowerUpgrade;
var optionB : TowerUpgrade;
var optionC : TowerUpgrade;
};
function CreateUpgradeSet(optionA, optionB, optionC) : TowerUpgradeOptionSet {
const towerUpgradeSet = TowerUpgradeOptionSet.alloc();
towerUpgradeSet.optionA = optionA;
towerUpgradeSet.optionB = optionB;
towerUpgradeSet.optionC = optionC;
// setcurpl(P1); Screen.printf("CreateUpgradeSet [{:s}, {:s}, {:s}]", towerUpgradeSet.optionA.title, towerUpgradeSet.optionB.title, towerUpgradeSet.optionC.title);
return towerUpgradeSet;
}