public void TestBystandersSuicide() { var info = new DamageInfo(_gob1).Bind(_gob1); var coroner = new Coroner(info); var bystanders = coroner.GetBystandingPlayers(AllPlayers).ToArray(); Assert.AreEqual(new[] { _player2, _player3, _player4 }, bystanders); }
public void Setup() { _arena = new Arena(); _avengers = new Team("Avengers", null); _player1 = new Player(null, "Player 1", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player2 = new Player(null, "Player 2", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player3 = new Player(null, "Player 3", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player2.AssignTeam(_avengers); _player3.AssignTeam(_avengers); _gob1 = new Gob { ID = 10, Owner = _player1, MaxDamageLevel = 100, Arena = _arena }; _gob1DamagedBy2 = new Gob { ID = 11, Owner = _player1, MaxDamageLevel = 100, Arena = _arena }; _gob2 = new Gob { ID = 2, Owner = _player2, MaxDamageLevel = 100, Arena = _arena }; _gob3 = new Gob { ID = 3, Owner = _player3, MaxDamageLevel = 100, Arena = _arena }; _gobNature = new Gob { ID = 4, Owner = null, MaxDamageLevel = 100, Arena = _arena }; _info1Hit1 = new DamageInfo(_gob1).Bind(_gob1); _info2Hit1 = new DamageInfo(_gob2).Bind(_gob1); _info3Hit2 = new DamageInfo(_gob3).Bind(_gob2); _infoNatureHit1 = new DamageInfo(_gobNature).Bind(_gob1); _arena.TotalTime = TimeSpan.FromSeconds(10); _gob1DamagedBy2.InflictDamage(10, new DamageInfo(_gob2)); _info1DamagedBy2 = DamageInfo.Unspecified.Bind(_gob1DamagedBy2); }
public override void InflictDamage(float damageAmount, DamageInfo cause) { if (damageAmount < 0) throw new ArgumentOutOfRangeException("damageAmount"); if (damageAmount == 0) return; if (IsNewborn) return; if (ReceivingDamage != null) damageAmount = ReceivingDamage(damageAmount, cause); if (damageAmount == 0) return; LastDamageTakenTime = Game.DataEngine.ArenaTotalTime; if (Owner != null) Owner.IncreaseShake(damageAmount); base.InflictDamage(damageAmount, cause); }
private void AssertTeamKillMessages(string teamKillPhrase, string killMessage, string deathMessage, string bystanderMessage) { Coroner.SetPhraseSets(new[] { "dummy" }, new[] { "dummy" }, new[] { teamKillPhrase }, new string[0]); var info = new DamageInfo(_gob4).Bind(_gob1); var coroner = new Coroner(info); Assert.AreEqual(_player4, coroner.KillerSpectator); Assert.AreEqual(Coroner.DeathTypeType.TeamKill, coroner.DeathType); Assert.AreEqual(killMessage, coroner.MessageToKiller); Assert.AreEqual(deathMessage, coroner.MessageToCorpse); Assert.AreEqual(bystanderMessage, coroner.MessageToBystander); }
private void AssertSuicideMessages(string suicidePhrase, string deathMessage, string bystanderMessage) { Coroner.SetPhraseSets(new[] { suicidePhrase }, new[] { "dummy" }, new[] { "dummy" }, new string[0]); var info = new DamageInfo(_gob2Nature).Bind(_gob1); var coroner = new Coroner(info); Assert.AreEqual(null, coroner.KillerSpectator); Assert.AreEqual(Coroner.DeathTypeType.Accident, coroner.DeathType); Assert.AreEqual(deathMessage, coroner.MessageToCorpse); Assert.AreEqual(bystanderMessage, coroner.MessageToBystander); }
private float ReceivingDamageHandler(float damageAmount, DamageInfo cause) { var requiredCharge = _chargeUsageMultiplier * damageAmount; if (_inactivationTime <= Owner.Game.GameTime.TotalGameTime) return damageAmount; if (Charge < requiredCharge) { CreateBlockEffect(_blockFailSound, _blockFailPengs, ref _lastFailEffectTime); return damageAmount; } Charge -= requiredCharge; CreateBlockEffect(_blockSuccessSound, _blockSuccessPengs, ref _lastSuccessEffectTime); return _receivedDamageMultiplier * damageAmount; }
public BoundDamageInfo(DamageInfo info, Gob target) : base(info) { if (target == null) throw new ArgumentNullException("target"); Target = target; }
public DamageInfo(DamageInfo info) : this(info.Cause) { }
static DamageInfo() { Unspecified = new DamageInfo(); }