コード例 #1
0
        public void Setup()
        {
            var bubbleSystem = new TextBubbleSystem();

            Mario = new Mario(
                new Inventory(),
                new List <IJumps> {
                new Attacks.Jump(), new PowerJump()
            }.ToArray(),
                new Attacks.Hammer(), new Attacks.HammerThrow());
            Goombario = new Goombario();
            //var scriptAttack = new ScriptAttack(EnemyAttack.JrTroopaPowerJump);
            //JrTroopa = new JrTroopa(new List<IEnemyAttack> { new RegularAttack(EnemyAttack.JrTroopaJump, 1) });
            Magikoopa = new Magikoopa();
            var enemies = new List <Enemy>()
            {
                Magikoopa
            };

            battle = new Battle.Battle(new List <Hero> {
                Mario, Goombario
            }, enemies, bubbleSystem);


            //battle.Start();
        }
コード例 #2
0
        public void Setup()
        {
            var bubbleSystem = new TextBubbleSystem();

            this.mario = new Mario(
                new Inventory(new Item("Mushroom"), new Item("Fire Flower", 3, TargetType.All), new Item("Mushroom")),
                new List <IJumps> {
                new Attacks.Jump(), new PowerJump()
            }.ToArray(),
                new Attacks.Hammer());
            this.goombario  = new Goombario(bubbleSystem);
            this.GoombaKing = new GoombaKing(new List <IEnemyAttack> {
                new ScriptAttack(EnemyAttack.GoomnutJump), new GoombaKingKick()
            });
            var goomNutTree = new GoomnutTree();

            this.redGoomba = new RedGoomba(2);
            var enemyFactory = new EnemyFactory();

            this.blueGoomba = enemyFactory.FetchEnemy <NewBlueGoomba>(2);
            var enemies = new List <Enemy>()
            {
                goomNutTree,
                GoombaKing,
                redGoomba,
                blueGoomba,
            };

            battle = new Battle.Battle(new List <Hero> {
                mario, goombario
            }, enemies, bubbleSystem);
            battle.Start();
        }
コード例 #3
0
ファイル: HeroService.cs プロジェクト: renantdesouza/CSC
 public HeroBattle[] LoadHeroesInBattle(Battle.Battle battle)
 {
     return((battle.players ?? throw new CannotLoadHeroesException())
            .ToList()
            .ConvertAll(player => BuildHero(player.name, player.isPresent, player.thumbnail))
            .ToArray());
 }
コード例 #4
0
        public void Setup()
        {
            var bubbleSystem = new TextBubbleSystem();

            Kooper = new Kooper();
            Mario  = new Mario(new Hero[] { new Goombario(), Kooper },
                               new Inventory(),
                               new List <IJumps> {
                new Attacks.Jump(), new PowerJump()
            }.ToArray(),
                               new Attacks.Hammer(), new Attacks.HammerThrow());

            //var scriptAttack = new ScriptAttack(EnemyAttack.JrTroopaPowerJump);
            //JrTroopa = new JrTroopa(new List<IEnemyAttack> { new RegularAttack(EnemyAttack.JrTroopaJump, 1) });
            var enemyCreator = new EnemyFactory();

            FuzzieA = enemyCreator.FetchEnemy <Fuzzie>();
            FuzzieB = enemyCreator.FetchEnemy <Fuzzie>();
            FuzzieC = enemyCreator.FetchEnemy <Fuzzie>();
            FuzzieD = enemyCreator.FetchEnemy <Fuzzie>();
            var enemies = new List <Enemy>()
            {
                FuzzieA,
                FuzzieB,
                FuzzieC,
                FuzzieD
            };

            battle = new Battle.Battle(new List <Hero> {
                Mario, Kooper
            }, enemies, bubbleSystem);


            //battle.Start();
        }
コード例 #5
0
    public static void Init()
    {
        _currentBattleIndex = BattleService.LoadData().currentBattle;
        _currentBattle      = BattleService.LoadBattle()?.ToList()[_currentBattleIndex];

        _lastCurrentBattleIndex = -1;
        _strongestAttack        = 0;
    }
コード例 #6
0
        public override void ExecuteEffect(Battle.Battle battle)
        {
            var treeLocation = battle.Enemies.FindIndex(hero => hero is GoomnutTree) + 1;

            for (int i = treeLocation; i < battle.Enemies.Count; i++)
            {
                battle.Enemies[i].Health.TakeDamage(3);
            }
            //battle.Enemies.Where((hero) => hero is GoombaKing).Health.TakeDamage(3);
        }
コード例 #7
0
        public void StartBattle()
        {
            var encounter = new Encounter(new Goomba(), new SpikedGoomba());
            var battle    = new Battle.Battle(new List <Hero> {
                mario
            }, encounter);

            battle.Start();
            Assert.IsTrue(battle.IsStarted());
            Assert.IsFalse(battle.IsEnded());
        }
