Exemple #1
0
        private void LoadAttack(Attack ActiveWeapon)
        {
            this.Text       = ActiveWeapon.RelativePath + " - Project Eternity Attack Editor";
            Editor          = new QuoteEditor();
            MAPAttackEditor = new MAPAttackEditor();
            PERAttackEditor = new PERAttackEditor();

            //Create the Part file.
            string ItemName    = ActiveWeapon.RelativePath;
            string Description = ActiveWeapon.Description;

            string PowerFormula      = ActiveWeapon.PowerFormula;
            int    ENCost            = ActiveWeapon.ENCost;
            int    MaximumAmmo       = ActiveWeapon.MaxAmmo;
            int    MoraleRequirement = ActiveWeapon.MoraleRequirement;
            int    MinimumRange      = ActiveWeapon.RangeMinimum;
            int    MaximumRange      = ActiveWeapon.RangeMaximum;
            int    Accuracy          = ActiveWeapon.Accuracy;
            int    Critical          = ActiveWeapon.Critical;

            string AttackType = ActiveWeapon.AttackType;

            Dictionary <string, char> DicTerrainAttribute = ActiveWeapon.DicTerrainAttribute;

            txtName.Text        = ItemName;
            txtDescription.Text = Description;

            txtDamage.Text            = PowerFormula;
            txtENCost.Text            = ENCost.ToString();
            txtMaximumAmmo.Text       = MaximumAmmo.ToString();
            txtMoraleRequirement.Text = MoraleRequirement.ToString();
            txtMinimumRange.Text      = MinimumRange.ToString();
            txtMaximumRange.Text      = MaximumRange.ToString();
            txtAccuracy.Text          = Accuracy.ToString();
            txtCritical.Text          = Critical.ToString();

            #region Primary

            switch (ActiveWeapon.Pri)
            {
            case WeaponPrimaryProperty.MAP:
                rbMAP.Checked = true;
                MAPAttackEditor.ListAttackchoice      = ActiveWeapon.MAPAttributes.ListChoice;
                MAPAttackEditor.txtAttackWidth.Value  = MAPAttackEditor.AttackWidth = ActiveWeapon.MAPAttributes.Width;
                MAPAttackEditor.txtAttackHeight.Value = MAPAttackEditor.AttackHeight = ActiveWeapon.MAPAttributes.Height;

                if (ActiveWeapon.MAPAttributes.Property == WeaponMAPProperties.Spread)
                {
                    MAPAttackEditor.rbSpread.Checked = true;
                }
                else if (ActiveWeapon.MAPAttributes.Property == WeaponMAPProperties.Direction)
                {
                    MAPAttackEditor.rbDirection.Checked = true;
                }
                else if (ActiveWeapon.MAPAttributes.Property == WeaponMAPProperties.Targeted)
                {
                    MAPAttackEditor.rbTargeted.Checked = true;
                }

                MAPAttackEditor.ckFriendlyFire.Checked = ActiveWeapon.MAPAttributes.FriendlyFire;
                MAPAttackEditor.txtAttackDelay.Value   = ActiveWeapon.MAPAttributes.Delay;
                break;

            case WeaponPrimaryProperty.PER:
                PERAttackEditor.txtProjectileSpeed.Value    = (decimal)ActiveWeapon.PERAttributes.ProjectileSpeed;
                PERAttackEditor.cbAffectedByGravity.Checked = ActiveWeapon.PERAttributes.AffectedByGravity;
                PERAttackEditor.cbCanBeShotDown.Checked     = ActiveWeapon.PERAttributes.CanBeShotDown;
                PERAttackEditor.txtMaxLifetime.Value        = ActiveWeapon.PERAttributes.MaxLifetime;

                PERAttackEditor.IsProjectileAnimated   = ActiveWeapon.PERAttributes.ProjectileAnimation.IsAnimated;
                PERAttackEditor.txtProjectilePath.Text = ActiveWeapon.PERAttributes.ProjectileAnimation.Path;

                PERAttackEditor.txtNumberOfProjectiles.Value = ActiveWeapon.PERAttributes.NumberOfProjectiles;
                PERAttackEditor.txtLateralMaxSpread.Value    = (decimal)ActiveWeapon.PERAttributes.MaxLateralSpread;
                PERAttackEditor.txtForwardMaxSpread.Value    = (decimal)ActiveWeapon.PERAttributes.MaxForwardSpread;
                PERAttackEditor.txtUpwardMaxSpread.Value     = (decimal)ActiveWeapon.PERAttributes.MaxUpwardSpread;

                if (ActiveWeapon.PERAttributes.GroundCollision == PERAttackAttributes.GroundCollisions.DestroySelf)
                {
                    PERAttackEditor.rbDestroySelf.Checked = true;
                }
                else if (ActiveWeapon.PERAttributes.GroundCollision == PERAttackAttributes.GroundCollisions.Stop)
                {
                    PERAttackEditor.rbStop.Checked = true;
                }
                else if (ActiveWeapon.PERAttributes.GroundCollision == PERAttackAttributes.GroundCollisions.Bounce)
                {
                    PERAttackEditor.rbBounce.Checked     = true;
                    PERAttackEditor.txtBounceLimit.Value = ActiveWeapon.PERAttributes.BounceLimit;
                }

                rbPER.Checked = true;
                break;

            case WeaponPrimaryProperty.ALL:
                rbALL.Checked = true;
                break;

            case WeaponPrimaryProperty.PLA:
                rbPLA.Checked = true;
                break;

            default:
                rbNone.Checked = true;
                break;
            }

            #endregion

            #region Secondary

            if ((ActiveWeapon.Sec & WeaponSecondaryProperty.PostMovement) == WeaponSecondaryProperty.PostMovement)
            {
                cbPostMovement.Checked = true;
            }

            if ((ActiveWeapon.Sec & WeaponSecondaryProperty.SwordCut) == WeaponSecondaryProperty.SwordCut)
            {
                cbSwordCut.Checked = true;
            }

            if ((ActiveWeapon.Sec & WeaponSecondaryProperty.ShootDown) == WeaponSecondaryProperty.ShootDown)
            {
                cbShootDown.Checked = true;
            }

            if ((ActiveWeapon.Sec & WeaponSecondaryProperty.Partial) == WeaponSecondaryProperty.Partial)
            {
                cbPartialAttack.Checked = true;
            }

            txtPostMovementAccuracyMalus.Value = ActiveWeapon.PostMovementAccuracyMalus;
            txtPostMovementEvasionBonus.Value  = ActiveWeapon.PostMovementEvasionBonus;

            #endregion

            #region Explosion Attributes

            txtExplosionRadius.Value                    = (decimal)ActiveWeapon.ExplosionOption.ExplosionRadius;
            txtExplosionWindPowerAtCenter.Value         = (decimal)ActiveWeapon.ExplosionOption.ExplosionWindPowerAtCenter;
            txtExplosionWindPowerAtEdge.Value           = (decimal)ActiveWeapon.ExplosionOption.ExplosionWindPowerAtEdge;
            txtExplosionWindPowerToSelfMultiplier.Value = (decimal)ActiveWeapon.ExplosionOption.ExplosionWindPowerToSelfMultiplier;
            txtExplosionDamageAtCenter.Value            = (decimal)ActiveWeapon.ExplosionOption.ExplosionDamageAtCenter;
            txtExplosionDamageAtEdge.Value              = (decimal)ActiveWeapon.ExplosionOption.ExplosionDamageAtEdge;
            txtExplosionDamageToSelfMultiplier.Value    = (decimal)ActiveWeapon.ExplosionOption.ExplosionDamageToSelfMultiplier;

            #endregion

            #region Attack type

            switch (AttackType)
            {
            case "Blank":
                rbAttackTypeBlank.Checked = true;
                break;

            case "Melee":
                rbAttackTypeMelee.Checked = true;
                break;

            case "Solid blade":
                rbAttackTypeSolidBlade.Checked = true;
                break;

            case "Energy blade":
                rbAttackTypeEnergyBlade.Checked = true;
                break;

            case "Solid shot":
                rbAttackTypeSolidShot.Checked = true;
                break;

            case "Energy shot":
                rbAttackTypeEnergyShot.Checked = true;
                break;

            case "Remote":
                rbAttackTypeRemote.Checked = true;
                break;

            case "Special":
                rbAttackTypeSpecial.Checked = true;
                break;
            }

            #endregion

            #region Terrain grades

            #region Air

            switch (DicTerrainAttribute[UnitStats.TerrainAir])
            {
            case '-':
                cbAirRank.SelectedIndex = 0;
                break;

            case 'S':
                cbAirRank.SelectedIndex = 1;
                break;

            case 'A':
                cbAirRank.SelectedIndex = 2;
                break;

            case 'B':
                cbAirRank.SelectedIndex = 3;
                break;

            case 'C':
                cbAirRank.SelectedIndex = 4;
                break;

            case 'D':
                cbAirRank.SelectedIndex = 5;
                break;
            }

            #endregion

            #region Land

            switch (DicTerrainAttribute[UnitStats.TerrainLand])
            {
            case '-':
                cbLandRank.SelectedIndex = 0;
                break;

            case 'S':
                cbLandRank.SelectedIndex = 1;
                break;

            case 'A':
                cbLandRank.SelectedIndex = 2;
                break;

            case 'B':
                cbLandRank.SelectedIndex = 3;
                break;

            case 'C':
                cbLandRank.SelectedIndex = 4;
                break;

            case 'D':
                cbLandRank.SelectedIndex = 5;
                break;
            }

            #endregion

            #region Sea

            switch (DicTerrainAttribute[UnitStats.TerrainSea])
            {
            case '-':
                cbSeaRank.SelectedIndex = 0;
                break;

            case 'S':
                cbSeaRank.SelectedIndex = 1;
                break;

            case 'A':
                cbSeaRank.SelectedIndex = 2;
                break;

            case 'B':
                cbSeaRank.SelectedIndex = 3;
                break;

            case 'C':
                cbSeaRank.SelectedIndex = 4;
                break;

            case 'D':
                cbSeaRank.SelectedIndex = 5;
                break;
            }

            #endregion

            #region Space

            switch (DicTerrainAttribute[UnitStats.TerrainSpace])
            {
            case '-':
                cbSpaceRank.SelectedIndex = 0;
                break;

            case 'S':
                cbSpaceRank.SelectedIndex = 1;
                break;

            case 'A':
                cbSpaceRank.SelectedIndex = 2;
                break;

            case 'B':
                cbSpaceRank.SelectedIndex = 3;
                break;

            case 'C':
                cbSpaceRank.SelectedIndex = 4;
                break;

            case 'D':
                cbSpaceRank.SelectedIndex = 5;
                break;
            }

            #endregion

            #endregion

            #region Attack Attributes

            if (ActiveWeapon.ArrayAttackAttributes.Length >= 1)
            {
                txtPilotSkill1.Text = ActiveWeapon.ArrayAttackAttributes[0].Name;
            }
            if (ActiveWeapon.ArrayAttackAttributes.Length >= 2)
            {
                txtPilotSkill2.Text = ActiveWeapon.ArrayAttackAttributes[1].Name;
            }
            if (ActiveWeapon.ArrayAttackAttributes.Length >= 3)
            {
                txtPilotSkill3.Text = ActiveWeapon.ArrayAttackAttributes[2].Name;
            }
            if (ActiveWeapon.ArrayAttackAttributes.Length >= 4)
            {
                txtPilotSkill4.Text = ActiveWeapon.ArrayAttackAttributes[3].Name;
            }

            #endregion

            #region Quotes

            for (int Q = 0; Q < ActiveWeapon.ListQuoteSet.Count; Q++)
            {
                Editor.dgvQuotes.Rows.Add(ActiveWeapon.ListQuoteSet[Q]);
            }

            #endregion
        }
        private void LoadAttack(Attack ActiveWeapon)
        {
            this.Text       = ActiveWeapon.FullName + " - Project Eternity Attack Editor";
            Editor          = new QuoteEditor();
            MAPAttackEditor = new MAPAttackEditor();

            //Create the Part file.
            string ItemName    = ActiveWeapon.FullName;
            string Description = ActiveWeapon.Description;

            string PowerFormula      = ActiveWeapon.PowerFormula;
            int    ENCost            = ActiveWeapon.ENCost;
            int    MaximumAmmo       = ActiveWeapon.MaxAmmo;
            int    MoraleRequirement = ActiveWeapon.MoraleRequirement;
            int    MinimumRange      = ActiveWeapon.RangeMinimum;
            int    MaximumRange      = ActiveWeapon.RangeMaximum;
            int    Accuracy          = ActiveWeapon.Accuracy;
            int    Critical          = ActiveWeapon.Critical;

            string AttackType = ActiveWeapon.AttackType;

            Dictionary <string, char> DicTerrainAttribute = ActiveWeapon.DicTerrainAttribute;

            txtName.Text        = ItemName;
            txtDescription.Text = Description;

            txtDamage.Text            = PowerFormula;
            txtENCost.Text            = ENCost.ToString();
            txtMaximumAmmo.Text       = MaximumAmmo.ToString();
            txtMoraleRequirement.Text = MoraleRequirement.ToString();
            txtMinimumRange.Text      = MinimumRange.ToString();
            txtMaximumRange.Text      = MaximumRange.ToString();
            txtAccuracy.Text          = Accuracy.ToString();
            txtCritical.Text          = Critical.ToString();

            #region Primary

            switch (ActiveWeapon.Pri)
            {
            case WeaponPrimaryProperty.MAP:
                rbMAP.Checked = true;
                MAPAttackEditor.ListAttackchoice      = ActiveWeapon.MAPAttributes.ListChoice;
                MAPAttackEditor.txtAttackWidth.Value  = MAPAttackEditor.AttackWidth = ActiveWeapon.MAPAttributes.Width;
                MAPAttackEditor.txtAttackHeight.Value = MAPAttackEditor.AttackHeight = ActiveWeapon.MAPAttributes.Height;

                if (ActiveWeapon.MAPAttributes.Property == WeaponMAPProperties.Spread)
                {
                    MAPAttackEditor.rbSpread.Checked = true;
                }
                else if (ActiveWeapon.MAPAttributes.Property == WeaponMAPProperties.Direction)
                {
                    MAPAttackEditor.rbDirection.Checked = true;
                }
                else if (ActiveWeapon.MAPAttributes.Property == WeaponMAPProperties.Targeted)
                {
                    MAPAttackEditor.rbTargeted.Checked = true;
                }

                MAPAttackEditor.ckFriendlyFire.Checked = ActiveWeapon.MAPAttributes.FriendlyFire;
                MAPAttackEditor.txtAttackDelay.Value   = ActiveWeapon.MAPAttributes.Delay;
                break;

            case WeaponPrimaryProperty.ALL:
                rbALL.Checked = true;
                break;

            case WeaponPrimaryProperty.PLA:
                rbPLA.Checked = true;
                break;

            default:
                rbNone.Checked = true;
                break;
            }

            #endregion

            #region Secondary

            if ((ActiveWeapon.Sec & WeaponSecondaryProperty.PostMovement) == WeaponSecondaryProperty.PostMovement)
            {
                cbPostMovement.Checked = true;
            }

            if ((ActiveWeapon.Sec & WeaponSecondaryProperty.SwordCut) == WeaponSecondaryProperty.SwordCut)
            {
                cbSwordCut.Checked = true;
            }

            if ((ActiveWeapon.Sec & WeaponSecondaryProperty.ShootDown) == WeaponSecondaryProperty.ShootDown)
            {
                cbShootDown.Checked = true;
            }

            #endregion

            #region Attack type

            switch (AttackType)
            {
            case "Blank":
                rbAttackTypeBlank.Checked = true;
                break;

            case "Melee":
                rbAttackTypeMelee.Checked = true;
                break;

            case "Solid blade":
                rbAttackTypeSolidBlade.Checked = true;
                break;

            case "Energy blade":
                rbAttackTypeEnergyBlade.Checked = true;
                break;

            case "Solid shot":
                rbAttackTypeSolidShot.Checked = true;
                break;

            case "Energy shot":
                rbAttackTypeEnergyShot.Checked = true;
                break;

            case "Remote":
                rbAttackTypeRemote.Checked = true;
                break;

            case "Special":
                rbAttackTypeSpecial.Checked = true;
                break;
            }

            #endregion

            #region Terrain grades

            #region Air

            switch (DicTerrainAttribute["Air"])
            {
            case '-':
                cbAirRank.SelectedIndex = 0;
                break;

            case 'S':
                cbAirRank.SelectedIndex = 1;
                break;

            case 'A':
                cbAirRank.SelectedIndex = 2;
                break;

            case 'B':
                cbAirRank.SelectedIndex = 3;
                break;

            case 'C':
                cbAirRank.SelectedIndex = 4;
                break;

            case 'D':
                cbAirRank.SelectedIndex = 5;
                break;
            }

            #endregion

            #region Land

            switch (DicTerrainAttribute["Land"])
            {
            case '-':
                cbLandRank.SelectedIndex = 0;
                break;

            case 'S':
                cbLandRank.SelectedIndex = 1;
                break;

            case 'A':
                cbLandRank.SelectedIndex = 2;
                break;

            case 'B':
                cbLandRank.SelectedIndex = 3;
                break;

            case 'C':
                cbLandRank.SelectedIndex = 4;
                break;

            case 'D':
                cbLandRank.SelectedIndex = 5;
                break;
            }

            #endregion

            #region Sea

            switch (DicTerrainAttribute["Sea"])
            {
            case '-':
                cbSeaRank.SelectedIndex = 0;
                break;

            case 'S':
                cbSeaRank.SelectedIndex = 1;
                break;

            case 'A':
                cbSeaRank.SelectedIndex = 2;
                break;

            case 'B':
                cbSeaRank.SelectedIndex = 3;
                break;

            case 'C':
                cbSeaRank.SelectedIndex = 4;
                break;

            case 'D':
                cbSeaRank.SelectedIndex = 5;
                break;
            }

            #endregion

            #region Space

            switch (DicTerrainAttribute["Space"])
            {
            case '-':
                cbSpaceRank.SelectedIndex = 0;
                break;

            case 'S':
                cbSpaceRank.SelectedIndex = 1;
                break;

            case 'A':
                cbSpaceRank.SelectedIndex = 2;
                break;

            case 'B':
                cbSpaceRank.SelectedIndex = 3;
                break;

            case 'C':
                cbSpaceRank.SelectedIndex = 4;
                break;

            case 'D':
                cbSpaceRank.SelectedIndex = 5;
                break;
            }

            #endregion

            #endregion

            #region Attack Attributes

            if (ActiveWeapon.ArrayAttackAttributes.Length >= 1)
            {
                txtPilotSkill1.Text = ActiveWeapon.ArrayAttackAttributes[0].Name;
            }
            if (ActiveWeapon.ArrayAttackAttributes.Length >= 2)
            {
                txtPilotSkill2.Text = ActiveWeapon.ArrayAttackAttributes[1].Name;
            }
            if (ActiveWeapon.ArrayAttackAttributes.Length >= 3)
            {
                txtPilotSkill3.Text = ActiveWeapon.ArrayAttackAttributes[2].Name;
            }
            if (ActiveWeapon.ArrayAttackAttributes.Length >= 4)
            {
                txtPilotSkill4.Text = ActiveWeapon.ArrayAttackAttributes[3].Name;
            }

            #endregion

            #region Quotes

            for (int Q = 0; Q < ActiveWeapon.ListQuoteSet.Count; Q++)
            {
                Editor.dgvQuotes.Rows.Add(ActiveWeapon.ListQuoteSet[Q]);
            }

            #endregion
        }