more cleanup
This commit is contained in:
@@ -90,7 +90,7 @@ namespace OpenRA
|
||||
return rawDamage * multiplier;
|
||||
}
|
||||
|
||||
public static bool WeaponValidForTarget(NewWeaponInfo weapon, Actor target)
|
||||
public static bool WeaponValidForTarget(WeaponInfo weapon, Actor target)
|
||||
{
|
||||
return true; // massive hack, and very wrong.
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA
|
||||
return xs.Aggregate(1f, (a, x) => a * x);
|
||||
}
|
||||
|
||||
public static NewWeaponInfo GetPrimaryWeapon(this Actor self)
|
||||
public static WeaponInfo GetPrimaryWeapon(this Actor self)
|
||||
{
|
||||
var info = self.Info.Traits.GetOrDefault<AttackBaseInfo>();
|
||||
if (info == null) return null;
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA
|
||||
return Rules.Weapons[weapon.ToLowerInvariant()];
|
||||
}
|
||||
|
||||
public static NewWeaponInfo GetSecondaryWeapon(this Actor self)
|
||||
public static WeaponInfo GetSecondaryWeapon(this Actor self)
|
||||
{
|
||||
var info = self.Info.Traits.GetOrDefault<AttackBaseInfo>();
|
||||
if (info == null) return null;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA
|
||||
public static TechTree TechTree;
|
||||
|
||||
public static Dictionary<string, ActorInfo> Info;
|
||||
public static Dictionary<string, NewWeaponInfo> Weapons;
|
||||
public static Dictionary<string, WeaponInfo> Weapons;
|
||||
|
||||
public static void LoadRules(string map, Manifest m)
|
||||
{
|
||||
@@ -64,9 +64,9 @@ namespace OpenRA
|
||||
Info.Add(kv.Key.ToLowerInvariant(), new ActorInfo(kv.Key.ToLowerInvariant(), kv.Value, yamlRules));
|
||||
|
||||
var weaponsYaml = m.Weapons.Select(a => MiniYaml.FromFile(a)).Aggregate(MiniYaml.Merge);
|
||||
Weapons = new Dictionary<string, NewWeaponInfo>();
|
||||
Weapons = new Dictionary<string, WeaponInfo>();
|
||||
foreach (var kv in weaponsYaml)
|
||||
Weapons.Add(kv.Key.ToLowerInvariant(), new NewWeaponInfo(kv.Key.ToLowerInvariant(), kv.Value));
|
||||
Weapons.Add(kv.Key.ToLowerInvariant(), new WeaponInfo(kv.Key.ToLowerInvariant(), kv.Value));
|
||||
|
||||
TechTree = new TechTree();
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||
* This file is part of OpenRA.
|
||||
*
|
||||
* OpenRA is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OpenRA is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
namespace OpenRA.GameRules
|
||||
{
|
||||
public class WarheadInfo
|
||||
{
|
||||
public readonly int Spread = 1;
|
||||
public readonly float[] Verses = { 1, 1, 1, 1, 1 };
|
||||
public readonly bool Wall = false;
|
||||
public readonly bool Wood = false;
|
||||
public readonly bool Ore = false;
|
||||
public readonly int Explosion = 0;
|
||||
public readonly SmudgeType SmudgeType = SmudgeType.None;
|
||||
public readonly int[] SmudgeSize = { 0,0 };
|
||||
public readonly int InfDeath = 0;
|
||||
public readonly string ImpactSound = null;
|
||||
public readonly string WaterImpactSound = null;
|
||||
public readonly int Damage = 0; // for new weapons infrastructure
|
||||
public readonly int Delay = 0; // delay in ticks before dealing the damage. 0=instant
|
||||
|
||||
public float EffectivenessAgainst(ArmorType at) { return Verses[ (int)at ]; }
|
||||
}
|
||||
|
||||
public enum ArmorType
|
||||
{
|
||||
none = 0,
|
||||
wood = 1,
|
||||
light = 2,
|
||||
heavy = 3,
|
||||
concrete = 4,
|
||||
}
|
||||
|
||||
public enum SmudgeType
|
||||
{
|
||||
None = 0,
|
||||
Crater = 1,
|
||||
Scorch = 2,
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,44 @@ using System;
|
||||
|
||||
namespace OpenRA.GameRules
|
||||
{
|
||||
public class WarheadInfo
|
||||
{
|
||||
public readonly int Spread = 1;
|
||||
public readonly float[] Verses = { 1, 1, 1, 1, 1 };
|
||||
public readonly bool Wall = false;
|
||||
public readonly bool Wood = false;
|
||||
public readonly bool Ore = false;
|
||||
public readonly int Explosion = 0;
|
||||
public readonly SmudgeType SmudgeType = SmudgeType.None;
|
||||
public readonly int[] SmudgeSize = { 0, 0 };
|
||||
public readonly int InfDeath = 0;
|
||||
public readonly string ImpactSound = null;
|
||||
public readonly string WaterImpactSound = null;
|
||||
public readonly int Damage = 0; // for new weapons infrastructure
|
||||
public readonly int Delay = 0; // delay in ticks before dealing the damage. 0=instant
|
||||
|
||||
public float EffectivenessAgainst(ArmorType at) { return Verses[(int)at]; }
|
||||
}
|
||||
|
||||
public enum ArmorType
|
||||
{
|
||||
none = 0,
|
||||
wood = 1,
|
||||
light = 2,
|
||||
heavy = 3,
|
||||
concrete = 4,
|
||||
}
|
||||
|
||||
public enum SmudgeType
|
||||
{
|
||||
None = 0,
|
||||
Crater = 1,
|
||||
Scorch = 2,
|
||||
}
|
||||
|
||||
public class ProjectileArgs
|
||||
{
|
||||
public NewWeaponInfo weapon;
|
||||
public WeaponInfo weapon;
|
||||
public Actor firedBy;
|
||||
public int2 src;
|
||||
public int srcAltitude;
|
||||
@@ -37,12 +72,9 @@ namespace OpenRA.GameRules
|
||||
public int destAltitude;
|
||||
}
|
||||
|
||||
public interface IProjectileInfo
|
||||
{
|
||||
IEffect Create(ProjectileArgs args);
|
||||
}
|
||||
public interface IProjectileInfo { IEffect Create(ProjectileArgs args); }
|
||||
|
||||
public class NewWeaponInfo
|
||||
public class WeaponInfo
|
||||
{
|
||||
public readonly float Range = 0;
|
||||
public readonly string Report = null;
|
||||
@@ -53,7 +85,7 @@ namespace OpenRA.GameRules
|
||||
public IProjectileInfo Projectile;
|
||||
public List<WarheadInfo> Warheads = new List<WarheadInfo>();
|
||||
|
||||
public NewWeaponInfo(string name, MiniYaml content)
|
||||
public WeaponInfo(string name, MiniYaml content)
|
||||
{
|
||||
foreach (var kv in content.Nodes)
|
||||
{
|
||||
@@ -75,7 +75,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Chat.cs" />
|
||||
<Compile Include="Chrome.cs" />
|
||||
<Compile Include="GameRules\NewWeaponInfo.cs" />
|
||||
<Compile Include="GameRules\WeaponInfo.cs" />
|
||||
<Compile Include="Traits\AI\ReturnOnIdle.cs" />
|
||||
<Compile Include="Traits\World\Shroud.cs" />
|
||||
<Compile Include="Widgets\Delegates\ConnectionDialogsDelegate.cs" />
|
||||
@@ -155,7 +155,6 @@
|
||||
<Compile Include="GameRules\Footprint.cs" />
|
||||
<Compile Include="GameRules\InfoLoader.cs" />
|
||||
<Compile Include="GameRules\Rules.cs" />
|
||||
<Compile Include="GameRules\WarheadInfo.cs" />
|
||||
<Compile Include="Graphics\Animation.cs" />
|
||||
<Compile Include="Game.cs" />
|
||||
<Compile Include="Graphics\CursorSequence.cs" />
|
||||
|
||||
Reference in New Issue
Block a user