コード例 #8
0
 public void Execute(Battle.Battle battle, object activeHero, Enemy[] targets, Action <IEnumerable <Tuple <Enemy, bool> > > p)
 {
     Console.WriteLine($"ItemOption a- {GetType().Name}");
     if (item.Damage != null)
     {
         targets.ToList().ForEach(target => target.TakeDamage((int)item.Damage));
     }
     Console.WriteLine($"Item Option b -{GetType().Name}");
     p?.Invoke(null);
     Console.WriteLine($"Item Option c -{GetType().Name}");
 }
コード例 #9
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]));
     }
 }
コード例 #10
0
    public void AddBattle(Battle.Battle battle)
    {
        var battleArray = LoadBattle();
        var battles     = (battleArray ?? throw new CannotLoadBattleFileException()).ToList();

        battles.Add(battle);

        var data = new BattleContainer()
        {
            battles = battles.ToArray()
        };

        _battleResource.SaveBattles(data);

        Save(battles.Count - 1);
    }
コード例 #11
0
 public void Setup()
 {
     battle = new Battle.Battle();
     battle.Heroes.Add(new Mario());
     battle.Enemies.Add(new Goomba(new Spike()));
 }
コード例 #12
0
 public void Execute(Battle.Battle battle, object activeHero, Enemy[] targets, Action <IEnumerable <Tuple <Enemy, bool> > > p)
 {
     //battle.Heroes[1] = battle.Pa;
     throw new NullReferenceException();
 }
コード例 #13
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();
        }
コード例 #14
0
 public void Setup()
 {
     battle = new Battle.Battle();
     battle.Heroes.Add(new Mario(new SpikeShield()));
     battle.Enemies.Add(new Goomba(new Flying(), new Spike()));
 }
コード例 #15
0
 public abstract void ExecuteEffect(Battle.Battle battle);
コード例 #16
0
        public void start()
        {
            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 JrTroopa2 = 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.TextBubbleSystem.ShowText(new GameText("1", "2", "3", "4"));
                battle.TextBubbleSystem.OnTextCompleted((_) => battleEvent.Complete());
            }, (battle) => battle.State == BattleState.STARTING));
            battle.AddEventOnStart(new BattleEvent((battleEvent, battle) =>
            {
                battle.TextBubbleSystem.ShowText(new GameText("Nice Job"));
                battleEvent.Completed = true;
                battle.TextBubbleSystem.OnTextCompleted((_) => battle.EndTurn());
            }, (battle) => battle.Enemies.First(enemy => enemy is JrTroopa).Health.CurrentValue == 4));

            battle.AddEventOnStart(new BattleEvent((battleEvent, battle) =>
            {
                battle.TextBubbleSystem.ShowText(new GameText("Mario is lame!"));
                battleEvent.Completed = true;
                battle.TextBubbleSystem.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.TextBubbleSystem.ShowText(new GameText("Goompa: You are almost there mario!"));
                battleEvent.Completed = true;
                battle.TextBubbleSystem.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.TextBubbleSystem.OnTextCompleted((_) =>
                {
                    battle.TextBubbleSystem.ShowText(new GameText("JrTroopa: All right, you asked for it", "Full power!!"));
                    battle.Enemies.First(o => o == JrTroopa).Sequence.Add(scriptAttack);
                    battle.TextBubbleSystem.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.TextBubbleSystem.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.TextBubbleSystem.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));

            double aa = this.Height;

            this.actionMenu    = new ActionMenuView(aa, battle.ActionMenu);
            this.targetingView = new TargetSystemView(battle, battle.TargetSystem);

            targetingView.Height = Height;
            targetingView.Width  = Height;
            targetingView.DrawAll();
            actionMenu.Height = Height;
            actionMenu.Width  = Height;

            this.textBubbleView   = new TextBubbleView(battle.TextBubbleSystem);
            textBubbleView.Height = Height;
            textBubbleView.Width  = Width;
            textBubbleView.Draw();
            Grid.Children.Add(actionMenu);
            Grid.Children.Add(targetingView);
            Grid.Children.Add(textBubbleView);
            //actionMenu.MoveTargetUp();
            //battle.ActionMenu.MoveTargetUp();
            //actionMenu.MoveTargetUp();
            //battle.ActionMenu.MoveTargetUp();
            //actionMenu.MoveTargetUp();
            //battle.ActionMenu.MoveTargetUp();
            EventManager.RegisterClassHandler(typeof(Window), Keyboard.KeyUpEvent, new KeyEventHandler(keyUp), true);
            battle.Start();
            System.Diagnostics.Debug.WriteLine($"State {battle.State}");
        }