From 4fa70cdfb922c0042c00a5483830ad3274d271bf Mon Sep 17 00:00:00 2001 From: Zimmermann Gyula Date: Wed, 6 Jul 2016 16:42:58 +0200 Subject: [PATCH 1/3] Add a percentage option to SelfHealing. --- OpenRA.Mods.Common/Traits/SelfHealing.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/SelfHealing.cs b/OpenRA.Mods.Common/Traits/SelfHealing.cs index 0b17489789..ed39fcaa38 100644 --- a/OpenRA.Mods.Common/Traits/SelfHealing.cs +++ b/OpenRA.Mods.Common/Traits/SelfHealing.cs @@ -16,10 +16,18 @@ namespace OpenRA.Mods.Common.Traits [Desc("Attach this to actors which should be able to regenerate their health points.")] class SelfHealingInfo : UpgradableTraitInfo, Requires { + [Desc("Absolute amount of health points added in each step.")] public readonly int Step = 5; + + [Desc("Relative percentages of health added in each step.", + "When both values are defined, their summary will be applied.")] + public readonly int PercentageStep = 0; + public readonly int Delay = 5; + [Desc("Heal if current health is below this percentage of full health.")] public readonly int HealIfBelow = 50; + public readonly int DamageCooldown = 0; public override object Create(ActorInitializer init) { return new SelfHealing(init.Self, this); } @@ -55,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits if (--ticks <= 0) { ticks = Info.Delay; - self.InflictDamage(self, new Damage(-Info.Step)); + self.InflictDamage(self, new Damage(-(Info.Step + Info.PercentageStep * health.MaxHP / 100))); } } From 3ac5e0b45575ab9bce33eb9b64ab4f56958b2385 Mon Sep 17 00:00:00 2001 From: Zimmermann Gyula Date: Wed, 6 Jul 2016 16:48:46 +0200 Subject: [PATCH 2/3] Add a damagetype option to SelfHealing. --- OpenRA.Mods.Common/Traits/SelfHealing.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/SelfHealing.cs b/OpenRA.Mods.Common/Traits/SelfHealing.cs index ed39fcaa38..745455ed2f 100644 --- a/OpenRA.Mods.Common/Traits/SelfHealing.cs +++ b/OpenRA.Mods.Common/Traits/SelfHealing.cs @@ -9,6 +9,7 @@ */ #endregion +using System.Collections.Generic; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits @@ -30,6 +31,9 @@ namespace OpenRA.Mods.Common.Traits public readonly int DamageCooldown = 0; + [Desc("Apply the selfhealing using these damagetypes.")] + public readonly HashSet DamageTypes = new HashSet(); + public override object Create(ActorInitializer init) { return new SelfHealing(init.Self, this); } } @@ -63,7 +67,7 @@ namespace OpenRA.Mods.Common.Traits if (--ticks <= 0) { ticks = Info.Delay; - self.InflictDamage(self, new Damage(-(Info.Step + Info.PercentageStep * health.MaxHP / 100))); + self.InflictDamage(self, new Damage(-(Info.Step + Info.PercentageStep * health.MaxHP / 100), Info.DamageTypes)); } } From 35cbb7adbb0a114738e3fae22766415eae49c0a6 Mon Sep 17 00:00:00 2001 From: Zimmermann Gyula Date: Wed, 27 Jul 2016 01:22:07 +0200 Subject: [PATCH 3/3] Change the Dune 2000 selfhealing from 2 HP to 4% per 125 frames. --- mods/d2k/rules/defaults.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml index c0c9116a9b..3c234957d7 100644 --- a/mods/d2k/rules/defaults.yaml +++ b/mods/d2k/rules/defaults.yaml @@ -38,7 +38,8 @@ UpgradeTypes: inaccuracy Modifier: 90, 80, 70, 50 SelfHealing@ELITE: - Step: 2 + Step: 0 + PercentageStep: 4 Delay: 125 HealIfBelow: 100 DamageCooldown: 125