Beispiel #1
0
    public bool CanBuy(Unit.TypeEnum type, Unit.OwnerEnum owner)
    {
        if (hasBuy)
        {
            return(false);
        }
        if (!Unit.IsSoldier(type))
        {
            return(false);
        }
        if (playerInfo[(int)owner][(int)Unit.TypeEnum.Bread] < StorageInfo.CardCost[UIStorage.TypeToIndex(type)])
        {
            return(false);
        }
        if (GetInfo(BoardInfo.Base[(int)owner]).owner != Unit.OwnerEnum.None)
        {
            return(false);
        }
        if (type == Unit.TypeEnum.Bomb && GameInfo.Instance.board.GetPlayerInfo(Unit.TypeEnum.Bomb, turn) >= 2)
        {
            return(false);
        }
        if (type == Unit.TypeEnum.Boss && GetPlayerInfo(Unit.TypeEnum.Boss, turn) != 0)
        {
            return(false);
        }
        if (GetPlayerTotalCount(turn) - GetPlayerInfo(Unit.TypeEnum.Bread, turn) >= 5)
        {
            return(false);
        }

        return(true);
    }
Beispiel #2
0
    public bool Buy(Unit.TypeEnum type, Unit.OwnerEnum owner)
    {
        if (!CanBuy(type, owner))
        {
            return(false);
        }

        Put(BoardInfo.Base[(int)owner], new UnitInfo(type, owner));
        playerInfo[(int)owner][(int)Unit.TypeEnum.Bread] -= StorageInfo.CardCost[UIStorage.TypeToIndex(type)];
        hasBuy = true;

        return(true);
    }