/// <summary>
 /// 物理攻击使对方造成伤害
 /// </summary>
 /// <param name="target">目标角色</param>
 public void AttackToHurt(RoleBase target)
 {
     //模拟伤害计算
     int damage = this.ATK - target.DEF < 0 ? 0 : this.ATK - target.DEF + RandomSeed.Next(-this.ATK / 3, this.ATK / 2);
     //各种伤害情况判断(实际不这么写,需要真实的数值公式计算)
     if (damage == 0 || RandomSeed.Next(100) < target.DEX) {
         target.ChangeLife(0, ValueEffects.Failure);
         return;
     } else if (RandomSeed.Next(100) > 80) {
         //暴击
         target.ChangeLife(-damage * 2, ValueEffects.DoubleDecrease);
         target.Quiver(2);
     } else {
         target.ChangeLife(-damage, ValueEffects.Decrease);
     }
     //伤害后如果对象生命为0
     if (target.Life == 0) {
         this.Stop();
         this.Target = null;
         target.ChangeLife(0, ValueEffects.Death);
     } else {
         ////附加被攻击装饰特效及额外特效都均可写在武器的Info.xml中
         //if (this.AttactEffect != -1) {
         //    Animation animation = new Animation() { Code = this.AttactEffect, Coordinate = obj.Center };
         //    EventHandler handler = null;
         //    animation.Disposed += handler = delegate {
         //        animation.Disposed -= handler;
         //        obj.RemoveTemporaryEffect();
         //    };
         //    obj.AddTemporaryEffect(animation);
         //}
     }
 }
 /// <summary>
 /// 魔法/技能攻击产生效果(伤害/治疗)
 /// </summary>
 public void CastingToEffect(RoleBase target, MagicArgs args)
 {
     //依据魔法实效类型处理
     switch (args.MagicEffectType) {
         case MagicEffectTypes.Gain:
             target.ChangeLife(Convert.ToInt32(args.Tag), ValueEffects.Increase);
             break;
         case MagicEffectTypes.Reduction:
             //模拟伤害计算
             int damage = RandomSeed.Next(this.MAG + args.EffectMin, this.MAG + args.EffectMax);
             if (RandomSeed.Next(100) > 90) {
                 target.ChangeLife(0, ValueEffects.Failure);
                 return;
             } else if (RandomSeed.Next(100) > 85) {
                 //暴击
                 target.ChangeLife(-damage * 2, ValueEffects.DoubleDecrease);
             } else {
                 target.ChangeLife(-damage, ValueEffects.Decrease);
             }
             //伤害后如果对象生命为0
             if (target.Life == 0) {
                 target.ChangeLife(0, ValueEffects.Death);
                 if (Action == Actions.Attack && !isSpecialMove) { this.Stop(); }
                 this.Target = null;
                 return;
             }
             break;
     }
     //显示魔法附加效果
     if (args.AdditionalEffect != AdditionalEffects.None) {
         EventHandler handler = null;
         AnimationBase animation = new AnimationBase() {
             Code = (int)args.AdditionalEffect,
             Position = target.Center,
             Z = 1000,
         };
         animation.Disposed += handler = (s0, e0) => {
             animation.Disposed -= handler;
             target.RemoveEffect(EffectTypes.Temporary);
         };
         target.AddEffect(animation, EffectTypes.Temporary);
     }
     //魔法特殊效果
     switch (args.SpecialEffect) {
         case SpecialEffects.Injure:
             target.Injure();
             break;
         case SpecialEffects.Bounce:
             target.BeBounce(args.Position, Convert.ToDouble(args.Tag), 500);
             break;
         case SpecialEffects.Knock:
             //target.BeKnock(40);
             break;
         case SpecialEffects.Freeze:
             //测试,50%几率命中
             if (RandomSeed.Next(100) > 50) {
                 target.BeFreeze(Convert.ToDouble(args.Tag));
             }
             break;
         case SpecialEffects.Petrifaction:
             //测试,50%几率命中
             if (RandomSeed.Next(100) > 50) {
                 target.BePetrifaction(Convert.ToDouble(args.Tag));
             }
             break;
         case SpecialEffects.Poison:
             target.BePoison(RandomSeed.Next(200, 500), Convert.ToDouble(args.Tag));
             break;
         case SpecialEffects.Quiver:
             target.Quiver(6);
             break;
     }
 }