Exemple #1
0
 public override void Damage(AttackInfo _attack)
 {
     if (_attack.Weapon.Item.HasTag("miner"))
     {
         Item _i = ItemDatabase.Spawn(
             _attack.Source.World,
             ItemDatabase.Items.Find(
             x => x.ID == 1000));
         _i
             .SetPosition(Position)
             .SetVelocity(
                 new Vector2(
                     -0.5f+(float)Game.Random.NextDouble(),
                     -0.5f+(float)Game.Random.NextDouble()
                 ) * 0.2f
         );
         if(_attack.Source.HasTag("ship")) {
             Ship _s = (_attack.Source as Ship);
             _s.AddItem(_i);
             _i.SetVelocity(Vector2.Zero);
         }
     }
 }
Exemple #2
0
 public override void Damage(AttackInfo _attack)
 {
     int _damage = _attack.Damage;
     if (Shield.Current > 0)
     {
         Shield.Current -= _damage;
         _damage -= Shield.Current;
         _damage = Math.Max(_damage, 0);
     }
     health -= _damage;
     if (_attack.Source != null)
     {
         Ship _attacker = _attack.Source as Ship;
         if (Faction.GetRelations(Faction, _attacker.Faction) > -1f)
             Faction.SetRelations(Faction, _attacker.Faction, -1f);
     }
 }
Exemple #3
0
 public virtual void Damage(AttackInfo _attack)
 {
     Health -= _attack.Damage;
 }