Added InaccuracyType.Absolute to projectiles
This commit is contained in:
committed by
Matthias Mailänder
parent
a2dbd5e013
commit
134d47e48c
@@ -21,7 +21,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Projectiles
|
||||
{
|
||||
public enum InaccuracyType { Maximum, PerCellIncrement }
|
||||
public enum InaccuracyType { Maximum, PerCellIncrement, Absolute }
|
||||
|
||||
public class AreaBeamInfo : IProjectileInfo
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
|
||||
public readonly WDist Inaccuracy = WDist.Zero;
|
||||
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' and 'PerCellIncrement'.")]
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")]
|
||||
public readonly InaccuracyType InaccuracyType = InaccuracyType.Maximum;
|
||||
|
||||
[Desc("Can this projectile be blocked when hitting actors with an IBlocksProjectiles trait.")]
|
||||
@@ -134,11 +134,19 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
{
|
||||
var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
|
||||
|
||||
int maxOffset;
|
||||
if (info.InaccuracyType == InaccuracyType.Maximum)
|
||||
maxOffset = inaccuracy * (target - headPos).Length / args.Weapon.Range.Length;
|
||||
else
|
||||
maxOffset = inaccuracy * (target - headPos).Length / 1024;
|
||||
var maxOffset = 0;
|
||||
switch (info.InaccuracyType)
|
||||
{
|
||||
case InaccuracyType.Maximum:
|
||||
maxOffset = inaccuracy * (target - headPos).Length / args.Weapon.Range.Length;
|
||||
break;
|
||||
case InaccuracyType.PerCellIncrement:
|
||||
maxOffset = inaccuracy * (target - headPos).Length / 1024;
|
||||
break;
|
||||
case InaccuracyType.Absolute:
|
||||
maxOffset = inaccuracy;
|
||||
break;
|
||||
}
|
||||
|
||||
target += WVec.FromPDF(world.SharedRandom, 2) * maxOffset / 1024;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
|
||||
public readonly WDist Inaccuracy = WDist.Zero;
|
||||
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' and 'PerCellIncrement'.")]
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")]
|
||||
public readonly InaccuracyType InaccuracyType = InaccuracyType.Maximum;
|
||||
|
||||
[Desc("Image to display.")]
|
||||
@@ -152,11 +152,19 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
|
||||
var range = Util.ApplyPercentageModifiers(args.Weapon.Range.Length, args.RangeModifiers);
|
||||
|
||||
int maxOffset;
|
||||
if (info.InaccuracyType == InaccuracyType.Maximum)
|
||||
maxOffset = inaccuracy * (target - pos).Length / range;
|
||||
else
|
||||
maxOffset = inaccuracy * (target - pos).Length / 1024;
|
||||
var maxOffset = 0;
|
||||
switch (info.InaccuracyType)
|
||||
{
|
||||
case InaccuracyType.Maximum:
|
||||
maxOffset = inaccuracy * (target - pos).Length / range;
|
||||
break;
|
||||
case InaccuracyType.PerCellIncrement:
|
||||
maxOffset = inaccuracy * (target - pos).Length / 1024;
|
||||
break;
|
||||
case InaccuracyType.Absolute:
|
||||
maxOffset = inaccuracy;
|
||||
break;
|
||||
}
|
||||
|
||||
target += WVec.FromPDF(world.SharedRandom, 2) * maxOffset / 1024;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
{
|
||||
public readonly WDist Inaccuracy = WDist.Zero;
|
||||
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' and 'PerCellIncrement'.")]
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")]
|
||||
public readonly InaccuracyType InaccuracyType = InaccuracyType.Maximum;
|
||||
|
||||
[Desc("Projectile can be blocked.")]
|
||||
@@ -57,11 +57,19 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
{
|
||||
var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
|
||||
|
||||
int maxOffset;
|
||||
if (info.InaccuracyType == InaccuracyType.Maximum)
|
||||
maxOffset = inaccuracy * (args.PassiveTarget - args.Source).Length / args.Weapon.Range.Length;
|
||||
else
|
||||
maxOffset = inaccuracy * (args.PassiveTarget - args.Source).Length / 1024;
|
||||
var maxOffset = 0;
|
||||
switch (info.InaccuracyType)
|
||||
{
|
||||
case InaccuracyType.Maximum:
|
||||
maxOffset = inaccuracy * (args.PassiveTarget - args.Source).Length / args.Weapon.Range.Length;
|
||||
break;
|
||||
case InaccuracyType.PerCellIncrement:
|
||||
maxOffset = inaccuracy * (args.PassiveTarget - args.Source).Length / 1024;
|
||||
break;
|
||||
case InaccuracyType.Absolute:
|
||||
maxOffset = inaccuracy;
|
||||
break;
|
||||
}
|
||||
|
||||
target = Target.FromPos(args.PassiveTarget + WVec.FromPDF(args.SourceActor.World.SharedRandom, 2) * maxOffset / 1024);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
|
||||
public readonly WDist Inaccuracy = WDist.Zero;
|
||||
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' and 'PerCellIncrement'.")]
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")]
|
||||
public readonly InaccuracyType InaccuracyType = InaccuracyType.Maximum;
|
||||
|
||||
[Desc("Beam can be blocked.")]
|
||||
@@ -134,11 +134,19 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
{
|
||||
var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
|
||||
|
||||
int maxOffset;
|
||||
if (info.InaccuracyType == InaccuracyType.Maximum)
|
||||
maxOffset = inaccuracy * (target - source).Length / args.Weapon.Range.Length;
|
||||
else
|
||||
maxOffset = inaccuracy * (target - source).Length / 1024;
|
||||
var maxOffset = 0;
|
||||
switch (info.InaccuracyType)
|
||||
{
|
||||
case InaccuracyType.Maximum:
|
||||
maxOffset = inaccuracy * (target - source).Length / args.Weapon.Range.Length;
|
||||
break;
|
||||
case InaccuracyType.PerCellIncrement:
|
||||
maxOffset = inaccuracy * (target - source).Length / 1024;
|
||||
break;
|
||||
case InaccuracyType.Absolute:
|
||||
maxOffset = inaccuracy;
|
||||
break;
|
||||
}
|
||||
|
||||
target += WVec.FromPDF(args.SourceActor.World.SharedRandom, 2) * maxOffset / 1024;
|
||||
}
|
||||
|
||||
@@ -73,8 +73,8 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
|
||||
public readonly WDist Inaccuracy = WDist.Zero;
|
||||
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' and 'PerCellIncrement'.")]
|
||||
public readonly InaccuracyType InaccuracyType = InaccuracyType.Maximum;
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")]
|
||||
public readonly InaccuracyType InaccuracyType = InaccuracyType.Absolute;
|
||||
|
||||
[Desc("Inaccuracy override when sucessfully locked onto target. Defaults to Inaccuracy if negative.")]
|
||||
public readonly WDist LockOnInaccuracy = new WDist(-1);
|
||||
@@ -240,9 +240,19 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
{
|
||||
inaccuracy = Util.ApplyPercentageModifiers(inaccuracy, args.InaccuracyModifiers);
|
||||
|
||||
var maxOffset = inaccuracy;
|
||||
if (info.InaccuracyType == InaccuracyType.PerCellIncrement)
|
||||
maxOffset = inaccuracy * (targetPosition - pos).Length / 1024;
|
||||
var maxOffset = 0;
|
||||
switch (info.InaccuracyType)
|
||||
{
|
||||
case InaccuracyType.Maximum:
|
||||
maxOffset = inaccuracy * (targetPosition - pos).Length / args.Weapon.Range.Length;
|
||||
break;
|
||||
case InaccuracyType.PerCellIncrement:
|
||||
maxOffset = inaccuracy * (targetPosition - pos).Length / 1024;
|
||||
break;
|
||||
case InaccuracyType.Absolute:
|
||||
maxOffset = inaccuracy;
|
||||
break;
|
||||
}
|
||||
|
||||
offset = WVec.FromPDF(world.SharedRandom, 2) * maxOffset / 1024;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
|
||||
public readonly WDist Inaccuracy = WDist.Zero;
|
||||
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' and 'PerCellIncrement'.")]
|
||||
[Desc("Controls the way inaccuracy is calculated. Possible values are 'Maximum' - scale from 0 to max with range, 'PerCellIncrement' - scale from 0 with range and 'Absolute' - use set value regardless of range.")]
|
||||
public readonly InaccuracyType InaccuracyType = InaccuracyType.Maximum;
|
||||
|
||||
[Desc("Can this projectile be blocked when hitting actors with an IBlocksProjectiles trait.")]
|
||||
@@ -136,11 +136,19 @@ namespace OpenRA.Mods.Common.Projectiles
|
||||
{
|
||||
var inaccuracy = Util.ApplyPercentageModifiers(info.Inaccuracy.Length, args.InaccuracyModifiers);
|
||||
|
||||
int maxOffset;
|
||||
if (info.InaccuracyType == InaccuracyType.Maximum)
|
||||
maxOffset = inaccuracy * (target - source).Length / args.Weapon.Range.Length;
|
||||
else
|
||||
maxOffset = inaccuracy * (target - source).Length / 1024;
|
||||
var maxOffset = 0;
|
||||
switch (info.InaccuracyType)
|
||||
{
|
||||
case InaccuracyType.Maximum:
|
||||
maxOffset = inaccuracy * (target - source).Length / args.Weapon.Range.Length;
|
||||
break;
|
||||
case InaccuracyType.PerCellIncrement:
|
||||
maxOffset = inaccuracy * (target - source).Length / 1024;
|
||||
break;
|
||||
case InaccuracyType.Absolute:
|
||||
maxOffset = inaccuracy;
|
||||
break;
|
||||
}
|
||||
|
||||
target += WVec.FromPDF(args.SourceActor.World.SharedRandom, 2) * maxOffset / 1024;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user