public int GetDamageModifier(Actor attacker, DamageWarhead warhead) { if (!IsProne) { return(100); } var modifierPercentages = info.DamageModifiers.Where(x => warhead.DamageTypes.Contains(x.Key)).Select(x => x.Value); return(Util.ApplyPercentageModifiers(100, modifierPercentages)); }
public int GetDamageModifier(Actor attacker, DamageWarhead warhead) { var percent = 100; if (attacker.Owner.IsAlliedWith(self.Owner) && warhead.Damage < 0 && !Info.ModifyHealing) { return(percent); } var world = self.World; var map = world.Map; var tileSet = world.TileSet; var tiles = map.MapTiles.Value; var pos = map.CellContaining(self.CenterPosition); var terrainType = tileSet[tileSet.GetTerrainIndex(tiles[pos])].Type; if (!Info.TerrainModifier.ContainsKey(terrainType)) { return(percent); } return(Info.TerrainModifier[terrainType]); }
public int GetDamageModifier(Actor attacker, DamageWarhead warhead) { return(state == PopupState.Closed ? info.ClosedDamageMultiplier : 100); }
public int GetDamageModifier(Actor attacker, DamageWarhead warhead) { return(IsProne && warhead != null ? warhead.ProneModifier : 100); }
public static void InflictDamage(this Actor self, Actor attacker, int damage, DamageWarhead warhead) { if (self.Destroyed) { return; } var health = self.TraitOrDefault <Health>(); if (health == null) { return; } health.InflictDamage(self, attacker, damage, warhead, false); }
public void InflictDamage(Actor self, Actor attacker, int damage, DamageWarhead warhead, bool ignoreModifiers) { // Overkill! don't count extra hits as more kills! if (IsDead) { return; } var oldState = this.DamageState; // Apply any damage modifiers if (!ignoreModifiers && damage > 0) { var modifiers = self.TraitsImplementing <IDamageModifier>() .Concat(self.Owner.PlayerActor.TraitsImplementing <IDamageModifier>()) .Select(t => t.GetDamageModifier(attacker, warhead)); damage = Util.ApplyPercentageModifiers(damage, modifiers); } hp = Exts.Clamp(hp - damage, 0, MaxHP); var ai = new AttackInfo { Attacker = attacker, Damage = damage, DamageState = this.DamageState, 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 (Info.NotifyAppliedDamage && 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) { foreach (var nd in self.TraitsImplementing <INotifyKilled>() .Concat(self.Owner.PlayerActor.TraitsImplementing <INotifyKilled>())) { nd.Killed(self, ai); } if (RemoveOnDeath) { self.Destroy(); } Log.Write("debug", "{0} #{1} killed by {2} #{3}", self.Info.Name, self.ActorID, attacker.Info.Name, attacker.ActorID); } }
public int GetDamageModifier(Actor attacker, DamageWarhead warhead) { return(enabled ? 0 : 100); }
public int GetDamageModifier(Actor attacker, DamageWarhead warhead) { return(damageLevel > 0 ? info.DamageModifier[damageLevel - 1] : 100); }
public int GetDamageModifier(Actor attacker, DamageWarhead warhead) { return(0); }
public int GetDamageModifier(Actor attacker, DamageWarhead warhead) { return(IsTraitDisabled ? 100 : 0); }