internal Map(MapDefine define) { this.Define = define; this.SpawnManager.Init(this); this.MonsterManager.Init(this); this.Battle = new Battle.Battle(this); }
public TargetSystemView(Battle.Battle battle, ITargetSystem targetSystem) { this.battle = battle; this.Background = new SolidColorBrush(Colors.BlueViolet); this.targetSystem = targetSystem; targetSystem.OnShowing += OnShowing; OnShowing(targetSystem.Showing); }
/// <summary> /// 创建玩家 /// 在创建战场时调用 /// </summary> public BSUser CreateUser(Protos.CS2BS_PlayerInfo playerInfo, Battle.Battle battle) { BSUser user = new BSUser(playerInfo, battle); this._gcNIDToUser.Add(user.gcNID, user); Logger.Log($"create user:{user.gcNID}"); return(user); }
public void Setup() { battle = new Battle.Battle(); battle.Heroes.Add(new Mario()); var enemyFactory = new EnemyFactory(); ; battle.Enemies.Add(enemyFactory.FetchEnemy <NewBlueGoomba>()); }
public void Setup() { var enemyFactory = new EnemyFactory(); battle = new Battle.Battle(); battle.Heroes.Add(new Mario(new List <IJumps>() { new PowerJump() })); battle.Enemies.Add(enemyFactory.FetchEnemy <NewBlueGoomba>()); }
public void HasBattleEnded() { var encounter = new Encounter(new Goomba(), new SpikedGoomba()); var battle = new Battle.Battle(new List <Hero> { mario }, encounter); battle.End(); Assert.IsTrue(battle.IsEnded()); Assert.IsFalse(battle.IsStarted()); }
public BSUser(Protos.CS2BS_PlayerInfo playerInfo, Battle.Battle battle) { this.gcNID = playerInfo.GcNID; this.actorID = playerInfo.ActorID; this.nickname = playerInfo.Nickname; this.avatar = playerInfo.Avatar; this.gender = ( byte )playerInfo.Gender; this.money = playerInfo.Money; this.diamoned = playerInfo.Diamoned; this.rank = playerInfo.Rank; this.exp = playerInfo.Exp; this.battle = battle; }
public void setup() { this.Battle = new Battler(); Battle.Heroes = new List <Hero>() { new Mario(jumps: new List <IJumps> { new Jump(), new PowerJump() }) }; Battle.Enemies = new List <Enemy>() { new Goomba(), new Goomba(), new Goomba() }; Battle.Start(); }
public void HasBattleEndedAfterAllEnemiesKilled() { var goomba = new Goomba(); var encounter = new Encounter(goomba, new SpikedGoomba()); var battle = new Battle.Battle(new List <Hero> { mario }, encounter); battle.Start(); Assert.IsTrue(battle.IsStarted()); //Can you kill a goomba if the battle has started?? battle.Enemies.ForEach(enemy => enemy.Kill()); Assert.IsTrue(battle.IsEnded()); Assert.IsFalse(battle.IsStarted()); }
public void HammerTest() { var battler = new Battler(); var goomba1 = new Goomba(); var goomba2 = new Goomba(new Flying()); var goomba3 = new Goomba(new Flying()); battler.Enemies = new List <Enemy>() { goomba1, goomba2, goomba3 }; battler.Heroes = new List <Hero>() { new Mario() }; battler.Start(); battler.TargetSystem.Show(battler.ActionMenu.Items[3].Options[0]); var targetSystem = battler.TargetSystem; targetSystem.MoveTargetRight(); Assert.True(targetSystem.Actives[0] == goomba1); // Use the Assert class to test conditions }
/// <summary> /// Play a battle between the trainers defined by thir names and sets if given through args, /// else ask for the names through stdin and use randomly choosen sets from the database. /// If the battle succed to start, process to play a game: get players commands, play turn, resets status. /// </summary> /// <param name="args">`Poktogone.exe nameP1 teamP1 nameP2 teamP2 [--dbo fileName] [--rng seed] [--dmc (damage calculator args)] [--log [fileName]]`.</param> /// <returns>0 if success, else last known <see cref="BattleState"/> (as an int).</returns> /// <remarks>This function is to be used by the PHP script (see web-based).</remarks> static int PhpMain(String[] args) { Program.dbo = new SqlHelper(); Program.isFromCmd = 0 < args.Length; Program.rng = new Random(); // TODO: args parse (meh..) Program.Log("info", "Connecting to sqllocaldb"); Program.dbo.Connect(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), "Database.mdf")); Program.Log("info", "\tConnected!"); Trainer P1, P2; Battle.Battle battle; Program.Log("info", "Loading players' sets"); if (Program.isFromCmd) { P1 = new Trainer(args[0], 1, ParseSets(args[1])); P2 = new Trainer(args[2], 2, ParseSets(args[3])); } else { P1 = new Trainer(Program.Input("Player 1 name: "), 1, ParseSets($"{Program.rng.Next(121) + 1};{Program.rng.Next(121) + 1};{Program.rng.Next(121) + 1}")); P2 = new Trainer(Program.Input("Player 2 name: "), 2, ParseSets($"{Program.rng.Next(121) + 1};{Program.rng.Next(121) + 1};{Program.rng.Next(121) + 1}")); } Program.Log("info", "\tLoaded!"); battle = new Battle.Battle(P1, P2); Program.Println(battle); Program.Input("Press Enter to start... "); Program.ConsoleClear(); if (battle.Start()) { do { Program.Println(battle); int code = -1; try { code = battle.InputCommand(int.Parse(Program.Input("Your player num: ")), Program.Input("Your command (attack / switch): ")); } catch (FormatException) { Program.Print("Not a number... "); } if (code < 0) { Program.Println("Wrong player number! (nice try tho...)"); } else if (code == 0) { Program.Println("Invalid command! (or typo...)"); } Program.Input("Press Enter to continue... "); Program.ConsoleClear(); }while (battle.State != BattleState.VictoryP1 && battle.State != BattleState.VictoryP2); } else { Program.Println($"Couln't start battle... Last known state: {battle.State}"); return((int)battle.State); } Program.Println(battle.State); return(0); }
void BasicGameLoop() { rand = new Random(); //gmcp = new GM(); do { Console.Clear(); /*if (hero.isGM == true) * { * Console.Write(@" * What would you like to do? * _____________________________ * (F)ight * (S)tore * (I)nn * (V)iew * (G)ame (M)aster Control Panel * (Q)uit * _____________________________ * F,S,I,V, GM,L,A or Q?"); * } * else * {*/ Console.Write(@" What would you like to do? _____________________________ (F)ight (S)tore (I)nn (V)iew (Q)uit _____________________________ F,S,I,V,L,A or Q?"); //} Console.WriteLine(); answer = Console.ReadLine(); Console.WriteLine(); switch (answer) { case "S": case "s": Store store = new Store(hero); break; case "I": case "i": Inn.Sleep(hero, Party); break; case "v": case "V": View.PrintStats(Party); break; case "F": case "f": string done = ""; do { Console.Clear(); Console.Write(@" Which monster do you want to fight? (S)keleton: _________________________"); Console.WriteLine(); string choice = Console.ReadLine(); if (choice == "S" || choice == "s") { Skeleton skeleton; skeleton = new Skeleton(); Skeleton.InitMelee(skeleton); Monster.Add(skeleton); } else if (choice == "B" || choice == "b") { //Monster.Add(new Barbarian()); } else if (choice == "M" || choice == "m") { //Monster.Add(new Mage()); } else { //Monster.Add(new Spider()); } Console.WriteLine("Would you like to fight more monsters(y/n)?"); Console.WriteLine(); done = Console.ReadLine(); }while (done == "Y" || done == "y"); //standby = new LoHEngine.Battle.Standby(Party, Monster); battle = new LoHEngine.Battle.Battle(Party, Monster); foreach (BaseCharacter partymember in Party) { if (hero.CurrHP < 0.01) { Console.WriteLine(hero.Name + " Has died!"); hero.IsAlive = false; continue; } else if (hero.fled == false) { int gold = 0; int experience = 0; foreach (BaseCharacter monster in Monster) { if (monster.fled == false) { experience += monster.EXP; gold += rand.Next(monster.GoldDrop[0], monster.GoldDrop[1]); } } partymember.EXP += experience; hero.Gold += gold; DidLvl = lvlhandler.LevelUp(partymember); if (DidLvl == true) { Console.WriteLine("{0} is now level {1} and gets {2} gold and {3} experience" , partymember.Name, partymember.LVL, gold, experience); } else { Console.WriteLine("{0} gets {1} gold and {2} experience" , partymember.Name, gold, experience); } Monster.Clear(); Console.WriteLine("Press enter to continue...."); Console.ReadLine(); } else { partymember.fled = false; } } break; case "Q": case "q": Console.WriteLine("Goodbye {0}", hero.Name); break; } }while (answer != "Q" && answer != "q"); }
public void Execute(Battle.Battle battle, object activeHero, Enemy[] targets, Action <IEnumerable <Tuple <Enemy, bool> > > p) { throw new NotImplementedException(); }
/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); #region Initialize ScreenManager.Game.IsMouseVisible = true; Battle = new InsipidusEngine.Battle.Battle(BattleInfo, ScreenManager.SpeechFont); #endregion #region LoadContent Battle.LoadContent(ScreenManager.GraphicsDevice, content, ScreenManager.SpriteBatch); // TODO: use this.Content to load your game content here #endregion // Once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. ScreenManager.Game.ResetElapsedTime(); }