/// Francium absorbs health from damage
    public override bool OnAttackedAbility(CellSlot mySlot, CellSlot targetSlot)
    {
        base.OnAttackedAbility(mySlot, targetSlot);

        bool bAttackThrough = true;

        CombatantCell targetCell = targetSlot.GetComponentInChildren <CombatantCell>();

        if (targetCell != null)
        {
            int targetCellDamage = targetCell.GetDamage();

            CombatantCell myCell = mySlot.GetCell();
            if (myCell != null)
            {
                if (!battleUI)
                {
                    battleUI = FindObjectOfType <BattleUI>();
                }
                battleUI.ToastInteraction(myCell.transform.position, targetCellDamage, 3, "hp +");

                myCell.ModifyHealth(targetCellDamage);

                bAttackThrough = false;
            }
        }

        return(bAttackThrough);
    }
Esempio n. 2
0
    /// Caesium returns attacks back to the opponent
    public override bool OnAttackedAbility(CellSlot mySlot, CellSlot targetSlot)
    {
        base.OnAttackedAbility(mySlot, targetSlot);

        bool bAttackThrough = true;

        CombatantCell targetCell = targetSlot.GetComponentInChildren <CombatantCell>();

        if (targetCell != null)
        {
            int targetCellDamage = targetCell.GetDamage();

            CombatantCell myCell = mySlot.GetCell();
            if (myCell != null)
            {
                if (!battleUI)
                {
                    battleUI = FindObjectOfType <BattleUI>();
                }
                battleUI.ToastInteraction(myCell.transform.position, targetCellDamage, 2, "reflect ");
                bAttackThrough = false;
                myCell.SetDamage(targetCellDamage);
                myCell.GetComponent <CellArsenal>().StartHitAfterDelay(mySlot.transform, targetSlot.transform, myCell.GetDamage());
                myCell.SetDamage(0);
            }
        }

        return(bAttackThrough);
    }
Esempio n. 3
0
    void ResolveCellPair(CellSlot cellSlotA, CellSlot cellSlotB)
    {
        cellSlotA.HighlightForDuration(0.5f);
        cellSlotB.HighlightForDuration(0.5f);

        CellData      cellA       = null;
        CombatantCell combatCellA = null;

        if (cellSlotA.GetCell() != null)
        {
            combatCellA = cellSlotA.GetCell();
            cellA       = combatCellA.GetCellData();
        }
        CellData      cellB       = null;
        CombatantCell combatCellB = null;

        if (cellSlotB.GetCell() != null)
        {
            combatCellB = cellSlotB.GetCell();
            cellB       = combatCellB.GetCellData();
        }

        if (cellA != null)
        {
            if (cellA.bAttackAbility)
            {
                cellA.AttackAbility(cellSlotA, cellSlotB);
            }

            int cellADamage = combatCellA.GetDamage();
            if (cellADamage > 0)
            {
                combatCellA.GetComponent <CellArsenal>().StartHitAfterDelay(cellSlotA.transform, cellSlotB.transform, cellADamage);
            }
        }

        if (cellB != null)
        {
            if (cellB.bAttackAbility)
            {
                cellB.AttackAbility(cellSlotB, cellSlotA);
            }

            int cellBDamage = combatCellB.GetDamage();
            if (cellBDamage > 0)
            {
                combatCellB.GetComponent <CellArsenal>().StartHitAfterDelay(cellSlotB.transform, cellSlotA.transform, cellBDamage);
            }
        }
    }