コード例 #1
0
ファイル: BattleSystem.cs プロジェクト: emhean/Shitemon
        public EffectQueueObject QueueMove(MoveArgs moveArgs, ContentManager contentManager)
        {
            string str = string.Format("sprites/moves/{0}", moveArgs.MoveUsed.asset_name);


            var anim_move = new BattleAnimation(2f, contentManager.Load <Texture2D>(str), moveArgs.Target.renderData.sprite_dest, moveArgs.Target.renderData.sprite_rect);


            // TODO: Implement more animations
            anim_move.HookRender(MoveDelegateBank.MoveBlinkRender);


            var moveResult = moveArgs.MoveUsed.moveDelegate(moveArgs);


            var anim_healthbar = new BattleAnimation(this, moveArgs.Target, moveResult.OutputDamage);


            if (moveArgs.MoveUsed.move_type == MOVE_TYPE.Damage)
            {
                anim_healthbar.HookUpdate(MoveDelegateBank.DamageUpdate);
            }



            BattleAnimation[] arr = new BattleAnimation[]
            {
                anim_move,
                anim_healthbar
            };


            var q = new EffectQueueObject()
            {
                Animations = arr,
                Move       = moveArgs.MoveUsed,
                MoveResult = moveResult,
                User       = moveArgs.User,
                Target     = moveArgs.Target
            };

            effect_que.Add(new List <EffectQueueObject>
            {
                q
            });

            return(q);
        }
コード例 #2
0
ファイル: MoveDelegateBank.cs プロジェクト: emhean/Shitemon
        static public MoveResult Shock(MoveArgs moveArgs)
        {
            bool crit = RollCrit(moveArgs.MoveUsed);
            bool hit  = RollAccuracy(moveArgs.MoveUsed);

            int damage = 0;

            if (hit)
            {
                if (crit)
                {
                    damage = (moveArgs.User.stats.attack + moveArgs.MoveUsed.damage);
                }
                else
                {
                    damage = (moveArgs.User.stats.attack + moveArgs.MoveUsed.damage) - (moveArgs.Target.stats.defence);
                }
            }

            return(new MoveResult(hit, crit, damage, 0));
        }