예제 #1
0
        public static Unit CreateDummyUnit()
        {
            Character DummyCharacter = new Character();

            DummyCharacter.Name          = "Dummy Pilot";
            DummyCharacter.Level         = 1;
            DummyCharacter.ArrayLevelMEL = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelRNG = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelDEF = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelSKL = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelEVA = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelHIT = new int[1] {
                200
            };
            DummyCharacter.ArrayLevelMaxSP = new int[1] {
                50
            };
            DummyCharacter.Init();

            Unit DummyUnit = new UnitNormal();

            DummyUnit.FullName    = "Dummy Unit";
            DummyUnit.MaxHP       = 10000;
            DummyUnit.MaxEN       = 200;
            DummyUnit.Armor       = 100;
            DummyUnit.Mobility    = 50;
            DummyUnit.MaxMovement = 5;
            Attack DummyAttack = new Attack("Dummy Attack", string.Empty, 0, "10000", 0, 5, WeaponPrimaryProperty.None,
                                            WeaponSecondaryProperty.PostMovement, 10, 0, 6, 1, 100, "Laser",
                                            new Dictionary <string, char>()
            {
                { "Air", 'S' }, { "Land", 'S' }, { "Sea", 'S' }, { "Space", 'S' }
            });

            DummyUnit.ArrayCharacterActive = new Character[1] {
                DummyCharacter
            };
            DummyUnit.ListAttack.Add(DummyAttack);
            DummyUnit.AttackIndex = 0;
            DummyUnit.UnitStat.DicTerrainValue.Add("Air", 1);
            DummyUnit.UnitStat.DicTerrainValue.Add("Land", 1);
            DummyUnit.UnitStat.DicTerrainValue.Add("Sea", 1);
            DummyUnit.UnitStat.DicTerrainValue.Add("Space", 1);

            return(DummyUnit);
        }
예제 #2
0
        public void TestSkillCreation()
        {
            BaseAutomaticSkill NewPilotSkill = new BaseAutomaticSkill();

            Character DummyCharacter = new Character();

            DummyCharacter.Level         = 1;
            DummyCharacter.ArrayLevelMEL = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelRNG = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelDEF = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelSKL = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelEVA = new int[1] {
                100
            };
            DummyCharacter.ArrayLevelHIT = new int[1] {
                100
            };
            DummyCharacter.Init();

            Unit   DummyUnit   = new UnitNormal();
            Attack DummyAttack = new Attack("Dummy Attack", string.Empty, 0, "10000", 0, 5, WeaponPrimaryProperty.None, WeaponSecondaryProperty.PostMovement, 10, 5, 0, 1, 100, "Laser", new System.Collections.Generic.Dictionary <string, char>());

            DummyUnit.ArrayCharacterActive = new Character[1] {
                DummyCharacter
            };
            DummyUnit.ListAttack.Add(DummyAttack);
            DummyUnit.AttackIndex = 0;
            Squad DummySquad = new Squad("Dummy", DummyUnit);

            Assert.AreEqual(190, DeathmatchMap.Accuracy(DummyUnit, 0));
        }
