public ActorSpell GetSpell(ActorSpellName spellName) { return((from kv in this.SpellDictionary where kv.Value.ContainsKey(spellName) select kv.Value[spellName]).FirstOrDefault()); }
public override void Execute(ActorController entityType) { if (entityType.IsStun) { entityType.StunDuration -= Time.deltaTime; if (entityType.StunDuration <= 0) { entityType.IsStun = false; entityType.StunDuration = 0; } return; } if (entityType.IsBleed) { entityType.BleedDuration -= Time.deltaTime; Damage bleedDamage = new Damage(); bleedDamage.DamageValue = entityType.BleedDps * Time.deltaTime; entityType.TakeDamage(bleedDamage); if (entityType.BleedDuration <= 0) { entityType.IsBleed = false; entityType.BleedDps = 0; entityType.BleedDuration = 0; } } if (entityType.IsRaging) { entityType.RagingDuration -= Time.deltaTime; if (entityType.RagingDuration <= 0) { entityType.IsRaging = false; entityType.RagingDuration = 0; } } if (entityType.IsShamanBlessing) { entityType.ShamanBlessingDuration -= Time.deltaTime; this.shamanBlessCounter += Time.deltaTime; if (this.shamanBlessCounter >= 1) { Damage blessDamage = new Damage(); blessDamage.DamageValue = -3; blessDamage.ShowCrit = true; entityType.TakeDamage(blessDamage); this.shamanBlessCounter = 0f; } if (entityType.ShamanBlessingDuration <= 0) { entityType.IsShamanBlessing = false; this.shamanBlessCounter = 0f; } } if (entityType.IsCaught) { entityType.CaughtDuration -= Time.deltaTime; if (entityType.CaughtDuration <= 0) { entityType.IsCaught = false; } } if (entityType.IsPoisioning) { this.poisionCounter += Time.deltaTime; if (this.poisionCounter >= 1f) { Damage poisionDamage = new Damage(); poisionDamage.DamageValue = entityType.PoisionDps; poisionDamage.ShowCrit = true; entityType.TakeDamage(poisionDamage); this.poisionCounter = 0f; } } if (entityType.IsBurningOilAttacked) { this.burningOilCounter += Time.deltaTime; if (this.burningOilCounter >= 1f) { Damage burningOilDamage = new Damage(); burningOilDamage.DamageValue = entityType.BurningOilDps; burningOilDamage.ShowCrit = true; entityType.TakeDamage(burningOilDamage); this.burningOilCounter = 0f; } entityType.BurningOilDuration -= Time.deltaTime; if (entityType.BurningOilDuration <= 0) { entityType.IsBurningOilAttacked = false; this.burningOilCounter = 0f; } } if (this.releaseCounterDictionary != null && this.activeSpellDictionary != null) { //foreach (KeyValuePair<ActorSpellName, float> kv in this.releaseCounterDictionary) ActorSpellName[] actorSpellArray = new ActorSpellName[this.releaseCounterDictionary.Keys.Count]; float[] counterArray = new float[this.releaseCounterDictionary.Keys.Count]; this.releaseCounterDictionary.Keys.CopyTo(actorSpellArray, 0); this.releaseCounterDictionary.Values.CopyTo(counterArray, 0); for (int i = 0; i < counterArray.Length; i++) { float temp = counterArray[i] + Time.deltaTime; ActorSpell spell = this.activeSpellDictionary[actorSpellArray[i]]; if (temp >= spell.ReleaseInterval) { this.ReleaseActiveSpell(entityType, spell); temp = 0f; } this.releaseCounterDictionary[actorSpellArray[i]] = temp; } } }
public bool HasSpell(ActorSpellName spellName) { return(this.SpellDictionary.Any(kv => kv.Value.ContainsKey(spellName))); }
public ActorSpell(ActorSpellName spellName, ActorType actorType) { this.ActorSpellType = ActorSpellType.PassiveSpell; this.ActorSpellName = spellName; this.ReleaseInterval = 0; this.AttackRange = 0; this.DamageBonusPercent = 0f; this.DamageBonusPercentProbability = 0; this.IncreaseFriendlyForcesArmor = 0; this.Resurrection = false; this.StunDuration = 0; this.StunProbability = 0; this.AdditionalDamage = 0; this.AdditionalDamageProbability = 0; this.DirectDamage = 0; this.DirectDamageProbability = 0; this.SplashPercent = 0; this.EvasiveProbability = 0; this.ParryAttackType = ActorAttackType.Normal; this.ParryPercent = 0; this.BleedDuration = 0; this.BleedProbability = 0; this.BleedDps = 0; this.IncreaseOneFriendlyUnitHp = 0; switch (actorType) { case ActorType.Infantry: { this.ParryAttackType = ActorAttackType.Pierce; this.ParryPercent = 30; break; } case ActorType.Supporter: { this.EvasiveProbability = 15; break; } case ActorType.Sniper: { this.DamageBonusPercent = 1.5f; this.DamageBonusPercentProbability = 10; break; } case ActorType.Marksman: { this.DamageBonusPercent = 3; this.DamageBonusPercentProbability = 40; break; } case ActorType.HeavyGunner: { this.AttackRange = 18; this.SplashPercent = 50; break; } case ActorType.MortarTeam: { this.AttackRange = 40; this.DirectDamage = 21; this.ReleaseInterval = 3; this.ActorSpellType = ActorSpellType.ActiveSpell; break; } case ActorType.Warlock: { this.AttackRange = 50; this.DirectDamage = 27; this.ReleaseInterval = 5; this.ActorSpellType = ActorSpellType.ActiveSpell; break; } case ActorType.GryphonRider: { this.BleedProbability = 25; this.BleedDps = 15; this.BleedDuration = 3; break; } case ActorType.SeniorGryphonRider: { this.BleedProbability = 30; this.BleedDps = 20; this.BleedDuration = 5; break; } case ActorType.Crusader: { this.StunDuration = 2; this.StunProbability = 20; this.AdditionalDamage = 25; break; } case ActorType.TemplarWarrior: { this.StunDuration = 2; this.StunProbability = 25; this.AdditionalDamage = 30; break; } case ActorType.Pastor: { this.IncreaseOneFriendlyUnitHp = 300; this.ReleaseInterval = 15; this.ActorSpellType = ActorSpellType.ActiveSpell; break; } case ActorType.Sage: { this.DirectDamageProbability = 25; this.DirectDamage = 200; break; } case ActorType.Knight: { this.IncreaseFriendlyForcesArmor = 6; this.AttackRange = 160; this.ReleaseInterval = 10; break; } case ActorType.Paladin: { this.IncreaseFriendlyForcesArmor = 9; this.AttackRange = 200; this.ReleaseInterval = 8; break; } case ActorType.Shaman: { this.ReleaseInterval = 16; break; } case ActorType.WitchDoctor: { this.ReleaseInterval = 10; break; } case ActorType.Raider: { this.ReleaseInterval = 8; break; } case ActorType.Catapult: { this.ReleaseInterval = 3; break; } case ActorType.SpiritWalker: { this.ReleaseInterval = 10; break; } } }