diff --git a/OpenRA.Game/Combat.cs b/OpenRA.Game/Combat.cs index fc223aca98..4ba3c0cf85 100644 --- a/OpenRA.Game/Combat.cs +++ b/OpenRA.Game/Combat.cs @@ -82,11 +82,6 @@ namespace OpenRA } } - static float GetMaximumSpread(WeaponInfo weapon, WarheadInfo warhead, float modifier) - { - return (int)(warhead.Spread * Math.Log(Math.Abs(weapon.Damage * modifier), 2)); - } - static float GetDamageToInflict(Actor target, ProjectileArgs args, WarheadInfo warhead, float modifier) { var distance = (target.CenterLocation - args.dest).Length; @@ -95,7 +90,7 @@ namespace OpenRA return rawDamage * multiplier; } - public static bool WeaponValidForTarget(WeaponInfo weapon, Actor target) + public static bool WeaponValidForTarget(NewWeaponInfo weapon, Actor target) { return true; // massive hack, and very wrong. diff --git a/OpenRA.Game/Effects/NukeLaunch.cs b/OpenRA.Game/Effects/NukeLaunch.cs index 3553e35727..b1f447c585 100644 --- a/OpenRA.Game/Effects/NukeLaunch.cs +++ b/OpenRA.Game/Effects/NukeLaunch.cs @@ -40,13 +40,11 @@ namespace OpenRA.Effects readonly int targetAltitude = 400; int altitude; bool goingUp = true; - WeaponInfo weapon; public NukeLaunch(Actor silo, string weapon, int2 targetLocation) { this.silo = silo; this.targetLocation = targetLocation; - this.weapon = Rules.WeaponInfo[weapon]; anim = new Animation("nuke"); anim.PlayRepeating("up"); pos = silo.CenterLocation; diff --git a/OpenRA.Game/Exts.cs b/OpenRA.Game/Exts.cs index 0555cbbbdc..c04bfd6827 100644 --- a/OpenRA.Game/Exts.cs +++ b/OpenRA.Game/Exts.cs @@ -44,7 +44,7 @@ namespace OpenRA return xs.Aggregate(1f, (a, x) => a * x); } - public static WeaponInfo GetPrimaryWeapon(this Actor self) + public static NewWeaponInfo GetPrimaryWeapon(this Actor self) { var info = self.Info.Traits.GetOrDefault(); if (info == null) return null; @@ -52,10 +52,10 @@ namespace OpenRA var weapon = info.PrimaryWeapon; if (weapon == null) return null; - return Rules.WeaponInfo[weapon]; + return Rules.Weapons[weapon.ToLowerInvariant()]; } - public static WeaponInfo GetSecondaryWeapon(this Actor self) + public static NewWeaponInfo GetSecondaryWeapon(this Actor self) { var info = self.Info.Traits.GetOrDefault(); if (info == null) return null; @@ -63,7 +63,7 @@ namespace OpenRA var weapon = info.SecondaryWeapon; if (weapon == null) return null; - return Rules.WeaponInfo[weapon]; + return Rules.Weapons[weapon.ToLowerInvariant()]; } public static int GetMaxHP(this Actor self) diff --git a/OpenRA.Game/GameRules/Rules.cs b/OpenRA.Game/GameRules/Rules.cs index 640f61c027..dd5f3271fe 100755 --- a/OpenRA.Game/GameRules/Rules.cs +++ b/OpenRA.Game/GameRules/Rules.cs @@ -30,7 +30,6 @@ namespace OpenRA { public static IniFile AllRules; public static Dictionary> Categories = new Dictionary>(); - public static InfoLoader WeaponInfo; public static InfoLoader WarheadInfo; public static InfoLoader VoiceInfo; public static TechTree TechTree; @@ -50,8 +49,6 @@ namespace OpenRA "Projectile", "Voice"); - WeaponInfo = new InfoLoader( - Pair.New>("Weapon", _ => new WeaponInfo())); WarheadInfo = new InfoLoader( Pair.New>("Warhead", _ => new WarheadInfo())); VoiceInfo = new InfoLoader( diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs deleted file mode 100755 index 4e893d7d38..0000000000 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ /dev/null @@ -1,41 +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 . - */ -#endregion - -namespace OpenRA.GameRules -{ - public class WeaponInfo - { - public readonly int Burst = 1; - public readonly bool Charges = false; - public readonly int Damage = 0; - public readonly string Projectile = "Invisible"; - public readonly int ROF = 1; // in 1/15 second units. - public readonly float Range = 0; - public readonly string Report = null; - public readonly int Speed = -1; - public readonly bool TurboBoost = false; - public readonly string Warhead = null; - - public readonly bool RenderAsTesla = false; - public readonly bool RenderAsLaser = false; - public readonly bool UsePlayerColor = true; - public readonly int BeamRadius = 1; - } -} diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 3a98564aa4..5e6910cc69 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -156,7 +156,6 @@ - diff --git a/OpenRA.Game/Traits/Attack/AttackBase.cs b/OpenRA.Game/Traits/Attack/AttackBase.cs index e809a4a6c9..709c30db1d 100755 --- a/OpenRA.Game/Traits/Attack/AttackBase.cs +++ b/OpenRA.Game/Traits/Attack/AttackBase.cs @@ -142,7 +142,7 @@ namespace OpenRA.Traits if (limitedAmmo != null && !limitedAmmo.HasAmmo()) return false; - var weapon = Rules.WeaponInfo[weaponName]; + var weapon = Rules.Weapons[weaponName.ToLowerInvariant()]; if (weapon.Range * weapon.Range < (target.Location - self.Location).LengthSquared) return false; if (!Combat.WeaponValidForTarget(weapon, target)) return false; @@ -211,7 +211,7 @@ namespace OpenRA.Traits if (mi.Button == MouseButton.Left || underCursor == null || underCursor.Owner == null) return null; if (self == underCursor) return null; - var isHeal = self.GetPrimaryWeapon().Damage < 0; + var isHeal = self.GetPrimaryWeapon().Warheads.First().Damage < 0; var forceFire = mi.Modifiers.HasModifier(Modifiers.Ctrl); if (isHeal) diff --git a/OpenRA.Game/Traits/Attack/AttackTesla.cs b/OpenRA.Game/Traits/Attack/AttackTesla.cs index 513b9d4c61..0677220a54 100755 --- a/OpenRA.Game/Traits/Attack/AttackTesla.cs +++ b/OpenRA.Game/Traits/Attack/AttackTesla.cs @@ -48,7 +48,7 @@ namespace OpenRA.Traits public override int FireDelay( Actor self, AttackBaseInfo info ) { primaryFireDelay = 8; - timeToRecharge = Rules.WeaponInfo[ info.PrimaryWeapon ].ROF; + timeToRecharge = self.GetPrimaryWeapon().ROF; --charges; if( target != sameTarget ) diff --git a/OpenRA.Mods.Aftermath/DemoTruck.cs b/OpenRA.Mods.Aftermath/DemoTruck.cs index 4c994911bd..e094198daf 100644 --- a/OpenRA.Mods.Aftermath/DemoTruck.cs +++ b/OpenRA.Mods.Aftermath/DemoTruck.cs @@ -59,9 +59,9 @@ namespace OpenRA.Mods.Aftermath //w.Add(new Bullet(info.PrimaryWeapon, detonatedBy.Owner, detonatedBy, // detonateLocation, detonateLocation, altitude, altitude)); - var weapon = Rules.WeaponInfo[info.PrimaryWeapon]; - if (!string.IsNullOrEmpty(weapon.Report)) - Sound.Play(weapon.Report + ".aud"); + //var weapon = Rules.WeaponInfo[info.PrimaryWeapon]; + //if (!string.IsNullOrEmpty(weapon.Report)) + // Sound.Play(weapon.Report + ".aud"); // Remove from world self.Health = 0;