Inheritance: MonoBehaviour
示例#1
1
        public override void Use(Player p, string message)
        {
            if (message == "") { Help(p); return; }
            if (message.IndexOf(' ') == -1) message = message + " 60";

            Player who = Player.Find(message.Split(' ')[0]);
            if (who == null) { Player.SendMessage(p, "Could not find player"); return; }
            if (p != null && who.group.Permission >= p.group.Permission) { Player.SendMessage(p, "Cannot ban someone of the same rank"); return; }
            if (Server.devs.Contains(who.name.ToLower()))
            {
                Player.SendMessage(p, "You can't ban a MCForge Developer!");
                if (p != null)
                {
                    Player.GlobalMessage(p.color + p.name + Server.DefaultColor + " attempted to tempban a MCForge Developer!");
                }
                else
                {
                    Player.GlobalMessage(Server.DefaultColor + "The Console attempted to tempban a MCForge Developer!");
                }
                return;
            }
            int minutes;
            try
            {
                minutes = int.Parse(message.Split(' ')[1]);
            } catch { Player.SendMessage(p, "Invalid minutes"); return; }
            if (minutes > 1440) { Player.SendMessage(p, "Cannot ban for more than a day"); return; }
            if (minutes < 1) { Player.SendMessage(p, "Cannot ban someone for less than a minute"); return; }

            Server.TempBan tBan;
            tBan.name = who.name;
            tBan.allowedJoin = DateTime.Now.AddMinutes(minutes);
            Server.tempBans.Add(tBan);
            who.Kick("Banned for " + minutes + " minutes!");
        }
 public void Initialize(Player player)
 {
     this.Player = player;
     playerTransform.gameObject.GetComponent<PlayerAnimatorChanger>().SetAnimator(player);
     this.playerTransform.position = startLocation.position;
     this.Enable(true);
 }
示例#3
1
 public bool CheckCollision(Player p)
 {
     if (p.State == Player.PlayerState.JUMP || p.State == Player.PlayerState.DYING)
             return false;
         return Mathf.Abs(p.x + p.hitBox.x - pos.x) < SPAWN_COLLISION_DIST &&
             Mathf.Abs(p.y + p.hitBox.y - pos.y) < SPAWN_COLLISION_DIST;
 }
示例#4
1
    //Method to be re written when serialisation/deserialisation implemented.
    public Game NewGame(Player newPlayer)
    {
        Game game = new Game(newPlayer);

        GameObject mayorSpawn = GameObject.Find("MayorSpawnLocation-Beach");
        GameObject ethanSpawn = GameObject.Find("EthanSpawnLocation-Hut");
        GameObject jennaSpawn = GameObject.Find("JennaSpawnPoint-forest");
        GameObject fisherSpawn = GameObject.Find("FisherSpawnPoint-headland");

        Npc mayor = new Npc("Mayor", "Mayor", mayorSpawn.transform.position, 1f, true);
        Npc ethan = new Npc("Ethan", "Ethan", ethanSpawn.transform.position, 0.2f, true);
        Npc jenna = new Npc("Jenna", "npc1", jennaSpawn.transform.position,0.3f, true);
        Npc fisher = new Npc("Fisher", "fisher", fisherSpawn.transform.position,0f, false);

        game.AddNpc(mayor);
        game.AddNpc(ethan);
        game.AddNpc(jenna);
        game.AddNpc(fisher);

        RecyclePoint beachPoint = new RecyclePoint("BeachRecyclePoint", 50);
        game.RecyclePoints.Add(beachPoint);

        game.CheckPoints.Add ("SpokenToMayorFirst");
        game.CheckPoints.Add ("SpokenToEthan");
        game.CheckPoints.Add ("FirstEthanMeetingPositive");
        game.CheckPoints.Add ("MayorLeaveBeach");
        game.CheckPoints.Add ("BeachRecyclePointFull");
        game.CheckPoints.Add ("StartSortingMiniGame");

        game.IsNewGame = false;
        return game;
    }
示例#5
1
        public Board StartNew(Player whitePlayer, Player blackPlayer, string fenString = null)
        {
            this.CloseDialog();

            this.Width = 850;
            this.Height = 850;

            this.Clear();
            //this.Focus();
            this.Visible = true;

            if (fenString == null)
                this.Board = new Board(whitePlayer, blackPlayer);
            else
                this.Board = new Board(whitePlayer, blackPlayer, fenString);

            this.Board.SquareChanged += square => DrawSquare(square);
            this.Board.Check += (player) => { if (this.Board != null && this.Board.CurrentPlayer is HumanPlayer) MessageBox.Show("Check!"); };
            this.Board.Checkmate += (player) => { MessageBox.Show("Checkmate!"); this.Cursor = Cursors.Arrow; };
            this.Board.Stalemate += (reason) => { MessageBox.Show("Stalemate: " + reason.GetDescription()); this.Cursor = Cursors.Arrow; };

            whitePlayer.Turn += () => this.Invoke((Action)(() => this.Cursor = whitePlayer is HumanPlayer ? Cursors.Arrow : Cursors.WaitCursor));
            blackPlayer.Turn += () => this.Invoke((Action)(() => this.Cursor = blackPlayer is HumanPlayer ? Cursors.Arrow : Cursors.WaitCursor));

            foreach (var square in Enum.GetValues(typeof(Square)).Cast<Square>())
                DrawSquare(square);

            if (this.GameStarted != null)
                this.GameStarted(this.Board);

            return this.Board;
        }
示例#6
1
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/save - Saves the level you are currently in");
     Player.SendMessage(p, "/save all - Saves all loaded levels.");
     Player.SendMessage(p, "/save <map> - Saves the specified map.");
     Player.SendMessage(p, "/save <map> <name> - Backups the map with a given restore name");
 }
        public void testLandOn()
        {
            Utility util = new Utility();

            //Create two players
            Player p1 = new Player("Bill");
            Player p2 = new Player("Fred", 1500);

            string msg;

            //test landon normally with no rent payable
            msg = util.landOn(ref p1);
            Console.WriteLine(msg);

            //set owner to p1
            util.setOwner(ref p1);

            //move p2 so that utility rent can be calculated
            p2.move();

            //p2 lands on util and should pay rent
            msg = util.landOn(ref p2);
            Console.WriteLine(msg);

            //check that correct rent  has been paid
            decimal balance = 1500 - (6 * p2.getLastMove());
            Assert.AreEqual(balance, p2.getBalance());
        }
示例#8
1
 public override void Use(Player p, string message)
 {
     if (message != "")
     {
         if (!Server.voting)
         {
             string temp = message.Substring(0, 1) == "%" ? "" : Server.DefaultColor;
             Server.voting = true;
             Server.NoVotes = 0;
             Server.YesVotes = 0;
             Player.GlobalMessage(" " + c.green + "VOTE: " + temp + message + "(" + c.green + "Yes " + Server.DefaultColor + "/" + c.red + "No" + Server.DefaultColor + ")");
             System.Threading.Thread.Sleep(15000);
             Server.voting = false;
             Player.GlobalMessage("The vote is in! " + c.green + "Y: " + Server.YesVotes + c.red + " N: " + Server.NoVotes);
             Player.players.ForEach(delegate(Player winners)
             {
                 winners.voted = false;
             });
         }
         else
         {
             p.SendMessage("A vote is in progress!");
         }
     }
     else
     {
         Help(p);
     }
 }
