Exemplo n.º 1
0
        protected void OnAttack(AttackEventArgs e)
        {
            EventHandler<AttackEventArgs> handler = this.Attack;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 2
0
        private void HandlePlayerAttack(object sender, AttackEventArgs e)
        {
            if (e.X == this.x && e.Y == this.y && e.Z == this.z)
            {
                Character attacker = (Character)sender;

                if (e.CombatTarget == this)
                {
                    this.inCombat = true;
                    this.combatTarget = attacker;

                    this.attackTimer = new System.Timers.Timer();
                    this.attackTimer.Elapsed += new ElapsedEventHandler(attackTimer_Elapsed);
                    this.attackTimer.Interval = Math.Ceiling((double)(60000 / this.agility));
                    this.attackTimer.Start();
                }
                else
                {
                    this.writeToClient(attacker.Name + " ATTACKS " + e.CombatTarget.Name + ".\r\n");
                }
            }
        }