Пример #1
0
    internal void PlayCardFail(GameObject co)
    {
        CardObjectBehaviour cob = co.GetComponent <CardObjectBehaviour>();

        co.transform.DOMove(cob.OriginPos, GameConfig.F("BATTLE_CARD_DEATH_FLY_TIME"));
        co.transform.DOScale(1.0f, GameConfig.F("BATTLE_CARD_DEATH_FLY_TIME"));
    }
Пример #2
0
    internal static void PlayCardCallback(object[] data)
    {
        string who = (string)data[0];
        PlayerObjectBehaviour forPlayer = LocalPlayer;

        if (who.Equals(EnemyPlayer.PlayerName))
        {
            forPlayer = EnemyPlayer;
        }
        int guid = (int)data[1];
        int mana = (int)data[2];
        CardObjectBehaviour cob = CardObjectBehaviour.GetCOB(guid);

        forPlayer.Hob.RemoveCard(cob.gameObject);
        forPlayer.UpdateMana(mana);
        cob.gameObject.GetComponent <DragHandCard>().CanDrag = false;

        cob.AddDoTweens(() =>
        {
            // Move card to neutral position and play effects
            Vector3 spellEffectPos = NeutralBattlePoint.transform.position;
            cob.AddEffectParticle();
            cob.SetTweening(true);
            Sequence s = DOTween.Sequence();
            s.Insert(0f, cob.gameObject.transform.DOMove(new Vector3(spellEffectPos.x, spellEffectPos.y, -3f), GameConfig.F("SPELL_CARD_FLY_TIME")));
            s.Insert(0f, cob.gameObject.transform.DOScale(GameConfig.F("SPELL_CARD_SCALE"), GameConfig.F("SPELL_CARD_FLY_TIME")));
            s.AppendInterval(GameConfig.F("SPELL_CARD_FLY_TIME") + GameConfig.F("SPELL_CARD_DISPLAY_TIME"));
            s.OnComplete(() =>
            {
                cob.SetTweening(false);
            });
        });
    }
Пример #3
0
    internal static void RemoveBuffCallback(object[] data)
    {
        CardObjectBehaviour cob = CardObjectBehaviour.GetCOB((int)data[0]);
        BuffBehaviour       bob = BuffBehaviour.GetBOB((int)data[1]);

        cob.RemoveBuff(bob.gameObject);
    }
Пример #4
0
    internal void RerenderCards()
    {
        if (cardObjs.Count > 0)
        {
            RectTransform cardTransform = cardObjs.ElementAt(0).transform.GetChild(0).GetComponent <RectTransform>();
            float         cardWidth     = cardTransform.rect.width * 0.003f; // HARD CODE
            RectTransform slotTransform = gameObject.transform.Find("frame").GetComponent <RectTransform>();
            float         handWidth     = slotTransform.rect.width * slotTransform.lossyScale.x * 0.9f;
            float         margin        = 0f;
            Vector3       basePos       = gameObject.transform.position;
            if (cardObjs.Count > 1)
            {
                margin  = (handWidth - cardWidth) / (cardObjs.Count - 1);
                basePos = new Vector3(gameObject.transform.position.x - handWidth / 2.0f + cardWidth / 2.0f, gameObject.transform.position.y, gameObject.transform.position.z);
            }

            for (int i = 0; i < cardObjs.Count; i++)
            {
                CardObjectBehaviour cob = cardObjs.ElementAt(i).GetComponent <CardObjectBehaviour>();
                cob.OriginPos = new Vector3(basePos.x + i * margin, basePos.y, (i + 1) * -0.01f - 1f);

                cob.AddDoTweens(() =>
                {
                    cob.SetTweening(true);
                    Sequence s = DOTween.Sequence();
                    s.Insert(0f, cob.gameObject.transform.DOMove(cob.OriginPos, GameConfig.F("CARD_SLOT_RENDER_MOVE_TIME")));
                    s.Insert(0f, cob.gameObject.transform.DOScale(1.0f, GameConfig.F("CARD_SLOT_RENDER_MOVE_TIME")));
                    s.OnComplete(() =>
                    {
                        cob.SetTweening(false);
                    });
                });
            }
        }
    }
