File size: 1,605 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
-- ========== GENERATED BY CharacterEffectCompositeDef Editor DO NOT EDIT MANUALLY! ==========

PlaceObj('CharacterEffectCompositeDef', {
	'Group', "Perk-Specialization",
	'Id', "CQCTraining",
	'SortKey', 100,
	'Parameters', {
		PlaceObj('PresetParamPercent', {
			'Name', "cqc_bonus_max",
			'Value', 20,
			'Tag', "<cqc_bonus_max>%",
		}),
		PlaceObj('PresetParamPercent', {
			'Name', "cqc_bonus_loss_per_tile",
			'Value', 2,
			'Tag', "<cqc_bonus_loss_per_tile>%",
		}),
	},
	'Comment', "lose 1/10 of the bonus for each tile between you and the target (if the target is adjacent I count it as range 0)",
	'object_class', "Perk",
	'unit_reactions', {
		PlaceObj('UnitReaction', {
			Event = "OnCalcChanceToHit",
			Handler = function (self, target, attacker, action, attack_target, weapon1, weapon2, data)
				if target == attacker then
					local value = self:ResolveValue("cqc_bonus_max")
					local tileSpace = DivRound(attacker:GetDist2D(attack_target), const.SlabSizeX) - 1
					if tileSpace > 0 then
						local lossPerTile = self:ResolveValue("cqc_bonus_loss_per_tile")
						value = value - lossPerTile * tileSpace
					end
					if value > 0 then
						ApplyCthModifier_Add(self, data, value)
					end
				end
			end,
		}),
	},
	'DisplayName', T(144446625840, --[[CharacterEffectCompositeDef CQCTraining DisplayName]] "CQC Training"),
	'Description', T(145788352124, --[[CharacterEffectCompositeDef CQCTraining Description]] "Major <em>Accuracy</em> bonus when attacking enemies at short range (degrades with distance)."),
	'Icon', "UI/Icons/Perks/CQCTraining",
	'Tier', "Specialization",
})