示例#9
1
文件: HUD.cs 项目: Phelisse/Elynium
     void Start ()
    {
        player = transform.root.GetComponent<Player>();
        SetCursorState(CursorState.Default);

        resourceValues = new Dictionary<ResourceType, int>();
        resourceLimits = new Dictionary<ResourceType, int>();

        resourceValues.Add(ResourceType.Gold, 0);
        resourceLimits.Add(ResourceType.Gold, 0);
        resourceValues.Add(ResourceType.Nelther, 0);
        resourceLimits.Add(ResourceType.Nelther, 0);
        resourceValues.Add(ResourceType.Elynium, 0);
        resourceLimits.Add(ResourceType.Elynium, 0);
        resourceValues.Add(ResourceType.Population, 0);
        resourceLimits.Add(ResourceType.Population, 0);

        posBar = transform.FindChild("Frame1").FindChild("Frame").FindChild("BackGround").FindChild("Production").gameObject.transform.position;

        transform.FindChild("Frame1").FindChild("UnitNameProduct").GetComponent<Text>().text = "";
        transform.FindChild("Frame1").FindChild("HitText").GetComponent<Text>().text = "";
        transform.FindChild("Frame1").FindChild("Object").gameObject.SetActive(false);

        transform.FindChild("Frame1").FindChild("Frame").gameObject.SetActive(false);
        transform.FindChild("Frame1").FindChild("UnitNameProduct").gameObject.SetActive(false);
        for (int j = 1; j < 6; j++)
        {
            transform.FindChild("Frame1").FindChild("FrameUnit" + j.ToString()).gameObject.SetActive(false);
        }
    }
        public static Player CreatePlayer(bool baseStatsOnly = false)
        {
            var player = new Player();
            if (baseStatsOnly)
            {
                player.Str = Convert.ToDouble(ConfigurationManager.AppSettings["BASE_STR"]);
                player.Acc = Convert.ToDouble(ConfigurationManager.AppSettings["BASE_ACC"]);
                player.Crt = Convert.ToDouble(ConfigurationManager.AppSettings["BASE_CRT"]);
                player.Det = Convert.ToDouble(ConfigurationManager.AppSettings["BASE_DET"]);
                player.Sks = Convert.ToDouble(ConfigurationManager.AppSettings["BASE_SKS"]);
            }
            else
            {
                player.Str = Convert.ToDouble(ConfigurationManager.AppSettings["STR"]);
                player.Crt = Convert.ToDouble(ConfigurationManager.AppSettings["CRT"]);
                player.Det = Convert.ToDouble(ConfigurationManager.AppSettings["DET"]);
                player.Sks = Convert.ToDouble(ConfigurationManager.AppSettings["SKS"]);
                player.Weapon = new Weapon
                {
                    WeaponDamage = Convert.ToDouble(ConfigurationManager.AppSettings["WD"]),
                    AutoAttack = Convert.ToDouble(ConfigurationManager.AppSettings["AA"]),
                    Delay = Convert.ToDouble(ConfigurationManager.AppSettings["AA_DELAY"])
                };
            }

            return player;
        }
示例#11
1
        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
        {
            Log.Warn("Player " + player.Username + " should be banned for hacking!");

            var block = world.GetBlock(blockCoordinates);
            if (block is Tnt)
            {
                world.SetBlock(new Air() {Coordinates = block.Coordinates});
                new PrimedTnt(world)
                {
                    KnownPosition = new PlayerLocation(blockCoordinates.X, blockCoordinates.Y, blockCoordinates.Z),
                    Fuse = (byte) (new Random().Next(0, 20) + 10)
                }.SpawnEntity();
            }
            else if (block.IsSolid)
            {
                var affectedBlock = world.GetBlock(GetNewCoordinatesFromFace(blockCoordinates, BlockFace.Up));
                if (affectedBlock.Id == 0)
                {
                    var fire = new Fire
                    {
                        Coordinates = affectedBlock.Coordinates
                    };
                    world.SetBlock(fire);
                }
            }
        }
示例#12
1
文件: Program.cs 项目: Danny417/Poker
        /// <summary>
        /// Main program that executes when it starts
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            var user = new Player();
            user.UniqueIdentifier = Guid.NewGuid();
            System.Console.WriteLine("Hello! Please enter your name.");
            var userInput = System.Console.ReadLine();
            user.UserName = userInput;
            System.Console.WriteLine("1. Join the game");
            System.Console.WriteLine("2. Watch the game");
            System.Console.WriteLine("3. Leave the game");
            System.Console.WriteLine("Please select {1, 2, 3 or quit to terminate} : ");

            // loop continusly check user input
            while (!(userInput = System.Console.ReadLine()).ToLower().Equals("quit"))
            {
                switch (userInput)
                {
                    case "1":
                        Proxy.JoinGame(user);
                        break;
                    case "2":
                        Proxy.WatchGame(user);
                        break;
                    case "3":
                        Proxy.QuitGame(user);
                        break;
                    case "quit":
                        break;
                    default:
                        break;
                }
            }
        }
示例#13
1
 public Card(Suit suit, Value value)
 {
     this.value = value;
     this.suit = suit;
     this.name = GetName();
     this.owner = null;
 }
示例#14
1
        public static bool IsInRange(Player p, Item i, int range)
        {
            int fromX = (int)(p.X * 32.0);
            int fromZ = (int)(p.Z * 32.0);

            return IsInRange(fromX, fromZ, i.X, i.Z, range);
        }
 //Yes this does work
 //Trust me...I'm a doctor
 public void BlankMessage(Player p)
 {
     byte[] buffer = new byte[65];
     Player.StringFormat(" ", 64).CopyTo(buffer, 1);
     p.SendRaw(OpCode.Message, buffer);
     buffer = null;
 }
示例#16
1
    public void SpawnPlayer(Player player)
    {
        player.RespawnAt(transform);

        foreach (var listener in listeners)
            listener.OnPlayerRespawnInThisCheckpoint(this, player);
    }
示例#17
1
    void SelectPlayer(float parh, float parV)
    {
        if (Input.GetKey(KeyCode.Z) || parh > 0.4 && _advancedPlayer == null)
        {
            if (!_playerList[0].isAdvanced)
            {
                _selectedPlayer = (Player)_playerList[0];
                HideIndicators();
                _indicatorPlayer[0].SetActive(true);
            }
        }
        if (Input.GetKey(KeyCode.E) || parh < -0.4 && _advancedPlayer == null)
        {
            if (!_playerList[1].isAdvanced)
            {
                _selectedPlayer = (Player)_playerList[1];
                HideIndicators();
                _indicatorPlayer[1].SetActive(true);
            }
        }

        if (parh == 0 && parV == 0)
        {
            _selectedPlayer = null;
            HideIndicators();
        }
    }
示例#18
1
    protected override void OnDestroy()
    {
        base.OnDestroy();

        mHeart = null;
        mPlayer = null;
    }
示例#19
1
 // Update is called once per frame
 void Update()
 {
     Phealth = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
     Health = Phealth.Health;
     if (GameObject.Find ("TD") != null)
     {
         FireRate = GameObject.Find ("TD").GetComponent<shoot_Bullet> ();
     }
     else
     {
         FireRate = GameObject.Find ("head").GetComponent<shoot_Bullet> ();
     }
     Reload = FireRate.fireRate;
     Hit = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
     Hit_Bullet = Hit.hit_Bullet;
     if (GameObject.Find ("TD") != null)
     {
         shoot = GameObject.Find ("TD").GetComponent<shoot_Bullet> ();
     }
     else
     {
         shoot = GameObject.Find ("head").GetComponent<shoot_Bullet> ();
     }
     s_Count = shoot.s_Count;
     Hit_rate = (Hit_Bullet / s_Count) * 100;
     Level = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> ();
     level = Level.Level;
 }
示例#20
1
 public override void Update(Room room, Player player)
 {
     Vector2 offset = player.position - position;
     Vector2 range = Main.instance.Size();
     if (Math.Abs(offset.X) > range.X / 2f || Math.Abs(offset.Y) > range.Y / 2f)
     {
         shootTimer = 0;
     }
     else
     {
         shootTimer++;
         if (shootTimer >= maxShootTimer)
         {
             Vector2 direction = offset;
             if (direction != Vector2.Zero)
             {
                 direction.Normalize();
             }
             direction *= shootSpeed;
             PositionalBullet bullet = new PositionalBullet(position, direction, 10f, bulletTexture, bulletTime);
             room.bullets.Add(bullet);
             shootTimer = 0;
         }
     }
 }
