-
Notifications
You must be signed in to change notification settings - Fork 228
/
UAL0301_script.lua
163 lines (153 loc) · 6.84 KB
/
UAL0301_script.lua
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
-----------------------------------------------------------------
-- File : /cdimage/units/UAL0301/UAL0301_script.lua
-- Author(s): Jessica St. Croix
-- Summary : Aeon Sub Commander Script
-- Copyright © 2005 Gas Powered Games, Inc. All rights reserved.
-----------------------------------------------------------------
---@alias AeonSCUEnhancementBuffType
---| "SCUBUILDRATE"
---| "SCUREGENRATE"
---@alias AeonSCUEnhancementBuffName # BuffType
---| "AeonSCUBuildRate" # SCUBUILDRATE
---| "AeonSCURegenRate" # SCUREGENRATE
local CommandUnit = import("/lua/defaultunits.lua").CommandUnit
local AWeapons = import("/lua/aeonweapons.lua")
local ADFReactonCannon = AWeapons.ADFReactonCannon
local SCUDeathWeapon = import("/lua/sim/defaultweapons.lua").SCUDeathWeapon
local EffectUtil = import("/lua/effectutilities.lua")
local Buff = import("/lua/sim/buff.lua")
---@class UAL0301 : CommandUnit
UAL0301 = ClassUnit(CommandUnit) {
Weapons = {
RightReactonCannon = ClassWeapon(ADFReactonCannon) {},
DeathWeapon = ClassWeapon(SCUDeathWeapon) {},
},
__init = function(self)
CommandUnit.__init(self, 'RightReactonCannon')
end,
OnStopBuild = function(self, unitBeingBuilt)
CommandUnit.OnStopBuild(self, unitBeingBuilt)
self:BuildManipulatorSetEnabled(false)
self.BuildArmManipulator:SetPrecedence(0)
self:SetWeaponEnabledByLabel('RightReactonCannon', true)
self:GetWeaponManipulatorByLabel('RightReactonCannon'):SetHeadingPitch(self.BuildArmManipulator:GetHeadingPitch())
self.UnitBeingBuilt = nil
self.UnitBuildOrder = nil
self.BuildingUnit = false
end,
OnCreate = function(self)
CommandUnit.OnCreate(self)
self:SetCapturable(false)
self:HideBone('Turbine', true)
self:SetupBuildBones()
end,
CreateBuildEffects = function(self, unitBeingBuilt, order)
EffectUtil.CreateAeonCommanderBuildingEffects(self, unitBeingBuilt, self.BuildEffectBones, self.BuildEffectsBag)
end,
CreateEnhancement = function(self, enh)
CommandUnit.CreateEnhancement(self, enh)
local bp = self.Blueprint.Enhancements[enh]
if not bp then return end
-- Teleporter
if enh == 'Teleporter' then
self:AddCommandCap('RULEUCC_Teleport')
elseif enh == 'TeleporterRemove' then
self:RemoveCommandCap('RULEUCC_Teleport')
-- Shields
elseif enh == 'Shield' then
self:AddToggleCap('RULEUTC_ShieldToggle')
self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0)
self:SetMaintenanceConsumptionActive()
self:CreateShield(bp)
elseif enh == 'ShieldRemove' then
self:DestroyShield()
self:SetMaintenanceConsumptionInactive()
self:RemoveToggleCap('RULEUTC_ShieldToggle')
elseif enh == 'ShieldHeavy' then
self.Trash:Add(ForkThread(self.CreateHeavyShield, self, bp))
elseif enh == 'ShieldHeavyRemove' then
self:DestroyShield()
self:SetMaintenanceConsumptionInactive()
self:RemoveToggleCap('RULEUTC_ShieldToggle')
-- ResourceAllocation
elseif enh == 'ResourceAllocation' then
local bp = self.Blueprint.Enhancements[enh]
local bpEcon = self.Blueprint.Economy
if not bp then return end
self:SetProductionPerSecondEnergy((bp.ProductionPerSecondEnergy + bpEcon.ProductionPerSecondEnergy) or 0)
self:SetProductionPerSecondMass((bp.ProductionPerSecondMass + bpEcon.ProductionPerSecondMass) or 0)
elseif enh == 'ResourceAllocationRemove' then
local bpEcon = self.Blueprint.Economy
self:SetProductionPerSecondEnergy(bpEcon.ProductionPerSecondEnergy or 0)
self:SetProductionPerSecondMass(bpEcon.ProductionPerSecondMass or 0)
-- Engineering Focus Module
elseif enh == 'EngineeringFocusingModule' then
if not Buffs['AeonSCUBuildRate'] then
BuffBlueprint {
Name = 'AeonSCUBuildRate',
DisplayName = 'AeonSCUBuildRate',
BuffType = 'SCUBUILDRATE',
Stacks = 'REPLACE',
Duration = -1,
Affects = {
BuildRate = {
Add = bp.NewBuildRate - self.Blueprint.Economy.BuildRate,
Mult = 1,
},
},
}
end
Buff.ApplyBuff(self, 'AeonSCUBuildRate')
elseif enh == 'EngineeringFocusingModuleRemove' then
if Buff.HasBuff(self, 'AeonSCUBuildRate') then
Buff.RemoveBuff(self, 'AeonSCUBuildRate')
end
-- SystemIntegrityCompensator
elseif enh == 'SystemIntegrityCompensator' then
local name = 'AeonSCURegenRate'
if not Buffs[name] then
BuffBlueprint {
Name = name,
DisplayName = name,
BuffType = 'SCUREGENRATE',
Stacks = 'REPLACE',
Duration = -1,
Affects = {
Regen = {
Add = bp.NewRegenRate - self.Blueprint.Defense.RegenRate,
Mult = 1,
},
},
}
end
Buff.ApplyBuff(self, name)
elseif enh == 'SystemIntegrityCompensatorRemove' then
if Buff.HasBuff(self, 'AeonSCURegenRate') then
Buff.RemoveBuff(self, 'AeonSCURegenRate')
end
-- Sacrifice
elseif enh == 'Sacrifice' then
self:AddCommandCap('RULEUCC_Sacrifice')
elseif enh == 'SacrificeRemove' then
self:RemoveCommandCap('RULEUCC_Sacrifice')
-- StabilitySupressant
elseif enh == 'StabilitySuppressant' then
local wep = self:GetWeaponByLabel('RightReactonCannon')
wep:AddDamageMod(bp.NewDamageMod or 0)
wep:AddDamageRadiusMod(bp.NewDamageRadiusMod or 0)
wep:ChangeMaxRadius(bp.NewMaxRadius or 40)
elseif enh == 'StabilitySuppressantRemove' then
local wep = self:GetWeaponByLabel('RightReactonCannon')
wep:AddDamageMod(-self.Blueprint.Enhancements['RightReactonCannon'].NewDamageMod)
wep:AddDamageRadiusMod(bp.NewDamageRadiusMod or 0)
wep:ChangeMaxRadius(bp.NewMaxRadius or 30)
end
end,
CreateHeavyShield = function(self, bp)
WaitTicks(1)
self:CreateShield(bp)
self:SetEnergyMaintenanceConsumptionOverride(bp.MaintenanceConsumptionPerSecondEnergy or 0)
self:SetMaintenanceConsumptionActive()
end,
}
TypeClass = UAL0301