public override void PreProccess()
        {
            // TODO 记下伤害值、异常状态
            int damage;

            ox = Executor.GetCombatX();
            oy = Executor.GetCombatY();
            dx = (44.0f - Executor.GetCombatX()) / TOTAL_FRAME;
            dy = (14.0f - Executor.GetCombatY()) / TOTAL_FRAME;
            for (int i = 0; i < Targets.Count; i++)
            {
                FightingCharacter fc = Targets[i];
                if (!fc.IsAlive)
                {
                    continue;
                }
                damage = Executor.Attack - fc.Defend;
                if (damage <= 0)
                {
                    damage = 1;
                }
                damage += (int)(Context.Random.NextDouble() * 3);
                fc.HP  -= damage;
                RaiseAnimations.Add(new RaiseAnimation(Context, Targets[i].GetCombatX(), Targets[i].GetCombatY(), -damage, 0));
            }
        }
 /// <summary>
 /// 多目标动作
 /// </summary>
 /// <param name="context"></param>
 /// <param name="attacker"></param>
 /// <param name="targets"></param>
 public ActionMultiTarget(SimulatorContext context, FightingCharacter attacker, List <FightingCharacter> targets) : base(context)
 {
     Executor = attacker;
     Targets  = new List <FightingCharacter>();
     Targets.AddRange(targets);
     RaiseAnimations = new List <RaiseAnimation>();
 }
        /// <summary>
        /// 群体使用
        /// </summary>
        /// <param name="user"></param>
        /// <param name="targets"></param>
        public void Use(FightingCharacter user, List <FightingCharacter> targets)
        {
            user.MP = user.MP - CostMp;

            foreach (FightingCharacter fc in targets)
            {
                fc.HP -= AffectHp;
            }
            //TODO 计算BUFF
        }
        /// <summary>
        /// Creates a new EquipmentScreen object for the given player.
        /// </summary>
        public EquipmentScreen(FightingCharacter fightingCharacter)
            : base()
        {
            // check the parameter
            if (fightingCharacter == null)
            {
                throw new ArgumentNullException("fightingCharacter");
            }
            this.fightingCharacter = fightingCharacter;

            // sort the player's equipment
            this.fightingCharacter.EquippedEquipment.Sort(
                delegate(Equipment equipment1, Equipment equipment2)
            {
                // handle null values
                if (equipment1 == null)
                {
                    return(equipment2 == null ? 0 : 1);
                }
                else if (equipment2 == null)
                {
                    return(-1);
                }

                // handle weapons - they're always first in the list
                if (equipment1 is Weapon)
                {
                    return(equipment2 is Weapon ?
                           equipment1.Name.CompareTo(equipment2.Name) : -1);
                }
                else if (equipment2 is Weapon)
                {
                    return(1);
                }

                // compare armor slots
                Armor armor1 = equipment1 as Armor;
                Armor armor2 = equipment2 as Armor;
                if ((armor1 != null) && (armor2 != null))
                {
                    return(armor1.Slot.CompareTo(armor2.Slot));
                }

                return(0);
            });

            // configure the menu text
            titleText        = "Equipped Gear";
            selectButtonText = String.Empty;
            backButtonText   = "Back";
            xButtonText      = "Unequip";
            yButtonText      = String.Empty;
            leftTriggerText  = String.Empty;
            rightTriggerText = String.Empty;
        }
        private void UseMagic(FightingCharacter target)
        {
            //TODO 处理异常状态
            var debuffs = target.DeBuffRound.Clone() as int[];
            var oldhp   = target.HP;

            _magic.Use(Attackers[0], target);
            var damage = oldhp - target.HP;

            RaiseAnimations.Add(new RaiseAnimation(Context, target.GetCombatX(), target.GetCombatY(), -damage, 0));
        }
        /// <summary>
        /// 合击动作
        /// </summary>
        /// <param name="actors"></param>
        /// <param name="monster"></param>
        public ActionCoopMagic(SimulatorContext context,
                               List <PlayerCharacter> actors,
                               FightingCharacter monster)
            : base(context,
                   actors.First(),
                   new List <FightingCharacter>() { monster })
        {
            State = CombatAnimationState.Move;

            Attackers       = actors;
            _onlyOneMonster = true;

            _magic = GetCoopMagic();
        }
示例#7
0
        public override void Use(FightingCharacter user, FightingCharacter target)
        {
            if (user.MP < CostMp)
            {
                return;
            }

            user.MP -= CostMp;

            target.HP += RestoreHp;
            if (target.HP > target.MaxHP)
            {
                target.HP = target.MaxHP;
            }
            target.DelDebuff(DefendDeBuff);
        }
        /// <summary>
        /// 执行完毕返回<code>false</code>
        /// </summary>
        private bool FixAction()
        {
            // attacker dead, goto next action
            while (!mCurrentAction.IsAttackerAlive())
            {
                mCurrentAction = mActionQueue.Dequeue();
                if (mCurrentAction == null)
                {
                    return(false);
                }
            }

            // target dead, get an alive target
            if (!mCurrentAction.IsTargetAlive())
            {
                if (mCurrentAction.IsTargetsMoreThanOne())
                { // 敌人都死了
                    return(false);
                }
                else
                { // try to find an alive target
                    FightingCharacter newTarget = null;
                    if (mCurrentAction.TargetIsMonster())
                    {
                        newTarget = mCombat.GetFirstAliveMonster();
                    }
                    else
                    {
                        newTarget = mCombat.GetRandomAlivePlayer();
                    }

                    if (newTarget == null)
                    {
                        return(false);
                    }
                    else if (!(mCurrentAction is ActionFlee))
                    {
                        ((ActionSingleTarget)mCurrentAction).SetTarget(newTarget);
                    }
                }
            }

            return(true);
        }
        /// <summary>
        /// Creates a new SpellbookScreen object for the given player and statistics.
        /// </summary>
        public SpellbookScreen(FightingCharacter fightingCharacter,
                               StatisticsValue statistics)
            : base()
        {
            // check the parameter
            if (fightingCharacter == null)
            {
                throw new ArgumentNullException("fightingCharacter");
            }
            this.fightingCharacter = fightingCharacter;
            this.statistics        = statistics;

            // sort the player's spell
            this.fightingCharacter.Spells.Sort(
                delegate(Spell spell1, Spell spell2)
            {
                // handle null values
                if (spell1 == null)
                {
                    return(spell2 == null ? 0 : 1);
                }
                else if (spell2 == null)
                {
                    return(-1);
                }

                // sort by name
                return(spell1.Name.CompareTo(spell2.Name));
            });

            // configure the menu text
            titleText        = "Spell Book";
            selectButtonText = "Cast";
            backButtonText   = "Back";
            xButtonText      = String.Empty;
            yButtonText      = String.Empty;
            leftTriggerText  = String.Empty;
            rightTriggerText = String.Empty;
        }
