コード例 #1
0
        public Power(Player player)
        {
            this.player                 = player;
            this.name                   = "";
            this.powerType              = PowerType.AtWill;
            this.actionType             = PowerActionType.Standard;
            this.level                  = 1;
            this.description            = "";
            this.notes                  = "";
            this.attackType             = PowerAttackType.Weapon;
            this.attackWeapon           = WeaponSlot.MainWeapon;
            this.attackAttribute        = AttributeType.Strength;
            this.defenseType            = DefenseType.AC;
            this.weaponDamageMultiplier = 1;
            this.damageType             = "";
            this.bonusDamageAttribute   = null;
            this.attackModifiers        = new BasicAdjustmentList();
            this.damageModifiers        = new BasicAdjustmentList();

            player.PropertyChanged += new PropertyChangedEventHandler(player_PropertyChanged);

            playerWeapon = Weapon;

            if (playerWeapon != null)
            {
                playerWeapon.PropertyChanged += new PropertyChangedEventHandler(playerWeapon_PropertyChanged);
            }

            attackModifiers.CollectionChanged       += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(attackModifiers_CollectionChanged);
            attackModifiers.ContainedElementChanged += new PropertyChangedEventHandler(attackModifiers_ContainedElementChanged);
            damageModifiers.CollectionChanged       += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(damageModifiers_CollectionChanged);
            damageModifiers.ContainedElementChanged += new PropertyChangedEventHandler(damageModifiers_ContainedElementChanged);
        }
コード例 #2
0
        public EditDefenseWindow(Player player, DefenseType defenseType)
        {
            this.player      = player;
            this.defenseType = defenseType;

            InitializeComponent();
        }
コード例 #3
0
ファイル: Smash.cs プロジェクト: wmartijn60/80s-game-jam
    private IEnumerator Cooldown(DefenseType defenseType, float delay)
    {
        switch (defenseType)
        {
        case DefenseType.UP:
            canAttackUp = false;
            break;

        case DefenseType.MID:
            canAttackMid = false;
            break;

        case DefenseType.DOWN:
            canAttackDown = false;
            break;
        }

        yield return(new WaitForSeconds(delay));

        switch (defenseType)
        {
        case DefenseType.UP:
            canAttackUp = true;
            break;

        case DefenseType.MID:
            canAttackMid = true;
            break;

        case DefenseType.DOWN:
            canAttackDown = true;
            break;
        }
    }
コード例 #4
0
 /// <summary>
 /// 守備適性をBrushに変換する
 /// </summary>
 /// <param name="typeValue"></param>
 /// <returns></returns>
 private Brush ConvertDefenseTypeToBrush(DefenseType typeValue)
 {
     switch (typeValue)
     {
         case DefenseType.Pitcher:
             return ResourcesHelper.RedBrush;
         case DefenseType.Catcher:
             return ResourcesHelper.BlueBrush;
         case DefenseType.First:
         case DefenseType.Second:
         case DefenseType.Third:
         case DefenseType.Short:
         case DefenseType.Infielder:
             return ResourcesHelper.YellowBrush;
         case DefenseType.Right:
         case DefenseType.Center:
         case DefenseType.Left:
         case DefenseType.Outfielder:
             return ResourcesHelper.GreenBrush;
         case DefenseType.Nothing:
             return ResourcesHelper.GrayBrush;
         default:
             throw new Exception("Invalid DefenseType");
     }
 }
コード例 #5
0
ファイル: Player.cs プロジェクト: tommy7568/CSharp-Examples
 public Player()
 {
     HP          = 50;
     currentHP   = 50;
     attackType  = AttackType.BACE;
     defenseType = DefenseType.BACE;
 }
コード例 #6
0
 public Player(long id, GameObject gameObject)
 {
     defenseType     = DefenseType.NONE;
     gameRules       = GameRules.GetInstance();
     this.id         = id;
     this.gameObject = gameObject;
     health          = 100f;
 }
コード例 #7
0
 public double getOneUnitDefense(DefenseType defenseType)
 {
     if (defenseType == DefenseType.MAGIC_DEFENSE)
     {
         return(oneUnitMagicDefense);
     }
     return(oneUnitDefense);
 }
コード例 #8
0
        public void Test_GetDefenseType_ByID_GoodResult()
        {
            int         intDefenseTypeID = 1;
            DefenseType objDefenseType   = new DefenseType();

            objDefenseType.GetDefenseType(intDefenseTypeID);

            Assert.AreEqual(intDefenseTypeID, objDefenseType.DefenseTypeID);
        }
コード例 #9
0
        public bool GetDefense(DefenseType defenseType)
        {
            if (this.defenseType == defenseType)
            {
                return(true);
            }

            return(false);
        }
コード例 #10
0
        public void Test_GetDefenseType_ByName_GoodResult()
        {
            string      strDefenseTypeName = "Will";
            DefenseType objDefenseType     = new DefenseType();

            objDefenseType.GetDefenseType(strDefenseTypeName);

            Assert.AreEqual(strDefenseTypeName, objDefenseType.DefenseTypeDescription);
        }
コード例 #11
0
        public void Test_GetDefenseType_ByID_BadResult()
        {
            int         intDefenseTypeID = 0;
            DefenseType objDefenseType   = new DefenseType();

            objDefenseType.GetDefenseType(intDefenseTypeID);

            Assert.IsNull(objDefenseType.DefenseTypeDescription);
        }
コード例 #12
0
        public void Test_GetDefenseType_ByName_BadResult()
        {
            string      strDefenseTypeName = "blah blah";
            DefenseType objDefenseType     = new DefenseType();

            objDefenseType.GetDefenseType(strDefenseTypeName);

            Assert.IsNull(objDefenseType.DefenseTypeDescription);
        }
