Clarify AttackPanicChance and add PanicChance.
This commit is contained in:
committed by
abcdefg30
parent
250f5bec18
commit
a4b427bfac
@@ -16,13 +16,16 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Makes the unit automatically run around when taking damage.")]
|
[Desc("Makes the unit automatically run around when taking damage.")]
|
||||||
class ScaredyCatInfo : ITraitInfo, Requires<MobileInfo>
|
class ScaredyCatInfo : ITraitInfo, Requires<MobileInfo>
|
||||||
{
|
{
|
||||||
|
[Desc("Chance (out of 100) the unit has to enter panic mode when attacked.")]
|
||||||
|
public readonly int PanicChance = 100;
|
||||||
|
|
||||||
[Desc("How long (in ticks) the actor should panic for.")]
|
[Desc("How long (in ticks) the actor should panic for.")]
|
||||||
public readonly int PanicLength = 25 * 10;
|
public readonly int PanicLength = 25 * 10;
|
||||||
|
|
||||||
[Desc("Panic movement speed as a percentage of the normal speed.")]
|
[Desc("Panic movement speed as a percentage of the normal speed.")]
|
||||||
public readonly int PanicSpeedModifier = 200;
|
public readonly int PanicSpeedModifier = 200;
|
||||||
|
|
||||||
[Desc("Chance (out of 100) the unit has to enter panic mode when attacked.")]
|
[Desc("Chance (out of 100) the unit has to enter panic mode when attacking.")]
|
||||||
public readonly int AttackPanicChance = 20;
|
public readonly int AttackPanicChance = 20;
|
||||||
|
|
||||||
[SequenceReference(null, true)]
|
[SequenceReference(null, true)]
|
||||||
@@ -81,7 +84,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
void INotifyDamage.Damaged(Actor self, AttackInfo e)
|
void INotifyDamage.Damaged(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (e.Damage.Value > 0)
|
if (e.Damage.Value > 0 && self.World.SharedRandom.Next(100) < info.PanicChance)
|
||||||
Panic();
|
Panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user