Exemplo n.º 1
0
 public void SetGuarding(CDivision guardian, CDivision guarded)
 {
     ClearGuarding(guardian);
     ClearGuarding(guarded);
     guardian.GuardPairing = guarded.ID;
     guarded.GuardPairing  = guardian.ID;
 }
Exemplo n.º 2
0
        private void SelectNewArmyEditorDivision(DivisionControl newSelection)
        {
            if (selectedDivisionControl != null)
            {
                selectedDivisionControl.BackColor = DefaultDivisionBgColour;
            }

            if (newSelection != null)
            {
                selectedDivisionControl = newSelection;

                selectedDivisionControl.BackColor = SelectedDivisionBgColour;

                CDivision division = selectedDivisionControl.DisplayedDivision;

                DivisionNameText.Text       = division.Name;
                divisionSelectedUnitType    = division.UnitType;
                DivisionUnitText.Text       = divisionSelectedUnitType.Name;
                DivisionSizeNumeric.Value   = division.StartingSize;
                DivisionSizeNumeric.Value   = division.CurrentSize;
                DivisionMoraleNumeric.Value = division.Morale;

                RefreshDivisionTraitDescriptionList();
            }
            else
            {
                throw new ArgumentNullException("newSelection", "Tried to select a null carmy division control");
            }
        }
Exemplo n.º 3
0
        private void AddNewArmyRow(CDivision division)
        {
            AddNewArmyRow();
            int             lastRow = ArmyTable.RowCount - 1;
            DivisionControl control = (DivisionControl)(ArmyTable.Controls[ARMY_EDIT_DIVISION_CONTROL_PREFIX + lastRow.ToString()]);

            control.DisplayedDivision = division;
        }
Exemplo n.º 4
0
        private void ArmyAddDivisionButton_Click(object sender, EventArgs e)
        {
            CDivision division = new CDivision()
            {
                Name         = DivisionNameText.Text,
                UnitType     = divisionSelectedUnitType,
                StartingSize = (int)DivisionSizeNumeric.Value,
                CurrentSize  = (int)DivisionSizeNumeric.Value,
                Morale       = (int)DivisionMoraleNumeric.Value,
            };

            armyCreatorWorkingCopy.Divisions.Add(division);
            AddNewArmyRow(division);
        }
Exemplo n.º 5
0
        private void ArmyUpdateDivisionButton_Click(object sender, EventArgs e)
        {
            if (selectedDivisionControl != null)
            {
                CDivision division = selectedDivisionControl.DisplayedDivision;

                division.Name         = DivisionNameText.Text;
                division.UnitType     = divisionSelectedUnitType;
                division.StartingSize = (int)DivisionSizeNumeric.Value;
                division.CurrentSize  = (int)DivisionSizeNumeric.Value;
                division.Morale       = (int)DivisionMoraleNumeric.Value;

                selectedDivisionControl.RefreshDisplayedUnit();
            }
        }
Exemplo n.º 6
0
 public void ClearGuarding(CDivision division)
 {
     if (division.GuardPairing != Guid.Empty)
     {
         CDivision other = Divisions.Find(i => i.GuardPairing == division.ID);
         division.GuardPairing = Guid.Empty;
         if (other != null)
         {
             other.GuardPairing = Guid.Empty;
         }
         else
         {
             throw new Exception(MISSING_GUARD_PAIR_MESSAGE);
         }
     }
 }
Exemplo n.º 7
0
        public int CheckDefensiveStrength(CDivision division)
        {
            int defense = 0;

            if (division.GuardPairing == Guid.Empty)
            {
                defense = (int)(division.UnitType.Stats[CUnit.STAT_DEFENSE]);
            }
            else
            {
                CDivision other = Divisions.Find(i => i.GuardPairing == division.ID);
                if (other != null)
                {
                    defense = (int)(other.UnitType.Stats[CUnit.STAT_DEFENSE]);
                }
                else
                {
                    throw new Exception(MISSING_GUARD_PAIR_MESSAGE);
                }
            }
            return(defense);
        }
Exemplo n.º 8
0
 public void ClearDisplayedDivision()
 {
     DisplayedDivision = null;
 }