Пример #5
0
    internal static void AddBuffCallback(object[] data)
    {
        int    cardGuid = (int)data[0];
        int    buffGuid = (int)data[1];
        string iconPath = (string)data[2];

        BuffBehaviour.Create(CardObjectBehaviour.GetCOB(cardGuid), buffGuid, iconPath);
    }
Пример #6
0
    internal static void PlayCardSlotCallback(object[] data)
    {
        PlayerObjectBehaviour p   = ForPlayer((string)data[0]);
        CardObjectBehaviour   cob = CardObjectBehaviour.GetCOB((int)data[1]);
        int slot  = (int)data[2];
        int power = (int)data[3];

        p.CSob[slot].AddCard(cob.gameObject);
        p.UpdateCardSlotPower(slot, power);
    }
Пример #7
0
 private static void AddCard(CardObjectBehaviour cob)
 {
     try
     {
         AllCards.Add(cob.guid, cob);
     }
     catch (ArgumentException e)
     {
         throw new Exception(" --- Catched --- : " + e.Message);
     }
 }
Пример #8
0
    internal static void PlayCardFailCallback(object[] data)
    {
        string who  = (string)data[0];
        int    guid = (int)data[1];
        PlayerObjectBehaviour forPlayer = LocalPlayer;

        if (who.Equals(EnemyPlayer.PlayerName))
        {
            forPlayer = EnemyPlayer;
        }
        forPlayer.Hob.PlayCardFail(CardObjectBehaviour.GetCOB(guid).gameObject);
    }
Пример #9
0
    public static GameObject Create(CardObjectBehaviour cob, int guid, string path)
    {
        GameObject    bo = Instantiate(Resources.Load("prefabs/Buff")) as GameObject;
        BuffBehaviour bb = bo.GetComponent <BuffBehaviour>();

        bb.Image.sprite = Resources.Load <Sprite>("sprites/buffs/" + path);
        bb.Guid         = guid;
        bo.transform.SetParent(cob.gameObject.transform);
        cob.AddBuff(bo);
        AddBuff(bb);
        return(bo);
    }
Пример #10
0
 public DrawCardView(PlayerObjectBehaviour pob, List <Card> cards, int deckN)
 {
     for (int i = 0; i < cards.Count; i++)
     {
         GameObject co = CardObjectBehaviour.Create(cards.ElementAt(i), pob);
         pob.Hob.AddCard(co);
         if (!BoardBehaviour.LocalPlayerName.Equals(pob.PlayerName))
         {
             co.GetComponent <DragHandCard>().CanDrag = false;
         }
     }
     pob.Dob.UpdateDeckNumber(deckN);
 }
Пример #11
0
    public static CardObjectBehaviour GetCOB(int id)
    {
        CardObjectBehaviour ret = null;

        if (AllCards.TryGetValue(id, out ret))
        {
            return(ret);
        }
        else
        {
            Debug.LogError(Environment.StackTrace);
            throw new Exception("No such card in the game, id: " + id);
        }
    }
Пример #12
0
 internal void MoveToGrave(Sequence s,float timePos,GameObject co)
 {
     if (cardObjs.Remove(co))
     {
         CardObjectBehaviour cob = co.GetComponent <CardObjectBehaviour>();
         cob.OriginPos = Pob.Grave.transform.position;
         cob.State     = CardState.GRAVE;
         s.Insert(timePos,co.transform.DOMove(cob.OriginPos,GameConfig.F("BATTLE_CARD_DEATH_FLY_TIME")));
         s.Insert(timePos,co.transform.DOScale(1.0f,GameConfig.F("BATTLE_CARD_SCALE_TIME")));
     }
     else
     {
         Debug.LogError(Environment.StackTrace);
         throw new Exception("Removing invalid card object from card slot");
     }
 }
Пример #13
0
    internal static void SelectTargetCallback(object[] data)
    {
        // Requesting a card selection
        PlayerObjectBehaviour p = ForPlayer((string)data[0]);

        if (SelectTargetObject != null)
        {
            Destroy(SelectTargetObject);
            SelectTargetObject = null;
        }
        SelectTargetObject = Instantiate(Resources.Load("prefabs/Target")) as GameObject;
        SelectTargetCard    sel = SelectTargetObject.GetComponent <SelectTargetCard>();
        CardObjectBehaviour cob = CardObjectBehaviour.GetCOB((int)data[1]);

        sel.From = cob.gameObject;
        SetUIState(UIState.TARGETING);
    }