コード例 #13
0
        public void Test_GetDefenseTypes_WithOutOrderBy_NoResult()
        {
            string strWhere   = "DefenseTypeDescription Like '%Toad%'";
            string strOrderBy = "";

            DefenseType        objDefenseType  = new DefenseType();
            List <DefenseType> lstDefenseTypes = new List <DefenseType>();

            lstDefenseTypes = objDefenseType.GetDefenseTypes(strWhere, strOrderBy);

            Assert.IsTrue(lstDefenseTypes.Count == 0);
        }
コード例 #14
0
        public DefenseValue(Player player, DefenseType defenseType)
        {
            this.player          = player;
            this.defenseType     = defenseType;
            this.miscAdjustments = new BasicAdjustmentList();

            player.PropertyChanged += new PropertyChangedEventHandler(player_PropertyChanged);

            this.playerClass = player.Class;

            if (player.Class != null)
            {
                player.Class.PropertyChanged += new PropertyChangedEventHandler(Class_PropertyChanged);
            }

            miscAdjustments.ContainedElementChanged += new PropertyChangedEventHandler(miscAdjustments_ContainedElementChanged);
            miscAdjustments.CollectionChanged       += new NotifyCollectionChangedEventHandler(miscAdjustments_CollectionChanged);
        }
コード例 #15
0
        private DefenseBase GetDefense(IEnumerable <HtmlNode> defensesNode, DefenseType type, PlayerPlanet planet)
        {
            var defenseNode    = GetDefenseNode(defensesNode, type);
            var defenseAmount  = GetDefenseAmount(defenseNode);
            var canBuildStatus = GetBuildStatus(defenseNode);
            var techReached    = canBuildStatus != "off";
            var canBuild       = techReached && canBuildStatus != "disabled";

            switch (type)
            {
            case DefenseType.RocketLauncher:
                return(new RocketLauncher(planet, defenseAmount, techReached, canBuild));

            case DefenseType.LightLaser:
                return(new LightLaser(planet, defenseAmount, techReached, canBuild));

            case DefenseType.HeavyLaser:
                return(new HeavyLaser(planet, defenseAmount, techReached, canBuild));

            case DefenseType.IonCannon:
                return(new IonCannon(planet, defenseAmount, techReached, canBuild));

            case DefenseType.GaussCannon:
                return(new GaussCannon(planet, defenseAmount, techReached, canBuild));

            case DefenseType.PlasmaTurret:
                return(new PlasmaTurret(planet, defenseAmount, techReached, canBuild));

            case DefenseType.SmallShield:
                return(new SmallShield(planet, defenseAmount, techReached, canBuild));

            case DefenseType.LargeShield:
                return(new LargeShield(planet, defenseAmount, techReached, canBuild));

            case DefenseType.AntiBallisticMissile:
                return(null);

            case DefenseType.InterplanetaryMissile:
                return(null);

            default:
                return(null);
            }
        }
コード例 #16
0
ファイル: Player.cs プロジェクト: battousai999/CharPad
        public DefenseValue GetDefenseValue(DefenseType defenseType)
        {
            switch (defenseType)
            {
            case DefenseType.AC:
                return(AcDefense);

            case DefenseType.Fortitude:
                return(FortDefense);

            case DefenseType.Reflex:
                return(ReflexDefense);

            case DefenseType.Will:
                return(WillDefense);

            default:
                throw new InvalidOperationException("Unexpected defense type value: " + Enum.Format(typeof(DefenseType), defenseType, "G"));
            }
        }
コード例 #17
0
 private HtmlNode GetDefenseNode(IEnumerable <HtmlNode> defensesNode, DefenseType type)
 {
     return(defensesNode.First(n => n.Descendants("div")
                               .Any(d => d.HasAttributes && d.Attributes.Any(a => a.Value.Contains($"defense{(int)type}")))));
 }
コード例 #18
0
ファイル: DefenseType.cs プロジェクト: koji716jp/eikannyain
        /// <summary>
        /// 概ね適性のある守備位置か
        /// </summary>
        /// <param name="position">指定された守備位置</param>
        /// <param name="type">対象メンバの守備適性</param>
        /// <returns>適性か</returns>
        public static bool MostFitDefensePosition(DefensePosition position, DefenseType type)
        {
            // 内野か外野のいずれかであれば概ね適正有りとする
            if (IsInFielder(type))
            {
                if (position == DefensePosition.First || position == DefensePosition.Second ||
                    position == DefensePosition.Third || position == DefensePosition.Short)
                {
                    return true;
                }
            }
            if (IsOutFielder(type))
            {
                if (position == DefensePosition.Right || position == DefensePosition.Center ||
                    position == DefensePosition.Left)
                {
                    return true;
                }
            }

            return false;
        }
コード例 #19
0
 public bool QueueAction( DefenseType defense )
 {
     return QueueAction( ((int)defense)+100 );
 }
コード例 #20
0
ファイル: DefenseType.cs プロジェクト: koji716jp/eikannyain
 /// <summary>
 /// 指定した守備適性が内野か(投手、捕手を含む)
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static bool IsInFielder(DefenseType type)
 {
     return type == DefenseType.First ||
            type == DefenseType.Second ||
            type == DefenseType.Third ||
            type == DefenseType.Short;
 }
コード例 #21
0
 public Defense(DefenseType defenseType)
 {
     this.defenseType = defenseType;
 }