示例#21
1
 public void Use(Player p, string[] args)
 {
     if (args.Length == 0) { p.SendMessage("You have to specify a message!"); return; }
     string message = null;
     foreach (string s in args) { message += s + " "; }
     Player.UniversalChat(message);
 }
示例#22
0
文件: Board.cs 项目: JasonBock/Quixo
		private void Reset()
		{
			this.currentPlayer = Player.X;
			this.winningPlayer = Player.None;
			this.moveHistory.Clear();
			this.pieces = 0;
		}
示例#23
0
        public static bool IsInRange(Player p, int toX, int toZ, int range, out int distance)
        {
            int fromX = (int)(p.X * 32.0);
            int fromZ = (int)(p.Z * 32.0);

            return IsInRange(fromX, fromZ, toX, toZ, range, out distance);
        }
示例#24
0
        public void Init()
        {
            player1Observer = new MockObserver("Player1 Observer");
            fullPlayerObserver = new MockObserver("FullPlayer Observer");
            player1InventoryObserver = new MockObserver("Player 1 Inventory Observer");
            fullPlayerInventoryObserver = new MockObserver("FullPlayer Inventory Observer");

            player1 = new Player ("Player1", Gender.FEMALE, "Eve2", new Vector2 (0, 0));
            player1.AddObserver(player1Observer);

            fullPlayer = new Player ("Ollie", Gender.MALE, "Evan1", Vector2.zero);
            fullPlayer.InitialiseInventory (20);
            fullPlayer.AddObserver(fullPlayerObserver);
            fullPlayer.Inventory.AddObserver(fullPlayerInventoryObserver);

            for (int i = 0; i < 20; i++) {
                InventoryItem item = new InventoryItem();
                item.ItemName = "Item" + i;
                item.ItemId = i;
                item.ItemType = ItemType.RUBBISH;
                item.ItemDescription = string.Empty;
                fullPlayer.AddItem(item);
            }

            tool1 = new MockTool("Tool1");
            tool2 = new MockTool("Tool2");
            tool3 = new MockTool("Tool3");

            fullPlayer.AddTool(tool1);
            fullPlayer.AddTool(tool2);
            fullPlayer.AddTool(tool3);
        }
示例#25
0
        public static int DistanceBetweenEntities(Player p, int toX, int toZ)
        {
            int fromX = (int)(p.X * 32.0);
            int fromZ = (int)(p.Z * 32.0);

            return DistanceBetweenEntities(fromX, fromZ, toX, toZ);
        }
示例#26
0
        public override void Use(Player p, string message)
        {
            if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; }
            if (!Directory.Exists("extra/copy"))
                Directory.CreateDirectory("extra/copy");

            if (!File.Exists("extra/copy/christmastree.copy"))
            {
                Player.SendMessage(p, "ChrismasTree copy doesn't exist. Downloading...");
                try
                {
                    using (WebClient WEB = new WebClient())
                        WEB.DownloadFile("http://dekemaserv.com/xmas.copy", "extra/copy/christmastree.copy");
                }
                catch
                {
                    Player.SendMessage(p, "Sorry, downloading failed. Please try again later.");
                    return;
                }
            }
            Command.all.Find("retrieve").Use(p, "christmastree");
            Command.all.Find("paste").Use(p, "");
            ushort[] loc = p.getLoc(false);
            Command.all.Find("click").Use(p, loc[0] + " " + loc[1] + " " + loc[2]);
        }
示例#27
0
        private bool CheckCell(int y, int x, Player[,] pA, int winSize)
        {
            if (pA[y, x] == Player.None) return false;

            int cellSize = (winSize - 1) / 2;

            int xLine = 1;
            int yLine = 1;
            int z1Line = 1;
            int z2Line = 1;

            for (int i = 1; i <= cellSize; i++)
            {
                if (EnoughHorizontalSpace(x, pA, cellSize) && pA[y, x] == pA[y, x - 1] && pA[y, x] == pA[y, x + 1])
                    xLine += 2;

                if (EnoughVerticalSpace(y, pA, cellSize) && pA[y, x] == pA[y - 1, x] && pA[y, x] == pA[y + 1, x])
                    yLine += 2;

                if (EnoughDiagonalSpace(x, y, pA, cellSize) && pA[y, x] == pA[y - i, x - i] && pA[y, x] == pA[y + i, x + i])
                    z1Line += 2;

                if (EnoughDiagonalSpace(x, y, pA, cellSize) && pA[y, x] == pA[y + i, x - i] &&  pA[y, x] == pA[y - i, x + i])
                    z2Line += 2;

                if (winSize == xLine || winSize == yLine || winSize == z1Line || winSize == z2Line)
                    return true;
            }

            return false;
        }
 // Use this for initialization
 void Start()
 {
     player = GameObject.FindObjectOfType<Player>();
     canvas = GetComponent<Canvas>();
     canvas.enabled = false;
     state = GameObject.FindObjectOfType<LevelState>();
 }
示例#29
0
	// Use this for initialization
	void Start ()
	{
		if (mPlayer == null)
		{
			mPlayer = WorldGen.Instance.Player();
		}
	}
示例#30
0
 private void Run()
 {
     try
     {
         _Listener.Bind(endPoint);
         _Listener.Listen(Settings.Instance.AllowedConnections);
         while (true)
         {
             Program.Logger.Info("Waiting for a connection...");
             // Program is suspended while waitin for an incoming connection.
             Player player = null;
             try
             {
                 player = new Player();
                 player.ClientConnection = new Client(_Listener.Accept());
                 GameServer.Instance.Player.Add(player);
             }
             catch (Exception ex)
             {
                 Program.Logger.Error(ex.ToString());
                 GameServer.Instance.Player.Remove(player);
             }
         }
     }
     catch (Exception ex)
     {
         // TODO logging
         Program.Logger.Error(ex.ToString());
     }
 }
示例#31
0
        public void listAscendingOrder_predicate_test()
        {
            var player1     = new Player("Joe Tester");
            var teamMember1 = new TestorTheBarbarian()
            {
                Health = 99
            };
            var teamMember2 = new MasterCodo()
            {
                Health = 100
            };

            player1.Party.Add(teamMember1);
            player1.Party.Add(teamMember2);
            //to fail test
            //teamMember2.Health = 0;

            //Nunit does not have an equivalent either separate asserts or a boolean which
            // will loose detail and have a generic message
            //Assert.That(player1.Party.All(p => p.Health > 0), Is.True);

            //FluentAssertions syntax
            player1.Party.Should().BeInAscendingOrder(p => p.Health);
            //-->Result Message: Expected collection {
            //                TestorTheBarbarianDemo.TestorTheBarbarian
            //                {
            //                    ActiveWeapon = < null >
            //                    Attacks = { "Clobber"}
            //                    BattleCry = ""
            //                    Health = 99
            //                    Name = "Testor The Mighty Barbarian"
            //                    Weapons = { "Fists Of Fury"}
            //                },

            //                   TestorTheBarbarianDemo.MasterCodo
            //                {
            //                    ActiveWeapon = < null >
            //                    Attacks = { "Sling"}
            //                    BattleCry = ""
            //                    Health = 0
            //                    Name = "Master Codo"
            //                    Weapons = { "Fiery Fingers"}
            //                }
            //            }
            //            to be ordered by "Health" and result in {

            //                TestorTheBarbarianDemo.MasterCodo
            //                {
            //                    ActiveWeapon = < null >
            //                    Attacks = { "Sling"}
            //                    BattleCry = ""
            //                    Health = 0
            //                    Name = "Master Codo"
            //                    Weapons = { "Fiery Fingers"}
            //                },

            //                TestorTheBarbarianDemo.TestorTheBarbarian
            //                {
            //                    ActiveWeapon = < null >
            //                    Attacks = { "Clobber"}
            //                    BattleCry = ""
            //                    Health = 99
            //                    Name = "Testor The Mighty Barbarian"
            //                    Weapons = { "Fists Of Fury"}
            //                }}.
        }
