// Master Chief balance overrides for TF2.
//
// Merged over the Halo data (custom/masterchief/scripts/halo/gameplay.txt, extracted from
// Halo: CE with the x4/3 damage scale applied) when the game loads it: any key here replaces
// the Halo value at the same path, so only the changed values are listed.  Damage values are
// final (already scaled).  Regenerate masterchief/docs/weapon_stats.md with
// masterchief/tools/weapon_stats.py to see the result.
//
// TF2-only keys (not in Halo):
//   damage/<name>/tf_falloff_start, tf_falloff_end, tf_falloff_min
//       TF2-style distance falloff (attacker to victim): full damage until start, then down to
//       min x damage at end.  Applies to headshot crits too (like the Ambassador), not to
//       Kritzkrieg / crit boosts or buildings (as in TF2).
//   damage/<name>/tf_knockback   1 = pushes players like TF2 bullets do
//   damage/<name>/tf_energy      1 = an energy weapon: ignores chief/tf_shield_resistance
//       (TF2's Pomson, Bison, Cow Mangler and Short Circuit are hard-coded as energy)
//   damage/<name>/tf_vs_buildings   x damage to Engineer buildings (on top of vs_human)
//   damage/<name>/tf_shield_bonus   x damage to a Chief's shield while it's up (what overflows into
//       his health isn't multiplied)
//   chief/tf_shield_resistance   fraction of each hit the shield shrugs off (not energy weapons)
//   chief/tf_fall_damage_scale   > 0: TF2's fall damage (for the height he fell, counting his health + shield
//       as the max health) x this, instead of Halo's; 0 = Halo's
//   chief/tf_fall_damage_curve   + this x (TF2 landing speed - 650)^2 on top (0 = TF2's straight line)
//   chief/tf_fall_distance_damage   0 = no Halo free-fall kill (falling faster than a 16.5 wu drop)
//   chief/tf_medigun_shield_scale   shield / overshield points per Medi Gun heal point once his health is full
//       (health is always healed first)
//   weapons/<key>/trigger0/tf_tracer   N = a TF2 bullet tracer on 1 of every N rounds
//       (replaces Halo's tracer for that weapon)
//   weapons/<key>/trigger0/tf_tracer_effect   its particle system, without TF2's _red / _blue (default
//       bullet_tracer01; TF2's shotguns use bullet_shotgun_tracer01)
//   projectiles/<name>/tf_deflectable   1 = Pyro airblast can reflect it
//   projectiles/<name>/tf_crit_particle_red, tf_crit_particle_blue   TF2's crit trails on it while its owner is
//       crit-boosted (then it crits), in his team's colour (up to 4, space-separated).  Halo-tracer bullets (no tf_tracer) draw TF2's crit
//       tracer (bullet_tracer01_<team>_crit) beside their own when crit-boosted
//   weapons/<key>/tf_melee_attack   1 = primary fire is Chief's melee (the weapon's melee_damage)
//   weapons/<key>/tf_lunge_speed    > 0: a melee with an enemy under the reticle (autoaim_range /
//       autoaim_angle) dashes Chief to it at this speed (units/s) first (Halo 2's sword lunge)
//   weapons/<key>/tf_melee_recovery   seconds added after a melee with this weapon before Chief can act again
//   weapons/<key>/tf_held_particle   a particle system on the weapon while it's drawn (viewmodel in first person)
//   weapons/<key>/tf_draw_sound, tf_swing_sound, tf_hit_sound   soundscripts played when it's drawn,
//       when its melee swings and when the swing hits
"HaloGameplay"
{
	// --- Chief is modelled at his canon 7'2" (x1.19, masterchief/tools/build_models.py CHIEF_SCALE);
	// his eyes follow, capped just under TF2's 82-unit hull so the camera can't see through ceilings
	// (Halo: 72.6 standing / 41 crouching)
	"chief"
	{
		"standing_camera_height"	"80"
		"crouching_camera_height"	"48.8"

		// --- Shield takes 40% less damage: 100 shield + 100 health = ~267 effective health
		// (Soldier 200, Heavy 300).  Energy weapons (tf_energy, and TF2's Pomson, Bison,
		// Cow Mangler, Short Circuit) ignore it
		"tf_shield_resistance"	"0.4"

		// --- Falling: Halo's killed him from a ~700 unit drop (13 -> 207 damage between 351 and 703 units) and
		// outright in a long free fall - brutal on TF2's vertical maps.  TF2's fall damage instead, starting where
		// TF2's does (~264 units), twice what a 200-health mercenary takes, curving up so big falls still kill:
		// 300 units ~47, 500 ~80, 700 ~127, 1000 ~213, 2000 ~560 (Soldier: 23 / 30 / 35 / 42 / 60), shields first
		"tf_fall_damage_scale"	"2"
		"tf_fall_damage_curve"	"0.00034"
		"tf_fall_distance_damage"	"0"
		// --- Medi Gun: health first, then the shield at half rate: his shield also recharges by itself, and a
		// full-rate beam on it made a pocketed Chief too hard to kill
		"tf_medigun_shield_scale"	"0.5"
	}

	"damage"
	{
		// --- Rocket launcher: 400-440 one-shots every class; 135 (lowered from 160 after playtesting;
		// TF2 soldier: 90) with TF2-like falloff that reaches a little farther (TF2: 512 -> 1024 down to 50%).
		// Blast radius 234 -> 185 u (TF2's rocket: 146), its full-damage core and line-of-sight spread with it
		"rocket_launcher.explosion"
		{
			"damage_minimum"	"41"
			"damage_lower"	"135"
			"damage_upper"	"135"
			"radius_full"	"46.25"
			"radius_cutoff"	"185"
			"core_radius"	"55.5"
			"tf_falloff_start"	"512"
			"tf_falloff_end"	"1536"
			"tf_falloff_min"	"0.5"
		}

		// --- Pistol: 33.3 -> 23 (headshot crit 69), TF2-like falloff, a little longer range
		// (headshot crits fall off too)
		"pistol.bullet"
		{
			"damage_minimum"	"23"
			"damage_lower"	"23"
			"damage_upper"	"23"
			"tf_falloff_start"	"512"
			"tf_falloff_end"	"1536"
			"tf_falloff_min"	"0.5"
			"tf_knockback"	"1"
		}

		// --- Sniper rifle: 134.7 -> 40 (headshot crit 120)
		"sniper_rifle.sniper_bullet"
		{
			"damage_minimum"	"40"
			"damage_lower"	"40"
			"damage_upper"	"40"
			"tf_knockback"	"1"
		}

		"assault_rifle.bullet"
		{
			"tf_knockback"	"1"
		}
		"shotgun.pellet"
		{
			"tf_knockback"	"1"
		}

		// --- Grenades: 160 -> 115, and steeper blast falloff: the frag's full-damage core shrinks
		// from 176 to the plasma's 59 u, and both fall to 57.5 (TF2's 50%) at the edge instead of
		// Halo's 2/3.  80% damage to Engineer buildings
		"frag_grenade.explosion"
		{
			"damage_minimum"	"57.5"
			"damage_lower"	"115"
			"damage_upper"	"115"
			"radius_full"	"58.5714"
			"tf_vs_buildings"	"0.8"
		}
		"plasma_grenade.explosion"
		{
			"damage_minimum"	"57.5"
			"damage_lower"	"115"
			"damage_upper"	"115"
			"tf_vs_buildings"	"0.8"
			"tf_energy"	"1"
		}
		"plasma_grenade.attached"
		{
			"damage_minimum"	"57.5"
			"damage_lower"	"115"
			"damage_upper"	"115"
			"tf_vs_buildings"	"0.8"
			"tf_energy"	"1"
		}

		// --- Plasma: TF2 classes have no shields, so the base damage goes up (Halo's 16-18.7 x1.4, then down to
		// 23 a bolt, then 20, then 16 after playtesting) and the multipliers against Chief go down by about as much
		// (still best against Chiefs).  All plasma is an energy weapon: Chief's shield resistance doesn't apply
		"plasma_rifle.bolt"
		{
			"damage_minimum"	"13.4"
			"damage_lower"	"16"
			"damage_upper"	"16"
			"vs_shield"	"1.45"
			"vs_chief"	"0.4"
			"tf_energy"	"1"
		}
		// (the plasma pistol's normal bolt keeps Halo's 21-27)
		"plasma_pistol.bolt"
		{
			"tf_energy"	"1"
		}
		// overcharged plasma pistol bolt: Halo's x0.2 against flesh made it ~19 damage on mercs;
		// 65 to mercs (85 before playtesting), 71.5 to a Chief's shield (it also strips it: EMP)
		"plasma_rifle.charged_bolt"
		{
			"damage_minimum"	"65"
			"damage_lower"	"65"
			"damage_upper"	"65"
			"vs_human"	"1"
			"vs_shield"	"1.1"
			"vs_chief"	"0.66"
			"tf_energy"	"1"
		}

		// --- Energy sword (from a50, lowered from 50 after playtesting; Halo: CE's Elites hit for
		// 201 + EMP): 40, always a crit (x3 = 120; the item's "halo always crit" attribute), the same
		// at any speed (Halo scales melee by forward speed down to damage_minimum).  Energy: ignores
		// Chief's shield resistance.  x2 against a shield that's up: a hit on a full Chief breaks the
		// shield and leaves him at 30 health (120 x2 = 240 vs 100 shield, 140 / 2 = 70 through), so two
		// hits kill from full even if his shield came back in between
		"energy_sword.melee"
		{
			"damage_minimum"	"40"
			"damage_lower"	"40"
			"damage_upper"	"40"
			"tf_energy"	"1"
			"tf_shield_bonus"	"2"
		}
		// --- Halo's flag melee (weapons\flag\melee), swung by a Chief holding the intel (tf_masterchief_halo_flag).
		// The flag weapon isn't part of the import, so the whole effect is here: Halo's 80 x 4/3, flat (speed doesn't
		// scale it), x1 vs shield and body - one hit kills an unshielded Chief, as in Halo - and lethal from behind.
		// Halo gives it no impact sound: the assault rifle's
		"flag.melee"
		{
			"damage_minimum"	"106.667"
			"damage_lower"	"106.667"
			"damage_upper"	"106.667"
			"radius_full"	"58.5714"
			"radius_cutoff"	"58.5714"
			"vs_shield"	"1"
			"vs_chief"	"1"
			"vs_human"	"1"
			"vs_world"	"0"
			"lethal_unsuspecting"	"1"
			"not_owner"	"1"
			"flash_time"	"1"
			"flash_intensity"	"0.2"
			"flash_color"	"0 1 0.0902"
			"flash_type"	"lighten"
			"sound"	"sound\sfx\impulse\melee\assault_impact"
		}
	}

	"projectiles"
	{
		// --- Rocket: Halo's 23-unit-wide rocket catches walls and corners a TF2 rocket clears
		// (crit: the Rocket Launcher's crit trail)
		"rocket_launcher.rocket"
		{
			"radius"	"2"
			"tf_deflectable"	"1"
			"tf_crit_particle_red"	"critical_rocket_red"
			"tf_crit_particle_blue"	"critical_rocket_blue"
		}
		// Pyro airblast reflects rockets and grenades, not plasma or needles.  Crit: the frag the Grenade
		// Launcher's pipe crit trail, the sticky plasma grenade the Stickybomb Launcher's crit glow
		"frag_grenade"
		{
			"tf_deflectable"	"1"
			"tf_crit_particle_red"	"critical_pipe_red"
			"tf_crit_particle_blue"	"critical_pipe_blue"
		}
		"plasma_grenade"
		{
			"tf_deflectable"	"1"
			"tf_crit_particle_red"	"critical_grenade_red"
			"tf_crit_particle_blue"	"critical_grenade_blue"
		}

		// --- Crit trails of the energy and needle rounds: plasma bolts (the plasma rifle's, the plasma pistol's
		// and its overcharged shot) the Capper's crit streaks (TF2's energy blaster); needles the Syringe Gun's.
		// The overcharged shot, a big slow orb, also the Rocket Launcher's crit trail and the Stickybomb's crit glow
		"plasma_rifle.bolt"
		{
			"tf_crit_particle_red"	"raygun_projectile_red_crit_trail"
			"tf_crit_particle_blue"	"raygun_projectile_blue_crit_trail"
		}
		"plasma_pistol.bolt"
		{
			"tf_crit_particle_red"	"raygun_projectile_red_crit_trail"
			"tf_crit_particle_blue"	"raygun_projectile_blue_crit_trail"
		}
		"plasma_rifle.charged_bolt"
		{
			"tf_crit_particle_red"	"raygun_projectile_red_crit_trail critical_rocket_red critical_grenade_red"
			"tf_crit_particle_blue"	"raygun_projectile_blue_crit_trail critical_rocket_blue critical_grenade_blue"
		}
		"needler.needle"
		{
			"tf_crit_particle_red"	"nailtrails_medic_red_crit"
			"tf_crit_particle_blue"	"nailtrails_medic_blue_crit"
		}
	}

	"weapons"
	{
		// --- Shotgun: 15 pellets in a 10 degree cone -> 12 pellets in 8 degrees (TF2: 10)
		"shotgun"
		{
			"trigger0"
			{
				"projectiles_per_shot"	"12"
				"error_lower"	"8"
				"error_upper"	"8"
				// TF2's shotgun tracers, on every other pellet as TF2's shotguns
				"tf_tracer"	"2"
				"tf_tracer_effect"	"bullet_shotgun_tracer01"
			}
		}
		"assault_rifle"
		{
			"trigger0"
			{
				"tf_tracer"	"2"
			}
		}
		"pistol"
		{
			"trigger0"
			{
				"tf_tracer"	"1"
			}
		}
		// --- Plasma pistol: Halo fires its bolts as fast as you click (rate 0: every Halo tick, 30 a second,
		// held under tf_halo_hold_to_fire); 6 a second (0.167 s apart, TF2's pistol 0.15 s), so held it heats up
		// over about a second (6 shots to overheat) instead of emptying at once
		"plasma_pistol"
		{
			"trigger0"
			{
				"rof_initial"	"6"
				"rof_final"	"6"
			}
		}
		// --- Sniper rifle: 2 shots a second -> 1.15 (~0.87 s apart: slower, not TF2's sniper's 1.5 s)
		"sniper_rifle"
		{
			"trigger0"
			{
				"rof_initial"	"1.15"
				"rof_final"	"1.15"
			}
		}

		// --- Energy sword: no triggers; the attack is Chief's melee (tf_melee_attack) with a
		// Halo 2 lunge at an enemy within the autoaim range/angle, which is also when the reticle
		// turns red.  Its Halo label "fb" (Elite) has no Chief animations: "es" is its own type made from
		// your animations (chief_weapons.py custom_tp; pistol class otherwise).  Halo has no sword HUD: the
		// plasma pistol's
		"energy_sword"
		{
			"label"	"es"
			"hud_interface"	"weapons\plasma pistol\plasma pistol"
			"autoaim_range"	"240"
			"autoaim_angle"	"8"
			"tf_melee_attack"	"1"
			"tf_lunge_speed"	"1000"
			// after a swing Chief can't attack again for the swing (~0.83 s) + this: ~1.1 s between swings
			"tf_melee_recovery"	"0.3"
			// crit sparks along the blade whenever the sword is out (it always crits): TF2's, recoloured white-teal
			// (masterchief/tools/make_particles.py), on the blade hitboxes (build_models.py blade_hitboxes)
			"tf_held_particle"	"halo_energy_sword_sparks"
			// custom sounds (Halo: CE has none for the sword): scripts/game_sounds_masterchief.txt
			"tf_draw_sound"	"MasterChief.EnergySword.Draw"
			"tf_swing_sound"	"MasterChief.EnergySword.Swing"
			"tf_hit_sound"	"MasterChief.EnergySword.Hit"
		}
	}
}