Пример #14
0
    public override void OnDraggingInUpdate()
    {
        DisableAllGlow();
        RaycastHit[] hits = Physics.RaycastAll(origin: new Vector3(transform.position.x, transform.position.y, -10), direction: new Vector3(0, 0, 1), maxDistance: 30f);
        // find card object behaviour
        CardObjectBehaviour cob = gameObject.GetComponent <CardObjectBehaviour>();

        foreach (RaycastHit h in hits)
        {
            // Find slot owner
            CardSlotBehaviour csob = h.transform.gameObject.GetComponent <CardSlotBehaviour>();

            if (h.transform.tag == "CardSlot" && csob.Pob.PlayerName.Equals(cob.Owner.PlayerName))
            {
                csob.SetGlow(true);
            }
        }
    }
Пример #15
0
    internal static void DiscardCardCallback(object[] data)
    {
        PlayerObjectBehaviour p   = ForPlayer((string)data[0]);
        CardObjectBehaviour   cob = CardObjectBehaviour.GetCOB((int)data[1]);

        cob.AddDoTweens(() =>
        {
            cob.OriginPos = p.Grave.transform.position;
            cob.SetTweening(true);
            Sequence s = DOTween.Sequence();
            s.Insert(0f, cob.gameObject.transform.DOMove(cob.OriginPos, GameConfig.F("BATTLE_CARD_DEATH_FLY_TIME")));
            s.Insert(0f, cob.gameObject.transform.DOScale(1.0f, GameConfig.F("BATTLE_CARD_DEATH_FLY_TIME")));
            cob.State = CardState.GRAVE;
            s.OnComplete(() =>
            {
                cob.SetTweening(false);
            });
        });
    }
Пример #16
0
    private void RerenderCards()
    {
        if (cardObjs.Count > 0)
        {
            RectTransform cardTransform = cardObjs.ElementAt(0).transform.GetChild(0).GetComponent <RectTransform>();
            float         cardWidth     = cardTransform.rect.width * cardTransform.lossyScale.x;
            float         handWidth     = cardWidth * cardObjs.Count;

            Vector3 basePos = new Vector3(gameObject.transform.position.x - handWidth / 2.0f + cardWidth / 2.0f, gameObject.transform.position.y, gameObject.transform.position.z);
            for (int i = 0; i < cardObjs.Count; i++)
            {
                Vector3 pos = new Vector3(basePos.x + i * cardWidth * 1.03f, basePos.y, basePos.z);
                cardObjs.ElementAt(i).transform.position = pos;
                CardObjectBehaviour cob = cardObjs.ElementAt(i).GetComponent <CardObjectBehaviour>();
                cob.OriginPos = pos;

                cardObjs.ElementAt(i).SetActive(true);
            }
        }
    }
Пример #17
0
    public static GameObject Create(Card cardData, PlayerObjectBehaviour player)
    {
        GameObject          co  = Instantiate(Resources.Load("prefabs/CardObject")) as GameObject;
        CardObjectBehaviour cob = co.GetComponent <CardObjectBehaviour>();

        // card visual
        cob.CardImage.sprite     = Resources.Load <Sprite>("sprites/card_images/" + cardData.id);
        cob.CardName.text        = cardData.name;
        cob.CardClass.sprite     = Resources.Load <Sprite>("sprites/card_ui/frame_" + cardData.color);
        cob.CardType.sprite      = Resources.Load <Sprite>("sprites/card_ui/type_" + cardData.ctype);
        cob.CardPower.text       = cardData.power.ToString();
        cob.CardDescription.text = cardData.desc.Replace("|n", "\n");
        cob.CardCostNumber.text  = cardData.cost.ToString();
        cob.CardCostImage.sprite = Resources.Load <Sprite>("sprites/card_ui/mana_" + cardData.color);
        Sprite powerFrame = Resources.Load <Sprite>("sprites/card_ui/power_" + cardData.color);

        cob.CardTypeFrame.sprite  = powerFrame;
        cob.CardPowerFrame.sprite = powerFrame;

        // layout
        cob.Order       = zOffset;
        cob.isExpanding = false;
        cob.State       = CardState.DEFAULT;

        if (!cardData.ctype.Equals(CardTypes.CREATURE))
        {
            cob.CardPowerFrame.enabled = false;
            cob.CardPower.enabled      = false;
        }

        cob.Owner = player;
        cob.buffs = new List <GameObject>();
        zOffset  += -0.01f;
        cob.guid  = cardData.guid;

        AddCard(cob);

        return(co);
    }
