Convert damage modifiers to integer percentages.
This commit is contained in:
@@ -50,16 +50,17 @@ namespace OpenRA.Mods.RA.Activities
|
||||
if (target.Type != TargetType.Actor)
|
||||
return;
|
||||
|
||||
// Invulnerable actors can't be demolished
|
||||
var modifier = (float)target.Actor.TraitsImplementing<IDamageModifier>()
|
||||
.Concat(self.Owner.PlayerActor.TraitsImplementing<IDamageModifier>())
|
||||
.Select(t => t.GetDamageModifier(self, null)).Product();
|
||||
|
||||
|
||||
var demolishable = target.Actor.TraitOrDefault<IDemolishable>();
|
||||
if (demolishable == null || !demolishable.IsValidTarget(target.Actor, self))
|
||||
return;
|
||||
|
||||
if (modifier > 0)
|
||||
var modifiers = target.Actor.TraitsImplementing<IDamageModifier>()
|
||||
.Concat(self.Owner.PlayerActor.TraitsImplementing<IDamageModifier>())
|
||||
.Select(t => t.GetDamageModifier(self, null));
|
||||
|
||||
if (Util.ApplyPercentageModifiers(100, modifiers) > 0)
|
||||
demolishable.Demolish(target.Actor, self);
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace OpenRA.Mods.RA
|
||||
public int CloseDelay = 125;
|
||||
public int DefaultFacing = 0;
|
||||
|
||||
[Desc("The factor damage received is multiplied by while this actor is closed.")]
|
||||
public float ClosedDamageMultiplier = 0.5f;
|
||||
[Desc("The percentage of damage that is received while this actor is closed.")]
|
||||
public int ClosedDamageMultiplier = 50;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new AttackPopupTurreted(init, this); }
|
||||
}
|
||||
@@ -105,9 +105,9 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
|
||||
public float GetDamageModifier(Actor attacker, DamageWarhead warhead)
|
||||
public int GetDamageModifier(Actor attacker, DamageWarhead warhead)
|
||||
{
|
||||
return state == PopupState.Closed ? info.ClosedDamageMultiplier : 1f;
|
||||
return state == PopupState.Closed ? info.ClosedDamageMultiplier : 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.RA
|
||||
public readonly float[] FirepowerModifier = { 1.1f, 1.15f, 1.2f, 1.5f };
|
||||
|
||||
public readonly string ArmorUpgrade = "armor";
|
||||
public readonly float[] ArmorModifier = { 1.1f, 1.2f, 1.3f, 1.5f };
|
||||
public readonly int[] ArmorModifier = { 110, 120, 130, 150 };
|
||||
|
||||
public readonly string SpeedUpgrade = "speed";
|
||||
public readonly decimal[] SpeedModifier = { 1.1m, 1.15m, 1.2m, 1.5m };
|
||||
@@ -60,9 +60,9 @@ namespace OpenRA.Mods.RA
|
||||
speedLevel = (speedLevel + mod).Clamp(0, info.SpeedModifier.Length);
|
||||
}
|
||||
|
||||
public float GetDamageModifier(Actor attacker, DamageWarhead warhead)
|
||||
public int GetDamageModifier(Actor attacker, DamageWarhead warhead)
|
||||
{
|
||||
return armorLevel > 0 ? 1 / info.ArmorModifier[armorLevel - 1] : 1;
|
||||
return armorLevel > 0 ? 1 / info.ArmorModifier[armorLevel - 1] : 100;
|
||||
}
|
||||
|
||||
public float GetFirepowerModifier()
|
||||
|
||||
@@ -18,6 +18,6 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
class Invulnerable : IDamageModifier
|
||||
{
|
||||
public float GetDamageModifier(Actor attacker, DamageWarhead warhead) { return 0.0f; }
|
||||
public int GetDamageModifier(Actor attacker, DamageWarhead warhead) { return 0; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace OpenRA.Mods.RA
|
||||
RemainingTicks--;
|
||||
}
|
||||
|
||||
public float GetDamageModifier(Actor attacker, DamageWarhead warhead)
|
||||
public int GetDamageModifier(Actor attacker, DamageWarhead warhead)
|
||||
{
|
||||
return (RemainingTicks > 0) ? 0.0f : 1.0f;
|
||||
return RemainingTicks > 0 ? 0 : 100;
|
||||
}
|
||||
|
||||
public void Activate(Actor self, int duration)
|
||||
|
||||
@@ -20,9 +20,9 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
public bool Invulnerable = false;
|
||||
|
||||
public float GetDamageModifier(Actor attacker, DamageWarhead warhead)
|
||||
public int GetDamageModifier(Actor attacker, DamageWarhead warhead)
|
||||
{
|
||||
return Invulnerable ? 0.0f : 1.0f;
|
||||
return Invulnerable ? 0 : 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ namespace OpenRA.Mods.RA
|
||||
LocalOffset = WVec.Zero;
|
||||
}
|
||||
|
||||
public float GetDamageModifier(Actor attacker, DamageWarhead warhead)
|
||||
public int GetDamageModifier(Actor attacker, DamageWarhead warhead)
|
||||
{
|
||||
return IsProne && warhead != null ? warhead.ProneModifier / 100f : 1f;
|
||||
return IsProne && warhead != null ? warhead.ProneModifier : 100;
|
||||
}
|
||||
|
||||
public decimal GetSpeedModifier()
|
||||
|
||||
Reference in New Issue
Block a user