Exemplo n.º 1
0
    // First calculates how many buildings of the type specified within the PointBonus there is.
    public void CalculateAccumulativeBonuses()
    {
        int konkai_points = 0;

        foreach (PointBonus pb in pk.Accumulative_perm)
        {
            if (pb.Array)
            {
                konkai_points += pb.PointBonusAr[GetNoBuildings(PointBonus.MapActionToBuilding(pb.GetActionType())) - 1] * pb.pointBonus;
            }
            else
            {
                konkai_points += GetNoBuildings(PointBonus.MapActionToBuilding(pb.GetActionType())) * pb.pointBonus;
            }
        }
        foreach (PointBonus pb in pk.Accumulative_temp)
        {
            if (pb.Array)
            {
                konkai_points += pb.PointBonusAr[GetNoBuildings(PointBonus.MapActionToBuilding(pb.GetActionType())) - 1] * pb.pointBonus;
            }
            else
            {
                konkai_points += GetNoBuildings(PointBonus.MapActionToBuilding(pb.GetActionType())) * pb.pointBonus;
            }
        }
        publicPlayerAttributes.CmdSetPoints(publicPlayerAttributes.PlayerPoints += konkai_points);
    }
Exemplo n.º 2
0
    /**
     * Sends in point bonus vars, parses them and sends them down the pipeline
     */
    public void AddPointBonus(PointBonus pb_, bool temporary)
    {
        List <PointBonus> temp;

        if (PointBonus.CheckReactive(pb_.GetActionType()))
        {
            if (temporary)
            {
                temp = reactive_temp;
            }
            else
            {
                temp = reactive_perm;
            };
            AddBonus(pb_, temp);
        }
        else
        {
            if (temporary)
            {
                temp = accumulative_temp;
            }
            else
            {
                temp = accumulative_perm;
            };
            AddBonus(pb_, temp);
        }
    }
Exemplo n.º 3
0
    /**
     * If a bonus exists in the list then just increase the amount of points recieved. Otherwise create a new entry.
     */
    void AddBonus(PointBonus pb_, List <PointBonus> list)
    {
        PointBonus temp = ContainsBonus(list, pb_.GetActionType());

        if (temp != null)
        {
            temp.AddPointBonus(pb_.pointBonus);
        }
        else
        {
            list.Add(pb_);
        }
    }
Exemplo n.º 4
0
    public void Build(Building.Building_Type bt)
    {
        switch (bt)
        {
        case Building.Building_Type.Dwelling:
            publicPlayerAttributes.CmdSetGold(publicPlayerAttributes.PlayerGold - faction.Get_cost_build_dwelling()[0]);
            publicPlayerAttributes.CmdSetWorkers(publicPlayerAttributes.PlayerWorkers - faction.Get_cost_build_dwelling()[1]);
            current_dwelling++;
            break;

        case Building.Building_Type.Trading_Post:
            //First calculate resources and all that
            publicPlayerAttributes.CmdSetGold(publicPlayerAttributes.PlayerGold - faction.Get_cost_build_TP()[0]);
            publicPlayerAttributes.CmdSetWorkers(publicPlayerAttributes.PlayerWorkers - faction.Get_cost_build_TP()[1]);
            //Then update UI to display remaining buildings of the type that increased. So when a player builds a TP they regain a dwelling.
            ui.DisplayRemaining(Building.Building_Type.Dwelling, Get_Remaining_Index(Building.Building_Type.Dwelling));
            current_tp++; current_dwelling--;
            break;

        case Building.Building_Type.Stronghold:
            publicPlayerAttributes.CmdSetGold(publicPlayerAttributes.PlayerGold - faction.Get_cost_build_stronghold()[0]);
            publicPlayerAttributes.CmdSetWorkers(publicPlayerAttributes.PlayerWorkers - faction.Get_cost_build_stronghold()[1]);
            ui.DisplayRemaining(Building.Building_Type.Trading_Post, Get_Remaining_Index(Building.Building_Type.Trading_Post));
            current_fortress++; current_tp--;
            CheckPoints(PointBonus.Action_Type.BuildT3);     //Special point bonus
            break;

        case Building.Building_Type.Temple:
            publicPlayerAttributes.CmdSetGold(publicPlayerAttributes.PlayerGold - faction.Get_cost_build_temple()[0]);
            publicPlayerAttributes.CmdSetWorkers(publicPlayerAttributes.PlayerWorkers - faction.Get_cost_build_temple()[1]);
            ui.DisplayRemaining(Building.Building_Type.Trading_Post, Get_Remaining_Index(Building.Building_Type.Trading_Post));
            current_temple++; current_tp--;
            break;

        case Building.Building_Type.Sanctuary:
            publicPlayerAttributes.CmdSetGold(publicPlayerAttributes.PlayerGold - faction.Get_cost_build_sanctuary()[0]);
            publicPlayerAttributes.CmdSetWorkers(publicPlayerAttributes.PlayerWorkers - faction.Get_cost_build_sanctuary()[1]);
            ui.DisplayRemaining(Building.Building_Type.Temple, Get_Remaining_Index(Building.Building_Type.Temple));
            current_sanctuary++; current_temple--;
            CheckPoints(PointBonus.Action_Type.BuildT3);     //Special point bonus
            break;
        }
        CheckPoints(PointBonus.MapBuildingToAction(bt)); //Check if we gained any points#
        ui.UpdatePoints(publicPlayerAttributes.PlayerPoints);

        //Finally update UI for building which is losing one of itself
        ui.DisplayRemaining(bt, Get_Remaining_Index(bt));
    }
Exemplo n.º 5
0
    public int GetPointBonus(PointBonus.Action_Type at_)
    {
        int        totalPointBonus = 0;
        PointBonus temp;

        if (PointBonus.CheckReactive(at_)) //If the action type is reactive only bother checking the reactive type lists.
        {
            temp = ContainsBonus(reactive_temp, at_);
            if (temp != null)
            {
                totalPointBonus += temp.pointBonus;
            }

            temp = ContainsBonus(reactive_perm, at_);
            if (temp != null)
            {
                totalPointBonus += temp.pointBonus;
            }
        }
        else //Else it's accumulative so only check those list types.
        {
            temp = ContainsBonus(accumulative_temp, at_);
            if (temp != null)
            {
                totalPointBonus += temp.pointBonus;
            }

            temp = ContainsBonus(accumulative_perm, at_);
            if (temp != null)
            {
                totalPointBonus += temp.pointBonus;
            }
        }

        return(totalPointBonus);
    }
 public RoundEndBonus(PointBonus pb, CultIncome ci, SingleIncome si)
 {
     RoundEndPointBonus = pb;
     cultCostPer        = ci;
     cultPerBonus       = si;
 }
 /**For favour tiles */
 public FavourBonus(SingleIncome i_, PointBonus pb_, CultIncome ci_)
 {
     income      = i_;
     pointBonus  = pb_;
     cult_income = ci_;
 }
Exemplo n.º 8
0
 public void AddPointBonus(PointBonus pb_, bool temporary)
 {
     pk.AddPointBonus(pb_, temporary);
 }
 public Round_Bonus(PointBonus pb_, SingleIncome income_, RoundBonusManager.RoundBonusType type_)
 {
     RoundPointbonus = pb_;
     Round_Income    = income_;
     Type            = type_;
 }
 public Round_Bonus(PointBonus pb_, RoundBonusManager.RoundBonusType type_)
 {
     RoundPointbonus = pb_;
     Type            = type_;
 }