Convert speed modifiers to integer percentages.
This commit is contained in:
@@ -156,7 +156,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public interface IRenderModifier { IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r); }
|
public interface IRenderModifier { IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r); }
|
||||||
public interface IDamageModifier { int GetDamageModifier(Actor attacker, DamageWarhead warhead); }
|
public interface IDamageModifier { int GetDamageModifier(Actor attacker, DamageWarhead warhead); }
|
||||||
public interface ISpeedModifier { decimal GetSpeedModifier(); }
|
public interface ISpeedModifier { int GetSpeedModifier(); }
|
||||||
public interface IFirepowerModifier { float GetFirepowerModifier(); }
|
public interface IFirepowerModifier { float GetFirepowerModifier(); }
|
||||||
public interface ILoadsPalettes { void LoadPalettes(WorldRenderer wr); }
|
public interface ILoadsPalettes { void LoadPalettes(WorldRenderer wr); }
|
||||||
public interface IPaletteModifier { void AdjustPalette(IReadOnlyDictionary<string, MutablePalette> b); }
|
public interface IPaletteModifier { void AdjustPalette(IReadOnlyDictionary<string, MutablePalette> b); }
|
||||||
|
|||||||
@@ -203,10 +203,9 @@ namespace OpenRA.Mods.RA.Air
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
decimal ret = info.Speed;
|
var modifiers = self.TraitsImplementing<ISpeedModifier>()
|
||||||
foreach (var t in self.TraitsImplementing<ISpeedModifier>())
|
.Select(m => m.GetSpeedModifier());
|
||||||
ret *= t.GetSpeedModifier();
|
return Util.ApplyPercentageModifiers(info.Speed, modifiers);
|
||||||
return (int)ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int[] ArmorModifier = { 110, 120, 130, 150 };
|
public readonly int[] ArmorModifier = { 110, 120, 130, 150 };
|
||||||
|
|
||||||
public readonly string SpeedUpgrade = "speed";
|
public readonly string SpeedUpgrade = "speed";
|
||||||
public readonly decimal[] SpeedModifier = { 1.1m, 1.15m, 1.2m, 1.5m };
|
public readonly int[] SpeedModifier = { 110, 115, 120, 150 };
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new GainsStatUpgrades(this); }
|
public object Create(ActorInitializer init) { return new GainsStatUpgrades(this); }
|
||||||
}
|
}
|
||||||
@@ -70,9 +70,9 @@ namespace OpenRA.Mods.RA
|
|||||||
return firepowerLevel > 0 ? info.FirepowerModifier[firepowerLevel - 1] : 1;
|
return firepowerLevel > 0 ? info.FirepowerModifier[firepowerLevel - 1] : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public decimal GetSpeedModifier()
|
public int GetSpeedModifier()
|
||||||
{
|
{
|
||||||
return speedLevel > 0 ? info.SpeedModifier[speedLevel - 1] : 1m;
|
return speedLevel > 0 ? info.SpeedModifier[speedLevel - 1] : 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int HarvestFacings = 0;
|
public readonly int HarvestFacings = 0;
|
||||||
[Desc("Which resources it can harvest.")]
|
[Desc("Which resources it can harvest.")]
|
||||||
public readonly string[] Resources = { };
|
public readonly string[] Resources = { };
|
||||||
[Desc("How much it is slowed down when returning to the refinery.")]
|
[Desc("Percentage of maximum speed when fully loaded.")]
|
||||||
public readonly decimal FullyLoadedSpeed = .85m;
|
public readonly int FullyLoadedSpeed = 85;
|
||||||
[Desc("Initial search radius (in cells) from the refinery that created us.")]
|
[Desc("Initial search radius (in cells) from the refinery that created us.")]
|
||||||
public readonly int SearchFromProcRadius = 24;
|
public readonly int SearchFromProcRadius = 24;
|
||||||
[Desc("Search radius (in cells) from the last harvest order location to find more resources.")]
|
[Desc("Search radius (in cells) from the last harvest order location to find more resources.")]
|
||||||
@@ -418,9 +418,9 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public bool ShouldExplode(Actor self) { return !IsEmpty; }
|
public bool ShouldExplode(Actor self) { return !IsEmpty; }
|
||||||
|
|
||||||
public decimal GetSpeedModifier()
|
public int GetSpeedModifier()
|
||||||
{
|
{
|
||||||
return 1m - (1m - Info.FullyLoadedSpeed) * contents.Values.Sum() / Info.Capacity;
|
return 100 - (100 - Info.FullyLoadedSpeed) * contents.Values.Sum() / Info.Capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
class HarvestOrderTargeter : IOrderTargeter
|
class HarvestOrderTargeter : IOrderTargeter
|
||||||
|
|||||||
@@ -487,13 +487,15 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
if (index == -1)
|
if (index == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// TODO: Convert to integers
|
||||||
var speed = Info.TilesetTerrainInfo[self.World.TileSet][index].Speed;
|
var speed = Info.TilesetTerrainInfo[self.World.TileSet][index].Speed;
|
||||||
if (speed == decimal.Zero)
|
if (speed == decimal.Zero)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
speed *= Info.Speed;
|
speed *= Info.Speed;
|
||||||
foreach (var t in self.TraitsImplementing<ISpeedModifier>())
|
foreach (var t in self.TraitsImplementing<ISpeedModifier>())
|
||||||
speed *= t.GetSpeedModifier();
|
speed *= t.GetSpeedModifier() / 100m;
|
||||||
|
|
||||||
return (int)(speed / 100);
|
return (int)(speed / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
|||||||
class ScaredyCatInfo : ITraitInfo
|
class ScaredyCatInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly int PanicLength = 25 * 10;
|
public readonly int PanicLength = 25 * 10;
|
||||||
public readonly decimal PanicSpeedModifier = 2;
|
public readonly int PanicSpeedModifier = 200;
|
||||||
public readonly int AttackPanicChance = 20;
|
public readonly int AttackPanicChance = 20;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new ScaredyCat(init.self, this); }
|
public object Create(ActorInitializer init) { return new ScaredyCat(init.self, this); }
|
||||||
@@ -74,9 +74,9 @@ namespace OpenRA.Mods.RA
|
|||||||
Panic();
|
Panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
public decimal GetSpeedModifier()
|
public int GetSpeedModifier()
|
||||||
{
|
{
|
||||||
return Panicking ? Info.PanicSpeedModifier : 1;
|
return Panicking ? Info.PanicSpeedModifier : 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ namespace OpenRA.Mods.RA
|
|||||||
"Measured in game ticks. Default is 4 seconds.")]
|
"Measured in game ticks. Default is 4 seconds.")]
|
||||||
public readonly int ProneTime = 100;
|
public readonly int ProneTime = 100;
|
||||||
|
|
||||||
[Desc("How quickly we should go from standing to prone.")]
|
[Desc("Prone movement speed as a percentage of the normal speed.")]
|
||||||
public readonly decimal ProneSpeed = .5m;
|
public readonly int ProneSpeed = 50;
|
||||||
|
|
||||||
public readonly WVec ProneOffset = new WVec(85, 0, -171);
|
public readonly WVec ProneOffset = new WVec(85, 0, -171);
|
||||||
|
|
||||||
@@ -66,9 +66,9 @@ namespace OpenRA.Mods.RA
|
|||||||
return IsProne && warhead != null ? warhead.ProneModifier : 100;
|
return IsProne && warhead != null ? warhead.ProneModifier : 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
public decimal GetSpeedModifier()
|
public int GetSpeedModifier()
|
||||||
{
|
{
|
||||||
return IsProne ? Info.ProneSpeed : 1m;
|
return IsProne ? Info.ProneSpeed : 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -416,6 +416,18 @@ namespace OpenRA.Utility
|
|||||||
|
|
||||||
if (depth == 2 && node.Key == "ArmorModifier" && parentKey == "GainsStatUpgrades")
|
if (depth == 2 && node.Key == "ArmorModifier" && parentKey == "GainsStatUpgrades")
|
||||||
ConvertFloatArrayToPercentArray(ref node.Value.Value);
|
ConvertFloatArrayToPercentArray(ref node.Value.Value);
|
||||||
|
|
||||||
|
if (depth == 2 && node.Key == "FullyLoadedSpeed" && parentKey == "Harvester")
|
||||||
|
ConvertFloatArrayToPercentArray(ref node.Value.Value);
|
||||||
|
|
||||||
|
if (depth == 2 && node.Key == "PanicSpeedModifier" && parentKey == "ScaredyCat")
|
||||||
|
ConvertFloatArrayToPercentArray(ref node.Value.Value);
|
||||||
|
|
||||||
|
if (depth == 2 && node.Key == "ProneSpeed" && parentKey == "TakeCover")
|
||||||
|
ConvertFloatArrayToPercentArray(ref node.Value.Value);
|
||||||
|
|
||||||
|
if (depth == 2 && node.Key == "SpeedModifier" && parentKey == "GainsStatUpgrades")
|
||||||
|
ConvertFloatArrayToPercentArray(ref node.Value.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user