Example #1
0
 public bool Test(Equipment newEquipment, List <Equipment> oldEquipment, BaseUnit soldiertype)
 {
     for (int i = 0; i < oldEquipment.Count; i++)
     {
         //If weapons is for foot only
         if ((newEquipment is Polearm || newEquipment is Pavise || newEquipment is Pike || newEquipment is Spear || newEquipment is DualWieldedWeapon) && !(oldEquipment[5] is Feet))
         {
             return(false);
         }
         // if weapons are for mounted only.
         else if ((newEquipment is Lance) && (oldEquipment[5] is Feet))
         {
             return(false);
         }
     }
     return(true);
 }
Example #2
0
 public BaseUnit(BaseUnit Copy)
 {
     this.loner      = Copy.loner;
     this.cost       = Copy.cost;
     this.fight      = Copy.fight;
     this.shoot      = Copy.shoot;
     this.defence    = Copy.defence;
     this.courage    = Copy.courage;
     this.discipline = Copy.discipline;
     this.minSpeed   = Copy.minSpeed;
     this.maxSpeed   = Copy.maxSpeed;
     this.name       = Copy.name;
     this.rules      = Copy.rules;
     this.army       = Copy.army;
     this.though     = Copy.though;
     this.mighty     = Copy.mighty;
     this.size       = Copy.size;
 }
Example #3
0
        public bool Update(MouseState mouseState, MouseState oldMouseState, BaseUnit soldiertype)
        {
            Rectangle mouseRec = new Rectangle(mouseState.X, mouseState.Y, 1, 1);

            for (int i = 0; i < buttonsList.Count(); i++)
            {
                for (int y = 0; y < buttonsList[i].Count(); y++)
                {
                    if (UpdateOnlyWhenRightType(soldiertype, i, y))
                    {
                        buttonsList[i][y].Update(mouseState, oldMouseState);
                        if (buttonsList[i][y].pressed)
                        {
                            PressedButton.X = i;
                            PressedButton.Y = y;
                            if (buttonsList[i][y].IsTurnedOff())// temp
                            {
                                return(false);
                            }
                            else
                            {
                                buttonsList[i][y].Sound();
                                output = buttonsList[i][y].GetEquipment();
                                return(true);
                            }
                        }
                        else if (buttonsList[i][y].MouseIntersect(mouseRec))
                        {
                            if (parchment.Countdown())
                            {
                                parchment.Create(mouseRec.X, mouseRec.Y, buttonsList[i][y].GetEquipment());
                            }
                        }
                    }
                }
            }
            if (parchment.Exist() && !parchment.Interact(mouseRec))
            {
                parchment.Reset();
            }
            return(false);
        }
Example #4
0
 public void AppointSoldier(BaseUnit soldier)
 {
     if (this.soldier != null)
     {
         List <Equipment> equipment = this.soldier.GetEquipment();
         this.soldier = soldier;
         for (int i = 0; i < equipment.Count(); i++)
         {
             this.soldier.EquipUnit(equipment[i]);
         }
         if (this.soldier.loner)
         {
             numberOfSoldiers = 1;
         }
     }
     else
     {
         this.soldier = soldier;
     }
 }
Example #5
0
 public int Returnpoints(int numberOfSoldiers, BaseUnit type)
 {
     return((type.GetCost() * numberOfSoldiers) + type.GetOneTimeCost() + type.GetArcherPlatformCost(numberOfSoldiers));
 }
Example #6
0
 public string Tough(BaseUnit soldier, List <Equipment> equipment)
 {
     return("Though 0");
 }
