コード例 #1
0
 public override void Execute(Battle.Battle battle, object activeHero, Enemy[] targets, Action <IEnumerable <Tuple <Enemy, bool> > > action)
 {
     Console.WriteLine($"{activeHero.GetType().Name} uses {GetType().Name} on {targets[0]}");
     battle.OnTextCompleted(action);
     if (targets[0].FetchTattleData() != null)
     {
         battle.ShowText(targets[0].FetchTattleData());
     }
     else
     {
         battle.ShowText(battle.TattleStore.FetchGameText(targets[0]));
     }
 }
コード例 #2
0
        public void Setup()
        {
            var bubbleSystem = new TextBubbleSystem();

            Mario = new Mario(
                new Inventory(),
                new List <IJumps> {
                new Attacks.Jump()
            }.ToArray(),
                new Attacks.Hammer());
            Goompa = new Goompa();
            var scriptAttack = new ScriptAttack(EnemyAttack.JrTroopaPowerJump);

            JrTroopa = new JrTroopa(new List <IEnemyAttack> {
                new RegularAttack(EnemyAttack.JrTroopaJump, 1)
            });

            var enemies = new List <Enemy>()
            {
                JrTroopa,
            };

            battle = new Battle.Battle(new List <Hero> {
                Mario, Goompa
            }, enemies, bubbleSystem);
            battle.AddEventOnStarting(new TextBubbleEvent((battleEvent, battle) =>
            {
                battle.ShowText(new GameText("1", "2", "3", "4"));
                //battleEvent.Completed = true;
                battle.OnTextCompleted((_) => battleEvent.Complete());
            }, (battle) => battle.State == BattleState.STARTING));
            battle.AddEventOnStart(new BattleEvent((battleEvent, battle) =>
            {
                battle.ShowText(new GameText("Nice Job"));
                battleEvent.Completed = true;
                battle.OnTextCompleted((_) => battle.EndTurn());
            }, (battle) => battle.Enemies.First(enemy => enemy is JrTroopa).Health.CurrentValue == 4));

            battle.AddEventOnStart(new BattleEvent((battleEvent, battle) =>
            {
                battle.ShowText(new GameText("Mario is lame!"));
                battleEvent.Completed = true;
                battle.OnTextCompleted((_) => battle.EndTurn());
                // what i return a turn end enum, then battle events haave to end turns!
            }, (battle) => battle.Enemies.First(enemy => enemy is JrTroopa).Health.CurrentValue == 3));

            battle.AddEventOnStart(new BattleEvent((battleEvent, battle) =>
            {
                battle.ShowText(new GameText("Goompa: You are almost there mario!"));
                battleEvent.Completed = true;
                battle.OnTextCompleted((_) =>
                {
                    battle.EndTurn();
                });
                // what i return a turn end enum, then battle events haave to end turns!
            }, (battle) => battle.Enemies.First(enemy => enemy is JrTroopa).Health.CurrentValue == 2));

            battle.AddEventOnStart(new BattleEvent((battleEvent, battle) =>
            {
                battle.TextBubbleSystem.ShowText(new GameText("Goompa: You are almost there mario!"));
                battleEvent.Completed = true;

                battle.OnTextCompleted((_) =>
                {
                    battle.ShowText(new GameText("JrTroopa: All right, you asked for it", "Full power!!"));
                    battle.Enemies.First(o => o == JrTroopa).Sequence.Add(scriptAttack);
                    battle.OnTextCompleted(__ =>
                    {
                        battle.EndTurn();
                    });
                });
                // what i return a turn end enum, then battle events haave to end turns!
            }, (battle) => battle.Enemies.First(enemy => enemy is JrTroopa).Health.CurrentValue == 1));
            battle.AddEventOnStart(new BattleEvent((battleEvent, battle) =>
            {
                battle.ShowText(new GameText("Goompa: You got Star points", "You get em when u win", "Every 100 you level up", "Git Hard"));
                battle.Enemies.First(o => o == JrTroopa).Sequence.Add(scriptAttack);
                battle.Enemies.First(o => o == JrTroopa).Sequence.Add(scriptAttack);
                battle.OnTextCompleted((_) =>
                {
                    battle.EndTurn();
                });
                // what i return a turn end enum, then battle events haave to end turns!
            }, (battle) => battle.Enemies.First(enemy => enemy is JrTroopa).Health.CurrentValue == 0));
            //battle.Start();
        }