示例#10
0
 /// <summary>
 /// 使用魔法
 /// </summary>
 /// <param name="user"></param>
 /// <param name="target"></param>
 public virtual void Use(FightingCharacter user, FightingCharacter target)
 {
 }
示例#11
0
 /// <summary>
 /// 单体使用
 /// </summary>
 /// <param name="user"></param>
 /// <param name="target"></param>
 public override void Use(FightingCharacter user, FightingCharacter target)
 {
     user.MP   = user.MP - CostMp;
     target.HP = target.HP - AffectHp;
     //TODO 计算BUFF
 }
示例#12
0
 public ActionDefend(SimulatorContext context, FightingCharacter fc) : base(context, fc, null)
 {
 }
 /// <summary>
 /// 投掷群体暗器
 /// </summary>
 /// <param name="context"></param>
 /// <param name="attacker"></param>
 /// <param name="targets"></param>
 /// <param name="goods"></param>
 public ActionThrowItemAll(SimulatorContext context, FightingCharacter attacker, List <FightingCharacter> targets, GoodsHiddenWeapon goods) : base(context, attacker, targets)
 {
     _hiddenWeapon = goods;
 }
 /// <summary>
 /// 单目标动作
 /// </summary>
 /// <param name="context"></param>
 /// <param name="attacker"></param>
 /// <param name="target"></param>
 public ActionSingleTarget(SimulatorContext context, FightingCharacter attacker, FightingCharacter target) : base(context)
 {
     Executor = attacker;
     Target   = target;
 }
 /// <summary>
 /// 群体物理攻击
 /// </summary>
 /// <param name="context"></param>
 /// <param name="attacker"></param>
 /// <param name="targets"></param>
 public ActionPhysicalAttackAll(SimulatorContext context, FightingCharacter attacker, List <FightingCharacter> targets) : base(context, attacker, targets)
 {
 }
示例#16
0
 /// <summary>
 /// 单体魔法攻击
 /// </summary>
 /// <param name="context"></param>
 /// <param name="attacker"></param>
 /// <param name="target"></param>
 /// <param name="magic"></param>
 public ActionMagicAttackOne(SimulatorContext context, FightingCharacter attacker, FightingCharacter target, BaseMagic magic) : base(context, attacker, target)
 {
     _magic = magic;
 }
 /// <summary>
 /// 使用单体物品
 /// </summary>
 /// <param name="context"></param>
 /// <param name="attacker"></param>
 /// <param name="target"></param>
 /// <param name="goods"></param>
 public ActionUseItemOne(SimulatorContext context, FightingCharacter attacker, FightingCharacter target, BaseGoods goods) : base(context, attacker, target)
 {
     _goods = goods;
 }
 /// <summary>
 /// 使用群体物品
 /// </summary>
 /// <param name="context"></param>
 /// <param name="attacker"></param>
 /// <param name="targets"></param>
 /// <param name="goods"></param>
 public ActionUseItemAll(SimulatorContext context, FightingCharacter attacker, List <FightingCharacter> targets, BaseGoods goods) : base(context, attacker, targets)
 {
     _goods = goods;
 }
 /// <summary>
 /// 单体物理攻击
 /// </summary>
 /// <param name="context"></param>
 /// <param name="attacker"></param>
 /// <param name="target"></param>
 public ActionPhysicalAttackOne(SimulatorContext context, FightingCharacter attacker, FightingCharacter target) : base(context, attacker, target)
 {
 }
 public void SetTarget(FightingCharacter fc)
 {
     Target = fc;
 }
 /// <summary>
 /// 单体投掷
 /// </summary>
 /// <param name="context"></param>
 /// <param name="attacker"></param>
 /// <param name="target"></param>
 /// <param name="hiddenWeapon"></param>
 public ActionThrowItemOne(SimulatorContext context, FightingCharacter attacker, FightingCharacter target, GoodsHiddenWeapon hiddenWeapon) : base(context, attacker, target)
 {
     _hiddenWeapon = hiddenWeapon;
 }
 /// <summary>
 /// 全体辅助魔法
 /// </summary>
 /// <param name="context"></param>
 /// <param name="attacker"></param>
 /// <param name="targets"></param>
 /// <param name="magic"></param>
 public ActionMagicHelpAll(SimulatorContext context, FightingCharacter attacker, List <FightingCharacter> targets, BaseMagic magic) : base(context, attacker, targets)
 {
     _magic = magic;
 }