Пример #18
0
    public override void OnEndDrag()
    {
        DisableAllGlow();

        // find cardslot when end drag
        GameObject endSlot = null;

        RaycastHit[] hits = Physics.RaycastAll(origin: new Vector3(transform.position.x, transform.position.y, -10), direction: new Vector3(0, 0, 1), maxDistance: 30f);
        foreach (RaycastHit h in hits)
        {
            if (h.transform.tag == "CardSlot")
            {
                endSlot = h.transform.gameObject;
            }
        }
        CardObjectBehaviour cob = gameObject.GetComponent <CardObjectBehaviour>();

        if (endSlot != null && BoardBehaviour.IsCurrentPlayerAction())
        {
            //Dragged into a cardslot
            CardSlotBehaviour csb = endSlot.GetComponent <CardSlotBehaviour>();
            NetworkController.Instance.PlayerPlayCardToSlot(cob.Owner.PlayerName, cob.Guid, csb.SlotId);

            // Move card to neutral position and play effects
            Vector3 spellEffectPos = BoardBehaviour.NeutralBattlePoint.transform.position;
            gameObject.transform.DOMove(new Vector3(spellEffectPos.x, spellEffectPos.y, -3f), GameConfig.F("SPELL_CARD_FLY_TIME"));
            gameObject.transform.DOScale(GameConfig.F("SPELL_CARD_SCALE"), GameConfig.F("SPELL_CARD_FLY_TIME"));
            //  - Add effect to the card
            cob.AddEffectParticle();
        }
        else
        {
            // Dragged into somewhere else
            transform.DOMove(cob.OriginPos, 0.5f).SetEase(Ease.OutCubic);
        }
    }
Пример #19
0
    internal static void UpdateCardPowerCallback(object[] data)
    {
        CardObjectBehaviour cob = CardObjectBehaviour.GetCOB((int)data[0]);

        cob.UpdatePower((int)data[1]);
    }