コード例 #22
0
        public bool BeginDefense( DefenseType defensetype, bool playerInitiated )
        {
            Mobile defender = AttachedTo as Mobile;
            if ( !CanBeginCombatAction() || !CanBeginParry() )
                return false;

            if ( m_Opponent != null && !m_PerformingSequence )
                SpellHelper.Turn( defender, m_Opponent );

            StopAllActions( false );

            BaseShield shield = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield;
            BaseWeapon twohander = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;
            BaseWeapon onehander = defender.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;

            if ( ((IKhaerosMobile)defender).TrippedTimer != null ) // always same animation if tripped
            {
                StopAnimating( false );
                if ( defender.Body.Type == BodyType.Human )
                {
                    if ( twohander != null )
                        Animate( 21, 4, 1, false, false, 255 );
                    else
                        Animate( 21, 5, 1, false, false, 255 );
                }
            }
            int zMod = 0;
            if ( defender is BaseCreature )
                zMod = ((BaseCreature)defender).Height;
            switch ( (int)defensetype )
            {
                case (int)DefenseType.ParrySwing:
                {
                    IEntity from = new Entity( Server.Serial.Zero, new Point3D( defender.X, defender.Y, defender.Z + zMod ), defender.Map );
                    IEntity to = new Entity( Server.Serial.Zero, new Point3D( defender.X, defender.Y, defender.Z + 25 + zMod*2 ), defender.Map );
                    SendCombatAlerts( from, to, 7035, 3, 0, true, false, 3, 2, 9501, 1, 0, EffectLayer.Head, 0x100 );
                    if ( ((IKhaerosMobile)defender).TrippedTimer == null )
                    {
                        if ( defender.Body.Type == BodyType.Human )
                        {
                            if ( defender.Mounted )
                            {
                                if ( shield != null || twohander != null )
                                    Animate( 27, 4, 1, false, false, 255 );
                                else
                                    Animate( 28, 2, 1, false, false, 255 );
                            }
                            else
                                Animate( 14, 2, 1, false, false, 255 );
                        }
                        else
                        {
                            int[] anim = BAData.GetAnimation( defender, DefenseType.ParrySwing );
                            if ( anim != null )
                                Animate( anim[0], anim[1], 1, false, false, 255 );
                        }
                    }
                    break;
                }

                case (int)DefenseType.ParryThrust:
                {
                    IEntity from = new Entity( Server.Serial.Zero, new Point3D( defender.X, defender.Y, defender.Z + zMod ), defender.Map );
                    IEntity to = new Entity( Server.Serial.Zero, new Point3D( defender.X, defender.Y, defender.Z + 25 + zMod*2 ), defender.Map );
                    SendCombatAlerts( from, to, 7035, 3, 0, true, false, 62, 2, 9501, 1, 0, EffectLayer.Head, 0x100 );
                    if ( ((IKhaerosMobile)defender).TrippedTimer == null )
                    {
                        if ( defender.Body.Type == BodyType.Human )
                        {
                            if ( defender.Mounted )
                                if ( twohander != null )
                                    Animate( 28, 8, 1, false, false, 255 );
                                else
                                    Animate( 27, 2, 1, false, false, 255 );
                            else
                                Animate( 16, 3, 1, false, false, 255 );
                        }
                        else
                        {
                            int[] anim = BAData.GetAnimation( defender, DefenseType.ParryThrust );
                            if ( anim != null )
                                Animate( anim[0], anim[1], 1, false, false, 255 );
                        }
                    }
                    break;
                }

                case (int)DefenseType.ParryOverhead:
                {
                    IEntity from = new Entity( Server.Serial.Zero, new Point3D( defender.X, defender.Y, defender.Z + zMod ), defender.Map );
                    IEntity to = new Entity( Server.Serial.Zero, new Point3D( defender.X, defender.Y, defender.Z + 25 + zMod*2 ), defender.Map );
                    SendCombatAlerts( from, to, 7035, 3, 0, true, false, 37, 2, 9501, 1, 0, EffectLayer.Head, 0x100 );
                    if ( ((IKhaerosMobile)defender).TrippedTimer == null )
                    {
                        if ( defender.Body.Type == BodyType.Human )
                        {
                            if ( defender.Mounted )
                            {
                                if ( shield != null || onehander != null )
                                    Animate( 27, 3, 1, false, false, 255 );
                                else
                                    Animate( 27, 2, 1, false, false, 255 );

                            }
                            else
                            {
                                if ( shield != null )
                                    Animate( 12, 2, 1, false, false, 255 );
                                else
                                    Animate( 17, 1, 1, false, false, 255 );
                            }
                        }
                        else
                        {
                            int[] anim = BAData.GetAnimation( defender, DefenseType.ParryOverhead );
                            if ( anim != null )
                                Animate( anim[0], anim[1], 1, false, false, 255 );
                        }
                    }
                    break;
                }
            }

            TimeSpan delay = TimeSpan.FromSeconds( 1.5 );
            IKhaerosMobile km = defender as IKhaerosMobile;
            BaseWeapon weapon = defender.Weapon as BaseWeapon;
            if ( defender.FindItemOnLayer( Layer.TwoHanded ) is BaseShield )
            {
                // we parried with a shield
                delay -= TimeSpan.FromSeconds( 0.5 ); // parrying with shield takes 0.5s less
            }
            else if ( km.Feats.GetFeatLevel(FeatList.WeaponParrying) > 0 && defender is PlayerMobile ) // weapon parrying feat
            {
                PlayerMobile pm = defender as PlayerMobile;
                if ( weapon.NameType == pm.WeaponSpecialization || weapon.NameType == pm.SecondSpecialization )
                {
                    if ( km.Feats.GetFeatLevel(FeatList.WeaponParrying) == 1 )
                        delay -= TimeSpan.FromSeconds( 0.125 );
                    else if ( km.Feats.GetFeatLevel(FeatList.WeaponParrying) == 2 )
                        delay -= TimeSpan.FromSeconds( 0.25 );
                    else if ( km.Feats.GetFeatLevel(FeatList.WeaponParrying) == 3 )
                        delay -= TimeSpan.FromSeconds( 0.5 );
                }
            }

            m_NextDefenseAction = DateTime.Now + delay;

            m_DefenseTimer = new DefenseTimer( defender, defensetype, TimeSpan.FromSeconds( GetParryDuration() ) );
            m_DefenseTimer.Start();
            if ( BandageContext.GetContext( defender ) != null )
            {
                BandageContext.GetContext( defender ).StopHeal();
                if ( defender is IKhaerosMobile )
                {
                    if ( ((IKhaerosMobile)defender).HealingTimer != null )
                    {
                        ((IKhaerosMobile)defender).HealingTimer.Stop();
                        ((IKhaerosMobile)defender).HealingTimer = null;
                    }
                }
            }
            return true;
        }
