Make capturing grant player experience
This commit is contained in:
@@ -65,6 +65,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
if (building != null && building.Locked)
|
||||
building.Unlock();
|
||||
|
||||
if (self.Owner.Stances[oldOwner].HasStance(capturesInfo.PlayerExperienceStances))
|
||||
{
|
||||
var exp = self.Owner.PlayerActor.TraitOrDefault<PlayerExperience>();
|
||||
if (exp != null)
|
||||
exp.GiveExperience(capturesInfo.PlayerExperience);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -77,6 +77,13 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
capturable.EndCapture();
|
||||
|
||||
if (self.Owner.Stances[oldOwner].HasStance(capturesInfo.PlayerExperienceStances))
|
||||
{
|
||||
var exp = self.Owner.PlayerActor.TraitOrDefault<PlayerExperience>();
|
||||
if (exp != null)
|
||||
exp.GiveExperience(capturesInfo.PlayerExperience);
|
||||
}
|
||||
|
||||
if (capturesInfo != null && capturesInfo.ConsumeActor)
|
||||
self.Dispose();
|
||||
});
|
||||
|
||||
@@ -22,11 +22,19 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Desc("Types of actors that it can capture, as long as the type also exists in the Capturable Type: trait.")]
|
||||
public readonly HashSet<string> CaptureTypes = new HashSet<string> { "building" };
|
||||
|
||||
[Desc("Unit will do damage to the actor instead of capturing it. Unit is destroyed when sabotaging.")]
|
||||
public readonly bool Sabotage = true;
|
||||
|
||||
[Desc("Only used if Sabotage=true. Sabotage damage expressed as a percentage of enemy health removed.")]
|
||||
public readonly int SabotageHPRemoval = 50;
|
||||
|
||||
[Desc("Experience granted to the capturing player.")]
|
||||
public readonly int PlayerExperience = 0;
|
||||
|
||||
[Desc("Stance that the structure's previous owner needs to have for the capturing player to receive Experience.")]
|
||||
public readonly Stance PlayerExperienceStances = Stance.Enemy;
|
||||
|
||||
[VoiceReference] public readonly string Voice = "Action";
|
||||
|
||||
public object Create(ActorInitializer init) { return new Captures(init.Self, this); }
|
||||
|
||||
@@ -26,6 +26,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Destroy the unit after capturing.")]
|
||||
public readonly bool ConsumeActor = false;
|
||||
|
||||
[Desc("Experience granted to the capturing player.")]
|
||||
public readonly int PlayerExperience = 0;
|
||||
|
||||
[Desc("Stance that the structure's previous owner needs to have for the capturing player to receive Experience.")]
|
||||
public readonly Stance PlayerExperienceStances = Stance.Enemy;
|
||||
|
||||
[VoiceReference] public readonly string Voice = "Action";
|
||||
|
||||
public object Create(ActorInitializer init) { return new ExternalCaptures(init.Self, this); }
|
||||
|
||||
Reference in New Issue
Block a user