much simpler rules loader

This commit is contained in:
Chris Forbes
2010-04-01 21:31:15 +13:00
parent c5fdda9141
commit 38605faecf
16 changed files with 110 additions and 120 deletions

View File

@@ -35,23 +35,21 @@ namespace OpenRA.Mods.RA.Activities
{
if (target == null || target.IsDead) return NextActivity;
var warhead = Rules.WarheadInfo["Super"];
if (self.Owner.Stances[ target.Owner ] == Stance.Ally)
{
if (target.Health == target.Info.Traits.Get<OwnedActorInfo>().HP)
return NextActivity;
target.InflictDamage(self, -EngineerCapture.EngineerDamage, warhead);
target.InflictDamage(self, -EngineerCapture.EngineerDamage, null);
}
else
{
if (target.Health - EngineerCapture.EngineerDamage <= 0)
{
target.Owner = self.Owner;
target.InflictDamage(self, target.Health - EngineerCapture.EngineerDamage, warhead);
target.InflictDamage(self, target.Health - EngineerCapture.EngineerDamage, null);
}
else
target.InflictDamage(self, EngineerCapture.EngineerDamage, warhead);
target.InflictDamage(self, EngineerCapture.EngineerDamage, null);
}
// the engineer is sacrificed.

View File

@@ -36,8 +36,8 @@ namespace OpenRA.Mods.RA.Activities
public IActivity Tick(Actor self)
{
if (target == null || target.IsDead) return NextActivity;
self.World.AddFrameEndTask(w => w.Add(new DelayedAction(25*2,
() => target.InflictDamage(self, target.Health, Rules.WarheadInfo["DemolishWarhead"]))));
self.World.AddFrameEndTask(w => w.Add(new DelayedAction(25 * 2,
() => target.InflictDamage(self, target.Health, null))));
return NextActivity;
}

View File

@@ -22,6 +22,7 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.Effects;
using OpenRA.Traits;
using OpenRA.Traits.Activities;
namespace OpenRA.Mods.RA
{
@@ -50,14 +51,8 @@ namespace OpenRA.Mods.RA
return;
var info = self.Info.Traits.Get<MineInfo>();
var warhead = Rules.WarheadInfo[info.Warhead];
self.World.AddFrameEndTask(w =>
{
w.Remove(self);
w.Add(new Explosion(w, self.CenterLocation.ToInt2(), warhead.Explosion, false));
crusher.InflictDamage(crusher, info.Damage, warhead);
});
Combat.DoExplosion(self, info.Warhead, self.CenterLocation.ToInt2(), 0);
self.QueueActivity(new RemoveSelf());
}
public bool IsPathableCrush(UnitMovementType umt, Player player)