/// <summary> /// Factory /// </summary> /// <param name="name">The name of effect</param> /// <param name="duration">Current duration</param> /// <returns>Effect object</returns> internal static AttackModificators CreateEffectByID(eModificatorName name, int duration = 50) { switch (name) { case eModificatorName.NoEffect: return null; case eModificatorName.Freeze: return new FreezeModificator(2, duration); case eModificatorName.Burn: return new BurningModificator(2, 5, duration); case eModificatorName.Posion: return new PosionModificator(2, 10, 7, duration); } return null; }
/// <summary> /// Damadge to monster /// </summary> /// <param name="damadge">The damadge.</param> /// <param name="modificator">The modificator.</param> /// <param name="reduceable">if set to <c>true</c> [reduceable].</param> internal void GetDamadge(int damadge, eModificatorName modificator = eModificatorName.NoEffect, bool reduceable = true/*may be reduced by armor*/) { _currentBaseParams.HealthPoints -= reduceable ? damadge * (1 - _currentBaseParams.Armor / 100) : damadge; if (_currentBaseParams.HealthPoints > 0)//If unit alive { if (modificator != eModificatorName.NoEffect)//If missle with effect { bool find = false; foreach (var effect in _effects.Where(effect => effect.Type == modificator)) { effect.Reset(); find = true; } if (!find) { _effects.Add(AttackModificators.CreateEffectByID(modificator)); } } return; } _currentBaseParams.HealthPoints = 0; DestroyMe = true; }
/// <summary> /// Prevents a default instance of the <see cref="Missle"/> class from being created. /// </summary> /// <param name="aimID">The aim ID.</param> /// <param name="damadge">The damadge.</param> /// <param name="missleType">Type of the missle.</param> /// <param name="misslePenColor">Color of the missle pen.</param> /// <param name="missleBrushColor">Color of the missle brush.</param> /// <param name="modificator">The modificator.</param> /// <param name="position">The position.</param> /// <param name="progress">The progress.</param> private Missle(int aimID, int damadge, eTowerType missleType, Color misslePenColor, Color missleBrushColor, eModificatorName modificator, PointF position, int progress = 30) { _aimID = aimID; _damadge = damadge; _missleType = missleType; _missleBrushColor = missleBrushColor; _misslePenColor = misslePenColor; _modificator = modificator; DestroyMe = false; _position = new PointF(position.X, position.Y); _progress = progress; }
public TowerParam() { Icon = null; MisslePenColor = Color.Black; MissleBrushColor = Color.Black; TowerType = eTowerType.Simple; UnlimitedUp = false; TrueSight = false; UpgradeParams = new List<sMainTowerParam>(); Modificator = eModificatorName.NoEffect; UpgradeParams.Add(new sMainTowerParam()); UpgradeParams[0] = sMainTowerParam.CreateDefault(); }