示例#32
0
		public override void PlaceBlock(Level world, Player player, BlockCoordinates targetCoordinates, BlockFace face, Vector3 faceCoords)
		{
			ItemBlock itemBlock = new ItemBlock(BlockFactory.GetBlockById(142));
			itemBlock.PlaceBlock(world, player, targetCoordinates, face, faceCoords);
		}
示例#33
0
 void Awake()
 {
     instance     = this;
     rend         = GetComponent <Renderer>();
     rend.enabled = true;
 }
示例#34
0
 public override void Help(Player p)
 {
     Player.SendMessage(p, "/timer [time] [message] - Starts a timer which repeats [message] every 5 seconds.");
     Player.SendMessage(p, "Repeats constantly until [time] has passed");
 }
示例#35
0
 public void Start()
 {
     _playerCharacter = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
 }
 public PlayerSpawnProjectileEvent(Player player, API.Server server, ProjectileData spawn_information) : base(player, server)
 {
     ProjectileSpawnInformation = spawn_information;
 }
示例#37
0
 public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
 {
     target.AddBuff(BuffID.Electrified, 300);
 }
示例#38
0
 private void ResetTouchingPlayer()
 {
     touchingPlayer = null;
 }
示例#39
0
        /// <summary>
        ///     Does the combo.
        /// </summary>
        private static void Combo()
        {
            var useQ = Menu.Item("useQ").GetValue<bool>();
            var useW = Menu.Item("useW").GetValue<bool>();
            var useE = Menu.Item("useE").GetValue<bool>();
            var useR = Menu.Item("useR").GetValue<bool>();
            var minQRange = Menu.Item("minQRange").GetValue<Slider>().Value;
            var useEStun = Menu.Item("useEStun").GetValue<bool>();
            var useQGapclose = Menu.Item("useQGapclose").GetValue<bool>();
            var useWBeforeQ = Menu.Item("useWBeforeQ").GetValue<bool>();
            var procSheen = Menu.Item("procSheen").GetValue<bool>();
            var useIgnite = Menu.Item("useIgnite").GetValue<bool>();
            var useRGapclose = Menu.Item("useRGapclose").GetValue<bool>();

            var target = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);

            if (target == null && useQGapclose)
            {
                /** var minionQ =
                    ObjectManager.Get<Obj_AI_Minion>()
                        .Where(x => x.IsValidTarget())
                        .Where(x => Player.GetSpellDamage(x, SpellSlot.Q) > x.Health)
                        .FirstOrDefault(
                            x =>
                                x.Distance(TargetSelector.GetTarget(Q.Range * 5, TargetSelector.DamageType.Physical)) <
                                Q.Range);*/
                var minionQ =
                    MinionManager.GetMinions(Q.Range, MinionTypes.All, MinionTeam.NotAlly)
                        .FirstOrDefault(
                            x =>
                            Q.IsKillable(x) && Q.IsInRange(x)
                            && x.Distance(HeroManager.Enemies.OrderBy(y => y.Distance(Player)).FirstOrDefault())
                            < Player.Distance(HeroManager.Enemies.OrderBy(z => z.Distance(Player)).FirstOrDefault()));

                if (minionQ != null && Player.Mana > Q.ManaCost * 2)
                {
                    Q.CastOnUnit(minionQ);
                    return;
                }

                if (useRGapclose)
                {
                    var minionR =
                        ObjectManager.Get<Obj_AI_Minion>()
                            .Where(
                                x =>
                                x.IsValidTarget() && x.Distance(Player) < Q.Range && x.CountEnemiesInRange(Q.Range) >= 1)
                            .FirstOrDefault(
                                x =>
                                x.Health - Player.GetSpellDamage(x, SpellSlot.R) < Player.GetSpellDamage(x, SpellSlot.Q));

                    if (minionR != null)
                    {
                        R.Cast(minionR);
                    }
                }
            }

            // Get target that is in the R range
            var rTarget = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Physical);
            if (useR && UltActivated && rTarget.IsValidTarget())
            {
                if (procSheen)
                {
                    // Fire Ult if player is out of AA range, with Q not up or not in range
                    if (target.Distance(Player) > Orbwalking.GetRealAutoAttackRange(Player))
                    {
                        R.Cast(rTarget);
                    }
                    else
                    {
                        if (!HasSheenBuff)
                        {
                            R.Cast(rTarget);
                        }
                    }
                }
                else
                {
                    R.Cast(rTarget);
                }
            }

            if (!target.IsValidTarget())
            {
                return;
            }

            if (Botrk.IsReady())
            {
                Botrk.Cast(target);
            }

            if (Cutlass.IsReady())
            {
                Cutlass.Cast(target);
            }

            if (Omen.IsReady() && Omen.IsInRange(target)
                && target.Distance(Player) > Orbwalking.GetRealAutoAttackRange(Player))
            {
                Omen.Cast();
            }

            if (useIgnite && target != null && target.IsValidTarget(600)
                && (IgniteSlot.IsReady()
                    && Player.GetSummonerSpellDamage(target, Damage.SummonerSpell.Ignite) > target.Health))
            {
                Player.Spellbook.CastSpell(IgniteSlot, target);
            }

            if (useWBeforeQ)
            {
                if (useW && W.IsReady())
                {
                    W.Cast();
                }

                if (useQ && Q.IsReady() && target.Distance(Player.ServerPosition) > minQRange)
                {
                    Q.CastOnUnit(target);
                }
            }
            else
            {
                if (useQ && Q.IsReady() && target.Distance(Player.ServerPosition) > minQRange)
                {
                    Q.CastOnUnit(target);
                }

                if (useW && W.IsReady())
                {
                    W.Cast();
                }
            }

            if (useEStun)
            {
                if (target.CanStunTarget() && useE && E.IsReady())
                {
                    E.Cast(target);
                }
            }
            else
            {
                if (useE && E.IsReady())
                {
                    E.Cast(target);
                }
            }

            if (useR && R.IsReady() && !UltActivated)
            {
                R.Cast(target);
            }
        }
