Merge pull request #12969 from atlimit8/UncloakOnDamageSign

UncloakOn: Damage, Heal, SelfHeal split
This commit is contained in:
abcdefg30
2017-03-17 21:12:10 +01:00
committed by GitHub
7 changed files with 22 additions and 9 deletions

View File

@@ -84,7 +84,7 @@ namespace OpenRA.Mods.Common.Activities
return this;
}
self.InflictDamage(self, new Damage(-hpToRepair));
self.InflictDamage(host.Actor, new Damage(-hpToRepair));
foreach (var depot in host.Actor.TraitsImplementing<INotifyRepair>())
depot.Repairing(host.Actor, self);

View File

@@ -29,7 +29,9 @@ namespace OpenRA.Mods.Common.Traits
Infiltrate = 8,
Demolish = 16,
Damage = 32,
Dock = 64
Heal = 64,
SelfHeal = 128,
Dock = 256
}
[Desc("This unit can cloak and uncloak in specific situations.")]
@@ -41,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Measured in game ticks.")]
public readonly int CloakDelay = 30;
[Desc("Events leading to the actor getting uncloaked. Possible values are: Attack, Move, Unload, Infiltrate, Demolish, Dock and Damage")]
[Desc("Events leading to the actor getting uncloaked. Possible values are: Attack, Move, Unload, Infiltrate, Demolish, Dock, Damage, Heal and SelfHeal.")]
public readonly UncloakType UncloakOn = UncloakType.Attack
| UncloakType.Unload | UncloakType.Infiltrate | UncloakType.Demolish | UncloakType.Dock;
@@ -101,7 +103,13 @@ namespace OpenRA.Mods.Common.Traits
void INotifyDamage.Damaged(Actor self, AttackInfo e)
{
if (Info.UncloakOn.HasFlag(UncloakType.Damage))
if (e.Damage.Value == 0)
return;
var type = e.Damage.Value < 0
? (e.Attacker == self ? UncloakType.SelfHeal : UncloakType.Heal)
: UncloakType.Damage;
if (Info.UncloakOn.HasFlag(type))
Uncloak();
}

View File

@@ -573,6 +573,11 @@ namespace OpenRA.Mods.Common.UtilityCommands
if (node.Key.StartsWith("DisguiseToolTip", StringComparison.Ordinal))
RenameNodeKey(node, "DisguiseTooltip");
// Split UncloakOn: Damage => Damage, Heal, SelfHeal
if (engineVersion < 20170315)
if (node.Key.StartsWith("UncloakOn", StringComparison.Ordinal))
node.Value.Value = node.Value.Value.Replace("Damage", "Damage, Heal, SelfHeal");
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
}

View File

@@ -150,7 +150,7 @@ fremen:
Cloak:
InitialDelay: 85
CloakDelay: 85
UncloakOn: Attack, Unload, Infiltrate, Demolish, Dock, Damage
UncloakOn: Attack, Unload, Infiltrate, Demolish, Dock, Damage, Heal
CloakSound: STEALTH1.WAV
UncloakSound: STEALTH2.WAV
IsPlayerPalette: true
@@ -251,7 +251,7 @@ saboteur:
CloakDelay: 85
CloakSound: STEALTH1.WAV
UncloakSound: STEALTH2.WAV
UncloakOn: Attack, Unload, Infiltrate, Demolish, Move, Damage
UncloakOn: Attack, Unload, Infiltrate, Demolish, Move, Damage, Heal
IsPlayerPalette: true
RequiresCondition: !cloak-force-disabled
GrantConditionOnDamageState@UNCLOAK:

View File

@@ -392,7 +392,7 @@ stealth_raider:
Cloak:
InitialDelay: 45
CloakDelay: 90
UncloakOn: Attack, Unload, Infiltrate, Demolish, Dock, Damage
UncloakOn: Attack, Unload, Infiltrate, Demolish, Dock, Damage, Heal
CloakSound: STEALTH1.WAV
UncloakSound: STEALTH2.WAV
IsPlayerPalette: true

View File

@@ -117,7 +117,7 @@
IsPlayerPalette: true
CloakSound: cloak5.aud
UncloakSound: cloak5.aud
UncloakOn: Attack, Unload, Infiltrate, Demolish, Damage
UncloakOn: Attack, Unload, Infiltrate, Demolish, Damage, Heal
ExternalCondition@CLOAKGENERATOR:
Condition: cloakgenerator
ExternalCondition@CRATE-CLOAK:

View File

@@ -395,7 +395,7 @@ STNK:
CloakSound: cloak5.aud
UncloakSound: cloak5.aud
IsPlayerPalette: true
UncloakOn: Attack, Unload, Infiltrate, Demolish, Damage
UncloakOn: Attack, Unload, Infiltrate, Demolish, Damage, Heal
RequiresCondition: !cloak-force-disabled
GrantConditionOnDamageState@UNCLOAK:
Condition: cloak-force-disabled