File size: 2,245 Bytes
b6a38d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
-- ========== GENERATED BY CharacterEffectCompositeDef Editor DO NOT EDIT MANUALLY! ==========

UndefineClass('Burning')
DefineClass.Burning = {
	__parents = { "CharacterEffect" },
	__generated_by_class = "CharacterEffectCompositeDef",


	object_class = "CharacterEffect",
	unit_reactions = {
		PlaceObj('UnitReaction', {
			Event = "OnBeginTurn",
			Handler = function (self, target)
				local chance = 50 - Max(0, target.Health - 50) / 2 - MulDivRound(target:GetLevel(), 25, 10)
				if target:Random(100) < chance then
					target:AddStatusEffect("Panicked")
				end
			end,
		}),
		PlaceObj('UnitReaction', {
			Event = "OnEndTurn",
			Handler = function (self, target)
				if not target:IsDead() then
					EnvEffectBurningTick(target, nil, "end turn")
				end
			end,
		}),
		PlaceObj('UnitReaction', {
			Event = "OnUnitBandaged",
			Handler = function (self, target, healer, patient, hp_restored)
				if target == patient then
					local voxels = target:GetVisualVoxels()
					local fire, dist = AreVoxelsInFireRange(voxels)
					if not fire or dist >= const.SlabSizeX then
						target:RemoveStatusEffect(self.class)
					end
				end
			end,
		}),
	},
	Modifiers = {
		PlaceObj('UnitModifier', {
			mod_add = -15,
			target_prop = "Wisdom",
		}),
	},
	DisplayName = T(178364189448, --[[CharacterEffectCompositeDef Burning DisplayName]] "Burning"),
	Description = T(661121942943, --[[CharacterEffectCompositeDef Burning Description]] "This character may <em>Panic</em> and will <em>take <damage> damage</em> at the end of each turn until they exit the flaming area. <em>Bandage</em> can cure the effect immediately."),
	AddEffectText = T(251545639918, --[[CharacterEffectCompositeDef Burning AddEffectText]] "<em><DisplayName></em> is on fire"),
	OnAdded = function (self, obj)
		PlayFX("UnitBurning", "start", obj)
		self:SetParameter("burning_start_time", GameTime())
		obj:AddStain("Burning", GetRandomStainSpot())
	end,
	OnRemoved = function (self, obj)
		if IsKindOf(obj, "Unit") then
			PlayFX("UnitBurning", "end", obj)
			obj:ClearStains("Burning")
		end
	end,
	type = "Debuff",
	Icon = "UI/Hud/Status effects/burning",
	RemoveOnSatViewTravel = true,
	RemoveOnCampaignTimeAdvance = true,
	Shown = true,
	HasFloatingText = true,
}