Esempio n. 1
0
    private List <Card> FindSurvivors()
    {
        List <Card> list = new List <Card>();

        foreach (ZonePlay play in ZoneMgr.Get().FindZonesOfType <ZonePlay>())
        {
            List <Card> cards = play.GetCards();
Esempio n. 2
0
 public void OnWorldZoneEvent(string EventName, ZoneMgr Zone, object Data)
 {
     for (int i = 0; i < Scripts.Count; ++i)
     {
         Scripts[i].OnWorldZoneEvent(EventName, Zone, Data);
     }
 }
Esempio n. 3
0
    private static MinionShake[] FindAllMinionShakers(GameObject shakeTrigger)
    {
        Card  sourceCard = null;
        Spell spell      = SceneUtils.FindComponentInThisOrParents <Spell>(shakeTrigger);

        if (spell != null)
        {
            sourceCard = spell.GetSourceCard();
        }
        List <MinionShake> list = new List <MinionShake>();

        foreach (Zone zone in ZoneMgr.Get().FindZonesForTag(TAG_ZONE.PLAY))
        {
            if (zone.GetType() != typeof(ZoneHero))
            {
                foreach (Card card2 in zone.GetCards())
                {
                    if (card2 != sourceCard)
                    {
                        MinionShake componentInChildren = card2.GetComponentInChildren <MinionShake>();
                        Log.Kyle.Print(string.Format("Minion Shake Search:{0}", card2), new object[0]);
                        if (componentInChildren != null)
                        {
                            list.Add(componentInChildren);
                            Log.Kyle.Print(string.Format("Minion Shake Found:{0}", card2), new object[0]);
                        }
                    }
                }
            }
        }
        return(list.ToArray());
    }
Esempio n. 4
0
        public FlagDominationScenario(Scenario_Info info, int tier)
            : base(info, tier)
        {
            foreach (Scenario_Object obj in info.ScenObjects)
            {
                if (obj.Type == "Capture Point")
                {
                    CapturePoint cPoint = new CapturePoint(obj, CaptureValid, OnCapture);
                    _capturePoints.Add(cPoint);
                    Region.AddObject(cPoint, info.MapId);
                }

                else if (obj.Type == "Flag")
                {
                    _flag = new HoldObject(obj.Identifier, obj.ObjectiveName, new Point3D(obj.WorldPosX, obj.WorldPosY, obj.PosZ), 60001, 13000, FlagPickedUp, ObjectDropped, ObjectReset, null, 299, 299);
                    Region.AddObject(_flag, info.MapId);
                    AddTrackedObject(_flag);
                }

                else
                {
                    LoadScenarioObject(obj);
                }
            }

            ZoneMgr curZone = Region.GetZoneMgr(Info.MapId);

            Region.LoadCells((ushort)(curZone.Info.OffX + 8), (ushort)(curZone.Info.OffY + 8), 8);
        }
    public static ZonePlay FindOpponentPlayZone(Spell spell)
    {
        Player player = FindOpponentPlayer(spell);

        if (player == null)
        {
            return(null);
        }
        return(ZoneMgr.Get().FindZoneOfType <ZonePlay>(player.GetSide()));
    }
Esempio n. 6
0
 public bool HasWeapon()
 {
     foreach (Zone zone in ZoneMgr.Get().GetZones())
     {
         if ((zone is ZoneWeapon) && (zone.m_Side == this.m_side))
         {
             return(zone.GetCards().Count > 0);
         }
     }
     return(false);
 }
Esempio n. 7
0
File: Game.cs Progetto: ruham111/BoL
        /* void Game.PlayCard(string type, Card card, [optional] Card target)
         * Plays a card from player hand, TYPES = "Minion", "Spell"
         * TODO: Improve this function and add support for Secret, Weapon Zones
         */
        public static void PlayCard(string type, Card card, Card target = null)
        {
            Entity cEntity = card.GetEntity();

            switch (type)
            {
            case "Minion":
                Zone destZone = MyPlayer().GetBattlefieldZone();
                int  slot     = destZone.GetCards().Count + 1;
                GameState.Get().GetGameEntity().NotifyOfCardDropped(cEntity);
                GameState.Get().SetSelectedOptionPosition(slot);
                if (InputManager.Get().DoNetworkResponse(cEntity))
                {
                    int zonePos = cEntity.GetZonePosition();
                    ZoneMgr.Get().AddLocalZoneChange(card, destZone, slot);
                    MyPlayer().GetHandZone().UpdateLayout(-1, true);
                    MyPlayer().GetBattlefieldZone().SortWithSpotForHeldCard(-1);
                    if (GameState.Get().GetResponseMode() != GameState.ResponseMode.SUB_OPTION)
                    {
                        EnemyActionHandler.Get().NotifyOpponentOfCardDropped();
                    }
                }
                break;

            case "Spell":
                if (card.GetActor().GetActorStateType() == ActorStateType.CARD_PLAYABLE)
                {
                    GameState.Get().GetGameEntity().NotifyOfCardDropped(cEntity);
                    if (InputManager.Get().DoNetworkResponse(cEntity))
                    {
                        ZoneMgr.Get().AddLocalZoneChange(card, TAG_ZONE.PLAY);
                        MyPlayer().GetHandZone().UpdateLayout(-1, true);
                        MyPlayer().GetBattlefieldZone().SortWithSpotForHeldCard(-1);

                        if (GameState.Get().GetResponseMode() != GameState.ResponseMode.SUB_OPTION)
                        {
                            EnemyActionHandler.Get().NotifyOpponentOfCardDropped();
                        }
                    }
                }
                break;
            }
            if (target != null && GameState.Get().IsInTargetMode())
            {
                GameState.Get().GetGameEntity().NotifyOfBattlefieldCardClicked(target.GetEntity(), true);
                if (InputManager.Get().DoNetworkResponse(target.GetEntity()))
                {
                    EnemyActionHandler.Get().NotifyOpponentOfTargetEnd();
                    MyPlayer().GetHandZone().UpdateLayout(-1, true);
                    MyPlayer().GetBattlefieldZone().UpdateLayout();
                }
            }
        }
    public static Zone FindTargetZone(Spell spell)
    {
        Card targetCard = spell.GetTargetCard();

        if (targetCard == null)
        {
            return(null);
        }
        Entity entity = targetCard.GetEntity();

        return(ZoneMgr.Get().FindZoneForEntity(entity));
    }
Esempio n. 9
0
        public static Card GetWeapon(bool ally)
        {
            foreach (var zone in ZoneMgr.Get().GetZones())
            {
                if (!(zone is ZoneWeapon) || zone.GetController().IsFriendlySide() != ally)
                {
                    continue;
                }

                return(zone.GetCards()[0]);
            }
            return(null);
        }
 protected void OnExitedNoneState()
 {
     if (this.DoesBlockServerEvents())
     {
         GameState.Get().AddServerBlockingSpell(this);
     }
     this.ActivateObjectContainer(true);
     this.BlockZones(true);
     if (ZoneMgr.Get() != null)
     {
         ZoneMgr.Get().RequestNextDeathBlockLayoutDelaySec(this.m_ZoneLayoutDelayForDeaths);
     }
 }
Esempio n. 11
0
    public void DoTasks(int startIndex, int count, CompleteCallback callback, object userData)
    {
        bool flag           = false;
        int  taskStartIndex = -1;
        int  taskEndIndex   = Mathf.Min((int)((startIndex + count) - 1), (int)(this.m_tasks.Count - 1));

        for (int i = startIndex; i <= taskEndIndex; i++)
        {
            PowerTask task = this.m_tasks[i];
            if (!task.IsCompleted())
            {
                if (taskStartIndex < 0)
                {
                    taskStartIndex = i;
                }
                if (ZoneMgr.IsHandledPower(task.GetPower()))
                {
                    flag = true;
                    break;
                }
            }
        }
        if (taskStartIndex < 0)
        {
            taskStartIndex = startIndex;
        }
        if (flag)
        {
            ZoneChangeCallbackData data = new ZoneChangeCallbackData {
                m_startIndex       = startIndex,
                m_count            = count,
                m_taskListCallback = callback,
                m_taskListUserData = userData
            };
            this.m_zoneChangeList = ZoneMgr.Get().AddServerZoneChanges(this, taskStartIndex, taskEndIndex, new ZoneMgr.ChangeCompleteCallback(this.OnZoneChangeComplete), data);
            if (this.m_zoneChangeList != null)
            {
                return;
            }
        }
        if (Gameplay.Get() != null)
        {
            Gameplay.Get().StartCoroutine(this.WaitForGameStateAndDoTasks(taskStartIndex, taskEndIndex, startIndex, count, callback, userData));
        }
        else
        {
            this.DoTasks(taskStartIndex, taskEndIndex, startIndex, count, callback, userData);
        }
    }
    private void FindSomethingToLookAt()
    {
        List <Vector3> list = new List <Vector3>();
        ZoneMgr        mgr  = ZoneMgr.Get();

        if (mgr == null)
        {
            this.PlayAniamtion();
        }
        else
        {
            foreach (ZonePlay play in mgr.FindZonesOfType <ZonePlay>())
            {
                foreach (Card card in play.GetCards())
                {
                    if (card.IsMousedOver())
                    {
                        this.m_LookAtPosition = card.transform.position;
                        return;
                    }
                    list.Add(card.transform.position);
                }
            }
            if (UnityEngine.Random.Range(0, 100) < this.m_LookAtHeroesPercent)
            {
                foreach (ZoneHero hero in ZoneMgr.Get().FindZonesOfType <ZoneHero>())
                {
                    foreach (Card card2 in hero.GetCards())
                    {
                        if (card2.IsMousedOver())
                        {
                            this.m_LookAtPosition = card2.transform.position;
                            return;
                        }
                        list.Add(card2.transform.position);
                    }
                }
            }
            if (list.Count > 0)
            {
                int num = UnityEngine.Random.Range(0, list.Count);
                this.m_LookAtPosition = list[num];
            }
            else
            {
                this.PlayAniamtion();
            }
        }
    }
Esempio n. 13
0
    private bool CanAnimateHeldCard(Card card)
    {
        if (!this.IsCardInHand(card))
        {
            return(false);
        }
        string tweenName = ZoneMgr.Get().GetTweenName <ZoneHand>();

        string[] names = new string[] { "RemoteActionHandler", tweenName };
        if (iTween.HasNameNotInList(card.gameObject, names))
        {
            return(false);
        }
        return(true);
    }
Esempio n. 14
0
        public static Card GetHeroCard(bool ally)
        {
            foreach (var zone in ZoneMgr.Get().GetZones())
            {
                if (!(zone is ZoneHero) || zone.GetController().IsFriendlySide() != ally)
                {
                    continue;
                }

                if (zone.GetCards().Count > 0)
                {
                    return(zone.GetCards()[0]);
                }
            }
            return(null);
        }
Esempio n. 15
0
    public List <string> GetSecretDefinitions()
    {
        List <string> list = new List <string>();

        foreach (Zone zone in ZoneMgr.Get().GetZones())
        {
            if ((zone is ZoneSecret) && (zone.m_Side == Side.FRIENDLY))
            {
                foreach (Card card in zone.GetCards())
                {
                    list.Add(card.GetEntity().GetCardId());
                }
            }
        }
        return(list);
    }
    private static List <Marshaled_TargetEntityInfo> GetMarshaledEntitiesInPlay()
    {
        List <Marshaled_TargetEntityInfo> list = new List <Marshaled_TargetEntityInfo>();

        foreach (Zone zone in ZoneMgr.Get().FindZonesForTag(TAG_ZONE.PLAY))
        {
            foreach (Card card in zone.GetCards())
            {
                Entity entity = card.GetEntity();
                if (entity.GetZone() == TAG_ZONE.PLAY)
                {
                    list.Add(Marshaled_TargetEntityInfo.ConvertFromTargetEntityInfo(entity.ConvertToTargetInfo()));
                }
            }
        }
        return(list);
    }
        public CaptureTheFlagScenario(Scenario_Info info, byte tier) : base(info, tier)
        {
            foreach (Scenario_Object obj in info.ScenObjects)
            {
                if (obj.Type == "Flag")
                {
                    HoldObject flag = new HoldObject(obj.Identifier, obj.ObjectiveName, new Point3D(obj.WorldPosX, obj.WorldPosY, obj.PosZ), 60001, 13000, ObjectPickedUp, FlagDropped, FlagReset, FlagBuffAssigned, 3442, 3442);

                    if (obj.ObjectiveName == "Order Flag")
                    {
                        flag.VfxState = 2;
                        _captureScore = obj.PointGain;
                        flag.SetActive(Realms.REALMS_REALM_DESTRUCTION);
                    }

                    else if (obj.ObjectiveName == "Destruction Flag")
                    {
                        flag.VfxState = 5;
                        _captureScore = obj.PointGain;
                        flag.SetActive(Realms.REALMS_REALM_ORDER);
                    }

                    else
                    {
                        flag.SetActive(0);
                        flag.HoldResetTimeSeconds = 180;
                        _captureScore             = obj.PointGain;
                    }

                    flag.ObjectType = 1;

                    _flags.Add(flag);
                    Region.AddObject(flag, info.MapId);
                    AddTrackedObject(flag);
                }
                else
                {
                    LoadScenarioObject(obj);
                }

                ZoneMgr curZone = Region.GetZoneMgr(Info.MapId);

                Region.LoadCells((ushort)(curZone.Info.OffX + 8), (ushort)(curZone.Info.OffY + 8), 8);
            }
        }
Esempio n. 18
0
    private int GetNumTotalMinionsInPlay()
    {
        int num = 0;

        foreach (Zone zone in ZoneMgr.Get().GetZones())
        {
            if (zone is ZonePlay)
            {
                foreach (Card card in zone.GetCards())
                {
                    if (card.GetEntity().IsMinion())
                    {
                        num++;
                    }
                }
            }
        }
        return(num);
    }
    public static List <Zone> FindZonesFromTag(Spell spell, SpellZoneTag zoneTag, SpellPlayerSide spellSide)
    {
        if (ZoneMgr.Get() != null)
        {
            if (spellSide == SpellPlayerSide.NEUTRAL)
            {
                return(null);
            }
            if (spellSide == SpellPlayerSide.BOTH)
            {
                return(FindZonesFromTag(zoneTag));
            }
            Player.Side side = ConvertSpellSideToPlayerSide(spell, spellSide);
            switch (zoneTag)
            {
            case SpellZoneTag.PLAY:
                return(ZoneMgr.Get().FindZonesOfType <Zone, ZonePlay>(side));

            case SpellZoneTag.HERO:
                return(ZoneMgr.Get().FindZonesOfType <Zone, ZoneHero>(side));

            case SpellZoneTag.HERO_POWER:
                return(ZoneMgr.Get().FindZonesOfType <Zone, ZoneHeroPower>(side));

            case SpellZoneTag.WEAPON:
                return(ZoneMgr.Get().FindZonesOfType <Zone, ZoneWeapon>(side));

            case SpellZoneTag.DECK:
                return(ZoneMgr.Get().FindZonesOfType <Zone, ZoneDeck>(side));

            case SpellZoneTag.HAND:
                return(ZoneMgr.Get().FindZonesOfType <Zone, ZoneHand>(side));

            case SpellZoneTag.GRAVEYARD:
                return(ZoneMgr.Get().FindZonesOfType <Zone, ZoneGraveyard>(side));

            case SpellZoneTag.SECRET:
                return(ZoneMgr.Get().FindZonesOfType <Zone, ZoneSecret>(side));
            }
            Debug.LogWarning(string.Format("SpellUtils.FindZonesFromTag() - Unhandled zoneTag {0}. spellSide={1} playerSide={2}", zoneTag, spellSide, side));
        }
        return(null);
    }
Esempio n. 20
0
 private void AssignPlayerBoardObjects()
 {
     foreach (ManaCounter counter in BoardStandardGame.Get().gameObject.GetComponentsInChildren <ManaCounter>(true))
     {
         if (counter.m_Side == this.m_side)
         {
             this.m_manaCounter = counter;
             this.m_manaCounter.SetPlayer(this);
             this.m_manaCounter.UpdateText();
             break;
         }
     }
     this.InitManaCrystalMgr();
     foreach (Zone zone in ZoneMgr.Get().GetZones())
     {
         if (zone.m_Side == this.m_side)
         {
             zone.SetController(this);
         }
     }
 }
Esempio n. 21
0
        public override void Execute()
        {
            var slot = Game.MyPlayer.FieldZone.GetCards().Count + 1;

            _source.PickUp();
            _source.Drop();
            if (!_source.DoReposponse)
            {
                return;
            }
            ZoneMgr.Get().AddLocalZoneChange(_source.Source, Game.MyPlayer.FieldZone, slot);
            Game.MyPlayer.UpdateMana(_source.RealTimeCost);
            Game.MyPlayer.HandZone.UpdateLayout(-1, true);
            Game.MyPlayer.FieldZone.SortWithSpotForHeldCard(-1);
            if (GameState.Get().GetResponseMode() == GameState.ResponseMode.SUB_OPTION)
            {
                return;
            }
            EnemyActionHandler.Get().NotifyOpponentOfCardDropped();
            ActionQueue.Remove(this);
        }
Esempio n. 22
0
        public static void F_PLAY_VOICE_OVER(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            packet.GetUint16(); // Unk
            ushort ZoneId = packet.GetUint16();

            Player Plr = cclient.Plr;

            if (Plr.Region == null)
            {
                return;
            }

            ZoneMgr Zone = Plr.Zone;

            if (Zone == null)
            {
                return;
            }

            List <PublicQuest> PQuests = Zone.PQuests;

            PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECTIVE_UPDATE, 64);

            Out.WriteUInt32(0);
            Out.WriteByte(6);
            Out.WriteUInt32(ZoneId);
            Out.WriteUInt16((ushort)PQuests.Count);

            foreach (PublicQuest PQuest in PQuests)
            {
                Out.WriteUInt32(PQuest.Info.Entry);
                Out.WriteUInt16((ushort)PQuest.ActivePlayers.Count);
            }

            cclient.Plr.SendPacket(Out);
        }
Esempio n. 23
0
    public bool ShowFriendlySidePlayerTurnReminder()
    {
        GameState state = GameState.Get();

        if (state.IsMulliganManagerActive())
        {
            return(false);
        }
        Player friendlySidePlayer = state.GetFriendlySidePlayer();

        if (friendlySidePlayer == null)
        {
            return(false);
        }
        if (!friendlySidePlayer.IsCurrentPlayer())
        {
            return(false);
        }
        ZoneMgr mgr = ZoneMgr.Get();

        if (mgr == null)
        {
            return(false);
        }
        ZonePlay play = mgr.FindZoneOfType <ZonePlay>(Player.Side.FRIENDLY);

        if (play == null)
        {
            return(false);
        }
        List <Card> cards = this.GenerateCardsToRemindList(state, play.GetCards());

        if (cards.Count != 0)
        {
            this.PlayReminders(cards);
        }
        return(true);
    }
    public static List <Zone> FindZonesFromTag(SpellZoneTag zoneTag)
    {
        ZoneMgr mgr = ZoneMgr.Get();

        if (mgr != null)
        {
            switch (zoneTag)
            {
            case SpellZoneTag.PLAY:
                return(mgr.FindZonesOfType <Zone, ZonePlay>());

            case SpellZoneTag.HERO:
                return(mgr.FindZonesOfType <Zone, ZoneHero>());

            case SpellZoneTag.HERO_POWER:
                return(mgr.FindZonesOfType <Zone, ZoneHeroPower>());

            case SpellZoneTag.WEAPON:
                return(mgr.FindZonesOfType <Zone, ZoneWeapon>());

            case SpellZoneTag.DECK:
                return(mgr.FindZonesOfType <Zone, ZoneDeck>());

            case SpellZoneTag.HAND:
                return(mgr.FindZonesOfType <Zone, ZoneHand>());

            case SpellZoneTag.GRAVEYARD:
                return(mgr.FindZonesOfType <Zone, ZoneGraveyard>());

            case SpellZoneTag.SECRET:
                return(mgr.FindZonesOfType <Zone, ZoneSecret>());
            }
            Debug.LogWarning(string.Format("SpellUtils.FindZonesFromTag() - unhandled zoneTag {0}", zoneTag));
        }
        return(null);
    }
Esempio n. 25
0
    public PlayErrors.SourceEntityInfo ConvertToSourceInfo(PlayErrors.PlayRequirementInfo playRequirementInfo, Entity parent)
    {
        List <string> entourageCardIDs = this.GetEntityDef().GetEntourageCardIDs();
        List <string> list2            = new List <string>();
        int           num = 0;
        ZoneMgr       mgr = ZoneMgr.Get();

        if (mgr != null)
        {
            ZonePlay play = mgr.FindZoneOfType <ZonePlay>(Player.Side.FRIENDLY);
            if (play != null)
            {
                foreach (Card card in play.GetCards())
                {
                    Entity entity = card.GetEntity();
                    if (entity != null)
                    {
                        list2.Add(entity.GetCardId());
                    }
                }
            }
            ZonePlay play2 = mgr.FindZoneOfType <ZonePlay>(Player.Side.OPPOSING);
            if (play2 != null)
            {
                foreach (Card card2 in play2.GetCards())
                {
                    Entity entity2 = card2.GetEntity();
                    if ((entity2 != null) && entity2.IsMinion())
                    {
                        num++;
                    }
                }
            }
        }
        PlayErrors.SourceEntityInfo info = new PlayErrors.SourceEntityInfo {
            requirementsMap = playRequirementInfo.requirementsMap,
            id     = base.GetEntityId(),
            cost   = base.GetCost(),
            attack = base.GetATK(),
            minAttackRequirement                = playRequirementInfo.paramMinAtk,
            maxAttackRequirement                = playRequirementInfo.paramMaxAtk,
            raceRequirement                     = playRequirementInfo.paramRace,
            numMinionSlotsRequirement           = playRequirementInfo.paramNumMinionSlots,
            numMinionSlotsWithTargetRequirement = playRequirementInfo.paramNumMinionSlotsWithTarget,
            minTotalMinionsRequirement          = playRequirementInfo.paramMinNumTotalMinions,
            minFriendlyMinionsRequirement       = playRequirementInfo.paramMinNumFriendlyMinions,
            minEnemyMinionsRequirement          = playRequirementInfo.paramMinNumEnemyMinions,
            numTurnsInPlay     = base.GetNumTurnsInPlay(),
            numAttacksThisTurn = base.GetNumAttacksThisTurn(),
            numWindfury        = base.GetWindfury(),
            cardType           = base.GetCardType(),
            zone              = base.GetZone(),
            isSecret          = base.IsSecret(),
            isDuplicateSecret = false
        };
        if (info.isSecret)
        {
            Player player = GameState.Get().GetPlayer(base.GetControllerId());
            if (player != null)
            {
                foreach (string str in player.GetSecretDefinitions())
                {
                    if (this.GetCardId().Equals(str, StringComparison.OrdinalIgnoreCase))
                    {
                        info.isDuplicateSecret = true;
                        break;
                    }
                }
            }
        }
        info.isExhausted           = base.IsExhausted();
        info.isMasterPower         = (base.GetZone() == TAG_ZONE.HAND) || base.IsHeroPower();
        info.isActionPower         = TAG_ZONE.HAND == base.GetZone();
        info.isActivatePower       = (base.GetZone() == TAG_ZONE.PLAY) || base.IsHeroPower();
        info.isAttackPower         = base.IsHero() || (!base.IsHeroPower() && (TAG_ZONE.PLAY == base.GetZone()));
        info.isFrozen              = base.IsFrozen();
        info.hasBattlecry          = base.HasBattlecry();
        info.canAttack             = base.CanAttack();
        info.entireEntourageInPlay = false;
        if (entourageCardIDs.Count > 0)
        {
            info.entireEntourageInPlay = list2.Count > 0;
    private void UpdateLayoutImpl(int slotMousedOver, int overrideCardCount)
    {
        int num = 0;

        if ((((this.lastMousedOver != slotMousedOver) && (this.lastMousedOver != -1)) && ((this.lastMousedOver < base.m_cards.Count) && (base.m_cards[this.lastMousedOver] != null))) && this.CanAnimateCard(base.m_cards[this.lastMousedOver]))
        {
            Card card = base.m_cards[this.lastMousedOver];
            iTween.Stop(card.gameObject);
            if (!this.enemyHand)
            {
                Vector3 mouseOverCardPosition = this.GetMouseOverCardPosition(card);
                Vector3 cardPosition          = this.GetCardPosition(card, overrideCardCount);
                card.transform.position         = new Vector3(mouseOverCardPosition.x, this.centerOfHand.y, cardPosition.z + 0.5f);
                card.transform.localScale       = this.GetCardScale(card);
                card.transform.localEulerAngles = this.GetCardRotation(card);
            }
            card.NotifyMousedOut();
            GameLayer cardRaycast = GameLayer.Default;
            if ((base.m_Side == Player.Side.OPPOSING) && SpectatorManager.Get().IsSpectatingOpposingSide())
            {
                cardRaycast = GameLayer.CardRaycast;
            }
            SceneUtils.SetLayer(card.gameObject, cardRaycast);
        }
        float delaySec = 0f;

        for (int i = 0; i < base.m_cards.Count; i++)
        {
            Vector3 vector3;
            Card    card2 = base.m_cards[i];
            if (!this.CanAnimateCard(card2))
            {
                continue;
            }
            num++;
            float z = !this.m_flipHandCards ? 354.5f : 534.5f;
            card2.transform.rotation = Quaternion.Euler(new Vector3(card2.transform.localEulerAngles.x, card2.transform.localEulerAngles.y, z));
            float num5 = 0.5f;
            if (this.m_handMoving)
            {
                num5 = 0.25f;
            }
            if (this.enemyHand)
            {
                num5 = 1.5f;
            }
            float           num6            = 0.25f;
            iTween.EaseType easeOutExpo     = iTween.EaseType.easeOutExpo;
            float           transitionDelay = card2.GetTransitionDelay();
            card2.SetTransitionDelay(0f);
            ZoneTransitionStyle transitionStyle = card2.GetTransitionStyle();
            card2.SetTransitionStyle(ZoneTransitionStyle.NORMAL);
            switch (transitionStyle)
            {
            case ZoneTransitionStyle.SLOW:
                easeOutExpo = iTween.EaseType.easeInExpo;
                num6        = num5;
                break;

            case ZoneTransitionStyle.VERY_SLOW:
                easeOutExpo = iTween.EaseType.easeInOutCubic;
                num6        = 1f;
                num5        = 1f;
                break;

            case ZoneTransitionStyle.NORMAL:
                goto Label_0265;
            }
            card2.GetActor().TurnOnCollider();
Label_0265:
            vector3 = this.GetCardPosition(card2, overrideCardCount);
            Vector3 cardRotation = this.GetCardRotation(card2, overrideCardCount);
            Vector3 cardScale    = this.GetCardScale(card2);
            if (i == slotMousedOver)
            {
                easeOutExpo = iTween.EaseType.easeOutExpo;
                if (this.enemyHand)
                {
                    num6 = 0.15f;
                    float num8 = 0.3f;
                    vector3 = new Vector3(vector3.x, vector3.y, vector3.z - num8);
                }
                else
                {
                    float num9 = 0.5f * i;
                    num9 -= (0.5f * base.m_cards.Count) / 2f;
                    float selectCardScale = (float)this.m_SelectCardScale;
                    float num11           = (float)this.m_SelectCardScale;
                    cardRotation = new Vector3(0f, 0f, 0f);
                    cardScale    = new Vector3(selectCardScale, cardScale.y, num11);
                    card2.transform.localScale = cardScale;
                    num5 = 4f;
                    float num12 = 0.1f;
                    vector3 = this.GetMouseOverCardPosition(card2);
                    float x = vector3.x;
                    if (this.m_handEnlarged)
                    {
                        vector3.x = Mathf.Max(vector3.x, this.m_enlargedHandCardMinX);
                        vector3.x = Mathf.Min(vector3.x, this.m_enlargedHandCardMaxX);
                    }
                    card2.transform.position         = new Vector3((x == vector3.x) ? card2.transform.position.x : vector3.x, vector3.y, vector3.z - num12);
                    card2.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
                    iTween.Stop(card2.gameObject);
                    easeOutExpo = iTween.EaseType.easeOutExpo;
                    if (CardTypeBanner.Get() != null)
                    {
                        CardTypeBanner.Get().Show(card2.GetActor());
                    }
                    InputManager.Get().SetMousedOverCard(card2);
                    bool    showOnRight    = card2.GetActor().GetMeshRenderer().bounds.center.x < base.GetComponent <BoxCollider>().bounds.center.x;
                    float?  overrideScale  = null;
                    Vector3?overrideOffset = null;
                    KeywordHelpPanelManager.Get().UpdateKeywordHelp(card2, card2.GetActor(), showOnRight, overrideScale, overrideOffset);
                    SceneUtils.SetLayer(card2.gameObject, GameLayer.Tooltip);
                }
            }
            else if (this.GetStandIn(card2) != null)
            {
                CardStandIn standIn = this.GetStandIn(card2);
                iTween.Stop(standIn.gameObject);
                standIn.transform.position = vector3;
                if (!card2.CardStandInIsInteractive())
                {
                    standIn.DisableStandIn();
                }
                else
                {
                    standIn.EnableStandIn();
                }
            }
            card2.EnableTransitioningZones(true);
            string    tweenName = ZoneMgr.Get().GetTweenName <ZoneHand>();
            object[]  args      = new object[] { "scale", cardScale, "delay", transitionDelay, "time", num6, "easeType", easeOutExpo, "name", tweenName };
            Hashtable hashtable = iTween.Hash(args);
            iTween.ScaleTo(card2.gameObject, hashtable);
            object[]  objArray2  = new object[] { "rotation", cardRotation, "delay", transitionDelay, "time", num6, "easeType", easeOutExpo, "name", tweenName };
            Hashtable hashtable2 = iTween.Hash(objArray2);
            iTween.RotateTo(card2.gameObject, hashtable2);
            object[]  objArray3  = new object[] { "position", vector3, "delay", transitionDelay, "time", num5, "easeType", easeOutExpo, "name", tweenName };
            Hashtable hashtable3 = iTween.Hash(objArray3);
            iTween.MoveTo(card2.gameObject, hashtable3);
            float[] values = new float[] { delaySec, transitionDelay + num5, transitionDelay + num6 };
            delaySec = Mathf.Max(values);
        }
        this.lastMousedOver = slotMousedOver;
        if (num > 0)
        {
            base.StartFinishLayoutTimer(delaySec);
        }
        else
        {
            base.UpdateLayoutFinished();
        }
    }
    public static GameObject GetLocationObject(Spell spell)
    {
        SpellLocation location = spell.GetLocation();

        if (location == SpellLocation.NONE)
        {
            return(null);
        }
        GameObject parentObject = null;

        switch (location)
        {
        case SpellLocation.SOURCE:
            parentObject = spell.GetSource();
            break;

        case SpellLocation.SOURCE_AUTO:
            parentObject = FindAutoObjectForSpell(spell.GetSource());
            break;

        case SpellLocation.SOURCE_HERO:
        {
            Card card2 = FindHeroCard(spell.GetSourceCard());
            if (card2 == null)
            {
                return(null);
            }
            parentObject = card2.gameObject;
            break;
        }

        case SpellLocation.SOURCE_HERO_POWER:
        {
            Card card4 = FindHeroPowerCard(spell.GetSourceCard());
            if (card4 == null)
            {
                return(null);
            }
            parentObject = card4.gameObject;
            break;
        }

        case SpellLocation.SOURCE_PLAY_ZONE:
        {
            Card sourceCard = spell.GetSourceCard();
            if (sourceCard == null)
            {
                return(null);
            }
            Player   controller = sourceCard.GetEntity().GetController();
            ZonePlay play       = ZoneMgr.Get().FindZoneOfType <ZonePlay>(controller.GetSide());
            if (play == null)
            {
                return(null);
            }
            parentObject = play.gameObject;
            break;
        }

        case SpellLocation.TARGET:
            parentObject = spell.GetVisualTarget();
            break;

        case SpellLocation.TARGET_AUTO:
            parentObject = FindAutoObjectForSpell(spell.GetVisualTarget());
            break;

        case SpellLocation.TARGET_HERO:
        {
            Card card7 = FindHeroCard(spell.GetVisualTargetCard());
            if (card7 == null)
            {
                return(null);
            }
            parentObject = card7.gameObject;
            break;
        }

        case SpellLocation.TARGET_HERO_POWER:
        {
            Card card9 = FindHeroPowerCard(spell.GetVisualTargetCard());
            if (card9 == null)
            {
                return(null);
            }
            parentObject = card9.gameObject;
            break;
        }

        case SpellLocation.TARGET_PLAY_ZONE:
        {
            Card visualTargetCard = spell.GetVisualTargetCard();
            if (visualTargetCard == null)
            {
                return(null);
            }
            Player   player2 = visualTargetCard.GetEntity().GetController();
            ZonePlay play2   = ZoneMgr.Get().FindZoneOfType <ZonePlay>(player2.GetSide());
            if (play2 == null)
            {
                return(null);
            }
            parentObject = play2.gameObject;
            break;
        }

        case SpellLocation.BOARD:
            if (Board.Get() == null)
            {
                return(null);
            }
            parentObject = Board.Get().gameObject;
            break;

        case SpellLocation.FRIENDLY_HERO:
        {
            Player player3 = FindFriendlyPlayer(spell);
            if (player3 == null)
            {
                return(null);
            }
            Card heroCard = player3.GetHeroCard();
            if (heroCard == null)
            {
                return(null);
            }
            parentObject = heroCard.gameObject;
            break;
        }

        case SpellLocation.FRIENDLY_HERO_POWER:
        {
            Player player4 = FindFriendlyPlayer(spell);
            if (player4 == null)
            {
                return(null);
            }
            Card heroPowerCard = player4.GetHeroPowerCard();
            if (heroPowerCard == null)
            {
                return(null);
            }
            parentObject = heroPowerCard.gameObject;
            break;
        }

        case SpellLocation.FRIENDLY_PLAY_ZONE:
        {
            ZonePlay play3 = FindFriendlyPlayZone(spell);
            if (play3 == null)
            {
                return(null);
            }
            parentObject = play3.gameObject;
            break;
        }

        case SpellLocation.OPPONENT_HERO:
        {
            Player player5 = FindOpponentPlayer(spell);
            if (player5 == null)
            {
                return(null);
            }
            Card card13 = player5.GetHeroCard();
            if (card13 == null)
            {
                return(null);
            }
            parentObject = card13.gameObject;
            break;
        }

        case SpellLocation.OPPONENT_HERO_POWER:
        {
            Player player6 = FindOpponentPlayer(spell);
            if (player6 == null)
            {
                return(null);
            }
            Card card14 = player6.GetHeroPowerCard();
            if (card14 == null)
            {
                return(null);
            }
            parentObject = card14.gameObject;
            break;
        }

        case SpellLocation.OPPONENT_PLAY_ZONE:
        {
            ZonePlay play4 = FindOpponentPlayZone(spell);
            if (play4 == null)
            {
                return(null);
            }
            parentObject = play4.gameObject;
            break;
        }

        case SpellLocation.CHOSEN_TARGET:
        {
            Card powerTargetCard = spell.GetPowerTargetCard();
            if (powerTargetCard == null)
            {
                return(null);
            }
            parentObject = powerTargetCard.gameObject;
            break;
        }
        }
        if (parentObject == null)
        {
            return(null);
        }
        string locationTransformName = spell.GetLocationTransformName();

        if (!string.IsNullOrEmpty(locationTransformName))
        {
            GameObject obj3 = SceneUtils.FindChildBySubstring(parentObject, locationTransformName);
            if (obj3 != null)
            {
                return(obj3);
            }
        }
        return(parentObject);
    }
Esempio n. 28
0
    private void UpdateCardOver()
    {
        Card card  = this.enemyActualUI.over.card;
        Card card2 = this.enemyWantedUI.over.card;

        if (card != card2)
        {
            this.enemyActualUI.over.card = card2;
            if (card != null)
            {
                card.NotifyOpponentMousedOffThisCard();
            }
            if (card2 != null)
            {
                card2.NotifyOpponentMousedOverThisCard();
            }
            ZoneMgr.Get().FindZoneOfType <ZoneHand>(Player.Side.OPPOSING).UpdateLayout(this.GetOpponentHandHoverSlot());
        }
        if (GameMgr.Get().IsSpectator())
        {
            Card card3 = this.friendlyActualUI.over.card;
            Card card4 = this.friendlyWantedUI.over.card;
            if (card3 != card4)
            {
                this.friendlyActualUI.over.card = card4;
                if (card3 != null)
                {
                    ZoneHand zone = card3.GetZone() as ZoneHand;
                    if (zone != null)
                    {
                        if (zone.CurrentStandIn == null)
                        {
                            zone.UpdateLayout(-1);
                        }
                    }
                    else
                    {
                        card3.NotifyMousedOut();
                    }
                }
                if (card4 != null)
                {
                    ZoneHand hand2 = card4.GetZone() as ZoneHand;
                    if (hand2 != null)
                    {
                        if (hand2.CurrentStandIn == null)
                        {
                            int num = hand2.FindCardPos(card4);
                            if (num >= 1)
                            {
                                hand2.UpdateLayout(num - 1);
                            }
                        }
                    }
                    else
                    {
                        card4.NotifyMousedOver();
                    }
                }
            }
        }
    }
Esempio n. 29
0
        public static LootContainer GetScenarioLoot(Player player, int scenTier, ZoneMgr zone)
        {
            List <LootInfo> lootList = new List <LootInfo>();

            int corpseLevel  = scenTier * 10;
            int corpseRenown = scenTier * 10;

            // Scenario zones all have a war_world.zone_infos.type value of 1.
            // Note - if "1" refers to "instance" instead of "scenario", there could be problems
            // with players receiving scenario-restricted loot for a PVP kill made in an instance
            List <Loot_Group> lootGroups = CreatureService.GetLootGroupsByEvent(1);

            // This will be our narrowed down list of loot groups that are relevant to the kill in question.
            List <Loot_Group> candidateLootGroups = new List <Loot_Group>();

            // Whittle down the loot groups into a new candidate list, based on the killed player's career,
            // and whether the kill occurred in the correct zone (if any) and whether the player has the required quest (if any)
            foreach (Loot_Group lg in lootGroups)
            {
                if (lg == null)
                {
                    continue;
                }

                if (lg.ReqActiveQuest > 0)
                {
                    Character_quest quest = player.QtsInterface.GetQuest(lg.ReqActiveQuest);
                    if (quest == null || quest.IsDone())
                    {
                        continue;
                    }
                }

                if (lg.SpecificZone != 0 && zone.Info.ZoneId != lg.SpecificZone)
                {
                    continue;
                }

                candidateLootGroups.Add(lg);
            }

            // Generate items from remaining loot groups
            foreach (Loot_Group lg in candidateLootGroups)
            {
                if (lg == null)
                {
                    continue;
                }
                // roll for drops.
                for (int groupIndex = 0; groupIndex < lg.DropCount; groupIndex++)
                {
                    float roll = (float)StaticRandom.Instance.Next(0, 10000) / 10000;

                    if (roll <= lg.DropChance)
                    {
                        // Assemble valid drops from the group
                        List <Loot_Group_Item> candidateItems = new List <Loot_Group_Item>();

                        foreach (Loot_Group_Item lgi in lg.LootGroupItems)
                        {
                            if (lgi == null)
                            {
                                continue;
                            }

                            if (corpseLevel < lgi.MinRank || corpseLevel > lgi.MaxRank)
                            {
                                continue;
                            }

                            if (corpseRenown < lgi.MinRenown || corpseRenown > lgi.MaxRenown)
                            {
                                continue;
                            }

                            Item_Info itemDef = ItemService.GetItem_Info(lgi.ItemID);

                            if (itemDef.Realm != 0 && itemDef.Realm != (byte)player.Realm)
                            {
                                continue;
                            }

                            candidateItems.Add(lgi);
                        }

                        // If the loot group requires that the dropped loot be usable by a member of
                        // the killer's party, then remove non-compatible loot from the candidate list.
                        if (lg.ReqGroupUsable)
                        {
                            List <Player> members;

                            if (player.PriorityGroup != null)
                            {
                                members = player.PriorityGroup.GetPlayerListCopy();
                            }
                            else
                            {
                                members = new List <Player> {
                                    player
                                };
                            }
                            for (int itemIndex = 0; itemIndex < candidateItems.Count; ++itemIndex)
                            {
                                bool valid = false;

                                Item_Info curItem = ItemService.GetItem_Info(candidateItems[itemIndex].ItemID);

                                foreach (Player member in members)
                                {
                                    if (!ItemsInterface.CanUse(curItem, member, true, false))
                                    {
                                        continue;
                                    }

                                    // Usable by at least one member
                                    valid = true;
                                    break;
                                }

                                if (!valid)
                                {
                                    candidateItems.RemoveAt(itemIndex);
                                    --itemIndex;
                                }
                            }
                        }

                        // Now roll for an item from the candidate item list, and add it to the loots.
                        if (candidateItems.Count > 0)
                        {
                            Item_Info winningItem = ItemService.GetItem_Info(candidateItems[StaticRandom.Instance.Next(0, candidateItems.Count)].ItemID);
                            lootList.Add(new LootInfo(winningItem));
                        }
                    }
                }
            }

            return(lootList.Count <= 0 ? null : new LootContainer {
                LootInfo = lootList
            });
        }
Esempio n. 30
0
        public bool DoDropMinion(Card c)
        {
            Log.log("Dropping minion " + c.GetEntity().GetName());
            try
            {
                var destZone = myPlayer.GetBattlefieldZone();
                int slot     = destZone.GetCards().Count + 1;
                gs.GetGameEntity().NotifyOfCardDropped(c.GetEntity());
                gs.SetSelectedOptionPosition(slot);
                if (InputManager.Get().DoNetworkResponse(c.GetEntity()))
                {
                    int zonePos = c.GetEntity().GetZonePosition();
                    ZoneMgr.Get().AddLocalZoneChange(c, destZone, slot);

                    myPlayer.GetHandZone().UpdateLayout(-1, true);
                    myPlayer.GetBattlefieldZone().SortWithSpotForHeldCard(-1);

                    if (gs.GetResponseMode() != GameState.ResponseMode.SUB_OPTION)
                    {
                        EnemyActionHandler.Get().NotifyOpponentOfCardDropped();
                    }
                    Log.log("Dropping minion succeeded");
                    return(true);

                    // TARGETTING - perhaps spin this off to a separate step

                    /*
                     * if (gs.EntityHasTargets(c.GetEntity()))
                     * {
                     *  // do targetting
                     *  EnemyActionHandler.Get().NotifyOpponentOfTargetModeBegin(c);
                     *  Thread.Sleep(500);
                     *  gs.GetGameEntity().NotifyOfBattlefieldCardClicked(target.GetEntity(), true);
                     *  if (InputManager.Get().DoNetworkResponse(target.GetEntity()))
                     *  {
                     *      EnemyActionHandler.Get().NotifyOpponentOfTargetEnd();
                     *      return true;
                     *  }
                     *  return false;
                     * }
                     * else if (gs.GetResponseMode() != GameState.ResponseMode.SUB_OPTION)
                     * {
                     *  EnemyActionHandler.Get().NotifyOpponentOfCardDropped();
                     *  return true;
                     * }
                     * else
                     * {
                     *  // TODO: unsure when this happens
                     *  return true;
                     * }
                     */
                }
                Log.log("Dropping minion failed (network response)");
                return(false);
            }
            catch (Exception ex)
            {
                Log.log("Dropping minion failed (exception): " + ex.StackTrace.ToString());
                return(false);
            }
            finally
            {
                Thread.Sleep(1000 * 2);
            }
        }