コード例 #23
0
ファイル: Charactor.cs プロジェクト: coollemen/ZombieComing
 // Use this for initialization
 void Start()
 {
     atkType = AttackType.Normal;
     defType = DefenseType.Light;
 }
コード例 #24
0
ファイル: DefenseType.cs プロジェクト: koji716jp/eikannyain
 /// <summary>
 /// 指定した守備適性が外野か
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static bool IsOutFielder(DefenseType type)
 {
     return type == DefenseType.Right ||
            type == DefenseType.Center ||
            type == DefenseType.Left;
 }
コード例 #25
0
ファイル: DefenseBonus.cs プロジェクト: battousai999/CharPad
 public DefenseBonus(int bonus, DefenseType defense)
 {
     this.Bonus   = bonus;
     this.Defense = defense;
 }
コード例 #26
0
ファイル: DefenseTypeApi.cs プロジェクト: killvxk/War3Net
 public static DefenseType ConvertDefenseType(int i)
 {
     return(DefenseType.GetDefenseType(i));
 }
コード例 #27
0
 public bool BeginDefense( DefenseType defensetype )
 {
     return BeginDefense( defensetype, false );
 }
コード例 #28
0
ファイル: MemberCreater.cs プロジェクト: koji716jp/eikannyain
        /// <summary>
        /// 選手の作成
        /// </summary>
        /// <param name="initialAbility">初期能力の種別</param>
        /// <param name="defenseType">守備適正</param>
        /// <returns>作成した選手</returns>
        private static Player CreatePlayer(InitialAbility initialAbility, DefenseType defenseType)
        {
            // 能力値用の変数を作成
            int meet = 0;
            int power = 0;
            int run = 0;
            int defense = 0;
            int wisdom = 0;
            int fastboll = 0;
            int breakingboll = 0;
            int control = 0;
            int stamina = 0;

            BreedType breedType = BreedType.Cat_White_Normal;

            #region 種族の設定

            if (initialAbility == InitialAbility.D)
            {
                // Dの場合は天才
                if (EVManager.Instance.WhiteCatSeason)
                {
                    breedType = BreedType.Cat_White_Genius;
                }
                else if (EVManager.Instance.YellowCatSeason)
                {
                    breedType = BreedType.Cat_Yellow_Genius;
                }
                else if (EVManager.Instance.CyanCatSeason)
                {
                    breedType = BreedType.Cat_Cyan_Genius;
                }
            }
            else if (initialAbility == InitialAbility.E)
            {
                // Eの場合は普通か熱血
                if (RandomCreater.GetPercentValue() < 50)
                {
                    if (EVManager.Instance.WhiteCatSeason)
                    {
                        breedType = BreedType.Cat_White_Normal;
                    }
                    else if (EVManager.Instance.YellowCatSeason)
                    {
                        breedType = BreedType.Cat_Yellow_Normal;
                    }
                    else if (EVManager.Instance.CyanCatSeason)
                    {
                        breedType = BreedType.Cat_Cyan_Normal;
                    }
                }
                else
                {
                    if (EVManager.Instance.WhiteCatSeason)
                    {
                        breedType = BreedType.Cat_White_Dashing;
                    }
                    else if (EVManager.Instance.YellowCatSeason)
                    {
                        breedType = BreedType.Cat_Yellow_Dashing;
                    }
                    else if (EVManager.Instance.CyanCatSeason)
                    {
                        breedType = BreedType.Cat_Cyan_Dashing;
                    }
                }
            }
            else if (initialAbility == InitialAbility.F)
            {
                // Fの場合はのんきかやんちゃ
                if (RandomCreater.GetPercentValue() < 50)
                {
                    if (EVManager.Instance.WhiteCatSeason)
                    {
                        breedType = BreedType.Cat_White_Jaunty;
                    }
                    else if (EVManager.Instance.YellowCatSeason)
                    {
                        breedType = BreedType.Cat_Yellow_Jaunty;
                    }
                    else if (EVManager.Instance.CyanCatSeason)
                    {
                        breedType = BreedType.Cat_Cyan_Jaunty;
                    }
                }
                else
                {
                    if (EVManager.Instance.WhiteCatSeason)
                    {
                        breedType = BreedType.Cat_White_Blonde;
                    }
                    else if (EVManager.Instance.YellowCatSeason)
                    {
                        breedType = BreedType.Cat_Yellow_Blonde;
                    }
                    else if (EVManager.Instance.CyanCatSeason)
                    {
                        breedType = BreedType.Cat_Cyan_Blonde;
                    }
                }
            }
            else if (initialAbility == InitialAbility.G)
            {
                // Gの場合はドジ
                if (EVManager.Instance.WhiteCatSeason)
                {
                    breedType = BreedType.Cat_White_Fool;
                }
                else if (EVManager.Instance.YellowCatSeason)
                {
                    breedType = BreedType.Cat_Yellow_Fool;
                }
                else if (EVManager.Instance.CyanCatSeason)
                {
                    breedType = BreedType.Cat_Cyan_Fool;
                }
            }
            else
            {
                throw new Exception("Invalid InitialAbility");
            }

            #endregion

            SpecialPitcherAbility specialPitcherAbility = SpecialPitcherAbility.Nothing;
            SpecialFilederAbility specialFilederAbility = SpecialFilederAbility.Nothing;

            #region 特殊能力の設定

            if (defenseType == DefenseType.Pitcher)
            {
                // 投手能力の設定
                specialPitcherAbility = (SpecialPitcherAbility)RandomCreater.GetRandomValue(
                    (int)SpecialPitcherAbility.Nothing + 1,
                    (int)SpecialPitcherAbility.Invalid - 1);
            }
            else
            {
                // 野手能力の設定
                specialFilederAbility = (SpecialFilederAbility)RandomCreater.GetRandomValue(
                    (int)SpecialFilederAbility.Nothing + 1,
                    (int)SpecialFilederAbility.Invalid - 1);
            }

            #endregion

            // 左投げ、左打ちは低確率で発生
            bool isLeftThrow = false;
            bool isLeftBox = RandomCreater.GetPercentValue() < 25;
            {
                // 左投げは投手と外野手のみ
                if (defenseType == DefenseType.Pitcher || defenseType == DefenseType.Left ||
                    defenseType == DefenseType.Center || defenseType == DefenseType.Right)
                {
                    isLeftThrow = RandomCreater.GetPercentValue() < 25;

                    // 左投げは必ず左打ち
                    if (isLeftThrow)
                    {
                        isLeftBox = true;
                    }
                }
            }

            // 投手能力タイプを決定
            // (野手からコンバートする可能性があるため、野手も設定する)
            {
                int percentValue = RandomCreater.GetPercentValue();
                if (initialAbility == InitialAbility.G)
                {
                    fastboll += 2;
                    breakingboll += 2;
                    control += 2;
                    stamina += 2;
                }
                else if (percentValue < 48)
                {
                    #region 単一能力特化型

                    // 単一能力特化型
                    percentValue = RandomCreater.GetPercentValue();
                    if (percentValue < 25)
                    {
                        // 直球特化
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                fastboll += 10;
                                breakingboll += 2;
                                control += 2;
                                stamina += 2;
                                break;
                            case InitialAbility.E:
                                fastboll += 12;
                                breakingboll += 4;
                                control += 4;
                                stamina += 4;
                                break;
                            case InitialAbility.D:
                                fastboll += 14;
                                breakingboll += 2;
                                control += 8;
                                stamina += 8;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 50)
                    {
                        // 変化球特化
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                fastboll += 2;
                                breakingboll += 10;
                                control += 2;
                                stamina += 2;
                                break;
                            case InitialAbility.E:
                                fastboll += 4;
                                breakingboll += 12;
                                control += 4;
                                stamina += 4;
                                break;
                            case InitialAbility.D:
                                fastboll += 2;
                                breakingboll += 14;
                                control += 8;
                                stamina += 8;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 75)
                    {
                        // 制球特化
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                fastboll += 2;
                                breakingboll += 2;
                                control += 10;
                                stamina += 2;
                                break;
                            case InitialAbility.E:
                                fastboll += 4;
                                breakingboll += 4;
                                control += 12;
                                stamina += 4;
                                break;
                            case InitialAbility.D:
                                fastboll += 6;
                                breakingboll += 6;
                                control += 14;
                                stamina += 6;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else
                    {
                        // スタミナ特化
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                fastboll += 2;
                                breakingboll += 2;
                                control += 2;
                                stamina += 10;
                                break;
                            case InitialAbility.E:
                                fastboll += 4;
                                breakingboll += 4;
                                control += 4;
                                stamina += 12;
                                break;
                            case InitialAbility.D:
                                fastboll += 6;
                                breakingboll += 6;
                                control += 6;
                                stamina += 14;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }

                    #endregion
                }
                else if (percentValue < 96)
                {
                    #region 単一能力がちょっとだけ特化

                    percentValue = RandomCreater.GetPercentValue();
                    if (percentValue < 25)
                    {
                        // 直球強い平均
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                fastboll += 6;
                                breakingboll += 2;
                                control += 4;
                                stamina += 4;
                                break;
                            case InitialAbility.E:
                                fastboll += 8;
                                breakingboll += 4;
                                control += 6;
                                stamina += 6;
                                break;
                            case InitialAbility.D:
                                fastboll += 10;
                                breakingboll += 6;
                                control += 8;
                                stamina += 8;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 50)
                    {
                        // 変化球強い平均
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                fastboll += 2;
                                breakingboll += 6;
                                control += 4;
                                stamina += 4;
                                break;
                            case InitialAbility.E:
                                fastboll += 4;
                                breakingboll += 8;
                                control += 6;
                                stamina += 6;
                                break;
                            case InitialAbility.D:
                                fastboll += 6;
                                breakingboll += 10;
                                control += 8;
                                stamina += 8;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 75)
                    {
                        // 制球強い平均
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                fastboll += 4;
                                breakingboll += 4;
                                control += 6;
                                stamina += 2;
                                break;
                            case InitialAbility.E:
                                fastboll += 6;
                                breakingboll += 6;
                                control += 8;
                                stamina += 4;
                                break;
                            case InitialAbility.D:
                                fastboll += 8;
                                breakingboll += 8;
                                control += 10;
                                stamina += 6;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else
                    {
                        // スタミナ強い平均
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                fastboll += 4;
                                breakingboll += 4;
                                control += 2;
                                stamina += 6;
                                break;
                            case InitialAbility.E:
                                fastboll += 6;
                                breakingboll += 6;
                                control += 4;
                                stamina += 8;
                                break;
                            case InitialAbility.D:
                                fastboll += 8;
                                breakingboll += 8;
                                control += 6;
                                stamina += 10;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }

                    #endregion
                }
                else
                {
                    #region 全ての能力が同じ

                    switch (initialAbility)
                    {
                        case InitialAbility.F:
                            fastboll += 4;
                            breakingboll += 4;
                            control += 4;
                            stamina += 4;
                            break;
                        case InitialAbility.E:
                            fastboll += 6;
                            breakingboll += 6;
                            control += 6;
                            stamina += 6;
                            break;
                        case InitialAbility.D:
                            fastboll += 8;
                            breakingboll += 8;
                            control += 8;
                            stamina += 8;
                            break;
                        default:
                            throw new Exception("Invalid InitialAbility");
                    }

                    #endregion
                }
                // 野手から投手にコンバートしやすいように、野手でも投手能力を下げない
                // (以前は投手能力を下げていたが、それだとコンバートの自由度が下がる)
                //if (defenseType != DefenseType.Pitcher)
                //{
                //    fastboll -= 1;
                //    breakingboll -= 1;
                //    control -= 1;
                //    stamina -= 1;
                //}
            }

            // 野手能力タイプを決定
            {
                int percentValue = RandomCreater.GetPercentValue();
                if (initialAbility == InitialAbility.G)
                {
                    meet += 2;
                    power += 2;
                    run += 2;
                    defense += 2;
                    wisdom += 2;
                }
                else if (percentValue < 30) // 確率は100%を16パターンで割った値でだいたい分散
                {
                    // 5パターン

                    #region 単一能力特化型

                    // 単一能力特化型
                    percentValue = RandomCreater.GetPercentValue();
                    if (percentValue < 20)
                    {
                        // ミート特化
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 10;
                                power += 4;
                                run += 2;
                                defense += 2;
                                wisdom += 2;
                                break;
                            case InitialAbility.E:
                                meet += 12;
                                power += 6;
                                run += 4;
                                defense += 4;
                                wisdom += 4;
                                break;
                            case InitialAbility.D:
                                meet += 14;
                                power += 8;
                                run += 6;
                                defense += 6;
                                wisdom += 6;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 40)
                    {
                        // パワー特化
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 2;
                                power += 10;
                                run += 4;
                                defense += 2;
                                wisdom += 2;
                                break;
                            case InitialAbility.E:
                                meet += 4;
                                power += 12;
                                run += 6;
                                defense += 4;
                                wisdom += 4;
                                break;
                            case InitialAbility.D:
                                meet += 8;
                                power += 14;
                                run += 6;
                                defense += 6;
                                wisdom += 6;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 60)
                    {
                        // 走力特化
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 2;
                                power += 2;
                                run += 10;
                                defense += 4;
                                wisdom += 2;
                                break;
                            case InitialAbility.E:
                                meet += 4;
                                power += 4;
                                run += 12;
                                defense += 6;
                                wisdom += 4;
                                break;
                            case InitialAbility.D:
                                meet += 6;
                                power += 6;
                                run += 14;
                                defense += 6;
                                wisdom += 8;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 80)
                    {
                        // 守備特化
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 2;
                                power += 2;
                                run += 2;
                                defense += 10;
                                wisdom += 4;
                                break;
                            case InitialAbility.E:
                                meet += 4;
                                power += 4;
                                run += 4;
                                defense += 12;
                                wisdom += 6;
                                break;
                            case InitialAbility.D:
                                meet += 6;
                                power += 6;
                                run += 8;
                                defense += 14;
                                wisdom += 6;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else
                    {
                        // 智力特化
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 4;
                                power += 2;
                                run += 2;
                                defense += 2;
                                wisdom += 10;
                                break;
                            case InitialAbility.E:
                                meet += 6;
                                power += 4;
                                run += 4;
                                defense += 4;
                                wisdom += 12;
                                break;
                            case InitialAbility.D:
                                meet += 6;
                                power += 6;
                                run += 6;
                                defense += 8;
                                wisdom += 14;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }

                    #endregion
                }
                else if (percentValue < 94)
                {
                    // 10パターン

                    #region 2種類の能力の特化型

                    // 2種類の能力の特化型
                    percentValue = RandomCreater.GetPercentValue();
                    if (percentValue < 10)
                    {
                        // ミート+パワー
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 8;
                                power += 8;
                                run += 2;
                                defense += 1;
                                wisdom += 1;
                                break;
                            case InitialAbility.E:
                                meet += 10;
                                power += 10;
                                run += 2;
                                defense += 4;
                                wisdom += 4;
                                break;
                            case InitialAbility.D:
                                meet += 12;
                                power += 12;
                                run += 4;
                                defense += 6;
                                wisdom += 6;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 20)
                    {
                        // ミート+走力
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 8;
                                power += 1;
                                run += 8;
                                defense += 2;
                                wisdom += 1;
                                break;
                            case InitialAbility.E:
                                meet += 10;
                                power += 4;
                                run += 10;
                                defense += 2;
                                wisdom += 4;
                                break;
                            case InitialAbility.D:
                                meet += 12;
                                power += 6;
                                run += 12;
                                defense += 4;
                                wisdom += 6;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 30)
                    {
                        // ミート+守備
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 8;
                                power += 1;
                                run += 1;
                                defense += 8;
                                wisdom += 2;
                                break;
                            case InitialAbility.E:
                                meet += 10;
                                power += 4;
                                run += 4;
                                defense += 10;
                                wisdom += 2;
                                break;
                            case InitialAbility.D:
                                meet += 12;
                                power += 6;
                                run += 6;
                                defense += 12;
                                wisdom += 4;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 40)
                    {
                        // ミート+智力
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 8;
                                power += 2;
                                run += 1;
                                defense += 1;
                                wisdom += 8;
                                break;
                            case InitialAbility.E:
                                meet += 10;
                                power += 2;
                                run += 4;
                                defense += 4;
                                wisdom += 10;
                                break;
                            case InitialAbility.D:
                                meet += 12;
                                power += 4;
                                run += 6;
                                defense += 6;
                                wisdom += 12;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 50)
                    {
                        // パワー+走力
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 1;
                                power += 8;
                                run += 8;
                                defense += 1;
                                wisdom += 2;
                                break;
                            case InitialAbility.E:
                                meet += 4;
                                power += 10;
                                run += 10;
                                defense += 4;
                                wisdom += 2;
                                break;
                            case InitialAbility.D:
                                meet += 6;
                                power += 12;
                                run += 12;
                                defense += 6;
                                wisdom += 4;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 60)
                    {
                        // パワー+守備
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 1;
                                power += 8;
                                run += 2;
                                defense += 8;
                                wisdom += 1;
                                break;
                            case InitialAbility.E:
                                meet += 4;
                                power += 10;
                                run += 2;
                                defense += 10;
                                wisdom += 4;
                                break;
                            case InitialAbility.D:
                                meet += 6;
                                power += 12;
                                run += 4;
                                defense += 12;
                                wisdom += 6;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 70)
                    {
                        // パワー+智力
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 1;
                                power += 8;
                                run += 1;
                                defense += 2;
                                wisdom += 8;
                                break;
                            case InitialAbility.E:
                                meet += 4;
                                power += 10;
                                run += 4;
                                defense += 2;
                                wisdom += 10;
                                break;
                            case InitialAbility.D:
                                meet += 6;
                                power += 12;
                                run += 6;
                                defense += 4;
                                wisdom += 12;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 80)
                    {
                        // 走力+守備
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 1;
                                power += 2;
                                run += 8;
                                defense += 8;
                                wisdom += 1;
                                break;
                            case InitialAbility.E:
                                meet += 4;
                                power += 2;
                                run += 10;
                                defense += 10;
                                wisdom += 4;
                                break;
                            case InitialAbility.D:
                                meet += 6;
                                power += 4;
                                run += 12;
                                defense += 12;
                                wisdom += 6;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else if (percentValue < 90)
                    {
                        // 走力+智力
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 2;
                                power += 1;
                                run += 8;
                                defense += 1;
                                wisdom += 8;
                                break;
                            case InitialAbility.E:
                                meet += 2;
                                power += 4;
                                run += 10;
                                defense += 4;
                                wisdom += 10;
                                break;
                            case InitialAbility.D:
                                meet += 4;
                                power += 6;
                                run += 12;
                                defense += 6;
                                wisdom += 12;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }
                    else
                    {
                        // 守備+智力
                        switch (initialAbility)
                        {
                            case InitialAbility.F:
                                meet += 2;
                                power += 1;
                                run += 1;
                                defense += 8;
                                wisdom += 8;
                                break;
                            case InitialAbility.E:
                                meet += 2;
                                power += 4;
                                run += 4;
                                defense += 10;
                                wisdom += 10;
                                break;
                            case InitialAbility.D:
                                meet += 4;
                                power += 6;
                                run += 6;
                                defense += 12;
                                wisdom += 12;
                                break;
                            default:
                                throw new Exception("Invalid InitialAbility");
                        }
                    }

                    #endregion
                }
                else
                {
                    #region 全ての能力が同じ

                    switch (initialAbility)
                    {
                        case InitialAbility.F:
                            meet += 4;
                            power += 4;
                            run += 4;
                            defense += 4;
                            wisdom += 4;
                            break;
                        case InitialAbility.E:
                            meet += 6;
                            power += 6;
                            run += 6;
                            defense += 6;
                            wisdom += 6;
                            break;
                        case InitialAbility.D:
                            meet += 8;
                            power += 8;
                            run += 8;
                            defense += 8;
                            wisdom += 8;
                            break;
                        default:
                            throw new Exception("Invalid InitialAbility");
                    }

                    #endregion
                }
            }

            int upPercent = 0;
            int upCount = 0;
            switch (EVManager.Instance.SchoolGradeKindForThisYear)
            {
                case SchoolGradeKind.Week:
                    break;
                case SchoolGradeKind.Modestly:
                    upPercent = 75;
                    upCount = 1;
                    break;
                case SchoolGradeKind.MiddleRank:
                    upPercent = 50;
                    upCount = 2;
                    break;
                case SchoolGradeKind.Powerful:
                    upPercent = 50;
                    upCount = 3;
                    break;
                case SchoolGradeKind.Great:
                    upPercent = 50;
                    upCount = 4;
                    break;
                default:
                    throw new Exception("Invalid SchoolKind");
            }

            #region ランダム能力アップ

            // ランダムで能力アップ(能力のパターンが多くあるように感じさせる)
            // (オールGはオールGでないとアイデンティティがなくなるためオールGは対象外)
            while (upCount > 0 && initialAbility != InitialAbility.G)
            {
                // 2回以上アップする場合は1回目は100%アップする
                // 残り1回のアップのみ確率で判定する
                if (upCount > 1 ||
                    RandomCreater.GetPercentValue() < upPercent )
                {
                    bool overMaxAbility;

                    // 野手能力アップ
                    do
                    {
                        overMaxAbility = false;
                        int percentValue = RandomCreater.GetPercentValue();
                        if (percentValue < 20) meet += 2;
                        else if (percentValue < 40) power += 2;
                        else if (percentValue < 60) run += 2;
                        else if (percentValue < 80) defense += 2;
                        else wisdom += 2;

                        // 天才以外は能力が上限に達した場合はやりなおし
                        if (initialAbility != InitialAbility.D)
                        {
                            if (meet > Constants.MaxDisplayAbilityValueByPractice)
                            {
                                meet -= 2;
                                overMaxAbility = true;
                            }
                            if (power > Constants.MaxDisplayAbilityValueByPractice)
                            {
                                power -= 2;
                                overMaxAbility = true;
                            }
                            if (run > Constants.MaxDisplayAbilityValueByPractice)
                            {
                                run -= 2;
                                overMaxAbility = true;
                            }
                            if (defense > Constants.MaxDisplayAbilityValueByPractice)
                            {
                                defense -= 2;
                                overMaxAbility = true;
                            }
                            if (wisdom > Constants.MaxDisplayAbilityValueByPractice)
                            {
                                wisdom -= 2;
                                overMaxAbility = true;
                            }
                        }
                    } while (overMaxAbility);

                    // 投手能力アップ
                    do
                    {
                        overMaxAbility = false;
                        int percentValue = RandomCreater.GetPercentValue();
                        if (percentValue < 25) fastboll += 2;
                        else if (percentValue < 50) breakingboll += 2;
                        else if (percentValue < 75) control += 2;
                        else stamina += 2;

                        // 天才以外は能力が上限に達した場合はやりなおし
                        if (initialAbility != InitialAbility.D)
                        {
                            if (fastboll > Constants.MaxDisplayAbilityValueByPractice)
                            {
                                fastboll -= 2;
                                overMaxAbility = true;
                            }
                            if (breakingboll > Constants.MaxDisplayAbilityValueByPractice)
                            {
                                breakingboll -= 2;
                                overMaxAbility = true;
                            }
                            if (control > Constants.MaxDisplayAbilityValueByPractice)
                            {
                                control -= 2;
                                overMaxAbility = true;
                            }
                            if (stamina > Constants.MaxDisplayAbilityValueByPractice)
                            {
                                stamina -= 2;
                                overMaxAbility = true;
                            }
                        }
                    } while (overMaxAbility);
                }

                upCount--;
            }

            #endregion

            // 選手オブジェクトの作成
            Player player = new Player();
            player.Name = GetName();
            player.BreedType = breedType;
            player.FielderAbility.DefenseType = defenseType;
            player.FielderAbility.Meet = meet;
            player.FielderAbility.Power = power;
            player.FielderAbility.Run = run;
            player.FielderAbility.Defense = defense;
            player.FielderAbility.Wisdom = wisdom;
            player.FielderAbility.SpecialFilederAbility = specialFilederAbility;
            player.PitcherAbility.Fastball = fastboll;
            player.PitcherAbility.Breakingball = breakingboll;
            player.PitcherAbility.Control = control;
            player.PitcherAbility.Stamina = stamina;
            player.PitcherAbility.SpecialPitcherAbility = specialPitcherAbility;
            player.IsLeftThrow = isLeftThrow;
            player.IsLeftBox = isLeftBox;
            player.Grade = 1;
            player.AdmissionSeason = EVManager.Instance.SeasonCount;
            player.InitialAbility = initialAbility;

            // 自主練習の設定
            if (player.InitialAbility != InitialAbility.G)
            {
                AddSelfPractices(player);
            }
            else
            {
                AddSelfPracticesForG(player);
            }

            return player;
        }
コード例 #29
0
 public DefenseTimer( Mobile defender, DefenseType type, TimeSpan delay )
     : base(delay)
 {
     Priority = TimerPriority.FiftyMS;
     m_Defender = defender;
     m_Type = type;
 }
コード例 #30
0
 public DefenseBase GetDefense(Planet planet, DefenseType type) => PlayerDefense.First(d => d.BelongsTo.Id == planet.Id && d.Type == type);
コード例 #31
0
ファイル: DefenseType.cs プロジェクト: koji716jp/eikannyain
        /// <summary>
        /// 指定した守備位置が指定した守備適性で適性があるか
        /// </summary>
        /// <param name="position">指定された守備位置</param>
        /// <param name="type">対象の守備適性</param>
        /// <returns>適性か</returns>
        public static bool FitDefensePosition(DefensePosition position, DefenseType type)
        {
            // 守備位置と適性が一致する場合は適性有り
            DefenseType convertDefenseType = DefensePositionHelper.ConvertDefenseType(position);
            bool isFit = convertDefenseType == type;

            // 適性が「内野手」「外野手」の場合は、内野・外野のいずれかであれば適正有りとする
            if (type == DefenseType.Infielder)
            {
                if (position == DefensePosition.First || position == DefensePosition.Second ||
                    position == DefensePosition.Third || position == DefensePosition.Short)
                {
                    isFit = true;
                }
            }
            if (type == DefenseType.Outfielder)
            {
                if (position == DefensePosition.Right || position == DefensePosition.Center ||
                    position == DefensePosition.Left)
                {
                    isFit = true;
                }
            }

            return isFit;
        }