removed old WeaponInfo
This commit is contained in:
@@ -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)
|
static float GetDamageToInflict(Actor target, ProjectileArgs args, WarheadInfo warhead, float modifier)
|
||||||
{
|
{
|
||||||
var distance = (target.CenterLocation - args.dest).Length;
|
var distance = (target.CenterLocation - args.dest).Length;
|
||||||
@@ -95,7 +90,7 @@ namespace OpenRA
|
|||||||
return rawDamage * multiplier;
|
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.
|
return true; // massive hack, and very wrong.
|
||||||
|
|
||||||
|
|||||||
@@ -40,13 +40,11 @@ namespace OpenRA.Effects
|
|||||||
readonly int targetAltitude = 400;
|
readonly int targetAltitude = 400;
|
||||||
int altitude;
|
int altitude;
|
||||||
bool goingUp = true;
|
bool goingUp = true;
|
||||||
WeaponInfo weapon;
|
|
||||||
|
|
||||||
public NukeLaunch(Actor silo, string weapon, int2 targetLocation)
|
public NukeLaunch(Actor silo, string weapon, int2 targetLocation)
|
||||||
{
|
{
|
||||||
this.silo = silo;
|
this.silo = silo;
|
||||||
this.targetLocation = targetLocation;
|
this.targetLocation = targetLocation;
|
||||||
this.weapon = Rules.WeaponInfo[weapon];
|
|
||||||
anim = new Animation("nuke");
|
anim = new Animation("nuke");
|
||||||
anim.PlayRepeating("up");
|
anim.PlayRepeating("up");
|
||||||
pos = silo.CenterLocation;
|
pos = silo.CenterLocation;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace OpenRA
|
|||||||
return xs.Aggregate(1f, (a, x) => a * x);
|
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<AttackBaseInfo>();
|
var info = self.Info.Traits.GetOrDefault<AttackBaseInfo>();
|
||||||
if (info == null) return null;
|
if (info == null) return null;
|
||||||
@@ -52,10 +52,10 @@ namespace OpenRA
|
|||||||
var weapon = info.PrimaryWeapon;
|
var weapon = info.PrimaryWeapon;
|
||||||
if (weapon == null) return null;
|
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<AttackBaseInfo>();
|
var info = self.Info.Traits.GetOrDefault<AttackBaseInfo>();
|
||||||
if (info == null) return null;
|
if (info == null) return null;
|
||||||
@@ -63,7 +63,7 @@ namespace OpenRA
|
|||||||
var weapon = info.SecondaryWeapon;
|
var weapon = info.SecondaryWeapon;
|
||||||
if (weapon == null) return null;
|
if (weapon == null) return null;
|
||||||
|
|
||||||
return Rules.WeaponInfo[weapon];
|
return Rules.Weapons[weapon.ToLowerInvariant()];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetMaxHP(this Actor self)
|
public static int GetMaxHP(this Actor self)
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
public static IniFile AllRules;
|
public static IniFile AllRules;
|
||||||
public static Dictionary<string, List<string>> Categories = new Dictionary<string, List<string>>();
|
public static Dictionary<string, List<string>> Categories = new Dictionary<string, List<string>>();
|
||||||
public static InfoLoader<WeaponInfo> WeaponInfo;
|
|
||||||
public static InfoLoader<WarheadInfo> WarheadInfo;
|
public static InfoLoader<WarheadInfo> WarheadInfo;
|
||||||
public static InfoLoader<VoiceInfo> VoiceInfo;
|
public static InfoLoader<VoiceInfo> VoiceInfo;
|
||||||
public static TechTree TechTree;
|
public static TechTree TechTree;
|
||||||
@@ -50,8 +49,6 @@ namespace OpenRA
|
|||||||
"Projectile",
|
"Projectile",
|
||||||
"Voice");
|
"Voice");
|
||||||
|
|
||||||
WeaponInfo = new InfoLoader<WeaponInfo>(
|
|
||||||
Pair.New<string, Func<string, WeaponInfo>>("Weapon", _ => new WeaponInfo()));
|
|
||||||
WarheadInfo = new InfoLoader<WarheadInfo>(
|
WarheadInfo = new InfoLoader<WarheadInfo>(
|
||||||
Pair.New<string, Func<string, WarheadInfo>>("Warhead", _ => new WarheadInfo()));
|
Pair.New<string, Func<string, WarheadInfo>>("Warhead", _ => new WarheadInfo()));
|
||||||
VoiceInfo = new InfoLoader<VoiceInfo>(
|
VoiceInfo = new InfoLoader<VoiceInfo>(
|
||||||
|
|||||||
@@ -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 <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -156,7 +156,6 @@
|
|||||||
<Compile Include="GameRules\InfoLoader.cs" />
|
<Compile Include="GameRules\InfoLoader.cs" />
|
||||||
<Compile Include="GameRules\Rules.cs" />
|
<Compile Include="GameRules\Rules.cs" />
|
||||||
<Compile Include="GameRules\WarheadInfo.cs" />
|
<Compile Include="GameRules\WarheadInfo.cs" />
|
||||||
<Compile Include="GameRules\WeaponInfo.cs" />
|
|
||||||
<Compile Include="Graphics\Animation.cs" />
|
<Compile Include="Graphics\Animation.cs" />
|
||||||
<Compile Include="Game.cs" />
|
<Compile Include="Game.cs" />
|
||||||
<Compile Include="Graphics\CursorSequence.cs" />
|
<Compile Include="Graphics\CursorSequence.cs" />
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ namespace OpenRA.Traits
|
|||||||
if (limitedAmmo != null && !limitedAmmo.HasAmmo())
|
if (limitedAmmo != null && !limitedAmmo.HasAmmo())
|
||||||
return false;
|
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 (weapon.Range * weapon.Range < (target.Location - self.Location).LengthSquared) return false;
|
||||||
|
|
||||||
if (!Combat.WeaponValidForTarget(weapon, target)) 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 (mi.Button == MouseButton.Left || underCursor == null || underCursor.Owner == null) return null;
|
||||||
if (self == underCursor) 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);
|
var forceFire = mi.Modifiers.HasModifier(Modifiers.Ctrl);
|
||||||
|
|
||||||
if (isHeal)
|
if (isHeal)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRA.Traits
|
|||||||
public override int FireDelay( Actor self, AttackBaseInfo info )
|
public override int FireDelay( Actor self, AttackBaseInfo info )
|
||||||
{
|
{
|
||||||
primaryFireDelay = 8;
|
primaryFireDelay = 8;
|
||||||
timeToRecharge = Rules.WeaponInfo[ info.PrimaryWeapon ].ROF;
|
timeToRecharge = self.GetPrimaryWeapon().ROF;
|
||||||
--charges;
|
--charges;
|
||||||
|
|
||||||
if( target != sameTarget )
|
if( target != sameTarget )
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ namespace OpenRA.Mods.Aftermath
|
|||||||
//w.Add(new Bullet(info.PrimaryWeapon, detonatedBy.Owner, detonatedBy,
|
//w.Add(new Bullet(info.PrimaryWeapon, detonatedBy.Owner, detonatedBy,
|
||||||
// detonateLocation, detonateLocation, altitude, altitude));
|
// detonateLocation, detonateLocation, altitude, altitude));
|
||||||
|
|
||||||
var weapon = Rules.WeaponInfo[info.PrimaryWeapon];
|
//var weapon = Rules.WeaponInfo[info.PrimaryWeapon];
|
||||||
if (!string.IsNullOrEmpty(weapon.Report))
|
//if (!string.IsNullOrEmpty(weapon.Report))
|
||||||
Sound.Play(weapon.Report + ".aud");
|
// Sound.Play(weapon.Report + ".aud");
|
||||||
|
|
||||||
// Remove from world
|
// Remove from world
|
||||||
self.Health = 0;
|
self.Health = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user