public void PerformBuff() { var effect = new BuffEffect("TestHpBuff"); var interaction = new Interaction(tower, creep, adjustment, effect); interaction.Apply(); Assert.AreEqual(204.0f, creep.GetStatValue("Hp")); }
private static void BuffAllCreepsToDropMoreGold() { var creeps = EntitiesRunner.Current.GetEntitiesOfType<Creep>(); var payday = new BuffEffect("PiggyBankPayDayGoldMultiplier"); foreach (var creep in creeps) creep.ApplyBuff(payday); }
public void Constructor() { var effect = new BuffEffect("TestHpBuff"); var interaction = new Interaction(tower, creep, adjustment, effect); Assert.AreEqual(tower, interaction.Source); Assert.AreEqual(creep, interaction.Target); }
public void SettingsConstructor() { var goldBuff = new BuffEffect("TestGoldBuff"); Assert.AreEqual("Gold", goldBuff.Attribute); Assert.AreEqual(2.0f, goldBuff.Multiplier); Assert.AreEqual(-3.0f, goldBuff.Addition); Assert.AreEqual(5.0f, goldBuff.Duration); }
public void Constructor() { var stat = new Stat(100.0f); var effect = new BuffEffect("TestGoldBuff"); var buff = new Buff(stat, effect); Assert.AreEqual(stat, buff.Stat); Assert.AreEqual(effect, buff.Effect); Assert.AreEqual(0, buff.Elapsed); }
public void ApplyBuff(BuffEffect effect) { if (effect.Attribute == null) return; Stat buffedStat; if (!Stats.TryGetValue(effect.Attribute, out buffedStat)) return; buffedStat.ApplyBuff(effect); buffs.Add(new Buff(buffedStat, effect)); }
public void Properties() { var stat = new Stat(100.0f); const float Elapsed = 4.0f; var effect = new BuffEffect("TestGoldBuff"); var buff = new Buff(new Stat(0.0f), new BuffEffect("TestHpBuff")) { Stat = stat, Effect = effect, Elapsed = Elapsed }; Assert.AreEqual(stat, buff.Stat); Assert.AreEqual(effect, buff.Effect); Assert.AreEqual(Elapsed, buff.Elapsed); }
private static void SetUnreacheableTile(this GameLevel level, Vector2D position, TowerType type) { var pathfinding = level.GetPathFinding(); var index = (int)(position.X + position.Y * level.Size.Width); level.MapData[index] = LevelTileType.Blocked; pathfinding.SetUnreachableAndUpdate(index); var towerProperties = ContentLoader.Load<TowerPropertiesXml>(Xml.TowerProperties.ToString()); var buff = new BuffEffect(Player.Current.Avatar.GetType().Name + "RangeMultiplier"); var range = towerProperties.Get(type).Range; range *= buff.Multiplier > 0.0f ? buff.Multiplier : 1.0f; pathfinding.UpdateWeightInAdjacentNodes(position, (int)range, 100); }
public void RemoveBuff(BuffEffect effect) { buffMultipliers /= effect.Multiplier; buffAdditions -= effect.Addition; }
public void ApplyBuff(BuffEffect effect) { buffMultipliers *= effect.Multiplier; buffAdditions += effect.Addition; }