示例#40
0
        void ShowBags(Random rand, IEnumerable <Item> loots, Player owner)
        {
            int bagType = 0;

            Item[] items = new Item[8];
            int    idx   = 0;

            short     bag;
            Container container;

            foreach (var i in loots)
            {
                if (i.BagType > bagType)
                {
                    bagType = i.BagType;
                }
                items[idx] = i;
                idx++;

                if (idx == 8)
                {
                    bag = 0x0500;
                    switch (bagType)
                    {
                    case 0: bag = 0x0500; break;

                    case 1: bag = 0x0503; break;

                    case 2: bag = 0x0507; break;

                    case 3: bag = 0x0508; break;

                    case 4: bag = 0x0509; break;
                    }
                    container = new Container(bag, 1000 * 60, true);
                    for (int j = 0; j < 8; j++)
                    {
                        container.Inventory[j] = items[j];
                    }
                    container.BagOwner = owner == null ? (int?)null : owner.AccountId;
                    container.Move(
                        Host.Self.X + (float)((rand.NextDouble() * 2 - 1) * 0.5),
                        Host.Self.Y + (float)((rand.NextDouble() * 2 - 1) * 0.5));
                    container.Size = 80;
                    Host.Self.Owner.EnterWorld(container);

                    bagType = 0;
                    items   = new Item[8];
                    idx     = 0;
                }
            }

            if (idx > 0)
            {
                bag = 0x0500;
                switch (bagType)
                {
                case 0: bag = 0x0500; break;

                case 1: bag = 0x0503; break;

                case 2: bag = 0x0507; break;

                case 3: bag = 0x0508; break;

                case 4: bag = 0x0509; break;
                }
                container = new Container(bag, 1000 * 60, true);
                for (int j = 0; j < idx; j++)
                {
                    container.Inventory[j] = items[j];
                }
                container.BagOwner = owner == null ? (int?)null : owner.AccountId;
                container.Move(
                    Host.Self.X + (float)((rand.NextDouble() * 2 - 1) * 0.5),
                    Host.Self.Y + (float)((rand.NextDouble() * 2 - 1) * 0.5));
                container.Size = 80;
                Host.Self.Owner.EnterWorld(container);
            }
        }
 private void Update()
 {
     if (m_isActive)
     {
         var mainUI = GameLogic.Get().m_mainGameUI;
         mainUI.m_isActionEnable[(PlayerAction)mainUI.GetActionDropdownItemIndex(m_cardAction)] = Player.Get().GetHp() < Player.Get().m_investigatorCard.m_health || Player.Get().GetSan() < Player.Get().m_investigatorCard.m_sanity;
     }
 }
        private void modEnforceBounds(On.Celeste.Level.orig_EnforceBounds orig, Level self, Player player) {
            if (isTheoCrystalsEverywhere() && !isAllowLeavingTheoBehind() &&
                // the player is holding nothing...
                (player.Holding == null || player.Holding.Entity == null || !player.Holding.IsHeld ||
                // or this thing is not a Theo crystal (f.e. jellyfish)
                (player.Holding.Entity.GetType() != typeof(TheoCrystal) && player.Holding.Entity.GetType() != typeof(ExtendedVariantTheoCrystal) && player.Holding.Entity.GetType() != typeof(ExtendedVariantTheoCrystalGoingOffscreen))) &&
                // but there is a Theo crystal on screen so the player has to grab it
                self.Tracker.CountEntities<ExtendedVariantTheoCrystal>() != 0) {

                // the player does not hold Theo, check if they try to leave the screen without him
                Rectangle bounds = self.Bounds;
                if (player.Left < bounds.Left) {
                    // prevent the player from going left
                    player.Left = bounds.Left;
                    player.OnBoundsH();
                } else if (player.Right > bounds.Right) {
                    // prevent the player from going right
                    player.Right = bounds.Right;
                    player.OnBoundsH();
                } else if (player.Top < bounds.Top) {
                    // prevent the player from going up
                    player.Top = bounds.Top;
                    player.OnBoundsV();
                } else if (player.Bottom > bounds.Bottom) {
                    if (SaveData.Instance.Assists.Invincible) {
                        // bounce the player off the bottom of the screen (= falling into a pit with invincibility on)
                        player.Play("event:/game/general/assist_screenbottom");
                        player.Bounce(bounds.Bottom);
                    } else {
                        // kill the player if they try to go down
                        player.Die(Vector2.Zero);
                    }
                } else {
                    // no screen transition detected => proceed to vanilla
                    orig(self, player);
                }
            } else {
                // the variant is disabled, we are allowed to leave Theo behind, or the player is holding Theo => we have no business here.
                orig(self, player);
            }
        }
示例#43
0
 public bool Trigger(TriggerEvent triggerEvent, Room room, Player target)
 {
     object data = new object();
     return Trigger(triggerEvent, room, target, ref data);
 }
示例#44
0
        private void PlayerOnOnExecuteOrder(Player player, ExecuteOrderEventArgs args)
        {
            /*if (!args.IsPlayerInput)
             *  return;*/
            if (!args.Entities.Any(x => x.Equals(Me)))
            {
                return;
            }
            if (_config.ComboKey || DisableKey)
            {
                return;
            }
            if (Me.IsInvisible() || UnitExtensions.HasAnyModifiers(Me, "modifier_invoker_ghost_walk_self",
                                                                   "modifier_rune_invis", "modifier_invisible"))
            {
                return;
            }
            var order = args.OrderId;

            if (args.IsPlayerInput)
            {
                if (order == OrderId.Ability)
                {
                    var abilityId = args.Ability.Id;
                    if (abilityId == AbilityId.invoker_quas || abilityId == AbilityId.invoker_wex ||
                        abilityId == AbilityId.invoker_exort || abilityId == AbilityId.invoker_invoke ||
                        abilityId == AbilityId.invoker_ghost_walk)
                    {
                        Sleeper.Sleep(1500);
                    }
                }
            }

            if (Sleeper.Sleeping || Me.IsSilenced())
            {
                return;
            }
            if (order == OrderId.AttackLocation || order == OrderId.AttackTarget)
            {
                if (_multySleeper.Sleeping("attack"))
                {
                    return;
                }
                _multySleeper.Sleep(250, "attack");
                var activeSphereForAttack =
                    Me.GetAbilityById(Buttons.First(x => x.IsActive && x.Type == TypeEnum.Attack).Id);
                if (activeSphereForAttack.CanBeCasted())
                {
                    if (CheckForModifiers)
                    {
                        var countOfModifiers =
                            Me.Modifiers.Count(x => x.Name == $"modifier_{activeSphereForAttack.Id}_instance");
                        if (countOfModifiers >= 3)
                        {
                            return;
                        }
                        for (var i = countOfModifiers; i < 3; i++)
                        {
                            activeSphereForAttack.UseAbility();
                        }
                        InChanging.Sleep(250);
                    }
                    else
                    {
                        InChanging.Sleep(250);
                        activeSphereForAttack.UseAbility();
                        activeSphereForAttack.UseAbility();
                        activeSphereForAttack.UseAbility();
                    }
                }
            }
            else if (order == OrderId.MoveLocation || order == OrderId.MoveTarget)
            {
                if (args.Target != null && args.Target.NetworkName == ClassId.CDOTA_BaseNPC_Healer.ToString())
                {
                    return;
                }

                if (_multySleeper.Sleeping("move"))
                {
                    return;
                }
                _multySleeper.Sleep(250, "move");

                var activeSphereForMove =
                    Me.GetAbilityById(Buttons.First(x => x.IsActive && x.Type == TypeEnum.Move).Id);
                if (VerySmartSpheres)
                {
                    if (UnitExtensions.HealthPercent(Me) <= HpSlider / 100f)
                    {
                        if (_config.Main.AbilitiesInCombo.Quas.Level > 0)
                        {
                            activeSphereForMove = _config.Main.AbilitiesInCombo.Quas;
                        }
                        else
                        {
                            activeSphereForMove = _config.Main.AbilitiesInCombo.Wex;
                        }
                    }
                    else
                    {
                        if (_config.Main.AbilitiesInCombo.Wex.Level > 0)
                        {
                            activeSphereForMove = _config.Main.AbilitiesInCombo.Wex;
                        }
                        else
                        {
                            activeSphereForMove = _config.Main.AbilitiesInCombo.Quas;
                        }
                    }

                    foreach (var typeButton in Buttons.Where(x => x.Type == TypeEnum.Move))
                    {
                        typeButton.IsActive = typeButton.Id == activeSphereForMove.Id;
                    }
                }

                if (activeSphereForMove.CanBeCasted())
                {
                    if (CheckForModifiers)
                    {
                        var countOfModifiers =
                            Me.Modifiers.Count(x => x.Name == $"modifier_{activeSphereForMove.Id}_instance");
                        if (countOfModifiers >= 3)
                        {
                            return;
                        }
                        for (var i = countOfModifiers; i < 3; i++)
                        {
                            activeSphereForMove.UseAbility();
                        }
                        InChanging.Sleep(250);
                    }
                    else
                    {
                        InChanging.Sleep(250);
                        activeSphereForMove.UseAbility();
                        activeSphereForMove.UseAbility();
                        activeSphereForMove.UseAbility();
                    }
                }
            }

            if (!args.IsPlayerInput)
            {
                if (!InChanging.Sleeping && order == OrderId.Ability)
                {
                    var abilityId = args.Ability.Id;
                    if (abilityId == AbilityId.invoker_quas || abilityId == AbilityId.invoker_wex ||
                        abilityId == AbilityId.invoker_exort || abilityId == AbilityId.invoker_invoke ||
                        abilityId == AbilityId.invoker_ghost_walk)
                    {
                        _multySleeper.Sleep(250, "attack");
                        _multySleeper.Sleep(250, "move");
                        //InvokerCrappahilationPaid.Log.Warn($"On Sleep");
                    }
                }
            }
        }