Пример #20
0
    internal static void BattleResult(object[] data)
    {
        string aname = (string)data[0];
        string dname = (string)data[1];
        List <BattleCardModifier> amods = (List <BattleCardModifier>)data[2];
        List <BattleCardModifier> dmods = (List <BattleCardModifier>)data[3];
        int         aoap     = (int)data[4];
        int         doap     = (int)data[5];
        List <Card> akilled  = (List <Card>)data[6];
        List <Card> atouched = (List <Card>)data[7];
        List <Card> dkilled  = (List <Card>)data[8];
        List <Card> dtouched = (List <Card>)data[9];
        int         ahit     = (int)data[10];
        int         dhit     = (int)data[11];
        List <Card> abattle  = (List <Card>)data[12];
        List <Card> bbattle  = (List <Card>)data[13];
        int         aaap     = (int)data[14];
        int         daap     = (int)data[15];
        int         acs      = (int)data[16];
        int         dcs      = (int)data[17];
        int         ahp      = (int)data[18];
        int         dhp      = (int)data[19];

        Sequence s           = DOTween.Sequence();
        float    endTimeNode = 0f;

        // We are battling
        SetUIState(UIState.BATTLING);
        // Move 2 set of cards to battle position
        int     indexCountA    = 0;
        int     indexCountB    = 0;
        Vector3 attackerAnchor = AttackerBattlePoint.transform.position;

        attackerAnchor.z = GameConfig.F("BATTLE_Z_INDEX");
        Vector3 defenderAnchor = DefenderBattlePoint.transform.position;

        defenderAnchor.z = GameConfig.F("BATTLE_Z_INDEX");
        for (int i = 0; i < abattle.Count; i++)
        {
            CardObjectBehaviour item = CardObjectBehaviour.GetCOB(abattle.ElementAt(i).guid);
            float time = GameConfig.F("BATTLE_CARD_INTERVAL") * i;
            item.TempPos = attackerAnchor;
            s.Insert(time, item.transform.DOMove(attackerAnchor, GameConfig.F("BATTLE_CARD_FLY_TIME")).SetEase(Ease.OutCubic));
            s.Insert(time, item.transform.DOScale(GameConfig.F("BATTLE_CARD_SCALE"), GameConfig.F("BATTLE_CARD_SCALE_TIME")));
            attackerAnchor.x += GameConfig.F("BATTLE_CARD_SPACING");
            attackerAnchor.z -= 0.01f;
            indexCountA++;
        }
        for (int i = 0; i < bbattle.Count; i++)
        {
            CardObjectBehaviour item = CardObjectBehaviour.GetCOB(bbattle.ElementAt(i).guid);
            float time = GameConfig.F("BATTLE_CARD_INTERVAL") * i;
            item.TempPos = defenderAnchor;
            s.Insert(time, item.transform.DOMove(defenderAnchor, GameConfig.F("BATTLE_CARD_FLY_TIME")).SetEase(Ease.OutCubic));
            s.Insert(time, item.transform.DOScale(GameConfig.F("BATTLE_CARD_SCALE"), GameConfig.F("BATTLE_CARD_SCALE_TIME")));
            defenderAnchor.x -= GameConfig.F("BATTLE_CARD_SPACING");
            defenderAnchor.z -= 0.01f;
            indexCountB++;
        }
        endTimeNode = Math.Max(abattle.Count, bbattle.Count) * GameConfig.F("BATTLE_CARD_INTERVAL");

        // Cards do effects
        for (int i = 0; i < amods.Count; i++)
        {
            BattleCardModifier  bcm  = amods.ElementAt(i);
            CardObjectBehaviour item = CardObjectBehaviour.GetCOB(bcm.guid);
            float time = endTimeNode + (GameConfig.F("BATTLE_CARD_INTERVAL") +
                                        GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME") * 2.0f +
                                        GameConfig.F("BATTLE_CARD_EFFECT_HIGHLIGHT_PAUSE") * 2.0f +
                                        GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME") +
                                        GameConfig.F("BATTLE_CARD_EFFECT_LABEL_PAUSE")) * i;
            // pop out active card
            s.Insert(time, item.transform.DOMove(new Vector3(item.TempPos.x, item.TempPos.y, item.TempPos.z - 1f), GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME")));
            s.Insert(time, item.transform.DOScale(GameConfig.F("BATTLE_CARD_EFFECT_SCALE"), GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME")));
            s.InsertCallback(time, () =>
            {
                item.AddEffectParticle();
            });
            // show effect values
            GameObject buffLabel   = AttackerBattlePoint.transform.Find("Buff").gameObject;
            GameObject debuffLabel = AttackerBattlePoint.transform.Find("Debuff").gameObject;
            GameObject activeLabel = null;
            if (bcm.mod > 0)
            {
                buffLabel.SetActive(false);
                debuffLabel.SetActive(false);
                buffLabel.GetComponent <BuffLabelBehaviour>().Text.text = "+" + bcm.mod.ToString();
                activeLabel = buffLabel;
            }
            else
            {
                buffLabel.SetActive(false);
                debuffLabel.SetActive(false);
                debuffLabel.GetComponent <BuffLabelBehaviour>().Text.text = bcm.mod.ToString();
                activeLabel = debuffLabel;
            }
            s.InsertCallback(time +
                             GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME") +
                             GameConfig.F("BATTLE_CARD_EFFECT_HIGHLIGHT_PAUSE"), () =>
            {
                activeLabel.SetActive(true);
                activeLabel.transform.DOScale(GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE"), GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME"));
            });
            s.InsertCallback(time +
                             GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME") +
                             GameConfig.F("BATTLE_CARD_EFFECT_HIGHLIGHT_PAUSE") * 2.0f +
                             GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME") +
                             GameConfig.F("BATTLE_CARD_EFFECT_LABEL_PAUSE"), () =>
            {
                activeLabel.SetActive(false);
                activeLabel.transform.DOScale(1.0f, GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME"));
            });
            // restore showing card
            s.Insert(time +
                     GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME") +
                     GameConfig.F("BATTLE_CARD_EFFECT_HIGHLIGHT_PAUSE") * 2.0f +
                     GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME") +
                     GameConfig.F("BATTLE_CARD_EFFECT_LABEL_PAUSE"), item.transform.DOMove(item.TempPos, GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME")));
            s.Insert(time +
                     GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME") +
                     GameConfig.F("BATTLE_CARD_EFFECT_HIGHLIGHT_PAUSE") * 2.0f +
                     GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME") +
                     GameConfig.F("BATTLE_CARD_EFFECT_LABEL_PAUSE"), item.transform.DOScale(GameConfig.F("BATTLE_CARD_SCALE"), GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME")));
        }
        for (int i = 0; i < dmods.Count; i++)
        {
            BattleCardModifier  bcm  = dmods.ElementAt(i);
            CardObjectBehaviour item = CardObjectBehaviour.GetCOB(bcm.guid);
            float time = endTimeNode + (GameConfig.F("BATTLE_CARD_INTERVAL") +
                                        GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME") * 2.0f +
                                        GameConfig.F("BATTLE_CARD_EFFECT_HIGHLIGHT_PAUSE") * 2.0f +
                                        GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME") +
                                        GameConfig.F("BATTLE_CARD_EFFECT_LABEL_PAUSE")) * i;
            // pop out active card
            s.Insert(time, item.transform.DOMove(new Vector3(item.TempPos.x, item.TempPos.y, item.TempPos.z - 1f), GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME")));
            s.Insert(time, item.transform.DOScale(GameConfig.F("BATTLE_CARD_EFFECT_SCALE"), GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME")));
            // show effect values
            GameObject buffLabel   = DefenderBattlePoint.transform.Find("Buff").gameObject;
            GameObject debuffLabel = DefenderBattlePoint.transform.Find("Debuff").gameObject;
            GameObject activeLabel = null;
            if (bcm.mod > 0)
            {
                buffLabel.SetActive(false);
                debuffLabel.SetActive(false);
                buffLabel.GetComponent <BuffLabelBehaviour>().Text.text = "+" + bcm.mod.ToString();
                activeLabel = buffLabel;
            }
            else
            {
                buffLabel.SetActive(false);
                debuffLabel.SetActive(false);
                debuffLabel.GetComponent <BuffLabelBehaviour>().Text.text = bcm.mod.ToString();
                activeLabel = debuffLabel;
            }
            s.InsertCallback(time +
                             GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME") +
                             GameConfig.F("BATTLE_CARD_EFFECT_HIGHLIGHT_PAUSE"), () =>
            {
                activeLabel.SetActive(true);
                activeLabel.transform.DOScale(GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE"), GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME"));
            });
            s.InsertCallback(time +
                             GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME") +
                             GameConfig.F("BATTLE_CARD_EFFECT_HIGHLIGHT_PAUSE") * 2.0f +
                             GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME") +
                             GameConfig.F("BATTLE_CARD_EFFECT_LABEL_PAUSE"), () =>
            {
                activeLabel.SetActive(false);
                activeLabel.transform.DOScale(1.0f, GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME"));
            });
            // restore showing card
            s.Insert(time +
                     GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME") +
                     GameConfig.F("BATTLE_CARD_EFFECT_HIGHLIGHT_PAUSE") * 2.0f +
                     GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME") +
                     GameConfig.F("BATTLE_CARD_EFFECT_LABEL_PAUSE"), item.transform.DOMove(item.TempPos, GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME")));
            s.Insert(time +
                     GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME") +
                     GameConfig.F("BATTLE_CARD_EFFECT_HIGHLIGHT_PAUSE") * 2.0f +
                     GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME") +
                     GameConfig.F("BATTLE_CARD_EFFECT_LABEL_PAUSE"), item.transform.DOScale(GameConfig.F("BATTLE_CARD_SCALE"), GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME")));
        }
        endTimeNode += (GameConfig.F("BATTLE_CARD_INTERVAL") +
                        GameConfig.F("BATTLE_CARD_EFFECT_SCALE_TIME") * 2.0f +
                        GameConfig.F("BATTLE_CARD_EFFECT_HIGHLIGHT_PAUSE") * 2.0f +
                        GameConfig.F("BATTLE_CARD_EFFECT_LABEL_SCALE_TIME") +
                        GameConfig.F("BATTLE_CARD_EFFECT_LABEL_PAUSE")) * Math.Max(amods.Count, dmods.Count);

        // Do damage
        s.InsertCallback(endTimeNode, () =>
        {
            GameObject defSlashSFX         = Instantiate(Resources.Load("prefabs/SlashEffect")) as GameObject;
            defSlashSFX.transform.position = defenderAnchor;
            Destroy(defSlashSFX, GameConfig.F("BATTLE_SLASH_TIME"));
            GameObject atkSlashSFX         = Instantiate(Resources.Load("prefabs/SlashEffect")) as GameObject;
            atkSlashSFX.transform.position = attackerAnchor;
            Destroy(atkSlashSFX, GameConfig.F("BATTLE_SLASH_TIME"));
        });
        endTimeNode += GameConfig.F("BATTLE_SLASH_TIME");

        endTimeNode += GameConfig.F("BATTLE_AFTER_DAMAGE_INTV");

        // Clean up
        s.InsertCallback(endTimeNode, () =>
        {
            // Move deads to grave
            for (int i = 0; i < akilled.Count; i++)
            {
                CardObjectBehaviour cob = CardObjectBehaviour.GetCOB(akilled.ElementAt(i).guid);
                cob.Owner.CSob[acs].MoveToGrave(s, endTimeNode + GameConfig.F("BATTLE_CARD_INTERVAL") * i, cob.gameObject);
            }
            for (int i = 0; i < dkilled.Count; i++)
            {
                CardObjectBehaviour cob = CardObjectBehaviour.GetCOB(dkilled.ElementAt(i).guid);
                cob.Owner.CSob[dcs].MoveToGrave(s, endTimeNode + GameConfig.F("BATTLE_CARD_INTERVAL") * i, cob.gameObject);
            }
            // Update player health/slot power
            if (aname.Equals(LocalPlayer.PlayerName))
            {
                LocalPlayer.UpdateCardSlotPower(acs, aaap);
                EnemyPlayer.UpdateCardSlotPower(dcs, daap);
                LocalPlayer.UpdateHealth(ahp);
                EnemyPlayer.UpdateHealth(dhp);
            }
            else if (dname.Equals(LocalPlayer.PlayerName))
            {
                LocalPlayer.UpdateCardSlotPower(dcs, daap);
                EnemyPlayer.UpdateCardSlotPower(acs, aaap);
                LocalPlayer.UpdateHealth(dhp);
                EnemyPlayer.UpdateHealth(ahp);
            }
            for (int i = 0; i < atouched.Count; i++)
            {
                Card item = atouched.ElementAt(i);
                CardObjectBehaviour cob = CardObjectBehaviour.GetCOB(item.guid);
                cob.UpdatePower(item.power);
            }
            for (int i = 0; i < dtouched.Count; i++)
            {
                Card item = dtouched.ElementAt(i);
                CardObjectBehaviour cob = CardObjectBehaviour.GetCOB(item.guid);
                cob.UpdatePower(item.power);
            }
        });

        s.OnComplete(() =>
        {
            if (aname.Equals(LocalPlayer.PlayerName))
            {
                LocalPlayer.CSob[acs].RerenderCards();
                EnemyPlayer.CSob[dcs].RerenderCards();
            }
            else if (dname.Equals(LocalPlayer.PlayerName))
            {
                EnemyPlayer.CSob[acs].RerenderCards();
                LocalPlayer.CSob[dcs].RerenderCards();
            }
            SetUIState(UIState.ACTION);
        });
    }