Пример #1
0
        private void CheckCursor()
        {
            string cursorname = "default";

            magicRegion.Active = false;
            if (leftSelectCard != null)
            {
                if (leftSelectCard.CardType == CardTypes.Monster)
                {
                    if (BattleLocationManager.IsPlaceCanSummon(leftSelectCard.CardId, mouseX, mouseY, true))
                    {
                        cursorname         = "summon";
                        magicRegion.Active = true;
                    }
                    else
                    {
                        var placeMon = BattleLocationManager.GetPlaceMonster(mouseX, mouseY);
                        if (placeMon != null && placeMon.IsLeft && !placeMon.Avatar.MonsterConfig.IsBuilding)
                        {
                            if (MonsterBook.HasTag(leftSelectCard.CardId, "sidekicker") ||
                                MonsterBook.HasTag(placeMon.CardId, "sidekickee") ||
                                BattleManager.Instance.PlayerManager.LeftPlayer.SpikeManager.HasSpike("sidekickall"))
                            {
                                cursorname = "sidekick";
                            }
                        }
                    }
                }
                else if (leftSelectCard.CardType == CardTypes.Weapon)
                {
                    LiveMonster lm = BattleLocationManager.GetPlaceMonster(mouseX, mouseY);
                    if (lm != null && lm.CanAddWeapon() && lm.IsLeft)
                    {
                        cursorname = "equip";
                    }
                }
                else if (leftSelectCard.CardType == CardTypes.Spell)
                {
                    if (mouseX > 0)
                    {
                        SpellConfig spellConfig = ConfigData.GetSpellConfig(leftSelectCard.CardId);
                        if (BattleLocationManager.IsPlaceCanCast(mouseX, mouseY, spellConfig.Target))
                        {
                            magicRegion.Active = true;
                            cursorname         = "cast";
                        }
                        else
                        {
                            cursorname = "nocast";
                        }
                    }
                }
            }
            myCursor.ChangeCursor(cursorname);
        }
Пример #2
0
        private static Point GetMonsterPoint(int mid, bool isLeft)
        {
            int size     = BattleManager.Instance.MemMap.CardSize;
            var sideCell = BattleManager.Instance.MemMap.ColumnCount / 2;

            while (true)
            {
                int x = isLeft ? MathTool.GetRandom(0, sideCell) : MathTool.GetRandom(sideCell + 1, BattleManager.Instance.MemMap.ColumnCount - 1);
                int y = MathTool.GetRandom(0, BattleManager.Instance.MemMap.RowCount);
                x *= size;
                y *= size;
                if (BattleLocationManager.IsPlaceCanSummon(mid, x, y, false))
                {
                    return(new Point(x, y));
                }
            }
        }
Пример #3
0
        internal void Draw(Graphics g)
        {
            if (cardId == 0)
            {
                return;
            }

            int        size      = BattleManager.Instance.MemMap.CardSize;
            SolidBrush fillBrush = new SolidBrush(Color.FromArgb(60, Color.Red));

            foreach (MemMapPoint memMapPoint in BattleManager.Instance.MemMap.Cells)
            {
                if (!BattleLocationManager.IsPlaceCanSummon(cardId, memMapPoint.X, memMapPoint.Y, true))
                {
                    g.FillRectangle(fillBrush, memMapPoint.X, memMapPoint.Y, size, size);
                }
            }
            fillBrush.Dispose();
        }