Exemple #1
0
        public void PhoenixExhibitsAnimalBehavior()
        {
            Phoenix fawkes = new Phoenix();

            fawkes.DoMagic();
            Assert.Equal(Int32.MinValue, fawkes.Age);
        }
        public WaitTargetCommand(Phoenix.Communication.Packets.TargetData targetData)
            : base(targetData.Serial != 0 ? targetData.Serial : Serial.Invalid)
        {
            if (targetData != null && (targetData.Serial == 0 || targetData.Serial == Serial.Invalid)) {
                if (targetData.X == 0xFFFF && targetData.Y == 0xFFFF) {
                    // CancelTarget
                    CommandTarget = "Cancel";
                }
                else {
                    x = targetData.X;
                    y = targetData.Y;
                    z = targetData.Z;
                    graphic = targetData.Graphic;
                    tile = true;
                    CommandTarget = "Tile";

                    lock (WorldData.World.SyncRoot) {
                        if (WorldData.World.RealPlayer.Serial != WorldData.World.InvalidSerial) {
                            relX = x - WorldData.World.RealPlayer.X;
                            relY = y - WorldData.World.RealPlayer.Y;
                            relZ = z - WorldData.World.RealPlayer.Z;
                            relEnabled = true;
                        }
                    }
                }
            }
        }
Exemple #3
0
            protected override void OnTick()
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                Mobile spawn;

                switch (Utility.Random(8))
                {
                default:
                case 0: spawn = new ElderGazer(); break;

                case 1: spawn = new Imp(); break;

                case 2: spawn = new OrcBrute(); break;

                case 3: spawn = new Phoenix(); break;

                case 4: spawn = new Quagmire(); break;

                case 5: spawn = new WhippingVine(); break;

                case 6: spawn = new Drake(); break;

                case 7: spawn = new VorpalBunny(); break;
                }

                spawn.MoveToWorld(m_Item.Location, m_Item.Map);

                m_Item.Delete();
            }
 public static void DrawSolidRect(this Texture2D texture,Rect rect,Phoenix.HSB96 color)
 {
     for (int y = (int)rect.y; y <rect.y+ rect.height; y++)
     {
         for (int x = (int)rect.x; x <rect.x+ rect.width; x++)
         {
             texture.SetPixel(x, y, color.ToColor());
         }
     }
 }
Exemple #5
0
        public void ShowCompileResult(CompilerResults result)
        {
            if (result.Errors.HasErrors)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Build Error:");
                Console.WriteLine("Error Numeber:{0}", result.Errors.Count);
                foreach (CompilerError item in result.Errors)
                {
                    Console.WriteLine("Line:{0}\tError:{1}", item.Line, item.ErrorText);
                }
                Console.ResetColor();
            }
            Console.WriteLine("Build Success!");
            try
            {
#if CompileIntoMemory
                                Type type  =  result.CompiledAssembly.GetType("Program");
                                Phoenix.GetMethod("Main").Invoke(null, new string[] {});
#else
                System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo
                {
                    FileName               = result.PathToAssembly,
                    UseShellExecute        = false,
                    CreateNoWindow         = true,
                    RedirectStandardError  = true,
                    RedirectStandardOutput = true
                };
                System.Diagnostics.Process process;
                process = new System.Diagnostics.Process();
                process.OutputDataReceived += (s, e) => {
                    if (e.Data != null)
                    {
                        Console.WriteLine(e.Data);
                    }
                };
                process.ErrorDataReceived += (s, e) => {
                    if (e.Data != null)
                    {
                        Console.WriteLine(e.Data);
                    }
                };
                process.StartInfo           = info;
                process.EnableRaisingEvents = true;
                process.Start();
                process.BeginOutputReadLine();
                process.BeginErrorReadLine();
#endif
            }
            catch (System.Reflection.TargetInvocationException ex)
            {
                Console.WriteLine("Exception:" + ex.InnerException.Message);
            }
        }
        public void The_method_Reborn_should_work_with_async_method()
        {
            // Arrange
            var wait    = SetUp(nameof(IUserService.GetByIdAsync));
            var phoenix = new Phoenix(_invocation, CacheInfo);

            // Action
            phoenix.Reborn();

            // Assert
            Assert.IsTrue(wait.WaitOne(_waitTime));
            Global.CacheStoreProvider.GetAsyncCacheStore(StoreId).Received(1)
            .SetAsync("cacheKey", Arg.Is <object>(obj => _id.Equals(((CacheItem)obj).Data)), Arg.Any <DateTimeOffset>());
        }
 public static Phoenix CreatePhoenix(HomePosition startPosition)
 {
     Phoenix phoenix = new Phoenix
                           {
                               LeftFrontLeg = createLeg(Side.Left, Position.Front, 60, 1, 3, 5, 4.3, -8.2, startPosition.LeftFrontLeg),
                               RightFrontLeg = createLeg(Side.Right, Position.Front, -60, 2, 4, 6, -4.3, -8.2, startPosition.RightFrontLeg),
                               LeftMiddleLeg = createLeg(Side.Left, Position.Middle, 0, 7, 9, 11, 6.3, 0, startPosition.LeftMiddleLeg),
                               RightMiddleLeg = createLeg(Side.Right, Position.Middle, 0, 8, 10, 12, -6.3, 0, startPosition.RightMiddleLeg),
                               LeftRearLeg = createLeg(Side.Left, Position.Rear, -60, 13, 15, 17, 4.3, 8.2, startPosition.LeftRearLeg),
                               RightRearLeg = createLeg(Side.Right, Position.Rear, 60, 14, 16, 18, -4.3, 8.2, startPosition.RightRearLeg)
                           };
     phoenix.MoveBody(0, 90);// calculates start posisions for angles
     return phoenix;
 }
        public void The_method_Reborn_should_dispose_and_return_DisposingPhoenix_if_cannot_create_new_cacheItem()
        {
            // Arrange
            var svc = Substitute.For <IUserService>();

            svc.GetById(Arg.Any <Guid>()).Returns(null);
            var wait    = SetUp(nameof(IUserService.GetById), svc);
            var phoenix = new Phoenix(_invocation, CacheInfo);

            // Action
            phoenix.Reborn();
            Assert.IsTrue(wait.WaitOne(_waitTime));
            // Assert
            var storeId = Global.CacheStoreProvider.GetAsyncCacheStore(StoreId);

            storeId.Received(1).RemoveAsync("cacheKey");
        }
        public void The_method_Reborn_should_throw_if_error_and_retry_after_1_second()
        {
            // Arrange
            var svc  = Substitute.For <IUserService>();
            var wait = SetUp(nameof(IUserService.GetById), svc);

            svc.When(x => x.GetById(Arg.Any <Guid>())).Do(c =>
            {
                wait.Set();
                throw new Exception();
            });

            var phoenix = new Phoenix(_invocation, CacheInfo);

            // Action
            phoenix.Reborn();
            Assert.IsTrue(wait.WaitOne(_waitTime));
            wait.Reset();
            Assert.IsTrue(wait.WaitOne(_waitTime));

            // Assert
            svc.Received(2).GetById(Arg.Any <Guid>());
        }
 public DatabaseManager(DatabaseServer _Server, Phoenix.Storage.Database _Database)
 {
     this.Server = _Server;
     this.Database = _Database;
 }
