예제 #1
0
        public override void  UpdateSelf()
        {
            if (IsFlying == false)
            {
                return;
            }
            // check for collision with target
            RPGCalc calc = new RPGCalc();

            if (calc.ObjectsCollide(this, this.Target))
            {
                switch (calc.AttemptHit(this.Owner, this.Target))
                {
                case (RPGCalc.ChallangeResult.Critical_Failure):     // crit miss
                {
                    // do nothing - maybe damage self?
                    this.Target.MissedMe();
                    break;
                }

                case (RPGCalc.ChallangeResult.Failure):     // miss
                {
                    // do nothing
                    this.Target.MissedMe();
                    break;
                }

                case (RPGCalc.ChallangeResult.Success):     // hit
                {
                    // damage target
                    Target.DamageMe(GetThisDmg(false));
                    break;
                }

                case (RPGCalc.ChallangeResult.Critical_Success):     // crit hit
                {
                    // damage target * 2
                    Target.DamageMe(GetThisDmg(true));
                    break;
                }

                default:
                {
                    break;
                }
                } // end switch

                // delete self on collide
                this.DeleteMe = true;
            } // end if collide
            else
            {
                this.X += this.VX;
                this.Y += this.VY;

                // if off screen, then delete me.
                if (this.X + this.Width < 0 ||
                    this.X > Session.thisSession.TabPageAction.panelAction.Width ||
                    this.Y + this.Height < 0 ||
                    this.Y > Session.thisSession.TabPageAction.panelAction.Height)
                {
                    this.DeleteMe = true;
                }
            }
        }