public override void DoSkill(Living caster, Living livingTarget, Tile TileTarget) { if (livingTarget != null) { caster.Mana -= ManaCost; NonAnimationSoundEvent MagicBoldSound = new NonAnimationSoundEvent("Sounds/donnerre2"); LocalServer.SendToClients(MagicBoldSound); livingTarget.TakeDamage(skillPower, DamageType.Magic); } else { throw new Exception("invalid target"); } }
public void Special_Attack(Living target, double mod) { int damageDealt = 0; DamageType damageType = DamageType.Magic; double modifier = mod; double attackValue = Special_AttackValue(modifier); damageDealt = target.TakeDamage(attackValue, damageType); if (damageDealt > 0) { ProcessReflection(damageDealt, target); } // Display attack missed (feedback on fail) }
/// <summary> /// Handles attacking an opponent. First checks if attacker hits opponent, if succesfull sends attackvalue to defending side, if unsuccesfull displays miss feedback /// </summary> /// <param name="target"></param> public void Attack(Living target) { string hitSound = "Sounds/muted_metallic_crash_impact"; int damageDealt = 0; DamageType damageType = DamageType.Physical; if (Weapon.SlotItem != null) { WeaponEquipment weaponItem = Weapon.SlotItem as WeaponEquipment; damageType = weaponItem.GetDamageType; hitSound = weaponItem.HitSound; } //double hitNumber = GameEnvironment.Random.NextDouble(); //if (hitNumber < HitChance()) if (TryHit(target)) { double attackValue = AttackValue(); NonAnimationSoundEvent hitSoundEvent = new NonAnimationSoundEvent(hitSound); //no annimation for attacks (hit or miss) yet. when inplementing that, include sound effect there and remove this. LocalServer.SendToClients(hitSoundEvent); damageDealt = target.TakeDamage(attackValue, damageType); } else { //TODO: Display attack missed (visual feedback on fail) NonAnimationSoundEvent missSoundEvent = new NonAnimationSoundEvent("Sounds/Dodge"); //no annimation for attacks (hit or miss) yet. when inplementing that, include sound effect there and remove this. LocalServer.SendToClients(missSoundEvent); } if (damageDealt > 0) { ProcessReflection(damageDealt, target); } }