Example #7
0
 public void CheckCanSee(BaseUnit soldiertype)
 {
     for (int i = 0; i < buttonsList.Count; i++)
     {
         for (int y = 0; y < buttonsList[i].Count; y++)
         {
             if (buttonsList[i][y].currentFrame == 2)
             {
                 buttonsList[i][y].TurnOnShow();
             }
         }
     }
     if (!(soldiertype is Artilleryman))
     {
         buttonsList[5][3].TurnOffShow();
     }
     if (!buttonsList[3][0].IsTurnedOn())
     {
         //Cannot buy infantry weapons if mounted
         buttonsList[0][4].TurnOffShow();
         buttonsList[0][5].TurnOffShow();
         buttonsList[0][6].TurnOffShow();
         buttonsList[0][7].TurnOffShow();
         buttonsList[0][8].TurnOffShow();
         buttonsList[1][1].TurnOffShow();
         buttonsList[1][2].TurnOffShow();
         buttonsList[1][3].TurnOffShow();
     }
     if (buttonsList[0][4].IsTurnedOn() || buttonsList[0][5].IsTurnedOn() || buttonsList[0][6].IsTurnedOn() || buttonsList[0][7].IsTurnedOn() || buttonsList[0][8].IsTurnedOn())
     {
         //Cannot buy mount if infantry weapons
         buttonsList[3][1].TurnOffShow();
         buttonsList[3][2].TurnOffShow();
         buttonsList[3][3].TurnOffShow();
         buttonsList[3][4].TurnOffShow();
         buttonsList[3][5].TurnOffShow();
         buttonsList[3][6].TurnOffShow();
     }
     if (buttonsList[3][0].IsTurnedOn() && !(soldiertype is BaseCentaur))
     {
         //Cannot get Lance or horse armour if not mounted
         buttonsList[0][9].TurnOffShow();
         buttonsList[1][4].TurnOffShow();
         buttonsList[1][5].TurnOffShow();
         buttonsList[1][6].TurnOffShow();
     }
     if (!buttonsList[3][0].IsTurnedOn() || soldiertype is BaseCentaur)
     {
         //Cannot get foot armour if mounted or centaur
         buttonsList[1][1].TurnOffShow();
         buttonsList[1][2].TurnOffShow();
         buttonsList[1][3].TurnOffShow();
     }
     if (buttonsList[4][4].IsTurnedOn())
     {
         //Cannot buy stuff if zombie
         for (int i = 0; i < buttonsList.Count; i++)
         {
             for (int y = 1; y < buttonsList[i].Count; y++)
             {
                 if (i != 4)
                 {
                     buttonsList[i][y].TurnOffShow();
                 }
             }
         }
     }
     if ((buttonsList[0][1].IsTurnedOn() || buttonsList[0][2].IsTurnedOn() || buttonsList[0][3].IsTurnedOn() || buttonsList[0][4].IsTurnedOn() || buttonsList[0][5].IsTurnedOn() || buttonsList[0][6].IsTurnedOn() || buttonsList[0][7].IsTurnedOn() || buttonsList[0][8].IsTurnedOn() || buttonsList[0][9].IsTurnedOn()) || !buttonsList[1][0].IsTurnedOn() || !buttonsList[2][0].IsTurnedOn() || !buttonsList[3][0].IsTurnedOn() || !buttonsList[5][0].IsTurnedOn())
     {
         //Cannot buy zombie if has stuff
         buttonsList[4][4].TurnOffShow();
     }
     if (buttonsList[1][2].IsTurnedOn() || buttonsList[1][3].IsTurnedOn() || buttonsList[1][5].IsTurnedOn() || buttonsList[1][6].IsTurnedOn())
     {
         //Cannot buy skrimisher if have heavy armour
         buttonsList[4][1].TurnOffShow();
         buttonsList[4][2].TurnOffShow();
         buttonsList[4][3].TurnOffShow();
     }
     if (buttonsList[4][1].IsTurnedOn() || buttonsList[4][2].IsTurnedOn() || buttonsList[4][3].IsTurnedOn())
     {
         //Cannot buy heavy armour if they are skirmishers
         buttonsList[1][2].TurnOffShow();
         buttonsList[1][3].TurnOffShow();
         buttonsList[1][5].TurnOffShow();
         buttonsList[1][6].TurnOffShow();
     }
     if (!(buttonsList[2][2].IsTurnedOn() || buttonsList[2][3].IsTurnedOn()))
     {
         //cannot buy firearrows unless it has bows
         buttonsList[4][6].TurnOffShow();
     }
     if (buttonsList[4][6].IsTurnedOn())
     {
         //cannot buy firearrows unless it has bows
         buttonsList[2][0].TurnOffShow();
         buttonsList[2][1].TurnOffShow();
         buttonsList[2][4].TurnOffShow();
         buttonsList[2][5].TurnOffShow();
         buttonsList[2][6].TurnOffShow();
         buttonsList[2][7].TurnOffShow();
         buttonsList[2][8].TurnOffShow();
     }
 }