Exemple #11
0
        public void PhoenixExhibitsFantasyBehavior()
        {
            Phoenix fawkes = new Phoenix();

            Assert.Equal(200, fawkes.Atk);
        }
		private void AuthenticationManagerOnTokenReceived(object sender, Phoenix.Engage.TokenReceivedEventArgs tokenReceivedEventArgs)
		{
			OnTokenReceived(tokenReceivedEventArgs.Token);
		}
Exemple #13
0
        public static void Main(string[] args)
        {
            Speaker speak = null;
            Informator info = null;
            Creature unicorn = new Unicorn("Saint", 100, 60);
            Console.WriteLine();
            Creature dragon = new Dragon("Fire", 200, 50);
            Console.WriteLine();
            Dragon special = new Dragon("Morroh", 200, 80, "black dragon", "Rise!");
            Console.WriteLine();
            Manticore manticore = new Manticore();
            Console.WriteLine();
            Creature phoenix = new Phoenix("Taurus", 100, 60);
            Console.WriteLine();
            Phoenix derek = new Phoenix("Derek", 120, 70);
            derek.Age = 55;
            Console.WriteLine();
            Gargoyle howley = new Gargoyle("Howley", 100, 60);
            Console.WriteLine();
            Unicorn trevor = new Unicorn("Trevor", 100, 60);
            Console.WriteLine();
            Pegasus rash = new Pegasus("Rash", 120, 70);
            Console.WriteLine();

            ArrayList creatures = new ArrayList();
            creatures.Add(unicorn);
            creatures.Add(derek);
            creatures.Add(special);
            creatures.Add(howley);
            creatures.Add(dragon);
            creatures.Add(phoenix);
            creatures.Add(trevor);
            creatures.Add(rash);

            foreach(Creature c in creatures)
            {
                react += c.React;
                speak += c.Say;
                info += c.Print;
            }

            info();
            Console.WriteLine();
            speak();
            Console.WriteLine();
            Console.WriteLine();
            try
            {
                trevor.Fight(manticore);
                Console.WriteLine("{0}: {1}", manticore.Name, manticore.Health);
                trevor.Enchant(dragon);
                trevor.Fight(null);
            }
            catch(AttackingMonsterException e)
            {
                Console.WriteLine("{0}: {1}", e.GetType(), e.Message);
            }
            Console.WriteLine();
            try
            {
                rash.Fight(howley);
                Console.WriteLine("{0}: {1}", howley.Name, howley.Health);
                Console.WriteLine();
                rash.Fight(special);

            }
            catch(AttackingMonsterException e)
            {
                Console.WriteLine("{0}: {1}", e.GetType(), e.Message);
            }

            try
            {
                rash.Fight(null);
            }
            catch(AttackingMonsterException e)
            {
                Console.WriteLine("{0}: {1}", e.GetType(), e.Message);
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("I summon you, Satan!");
            Demon satan = Demon.Summon("Satan!");
            satan.Print();
            Console.WriteLine();
            satan.Say();
            Console.WriteLine();
            satan.ApocalypsisEvent += new EventHandler<ApocalypsisEventArgs>(ReactionOfAnimals);
            satan.CarryChaos();
            satan.ApocalypsisEvent -= new EventHandler<ApocalypsisEventArgs>(ReactionOfAnimals);

            Console.WriteLine();
            Console.WriteLine("Damage from earthquake:");
            Console.WriteLine("{0}: {1}", unicorn.Name, unicorn.Health);
            Console.WriteLine("{0}: {1}", derek.Name, derek.Health);
            Console.WriteLine("{0}: {1}", phoenix.Name, phoenix.Health);
            Console.WriteLine("{0}: {1}", trevor.Name, trevor.Health);
            Console.WriteLine("{0}: {1}", rash.Name, rash.Health);

            Console.WriteLine();
            manticore.Poison(trevor);
            manticore.Fight(rash);
            Console.WriteLine("{0}: {1}", rash.Name, rash.Health);

            Console.ReadKey();
        }
 private void engage_TokenReceived(object sender, Phoenix.Windows.Engage.TokenReceivedRoutedEventArgs e)
 {
     MessageBox.Show(e.Token);
 }