示例#45
0
 void Awake()
 {
     playerRef = FindObjectOfType <Player>();
 }
 public override void UpdateArmorSet(Player player)
 {
     player.setBonus = "The dark is your allie";
     player.AddBuff(ModContent.BuffType <Buffs.DarkFlame>(), 1, true);
 }
示例#47
0
        public bool Trigger(TriggerEvent triggerEvent, Room room, Player target, ref object data)
        {
            // push it to event stack
            if (!string.IsNullOrEmpty(room.PreWinner)) return true;

            _m_trigger_id++;
            int trigger_id = _m_trigger_id;
            trigger_count.Add(trigger_id, new Dictionary<string, int>());

            bool broken = false;
            List <TriggerSkill> will_trigger = new List<TriggerSkill>();
            List<TriggerSkill> triggerable_tested = new List<TriggerSkill>();
            List<TriggerSkill> rules = new List<TriggerSkill>(); // we can't get a GameRule with Engine::getTriggerSkill() :(
            Dictionary<Player, List<TriggerStruct>> trigger_who = new Dictionary<Player, List<TriggerStruct>>();
            List<TriggerSkill> triggered = new List<TriggerSkill>();
            Dictionary<Player, List<TriggerStruct>> already_triggered = new Dictionary<Player, List<TriggerStruct>>();
            do
            {
                List<TriggerSkill> skills  = skill_table.ContainsKey(triggerEvent) ? new List<TriggerSkill>(skill_table[triggerEvent]) : new List<TriggerSkill>();
                trigger_who.Clear();
                foreach (TriggerSkill skill in skills)
                {
                    if (!triggered.Contains(skill))
                    {
                        if (skill is GameRule)
                        {
                            if (will_trigger.Count == 0
                                || skill.GetDynamicPriority(triggerEvent) == will_trigger[will_trigger.Count - 1].GetDynamicPriority(triggerEvent))
                            {
                                will_trigger.Add(skill);
                                if (trigger_who.ContainsKey(rule_player))
                                    trigger_who[rule_player].Add(new TriggerStruct(skill.Name));       // Don't assign game rule to some player.
                                else
                                    trigger_who[rule_player] = new List<TriggerStruct> { new TriggerStruct(skill.Name) };

                                rules.Add(skill);
                            }
                            else if (skill.GetDynamicPriority(triggerEvent) != will_trigger[will_trigger.Count - 1].GetDynamicPriority(triggerEvent))
                                break;

                            triggered.Insert(0, skill);
                        }
                        else
                        {
                            if (will_trigger.Count == 0
                                || skill.GetDynamicPriority(triggerEvent) == will_trigger[will_trigger.Count - 1].GetDynamicPriority(triggerEvent))
                            {
                                skill.Record(triggerEvent, room, target, ref data);        //to record something for next.
                                List<TriggerStruct> triggerSkillList = skill.Triggerable(triggerEvent, room, target, ref data);

                                foreach (TriggerStruct skill_struct in triggerSkillList) {
                                    TriggerStruct tskill = skill_struct;
                                    if (tskill.Times != 1) tskill.Times = 1;            //make sure times == 1
                                    TriggerSkill trskill = Engine.GetTriggerSkill(tskill.SkillName);
                                    Player p = room.FindPlayer(tskill.Invoker, true);
                                    if (trskill != null)
                                    {
                                        will_trigger.Add(trskill);
                                        if (trigger_who.ContainsKey(p))
                                            trigger_who[p].Add(tskill);
                                        else
                                            trigger_who[p] = new List<TriggerStruct> { tskill };
                                    }
                                }
                            }
                            else if (skill.GetDynamicPriority(triggerEvent) != will_trigger[will_trigger.Count - 1].GetDynamicPriority(triggerEvent))
                                break;

                            triggered.Insert(0, skill);
                        }
                    }
                    if (!triggerable_tested.Contains(skill))
                        triggerable_tested.Add(skill);
                }
                
                if (will_trigger.Count > 0)
                {
                    will_trigger.Clear();
                    foreach (Player p in room.GetAllPlayers(true))
                    {
                        if (!trigger_who.ContainsKey(p)) continue;
                        //List<TriggerStruct> already_triggered = new List<TriggerStruct>();
                        Dictionary<Player, List<TriggerStruct>> refuse = new Dictionary<Player, List<TriggerStruct>>();
                        while (true)
                        {
                            List<TriggerStruct> who_skills = trigger_who.ContainsKey(p) ? new List<TriggerStruct>(trigger_who[p]) : new List<TriggerStruct>();
                            if (who_skills.Count == 0) break;
                            TriggerStruct name = new TriggerStruct();
                            foreach (TriggerStruct skill in who_skills) {
                                TriggerSkill tskill = Engine.GetTriggerSkill(skill.SkillName);
                                if (tskill != null && tskill.Global && tskill.SkillFrequency == Skill.Frequency.Compulsory)
                                {
                                    TriggerStruct name_copy = skill;
                                    if (skill.Targets.Count > 0) name_copy.ResultTarget = skill.Targets[0];
                                    name = name_copy;       // a new trick to deal with all "record-skill" or "compulsory-global",
                                                            // they should always be triggered first.
                                    break;
                                }
                            }

                            if (string.IsNullOrEmpty(name.SkillName))
                            {
                                if (p != null && !p.HasShownAllGenerals())
                                    p.SetFlags("Global_askForSkillCost");           // TriggerOrder need protect
                                if (who_skills.Count == 1 && (p == null || who_skills[0].SkillName.Contains("global-fake-move")))
                                {
                                    TriggerStruct name_copy = who_skills[0];
                                    if (who_skills[0].Targets.Count > 0) name_copy.ResultTarget = who_skills[0].Targets[0];
                                    name = name_copy;
                                }
                                else if (p != null)
                                {
                                    string reason = "GameRule:TriggerOrder";
                                    foreach (TriggerStruct skill in who_skills)
                                    {
                                        if (triggerEvent == TriggerEvent.EventPhaseStart && skill.SkillName.Contains("GameRule_AskForGeneralShow"))
                                        {
                                            reason = "GameRule:TurnStart";
                                            break;
                                        }
                                    }
                                    name = room.AskForSkillTrigger(p, reason, who_skills, true, data);
                                }
                                else
                                    name = who_skills[who_skills.Count - 1];
                                if (p != null && p.HasFlag("Global_askForSkillCost"))
                                    p.SetFlags("-Global_askForSkillCost");
                            }

                            if (string.IsNullOrEmpty(name.SkillName)) break;

                            TriggerSkill result_skill = Engine.GetTriggerSkill(name.SkillName);
                            Player skill_target = room.FindPlayer(name.ResultTarget, true);
                            if (skill_target == null && target != null)
                            {
                                skill_target = target;
                                name.ResultTarget = target.Name;
                            }

                            if (name.Targets.Count > 0)
                            {
                                bool deplicated = false;
                                List<TriggerStruct> already = already_triggered.ContainsKey(p) ? new List<TriggerStruct>(already_triggered[p]) : new List<TriggerStruct>();
                                foreach (TriggerStruct already_s in already)                            //类似铁骑对多目标发动的触发技
                                {                                                                       //若先选择了对后位角色发动,则直接跳过前位的其他角色
                                    if (already_s.Equals(name) && already_s.Targets.Count > 0)
                                    {
                                        Player triggered_target = room.FindPlayer(already_s.ResultTarget, true);
                                        Player _target = room.FindPlayer(name.ResultTarget, true);
                                        List<Player> all = room.GetAllPlayers(true);
                                        if (all.IndexOf(_target) > all.IndexOf(triggered_target))
                                        {
                                            already_triggered[p][already.IndexOf(already_s)] = name;
                                            deplicated = true;
                                            break;
                                        }
                                    }
                                }
                                if (!deplicated)
                                {
                                    if (already_triggered.ContainsKey(p))
                                        already_triggered[p].Add(name);
                                    else
                                        already_triggered[p] = new List<TriggerStruct> { name };
                                }
                            }
                            else
                            {
                                if (already_triggered.ContainsKey(p))
                                    already_triggered[p].Add(name);
                                else
                                    already_triggered[p] = new List<TriggerStruct> { name };
                            }

                            //----------------------------------------------- TriggerSkill::cost
                            bool do_effect = false;

                            if (p != null && !RoomLogic.PlayerHasShownSkill(room, p, result_skill))
                                p.SetFlags("Global_askForSkillCost");           // SkillCost need protect

                            string mark = string.Format("{0}_{1}_{2}", name.SkillName, p.Name, skill_target != null ? skill_target.Name : "null");
                            if (!trigger_count[trigger_id].ContainsKey(mark))
                                trigger_count[trigger_id][mark] = 1;
                            else
                                trigger_count[trigger_id][mark]++;
                            TriggerStruct cost = name;
                            cost.Times = trigger_count[trigger_id][mark];

                            TriggerStruct cost_str = result_skill.Cost(triggerEvent, room, skill_target, ref data, p, cost);
                            result_skill = Engine.GetTriggerSkill(cost_str.SkillName);

                            if (result_skill != null)
                            {
                                do_effect = true;
                                if (p != null)
                                {
                                    bool compulsory_shown = false;
                                    if (result_skill.SkillFrequency == Skill.Frequency.Compulsory && RoomLogic.PlayerHasShownSkill(room, p, result_skill))
                                        compulsory_shown = true;
                                    bool show = room.ShowSkill(p, result_skill.Name, cost_str.SkillPosition);
                                    if (!compulsory_shown && show) p.SetTag("JustShownSkill", result_skill.Name);
                                }
                            }

                            if (p != null && p.HasFlag("Global_askForSkillCost"))                      // for next time
                                p.SetFlags("-Global_askForSkillCost");

                            //----------------------------------------------- TriggerSkill::effect
                            if (do_effect)
                            {
                                Player invoker = room.FindPlayer(cost_str.Invoker, true);       //it may point to another skill, such as EightDiagram to bazhen
                                skill_target = room.FindPlayer(cost_str.ResultTarget, true);
                                broken = result_skill.Effect(triggerEvent, room, skill_target, ref data, invoker, cost_str);
                                if (broken)
                                {
                                    //if (room.Setting.GameMode == "Hegemony")
                                    //    room.Debug(string.Format("{0}-{1}", triggerEvent, result_skill.Name));
                                    p.RemoveTag("JustShownSkill");
                                    break;
                                }
                            }
                            else
                            {
                                if (refuse.ContainsKey(p))
                                    refuse[p].Add(name);
                                else
                                    refuse[p] = new List<TriggerStruct> { name };
                            }
                            //-----------------------------------------------
                            p.RemoveTag("JustShownSkill");

                            trigger_who.Clear();
                            foreach (TriggerSkill skill in triggered)
                            {
                                if (skill is GameRule)
                                {
                                    //room->tryPause();
                                    continue; // dont assign them to some person.
                                }
                                else
                                {
                                    //room->tryPause();
                                    if (skill.GetDynamicPriority(triggerEvent) == triggered[0].GetDynamicPriority(triggerEvent))
                                    {
                                        List<TriggerStruct> triggerSkillList = skill.Triggerable(triggerEvent, room, target, ref data);
                                        foreach (Player _p in room.Players)
                                        {
                                            foreach (TriggerStruct _skill in triggerSkillList)
                                            {
                                                if (_p.Name != _skill.Invoker)
                                                    continue;

                                                bool refuse_before = false;
                                                if (refuse.ContainsKey(_p))
                                                {
                                                    foreach (TriggerStruct refused in refuse[_p])
                                                    {
                                                        if (_skill.Equals(refused) && _skill.Targets.Count == 0)
                                                        {
                                                            refuse_before = true;
                                                            break;
                                                        }
                                                    }
                                                }
                                                if (refuse_before) break;

                                                TriggerStruct tskill = _skill;
                                                if (tskill.Times != 1) tskill.Times = 1;            //make sure times == 1
                                                TriggerSkill trskill = Engine.GetTriggerSkill(tskill.SkillName);
                                                if (trskill != null)
                                                {
                                                    if (trigger_who.ContainsKey(_p))
                                                        trigger_who[_p].Add(tskill);
                                                    else
                                                        trigger_who[_p] = new List<TriggerStruct> { tskill };
                                                }
                                            }
                                        }
                                    }
                                    else
                                        break;
                                }
                            }

                            foreach (TriggerStruct already_s in already_triggered[p])
                            {
                                List<TriggerStruct> who_skills_q = trigger_who.ContainsKey(p) ? new List<TriggerStruct>(trigger_who[p]) : new List<TriggerStruct>();
                                foreach (TriggerStruct re_skill in who_skills_q)
                                {
                                    if (already_s.Equals(re_skill))         //类似铁骑、烈弓多目标的触发技
                                    {                                       //筛选剩余未发动的目标
                                        if (already_s.Targets.Count > 0 && re_skill.Targets.Count > 0 && re_skill.Targets.Contains(already_s.ResultTarget))
                                        {
                                            List<string> targets = new List<string>(re_skill.Targets);
                                            for (int i = 0; i <= targets.IndexOf(already_s.ResultTarget); i++)
                                                re_skill.Targets.Remove(targets[i]);

                                            if (re_skill.Targets.Count > 0)
                                            {
                                                TriggerStruct re_skill2 = already_s;
                                                re_skill2.Targets = re_skill.Targets;
                                                re_skill2.ResultTarget = null;
                                                trigger_who[p][trigger_who[p].IndexOf(re_skill)] = re_skill2;
                                                break;
                                            }
                                        }
                                        trigger_who[p].Remove(re_skill);
                                        break;
                                    }
                                }
                            }
                        }
                        if (broken) break;
                    }
                }
                if (broken)
                    break;

            } while (skill_table.ContainsKey(triggerEvent) && skill_table[triggerEvent].Count != triggerable_tested.Count && string.IsNullOrEmpty(room.PreWinner));

            // @todo_Slob: for drawing cards when game starts -- stupid design of triggering no player!
            if (!broken && trigger_who.ContainsKey(rule_player) && trigger_who[rule_player].Count > 0)
            {
                List<TriggerStruct> triggers = new List<TriggerStruct>(trigger_who[rule_player]);
                foreach (TriggerStruct s in triggers)
                {
                    if (!string.IsNullOrEmpty(room.PreWinner)) break;

                    TriggerSkill skill = null;
                    foreach (TriggerSkill rule in rules)
                    {                      // because we cannot get a GameRule with Engine::getTriggerSkill()
                        if (rule.Name == s.SkillName)
                        {
                            skill = rule;
                            break;
                        }
                    }

                    TriggerStruct skill_cost = skill.Cost(triggerEvent, room, target, ref data, null, s);
                    if (!string.IsNullOrEmpty(skill_cost.SkillName))
                    {
                        broken = skill.Effect(triggerEvent, room, target, ref data, null, skill_cost);
                        if (broken)
                            break;
                    }
                }
            }

            foreach (TrustedAI ai in room.AIs)
                ai.Event(triggerEvent, target, data);

            //Bot聊天
            Bot.BotChat(triggerEvent, room, target, data);
            //成就
            AchieveCollector.Event(triggerEvent, room, target, data);

            // pop event stack
            //event_stack.pop_back();

            //room->tryPause();
            trigger_count.Remove(trigger_id);
            return broken;
        }
	// Use this for initialization
	void Start () {
		controller = GetComponent<Controller2D>();
		player = GetComponent<Player>();
	}
