public void BlockDamage(Damage dmg, Vector2 arg_pos) { float total_dmg = shield_resistance.EvaluateDamage(dmg); integrity -= total_dmg; art.Ping(arg_pos, total_dmg ); if (integrity < 0) { this.Pop(); } }
public Damage BlockDamage(Damage dmg, Vector2 arg_pos) { int segment = this.GetSegment( arg_pos - ship.pos ); if (integrity[segment] > 0) { float dmg_dealt = armor_resistance.EvaluateDamage(dmg); if (integrity[segment] < dmg_dealt) { float segment_hp = integrity[segment]; integrity[segment] = 0.0f; return armor_resistance.RemainingDamage(segment_hp, dmg); } else { integrity[segment] -= dmg_dealt; return null; } } return dmg; }
public virtual void AdsorbDamage(Damage dmg, Vector2 position) { }
public virtual Damage AdsorbDamage( Damage dmg ) { float dmg_dealt = base_template.resistance.EvaluateDamage(dmg); if (health < dmg_dealt) { Damage remaining = base_template.resistance.RemainingDamage(health, dmg); this.Destroy(); return remaining; } else { health -= dmg_dealt; return null; } }
public override void AdsorbDamage(Damage dmg, Vector2 position) { Vector2 local_position = Utility.Rotate(position - pos, -angle); Component[] components = ListComponents().ToArray(); float[] distances = new float[components.Length]; for (int i = 0; i < components.Length; i++) { distances[i] = (components[i].pos - local_position).LengthSquared(); } Array.Sort(distances, components); foreach (Component comp in components) { if (!comp.destroyed) { dmg = comp.AdsorbDamage(dmg); if (dmg == null) { break; } } } }
public float EvaluateDamage(Damage dmg) { return (dmg.kinetic * kinetic) + (dmg.thermal * thermal) + (dmg.electro * electro) + (dmg.mining * mining); }
public Explosion(Damage arg_dmg, ArtExplosionResource arg_cloud_art, float arg_art_scale = 1.0f) { dmg = arg_dmg; art_cloud_resource = arg_cloud_art; art_scale = arg_art_scale; }
public Damage RemainingDamage(float hp, Damage dmg) { float max_damage = this.EvaluateDamage(dmg); return dmg * ((max_damage - hp) / max_damage); }