fix trailing whitespace everywhere
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
@@ -22,16 +22,16 @@ namespace OpenRA.Traits
|
||||
}
|
||||
|
||||
public enum DamageState { Undamaged, Light, Medium, Heavy, Critical, Dead };
|
||||
|
||||
|
||||
public class Health : ISync, ITick
|
||||
{
|
||||
public readonly HealthInfo Info;
|
||||
|
||||
|
||||
[Sync]
|
||||
int hp;
|
||||
|
||||
public int DisplayHp { get; private set; }
|
||||
|
||||
|
||||
public Health(ActorInitializer init, HealthInfo info)
|
||||
{
|
||||
Info = info;
|
||||
@@ -40,36 +40,36 @@ namespace OpenRA.Traits
|
||||
hp = init.Contains<HealthInit>() ? (int)(init.Get<HealthInit, float>() * MaxHP) : MaxHP;
|
||||
DisplayHp = hp;
|
||||
}
|
||||
|
||||
|
||||
public int HP { get { return hp; } }
|
||||
public readonly int MaxHP;
|
||||
|
||||
|
||||
public bool IsDead { get { return hp <= 0; } }
|
||||
public bool RemoveOnDeath = true;
|
||||
|
||||
|
||||
public DamageState DamageState
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
if (hp <= 0)
|
||||
return DamageState.Dead;
|
||||
|
||||
|
||||
if (hp < MaxHP * 0.25f)
|
||||
return DamageState.Critical;
|
||||
|
||||
|
||||
if (hp < MaxHP * 0.5f)
|
||||
return DamageState.Heavy;
|
||||
|
||||
|
||||
if (hp < MaxHP * 0.75f)
|
||||
return DamageState.Medium;
|
||||
|
||||
|
||||
if (hp == MaxHP)
|
||||
return DamageState.Undamaged;
|
||||
|
||||
|
||||
return DamageState.Light;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void InflictDamage(Actor self, Actor attacker, int damage, WarheadInfo warhead, bool ignoreModifiers)
|
||||
{
|
||||
if (IsDead) return; /* overkill! don't count extra hits as more kills! */
|
||||
@@ -93,30 +93,30 @@ namespace OpenRA.Traits
|
||||
PreviousDamageState = oldState,
|
||||
Warhead = warhead,
|
||||
};
|
||||
|
||||
|
||||
foreach (var nd in self.TraitsImplementing<INotifyDamage>()
|
||||
.Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyDamage>()))
|
||||
nd.Damaged(self, ai);
|
||||
|
||||
|
||||
|
||||
|
||||
if (DamageState != oldState)
|
||||
foreach (var nd in self.TraitsImplementing<INotifyDamageStateChanged>())
|
||||
nd.DamageStateChanged(self, ai);
|
||||
|
||||
|
||||
if (attacker != null && attacker.IsInWorld && !attacker.IsDead())
|
||||
foreach (var nd in attacker.TraitsImplementing<INotifyAppliedDamage>()
|
||||
.Concat(attacker.Owner.PlayerActor.TraitsImplementing<INotifyAppliedDamage>()))
|
||||
nd.AppliedDamage(attacker, self, ai);
|
||||
|
||||
|
||||
if (hp == 0)
|
||||
{
|
||||
attacker.Owner.Kills++;
|
||||
self.Owner.Deaths++;
|
||||
|
||||
|
||||
foreach (var nd in self.TraitsImplementing<INotifyKilled>()
|
||||
.Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyKilled>()))
|
||||
nd.Killed(self, ai);
|
||||
|
||||
|
||||
if( RemoveOnDeath )
|
||||
self.Destroy();
|
||||
|
||||
@@ -147,11 +147,11 @@ namespace OpenRA.Traits
|
||||
public static bool IsDead(this Actor self)
|
||||
{
|
||||
if (self.Destroyed) return true;
|
||||
|
||||
|
||||
var health = self.TraitOrDefault<Health>();
|
||||
return (health == null) ? false : health.IsDead;
|
||||
}
|
||||
|
||||
|
||||
public static DamageState GetDamageState(this Actor self)
|
||||
{
|
||||
if (self.Destroyed) return DamageState.Dead;
|
||||
@@ -159,14 +159,14 @@ namespace OpenRA.Traits
|
||||
var health = self.TraitOrDefault<Health>();
|
||||
return (health == null) ? DamageState.Undamaged : health.DamageState;
|
||||
}
|
||||
|
||||
|
||||
public static void InflictDamage(this Actor self, Actor attacker, int damage, WarheadInfo warhead)
|
||||
{
|
||||
var health = self.TraitOrDefault<Health>();
|
||||
if (health == null) return;
|
||||
health.InflictDamage(self, attacker, damage, warhead, false);
|
||||
}
|
||||
|
||||
|
||||
public static void Kill(this Actor self, Actor attacker)
|
||||
{
|
||||
var health = self.TraitOrDefault<Health>();
|
||||
|
||||
Reference in New Issue
Block a user