示例#49
0
文件: self.cs 项目: VizenDev/PopRPG
 private async Task SendStatsMessage(CommandEventArgs e, Player player)
 {
     Message message = await e.Channel.SendMessage(e.User.Mention + "\n" + player.ToString());
 }
示例#50
0
 // Se poate duplica o tabla
 public Simulator(Simulator sim) {
     pieces = (GameObject[,]) sim.pieces.Clone();
     movedPawns = new List<GameObject>(sim.movedPawns);
     currentPlayer = sim.currentPlayer;
     otherPlayer = sim.otherPlayer;
 }
示例#51
0
        public override void AI()
        {
            //Making player variable "p" set as the projectile's owner
            Player player = Main.player[projectile.owner];

            int[] array  = new int[20];
            int   num428 = 0;
            float num429 = 300f;
            //Factors for calculations
            double deg  = (double)projectile.ai[1]; //The degrees, you can multiply projectile.ai[1] to make it orbit faster, may be choppy depending on the value
            double rad  = deg * (Math.PI / 180);    //Convert degrees to radians
            double dist = 50;                       //Distance away from the player

            /*Position the player based on where the player is, the Sin/Cos of the angle times the /
            *  /distance for the desired distance away from the player minus the projectile's width   /
            *  /and height divided by two so the center of the projectile is at the right place.     */
            projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - projectile.width / 2;
            projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - projectile.height / 2;

            //Increase the counter/angle in degrees by 1 point, you can change the rate here too, but the orbit may look choppy depending on the value
            projectile.ai[1] += 2f;
            bool     flag64    = projectile.type == mod.ProjectileType("EarthTurret");
            MyPlayer modPlayer = (MyPlayer)player.GetModPlayer(mod, "MyPlayer");

            if (player.dead)
            {
                modPlayer.EarthTurret = false;
            }
            if (modPlayer.EarthTurret)
            {
                projectile.timeLeft = 2;
            }
            if (!modPlayer.BiologicalCrit)
            {
                projectile.Kill();
            }



            int num3 = projectile.frameCounter;


            int   num433 = 0;
            float num434 = 300f;
            bool  flag14 = false;

            for (int num435 = 0; num435 < 200; num435 = num3 + 1)
            {
                if (Main.npc[num435].CanBeChasedBy(projectile, false))
                {
                    float num436 = Main.npc[num435].position.X + (float)(Main.npc[num435].width / 2);
                    float num437 = Main.npc[num435].position.Y + (float)(Main.npc[num435].height / 2);
                    float num438 = Math.Abs(projectile.position.X + (float)(projectile.width / 2) - num436) + Math.Abs(projectile.position.Y + (float)(projectile.height / 2) - num437);
                    if (num438 < num434 && Collision.CanHit(projectile.Center, 1, 1, Main.npc[num435].Center, 1, 1))
                    {
                        if (num433 < 20)
                        {
                            array[num433] = num435;
                            num3          = num433;
                            num433        = num3 + 1;
                        }
                        flag14 = true;
                    }
                }
                num3 = num435;
            }

            if (flag14)
            {
                int num439 = Main.rand.Next(num433);
                num439 = array[num439];
                float num440 = Main.npc[num439].position.X + (float)(Main.npc[num439].width / 2);
                float num441 = Main.npc[num439].position.Y + (float)(Main.npc[num439].height / 2);
                projectile.localAI[0] += 1f;
                if (projectile.localAI[0] > 50f)
                {
                    projectile.localAI[0] = 0f;
                    float   num442   = 18f;
                    Vector2 vector32 = new Vector2(projectile.position.X + (float)projectile.width, projectile.position.Y + (float)projectile.height);
                    vector32 += projectile.velocity * 4f;
                    float num443 = num440 - vector32.X;
                    float num444 = num441 - vector32.Y;
                    float num445 = (float)Math.Sqrt((double)(num443 * num443 + num444 * num444));
                    num445  = num442 / num445;
                    num443 *= num445;
                    num444 *= num445;
                    int num666 = 30;
                    int num307 = mod.ProjectileType("StoneFossilFriendly");
                    Projectile.NewProjectile(vector32.X, vector32.Y, num443, num444, num307, num666, projectile.knockBack, projectile.owner, 0f, 0f);
                    return;
                }
            }
        }
