merged
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
@@ -184,6 +184,7 @@
|
||||
<Compile Include="Traits\InvisibleToOthers.cs" />
|
||||
<Compile Include="Traits\MineImmune.cs" />
|
||||
<Compile Include="Traits\Minelayer.cs" />
|
||||
<Compile Include="Traits\LimitedAmmo.cs" />
|
||||
<Compile Include="Traits\SquishByTank.cs" />
|
||||
<Compile Include="Traits\Plane.cs" />
|
||||
<Compile Include="Traits\ProductionQueue.cs" />
|
||||
@@ -266,4 +267,4 @@
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -91,6 +91,11 @@ namespace OpenRa.Game.Traits
|
||||
bool CheckFire(Actor self, Unit unit, string weaponName, ref int fireDelay, int[] offset, ref int burst)
|
||||
{
|
||||
if (fireDelay > 0) return false;
|
||||
|
||||
var limitedAmmo = self.traits.GetOrDefault<LimitedAmmo>();
|
||||
if (!limitedAmmo.HasAmmo())
|
||||
return false;
|
||||
|
||||
var weapon = Rules.WeaponInfo[weaponName];
|
||||
if (weapon.Range * weapon.Range < (target.Location - self.Location).LengthSquared) return false;
|
||||
|
||||
|
||||
29
OpenRa.Game/Traits/LimitedAmmo.cs
Normal file
29
OpenRa.Game/Traits/LimitedAmmo.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
class LimitedAmmo : INotifyAttack, IPips
|
||||
{
|
||||
int ammo;
|
||||
Actor self;
|
||||
|
||||
public LimitedAmmo(Actor self)
|
||||
{
|
||||
ammo = self.Info.Ammo;
|
||||
this.self = self;
|
||||
}
|
||||
|
||||
public bool HasAmmo() { return ammo > 0; }
|
||||
|
||||
public void Attacking(Actor self) { --ammo; }
|
||||
|
||||
public IEnumerable<PipType> GetPips()
|
||||
{
|
||||
return Graphics.Util.MakeArray(self.Info.Ammo,
|
||||
i => ammo > i ? PipType.Green : PipType.Transparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,13 +165,13 @@ HIND
|
||||
[MIG]
|
||||
Description=Mig Attack Plane
|
||||
BuiltAt=afld
|
||||
Traits=Unit, Plane, RenderUnit, WithShadow
|
||||
Traits=Unit, Plane, RenderUnit, WithShadow, LimitedAmmo
|
||||
InitialFacing=192
|
||||
LongDesc=Fast Ground-Attack Plane.\n Strong vs Buildings\n Weak vs Infantry, Light Vehicles
|
||||
[YAK]
|
||||
Description=Yak Attack Plane
|
||||
BuiltAt=afld
|
||||
Traits=Unit, Plane, RenderUnit, WithShadow
|
||||
Traits=Unit, Plane, RenderUnit, WithShadow, LimitedAmmo
|
||||
InitialFacing=192
|
||||
LongDesc=Anti-Tanks & Anti-Infantry Plane.\n Strong vs Infantry, Tanks\n Weak vs Buildings
|
||||
[TRAN]
|
||||
@@ -185,14 +185,14 @@ LongDesc=Fast Infantry Transport Helicopter.\n Unarmed
|
||||
[HELI]
|
||||
Description=Longbow
|
||||
BuiltAt=hpad
|
||||
Traits=Unit, Helicopter, RenderUnitRotor, WithShadow
|
||||
Traits=Unit, Helicopter, RenderUnitRotor, WithShadow, LimitedAmmo
|
||||
PrimaryOffset=0,0,0,-2
|
||||
InitialFacing=20
|
||||
LongDesc=Helicopter Gunship with AG Missiles.\n Strong vs Buildings, Tanks\n Weak vs Infantry
|
||||
[HIND]
|
||||
Description=Hind
|
||||
BuiltAt=hpad
|
||||
Traits=Unit, Helicopter, RenderUnitRotor, WithShadow
|
||||
Traits=Unit, Helicopter, RenderUnitRotor, WithShadow, LimitedAmmo
|
||||
InitialFacing=20
|
||||
LongDesc=Helicopter Gunship with Chainguns.\n Strong vs Infantry, Light Vehicles.\n Weak vs Tanks
|
||||
|
||||
|
||||
Reference in New Issue
Block a user