File size: 2,731 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
70
71
72
-- ========== GENERATED BY CharacterEffectCompositeDef Editor DO NOT EDIT MANUALLY! ==========

UndefineClass('Bleeding')
DefineClass.Bleeding = {
	__parents = { "StatusEffect" },
	__generated_by_class = "CharacterEffectCompositeDef",


	object_class = "StatusEffect",
	unit_reactions = {
		PlaceObj('UnitReaction', {
			Event = "OnEndTurn",
			Handler = function (self, target)
				if not IsInCombat() then return end
				if target:HasStatusEffect("BeingBandaged") then
					target:RemoveStatusEffect("Bleeding")
					return
				end
				local value = self:ResolveValue("DamagePerTurn")
				local floating_text = T{193053798048, "<num> (bleeding)", num = value}
				local pov_team = GetPoVTeam()
				local has_visibility = HasVisibilityTo(pov_team, target)
				local log_msg = T{729241506274, "<name> bleeds for <em><num> damage</em>", name = target:GetLogName(), num = value}
				target:TakeDirectDamage(value, has_visibility and floating_text or false, "short", log_msg)
			end,
		}),
		PlaceObj('UnitReaction', {
			Event = "OnCalcChanceToHit",
			Handler = function (self, target, attacker, action, attack_target, weapon1, weapon2, data)
				if target == attacker then
					ApplyCthModifier_Add(self, data, self:ResolveValue("cth_penalty"))
				end
			end,
		}),
		PlaceObj('UnitReaction', {
			Event = "OnCalcCritChance",
			Handler = function (self, target, attacker, attack_target, action, weapon, data)
				if target == attack_target and IsKindOf(data.weapon, "GutHookKnife") then
					data.guaranteed_crit = true
				end
			end,
		}),
		PlaceObj('UnitReaction', {
			Event = "OnUnitBandaged",
			Handler = function (self, target, healer, patient, hp_restored)
				if target == patient then
					target:RemoveStatusEffect(self.class)
				end
			end,
		}),
	},
	DisplayName = T(779855732255, --[[CharacterEffectCompositeDef Bleeding DisplayName]] "Bleeding"),
	Description = T(303094247377, --[[CharacterEffectCompositeDef Bleeding Description]] "This character will <em>take <DamagePerTurn> damage</em> each turn until they are <em>bandaged</em>. Maximum <em>AP decreased by <APLoss></em>."),
	AddEffectText = T(902710213609, --[[CharacterEffectCompositeDef Bleeding AddEffectText]] "<em><DisplayName></em> is bleeding"),
	OnAdded = function (self, obj)
		if g_Teams[g_CurrentTeam] == obj.team and not obj:HasStatusEffect("BeingBandaged") then
			obj:ConsumeAP(-self:ResolveValue("APLoss") * const.Scale.AP)
		end
	end,
	OnRemoved = function (self, obj)
		if g_Combat and not obj:HasStatusEffect("BeingBandaged") then
			obj:ConsumeAP(self:ResolveValue("APLoss") * const.Scale.AP)
		end
	end,
	type = "Debuff",
	Icon = "UI/Hud/Status effects/bleeding",
	RemoveOnEndCombat = true,
	Shown = true,
	HasFloatingText = true,
}