示例#52
0
 // De apelat la final de mutare
 public void NextPlayer()
 {
     Player tempPlayer = currentPlayer;
     currentPlayer = otherPlayer;
     otherPlayer = tempPlayer;
 }
示例#53
0
 public override bool Operate(bool isKeyboard)
 {
     Player.Save();
     return(true);
 }
		public override short ManaCost(Player p, short stack) => 25;
示例#55
0
 /// <summary>
 /// Tries to delete the character.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="characterName">Name of the character.</param>
 /// <param name="securityCode">The security code.</param>
 public void DeleteCharacter(Player player, string characterName, string securityCode)
 {
     var result = this.DeleteCharacterRequest(player, characterName, securityCode);
     player.PlayerView.ShowCharacterDeleteResponse(result);
 }
示例#56
0
 public void AddPlayer(Player ply)
 {
     playerDAL.AddPlayer(ply);
 }
示例#57
0
		public override void Update(Player player, ref int buffIndex)
		{
			MyPlayer modPlayer = player.GetSpiritPlayer();
			player.buffTime[buffIndex] = modPlayer.timeLeft;
		}
示例#58
0
 public King(Player player)
     : base(player)
 {
 }
示例#59
0
 public async Task<bool> Execute(GameServer server, Player plr, string[] args)
 {
     return true;
 }
示例#60
0
		public override void RightClick(Player player)
		{
			int loots = Main.rand.Next(18);
			switch (loots)
			{
				case 1:
					player.QuickSpawnItem(ModContent.ItemType<TrenagonBar>(), Main.rand.Next(7, 10));
					break;

				case 2:
					player.QuickSpawnItem(ItemID.CopperBar, Main.rand.Next(7, 10));
					break;

				case 3:
					player.QuickSpawnItem(ItemID.TinBar, Main.rand.Next(7, 10));
					break;

				case 4:
					player.QuickSpawnItem(ItemID.IronBar, Main.rand.Next(7, 10));
					break;

				case 5:
					player.QuickSpawnItem(ItemID.LeadBar, Main.rand.Next(7, 10));
					break;

				case 6:
					player.QuickSpawnItem(ItemID.SilverBar, Main.rand.Next(7, 10));
					break;

				case 7:
					player.QuickSpawnItem(ItemID.TungstenBar, Main.rand.Next(7, 10));
					break;

				case 8:
					player.QuickSpawnItem(ItemID.GoldBar, Main.rand.Next(7, 10));
					break;

				case 9:
					player.QuickSpawnItem(ItemID.PlatinumBar, Main.rand.Next(7, 10));
					break;

				case 10:
					player.QuickSpawnItem(ItemID.Topaz, Main.rand.Next(7, 10));
					break;

				case 11:
					player.QuickSpawnItem(ItemID.Amethyst, Main.rand.Next(7, 10));
					break;

				case 12:
					player.QuickSpawnItem(ItemID.Sapphire, Main.rand.Next(7, 10));
					break;

				case 13:
					player.QuickSpawnItem(ItemID.Emerald, Main.rand.Next(7, 10));
					break;

				case 14:
					player.QuickSpawnItem(ItemID.Ruby, Main.rand.Next(7, 10));
					break;

				case 15:
					player.QuickSpawnItem(ItemID.Diamond, Main.rand.Next(7, 10));
					break;

				case 16:
					player.QuickSpawnItem(ModContent.ItemType<ShadowCrystal>(), Main.rand.Next(7, 10));
					break;

				case 17:
					player.QuickSpawnItem(ModContent.ItemType<SeafoamCrystal>(), Main.rand.Next(7, 10));
					break;
			}
		}