예제 #3
0
 public EquipmentInformations(string EquipmentUnitPath, string EquipmentName)
 {
     UnitForm = null;
     this.EquipmentUnitPath = EquipmentUnitPath;
     this.EquipmentName     = EquipmentName;
 }
        /// <summary>
        /// Load a Unit item at selected path.
        /// </summary>
        /// <param name="PartPath">Path from which to open the Unit.</param>
        private void LoadUnit(string UnitPath)
        {
            Name = UnitPath.Substring(0, UnitPath.Length - 4).Substring(21);
            UnitNormal LoadedUnit = new UnitNormal(Name, null, DicRequirement, DicEffect, DicAutomaticSkillTarget);

            frmAttacks.UnitName = Name;

            #region Unit Animations

            if (string.IsNullOrEmpty(LoadedUnit.Animations.Default.AnimationName))
            {
                lstAnimations.Items[0].Tag = Name + "/Default";
            }
            else
            {
                lstAnimations.Items[0].Tag = LoadedUnit.Animations.Default.AnimationName;
            }
            if (string.IsNullOrEmpty(LoadedUnit.Animations.Hit.AnimationName))
            {
                lstAnimations.Items[1].Tag = "Default Animations/Hit";
            }
            else
            {
                lstAnimations.Items[1].Tag = LoadedUnit.Animations.Hit.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.HitToDefault.AnimationName))
            {
                lstAnimations.Items[2].Tag = "Default Animations/Hit To Default";
            }
            else
            {
                lstAnimations.Items[2].Tag = LoadedUnit.Animations.HitToDefault.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.MoveFoward.AnimationName))
            {
                lstAnimations.Items[3].Tag = "Default Animations/Move Foward";
            }
            else
            {
                lstAnimations.Items[3].Tag = LoadedUnit.Animations.MoveFoward.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.MoveFowardToDefault.AnimationName))
            {
                lstAnimations.Items[4].Tag = "Default Animations/Move Foward to Default";
            }
            else
            {
                lstAnimations.Items[4].Tag = LoadedUnit.Animations.MoveFowardToDefault.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.MoveBackward.AnimationName))
            {
                lstAnimations.Items[5].Tag = "Default Animations/Move Backward";
            }
            else
            {
                lstAnimations.Items[5].Tag = LoadedUnit.Animations.MoveBackward.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.MoveBackwardToDefault.AnimationName))
            {
                lstAnimations.Items[6].Tag = "Default Animations/Move Backward To Default";
            }
            else
            {
                lstAnimations.Items[6].Tag = LoadedUnit.Animations.MoveBackwardToDefault.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.Destroyed.AnimationName))
            {
                lstAnimations.Items[7].Tag = "Default Animations/Destroyed";
            }
            else
            {
                lstAnimations.Items[7].Tag = LoadedUnit.Animations.Destroyed.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.Shield.AnimationName))
            {
                lstAnimations.Items[8].Tag = "Default Animations/Shield";
            }
            else
            {
                lstAnimations.Items[8].Tag = LoadedUnit.Animations.Shield.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.ShieldToDefault.AnimationName))
            {
                lstAnimations.Items[9].Tag = "Default Animations/Shield To Default";
            }
            else
            {
                lstAnimations.Items[9].Tag = LoadedUnit.Animations.ShieldToDefault.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.ParryStart.AnimationName))
            {
                lstAnimations.Items[10].Tag = "Default Animations/Parry Start";
            }
            else
            {
                lstAnimations.Items[10].Tag = LoadedUnit.Animations.ParryStart.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.ParryEnd.AnimationName))
            {
                lstAnimations.Items[11].Tag = "Default Animations/Parry End";
            }
            else
            {
                lstAnimations.Items[11].Tag = LoadedUnit.Animations.ParryEnd.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.ShootDownFiring.AnimationName))
            {
                lstAnimations.Items[12].Tag = "Default Animations/Shoot Down Firing";
            }
            else
            {
                lstAnimations.Items[12].Tag = LoadedUnit.Animations.ShootDownFiring.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.ShootDownShot.AnimationName))
            {
                lstAnimations.Items[13].Tag = "Default Animations/Shoot Down Shot";
            }
            else
            {
                lstAnimations.Items[13].Tag = LoadedUnit.Animations.ShootDownShot.AnimationName;
            }

            #endregion

            //Pilot whitelist.
            for (int P = 0; P < LoadedUnit.ListCharacterIDWhitelist.Count; P++)
            {
                lstPilots.Items.Add(LoadedUnit.ListCharacterIDWhitelist[P]);
            }

            frmAttacks.SetAttacks(LoadedUnit.ListAttack);
            frmAttacks.cbUpgradeCost.SelectedIndex   = (int)LoadedUnit.UnitStat.AttackUpgradesCost;
            frmAttacks.cbUpgradeValues.SelectedIndex = (int)LoadedUnit.UnitStat.AttackUpgradesSpeed;

            frmDetails.txtMapSprite.Text  = LoadedUnit.SpriteMapPath;
            frmDetails.txtUnitSprite.Text = LoadedUnit.SpriteUnitPath;
            frmDetails.txtTags.Text       = LoadedUnit.UnitTags;

            #region Abilities

            for (int A = 0; A < LoadedUnit.ArrayUnitAbility.Length; A++)
            {
                lstAbilities.Items.Add(LoadedUnit.ArrayUnitAbility[A].Name);
            }

            #endregion

            txtPartsSlots.Value = LoadedUnit.ArrayParts.Length;

            this.Text = LoadedUnit.RelativePath + " - Project Eternity Unit Editor";

            #region Load controls

            txtName.Text        = LoadedUnit.ItemName;
            txtPrice.Text       = LoadedUnit.Price.ToString();
            txtEXP.Value        = LoadedUnit.UnitStat.EXPValue;
            txtDescription.Text = LoadedUnit.Description;

            txtBaseHP.Text       = LoadedUnit.MaxHP.ToString();
            txtBaseEN.Text       = LoadedUnit.MaxEN.ToString();
            txtBaseArmor.Text    = LoadedUnit.Armor.ToString();
            txtBaseMobility.Text = LoadedUnit.Mobility.ToString();
            txtBaseMovement.Text = LoadedUnit.MaxMovement.ToString();

            List <char> Grades = new List <char> {
                '-', 'S', 'A', 'B', 'C', 'D'
            };
            cbTerrainAir.SelectedIndex   = LoadedUnit.DicTerrainValue[UnitStats.TerrainAir];
            cbTerrainLand.SelectedIndex  = LoadedUnit.DicTerrainValue[UnitStats.TerrainLand];
            cbTerrainSea.SelectedIndex   = LoadedUnit.DicTerrainValue[UnitStats.TerrainSea];
            cbTerrainSpace.SelectedIndex = LoadedUnit.DicTerrainValue[UnitStats.TerrainSpace];

            if (LoadedUnit.ListTerrainChoices.Contains(UnitStats.TerrainAir))
            {
                cboMovementAir.Checked = true;
            }
            if (LoadedUnit.ListTerrainChoices.Contains(UnitStats.TerrainLand))
            {
                cboMovementLand.Checked = true;
            }
            if (LoadedUnit.ListTerrainChoices.Contains(UnitStats.TerrainSea))
            {
                cboMovementSea.Checked = true;
            }
            if (LoadedUnit.ListTerrainChoices.Contains(UnitStats.TerrainSpace))
            {
                cboMovementSpace.Checked = true;
            }
            if (LoadedUnit.ListTerrainChoices.Contains(UnitStats.TerrainUnderground))
            {
                cboMovementUnderground.Checked = true;
            }
            if (LoadedUnit.ListTerrainChoices.Contains(UnitStats.TerrainUnderwater))
            {
                cboMovementUnderwater.Checked = true;
            }

            if (LoadedUnit.Size == UnitStats.UnitSizeLLL)
            {
                rbSizeLLL.Checked = true;
            }
            else if (LoadedUnit.Size == UnitStats.UnitSizeLL)
            {
                rbSizeLL.Checked = true;
            }
            else if (LoadedUnit.Size == UnitStats.UnitSizeL)
            {
                rbSizeL.Checked = true;
            }
            else if (LoadedUnit.Size == UnitStats.UnitSizeM)
            {
                rbSizeM.Checked = true;
            }
            else if (LoadedUnit.Size == UnitStats.UnitSizeS)
            {
                rbSizeS.Checked = true;
            }
            else if (LoadedUnit.Size == UnitStats.UnitSizeSS)
            {
                rbSizeSS.Checked = true;
            }

            if (LoadedUnit.UnitStat.ArrayMapSize.GetLength(0) == 1 && LoadedUnit.UnitStat.ArrayMapSize.GetLength(1) == 1)
            {
                frmUnitSizeEditor.rbNone.Checked = true;
            }
            else
            {
                frmUnitSizeEditor.txtWidth.Value  = LoadedUnit.UnitStat.ArrayMapSize.GetLength(0);
                frmUnitSizeEditor.txtHeight.Value = LoadedUnit.UnitStat.ArrayMapSize.GetLength(1);
                bool AllTrue = true;

                for (int X = 0; X < LoadedUnit.UnitStat.ArrayMapSize.GetLength(0); X++)
                {
                    for (int Y = 0; Y < LoadedUnit.UnitStat.ArrayMapSize.GetLength(1); Y++)
                    {
                        if (!LoadedUnit.UnitStat.ArrayMapSize[X, Y])
                        {
                            AllTrue = false;
                        }
                        frmUnitSizeEditor.ListUnitSize[X][Y] = LoadedUnit.UnitStat.ArrayMapSize[X, Y];
                    }
                }

                if (AllTrue)
                {
                    frmUnitSizeEditor.rbSizeOnly.Checked = true;
                }
                else
                {
                    frmUnitSizeEditor.rbCustomSizeBox.Checked = true;
                }
            }

            #endregion
        }
        /// <summary>
        /// Load a Unit item at selected path.
        /// </summary>
        /// <param name="PartPath">Path from which to open the Unit.</param>
        private void LoadUnit(string UnitPath)
        {
            Name = UnitPath.Substring(0, UnitPath.Length - 4).Substring(21);
            UnitNormal LoadedUnit = new UnitNormal(Name, null, DicRequirement, DicEffect);

            frmAttacks.UnitName = Name;

            #region Unit Animations

            if (string.IsNullOrEmpty(LoadedUnit.Animations.Default.AnimationName))
            {
                lstAnimations.Items[0].Tag = Name + "/Default";
            }
            else
            {
                lstAnimations.Items[0].Tag = LoadedUnit.Animations.Default.AnimationName;
            }
            if (string.IsNullOrEmpty(LoadedUnit.Animations.Hit.AnimationName))
            {
                lstAnimations.Items[1].Tag = "Default Animations/Hit";
            }
            else
            {
                lstAnimations.Items[1].Tag = LoadedUnit.Animations.Hit.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.HitToDefault.AnimationName))
            {
                lstAnimations.Items[2].Tag = "Default Animations/Hit To Default";
            }
            else
            {
                lstAnimations.Items[2].Tag = LoadedUnit.Animations.HitToDefault.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.MoveFoward.AnimationName))
            {
                lstAnimations.Items[3].Tag = "Default Animations/Move Foward";
            }
            else
            {
                lstAnimations.Items[3].Tag = LoadedUnit.Animations.MoveFoward.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.MoveFowardToDefault.AnimationName))
            {
                lstAnimations.Items[4].Tag = "Default Animations/Move Foward to Default";
            }
            else
            {
                lstAnimations.Items[4].Tag = LoadedUnit.Animations.MoveFowardToDefault.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.MoveBackward.AnimationName))
            {
                lstAnimations.Items[5].Tag = "Default Animations/Move Backward";
            }
            else
            {
                lstAnimations.Items[5].Tag = LoadedUnit.Animations.MoveBackward.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.MoveBackwardToDefault.AnimationName))
            {
                lstAnimations.Items[6].Tag = "Default Animations/Move Backward To Default";
            }
            else
            {
                lstAnimations.Items[6].Tag = LoadedUnit.Animations.MoveBackwardToDefault.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.Destroyed.AnimationName))
            {
                lstAnimations.Items[7].Tag = "Default Animations/Destroyed";
            }
            else
            {
                lstAnimations.Items[7].Tag = LoadedUnit.Animations.Destroyed.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.Shield.AnimationName))
            {
                lstAnimations.Items[8].Tag = "Default Animations/Shield";
            }
            else
            {
                lstAnimations.Items[8].Tag = LoadedUnit.Animations.Shield.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.ShieldToDefault.AnimationName))
            {
                lstAnimations.Items[9].Tag = "Default Animations/Shield To Default";
            }
            else
            {
                lstAnimations.Items[9].Tag = LoadedUnit.Animations.ShieldToDefault.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.ParryStart.AnimationName))
            {
                lstAnimations.Items[10].Tag = "Default Animations/Parry Start";
            }
            else
            {
                lstAnimations.Items[10].Tag = LoadedUnit.Animations.ParryStart.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.ParryEnd.AnimationName))
            {
                lstAnimations.Items[11].Tag = "Default Animations/Parry End";
            }
            else
            {
                lstAnimations.Items[11].Tag = LoadedUnit.Animations.ParryEnd.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.ShootDownFiring.AnimationName))
            {
                lstAnimations.Items[12].Tag = "Default Animations/Shoot Down Firing";
            }
            else
            {
                lstAnimations.Items[12].Tag = LoadedUnit.Animations.ShootDownFiring.AnimationName;
            }

            if (string.IsNullOrEmpty(LoadedUnit.Animations.ShootDownShot.AnimationName))
            {
                lstAnimations.Items[13].Tag = "Default Animations/Shoot Down Shot";
            }
            else
            {
                lstAnimations.Items[13].Tag = LoadedUnit.Animations.ShootDownShot.AnimationName;
            }

            #endregion

            //Pilot whitelist.
            for (int P = 0; P < LoadedUnit.ListCharacterIDWhitelist.Count; P++)
            {
                lstPilots.Items.Add(LoadedUnit.ListCharacterIDWhitelist[P]);
            }

            frmAttacks.ListAttack = LoadedUnit.ListAttack;
            frmAttacks.cbUpgradeCost.SelectedIndex   = (int)LoadedUnit.UnitStat.AttackUpgradesCost;
            frmAttacks.cbUpgradeValues.SelectedIndex = (int)LoadedUnit.UnitStat.AttackUpgradesSpeed;

            frmDetails.txtMapSprite.Text  = LoadedUnit.SpriteMapPath;
            frmDetails.txtUnitSprite.Text = LoadedUnit.SpriteUnitPath;
            frmDetails.txtTags.Text       = LoadedUnit.UnitTags;

            #region Abilities

            for (int A = 0; A < LoadedUnit.ArrayUnitAbility.Length; A++)
            {
                lstAbilities.Items.Add(LoadedUnit.ArrayUnitAbility[A].Name);
            }

            #endregion

            txtPartsSlots.Value = LoadedUnit.ArrayParts.Length;

            this.Text = LoadedUnit.FullName + " - Project Eternity Unit Editor";

            #region Load controls

            txtName.Text        = LoadedUnit.FullName;
            txtPrice.Text       = LoadedUnit.Price.ToString();
            txtEXP.Value        = LoadedUnit.UnitStat.EXPValue;
            txtDescription.Text = LoadedUnit.Description;

            txtBaseHP.Text       = LoadedUnit.MaxHP.ToString();
            txtBaseEN.Text       = LoadedUnit.MaxEN.ToString();
            txtBaseArmor.Text    = LoadedUnit.Armor.ToString();
            txtBaseMobility.Text = LoadedUnit.Mobility.ToString();
            txtBaseMovement.Text = LoadedUnit.MaxMovement.ToString();

            List <char> Grades = new List <char> {
                '-', 'S', 'A', 'B', 'C', 'D'
            };
            cbTerrainAir.SelectedIndex   = LoadedUnit.DicTerrainValue["Air"];
            cbTerrainLand.SelectedIndex  = LoadedUnit.DicTerrainValue["Land"];
            cbTerrainSea.SelectedIndex   = LoadedUnit.DicTerrainValue["Sea"];
            cbTerrainSpace.SelectedIndex = LoadedUnit.DicTerrainValue["Space"];

            if (LoadedUnit.ListTerrainChoices.Contains("Air"))
            {
                cboMovementAir.Checked = true;
            }
            if (LoadedUnit.ListTerrainChoices.Contains("Land"))
            {
                cboMovementLand.Checked = true;
            }
            if (LoadedUnit.ListTerrainChoices.Contains("Sea"))
            {
                cboMovementSea.Checked = true;
            }
            if (LoadedUnit.ListTerrainChoices.Contains("Space"))
            {
                cboMovementSpace.Checked = true;
            }
            if (LoadedUnit.ListTerrainChoices.Contains("Underground"))
            {
                cboMovementUnderground.Checked = true;
            }

            if (LoadedUnit.Size == "LLL")
            {
                rbSizeLLL.Checked = true;
            }
            else if (LoadedUnit.Size == "LL")
            {
                rbSizeLL.Checked = true;
            }
            else if (LoadedUnit.Size == "L")
            {
                rbSizeL.Checked = true;
            }
            else if (LoadedUnit.Size == "M")
            {
                rbSizeM.Checked = true;
            }
            else if (LoadedUnit.Size == "S")
            {
                rbSizeS.Checked = true;
            }
            else if (LoadedUnit.Size == "SS")
            {
                rbSizeSS.Checked = true;
            }

            #endregion
        }