Esempio n. 1
0
    void OnMouseUp()
    {
        //Method
        // -give position back to the unit so it will know where to do the attack when it's ready.
        // -tell enemymap to stop allowing hover.

        if (pm.allowHover)
        {
            OnMouseExit();
            if (pm.mustUseOrigin && isOrigin)
            {
                isOrigin = false;

                pm.disallow_hover();
                pm.get_battle().log_attack(x, y);
            }
            else if (!pm.mustUseOrigin)
            {
                //pm.highlight_helper_off(x, y);

                switch (pm.type)
                {
                case 0:
                    pm.disallow_hover();

                    int tryX = x;
                    int tryY = y;
                    if (x + pm.targetArea[1] > 4)
                    {
                        tryX = 4 - pm.targetArea[1];
                    }
                    if (y + pm.targetArea[0] > 5)
                    {
                        tryY = 5 - pm.targetArea[0];
                    }

                    pm.get_battle().log_attack(tryX, tryY);
                    break;

                case 2:
                    if (x <= 2 && y <= 3 && x >= 1 && y >= 1)
                    {
                        pm.disallow_hover();
                        pm.get_battle().log_attack(x, y);
                    }
                    break;
                }
            }
        }
        else if (repositionPlace)
        {
            pm.get_battle().reposition_unit(x, y);
        }
    }