Example #8
0
 private bool TurnOffShowTest(int i, int y, BaseUnit soldiertype)
 {
     if (i == 1)
     {
         int p = 0;
     }
     if (buttonsList[i][y].IsTurnedOn())
     {
         return(false);
     }
     if (!(i == 4 && y == 0) && buttonsList[4][4].IsTurnedOn())
     {
         return(true);
     }
     else if (((i == 0 && (y == 4 || y == 5 || y == 6 || y == 7 || y == 8)) && !(buttonsList[3][0].IsTurnedOn() || soldiertype is BaseCentaur))) //cannot get infantry only weapons if mounted
     {
         return(true);
     }
     // Cannot buy lances unless mounted or centaur
     else if ((i == 0 && y == 9) && (buttonsList[3][0].IsTurnedOn() && !(soldiertype is BaseCentaur)))
     {
         return(true);
     }
     //Cannot buy mount if has infantry weapon)
     else if (((i == 3 && (y == 1 || y == 2 || y == 3 || y == 4 || y == 5 || y == 6)) && (buttonsList[0][4].IsTurnedOn() || buttonsList[0][5].IsTurnedOn() || buttonsList[0][6].IsTurnedOn() || buttonsList[0][7].IsTurnedOn() || buttonsList[0][8].IsTurnedOn())))
     {
         return(true);
     }
     //Cannot buy Horses if in infantry armour
     else if (((i == 3 && y != 0) && ((buttonsList[1][1].IsTurnedOn() || buttonsList[1][2].IsTurnedOn() || buttonsList[1][3].IsTurnedOn()) || soldiertype is BaseCentaur)))
     {
         return(true);
     }
     //Cannot buy horse armour if on foot
     else if ((i == 1 && y > 3) && buttonsList[3][0].IsTurnedOn() && !(soldiertype is BaseCentaur))
     {
         return(true);
     }
     //Cannot buy infantry armour if mounted
     else if ((i == 1 && (y == 1 || y == 2 || y == 3)) && !buttonsList[3][0].IsTurnedOn())
     {
         return(true);
     }
     //Cannot buy skirmisher in heavy armour
     else if ((i == 4 && (y == 1 || y == 2 || y == 3)) && (buttonsList[1][2].IsTurnedOn() || buttonsList[1][3].IsTurnedOn() || buttonsList[1][5].IsTurnedOn() || buttonsList[1][6].IsTurnedOn()))
     {
         return(true);
     }
     // Cannot buy heavy armour if Skirmisher
     else if ((i == 1 && (y == 2 || y == 3 || y == 5 || y == 6)) && (buttonsList[4][1].IsTurnedOn() || buttonsList[4][3].IsTurnedOn() || buttonsList[4][2].IsTurnedOn()))
     {
         return(true);
     }
     else if (i == 4 && y == 6 && !(buttonsList[2][2].IsTurnedOn() || buttonsList[2][3].IsTurnedOn()))
     {
         return(true);
     }
     else if (i == 5 && y == 3 && !(soldiertype is Artilleryman))
     {
         return(true);
     }
     return(false);
 }