ベストプレープロ野球…エクセルVBAでツール作成⑦投手成長

ベスプレ画面 ゲーム

  

 

この記事は

一生遊べる野球ゲーム 【ベストプレープロ野球】

をエクセルVBAでオリジナルリーグを作成するツールを作り、自分だけの世界を楽しんでもらえる参考になればと思い書いております。

すでに自作ツールで運用している方にも良い刺激になればと思っております。

 

この記事で紹介する ツールのダウンロードはこちらから

前 回 まで

・野手シートと投手シートの選手名を自動で作成しました。

・リーグ運営の設定表作成(選手の能力・成長 決定)

・野手の初期パラメータ作成(16歳)

・野手のプロ入り後パラメータ作成(現在)

・投手の初期パラメータ作成(16歳)

⇓出来上がったプログラム

・メインモジュール  プログラム Test
・共通モジュール  プログラム Saikoro・Get_Name・Get_SeityoType・Get_Nouryoku・NouryokuUp・NouryokuDown・年齢加算
・野手編モジュール  プログラム 野手作成・Get_Daseki・Get_Type・Get_Sinrai・Get_KillLeft・Get_Daritu・野手成長
・投手編モジュール  プログラム 投手作成 ・Get_Touho ・Get_PType ・Get_Kyusoku ・Get_Kaifuku

前回で16歳時の (高校入学~1年生) 投手の能力を決定しましたので

今回もプロ入り後の年齢まで成長させたいと思います。

 

今回作成するプログラム 投手成長 では、能力変動と年齢加算と引退なども考慮して作成していきます。

投手モジュール

投手の初期能力(16歳)を作成しましたので、設定年齢まで成長させます。

1・2軍⇒18 + (Saikoro(17)) + 1 20歳~36歳まで

外人⇒25 + (Saikoro(9)) + 1 27歳~35歳まで

若手(新人)⇒18 + ((Saikoro(4) * 2) – 2) + 1 19歳~25歳まで

ここは野手と同じです。

 

前回選手作成時に設定年齢は⇑の計算式で算出されています。

実年齢 の行の下が 設定年齢です。

 

また投法が o⇒s o⇐s⇒u u⇒s に100面体で 33がでれば変わります。

タイプも100面体で 77がでれば変わります。(結構衝撃的な変化です)

 

※ただし能力の飛びぬけた指数があれば(>=235) 変わりません。

それに伴い当然能力も変化します。

 

↓のプログラムを投手編モジュールに作成します。

Public Function 投手成長(SName As String)

Dim Low As Byte ‘行
Dim Col As Byte ‘列
Dim i As Byte ‘ショートループ
Dim j As Byte ‘年齢ループ
Dim k As Byte ‘選手数分ループ
Dim L As Byte ‘設定年齢と実年齢の年数差
Dim ID As Integer ‘名前ID番号

Dim Nenrei As Byte ‘現在の年齢
Dim SetteiNenrei As Byte ‘設定年齢
Dim Nenreisa As Byte ’15歳から現在までの経過年数
Dim PStyle As String ‘投手タイプ
Dim PStyle2 As String ‘投法

Dim Kokoro(1) As String ‘心の(0)成長タイプ:(1)成長モード
Dim Waza(1) As String ‘技の(0)成長タイプ:(1)成長モード
Dim Karada(1) As String ‘体の(0)成長タイプ:(1)成長モード
Dim Avipoint As Single ‘特徴ポイント確率補正

Dim IntNoryoku As Integer ‘能力指数
Dim GetFrg As Boolean ‘引退フラグ

Dim ch As Byte

On Error GoTo err

‘変数初期設定
Low = 0
Worksheets(SName).Activate

For k = 1 To 46
Low = Low + 3
Col = 2
GetFrg = False

Cells(Low – 1, 1).Select
Selection.Font.ColorIndex = 0

If Cells(Low – 1, Col) > 1 Then

‘年齢の取得
Nenrei = Cells(Low – 1, Col)
SetteiNenrei = Cells(Low, Col)

‘成長タイプ取得
Kokoro(0) = Cells(Low – 1, Col + 1)
Waza(0) = Cells(Low – 1, Col + 2)
Karada(0) = Cells(Low – 1, Col + 3)

L = SetteiNenrei – Nenrei
For j = 1 To L
Col = 2

‘投法タイプ変更
ch = Saikoro
If ch = 33 And _
Cells(Low, Col + 6) <= 240 And _
Cells(Low, Col + 7) <= 240 And _
Cells(Low, Col + 8) <= 240 And _
Cells(Low, Col + 9) <= 240 And _
Cells(Low, Col + 10) <= 240 Then

PStyle = Right(Cells(Low – 1, Col + 4), 1)
ch = Saikoro(10)
Select Case PStyle
Case “o”
Cells(Low – 1, Col + 4) = Left(Cells(Low – 1, Col + 4), 1) & “s”
Cells(Low, Col + 7) = Cells(Low, Col + 7) + 7
Cells(Low, Col + 8) = Cells(Low, Col + 8) + 13
Case “s”
If ch < 6 Then
Cells(Low – 1, Col + 4) = Left(Cells(Low – 1, Col + 4), 1) & “o”
Cells(Low, Col + 7) = Cells(Low, Col + 7) + 13
Cells(Low, Col + 10) = Cells(Low, Col + 10) + 7
Else
Cells(Low – 1, Col + 4) = Left(Cells(Low – 1, Col + 4), 1) & “u”
Cells(Low, Col + 8) = Cells(Low, Col + 8) + 7
Cells(Low, Col + 9) = Cells(Low, Col + 9) + 13
End If
Case “u”
Cells(Low – 1, Col + 4) = Left(Cells(Low – 1, Col + 4), 1) & “s”
Cells(Low, Col + 6) = Cells(Low, Col + 6) + 7
Cells(Low, Col + 7) = Cells(Low, Col + 7) + 13
End Select
ElseIf ch = 77 And _
Cells(Low, Col + 6) <= 235 And _
Cells(Low, Col + 7) <= 235 And _
Cells(Low, Col + 8) <= 235 And _
Cells(Low, Col + 9) <= 235 And _
Cells(Low, Col + 10) <= 235 Then

PStyle = Cells(Low – 1, Col + 5)
Do
Cells(Low, Col + 5) = Saikoro
PStyle2 = Get_PType(Cells(Low, Col + 5))
Loop Until PStyle2 <> PStyle
Cells(Low – 1, Col + 5) = PStyle2

Select Case Cells(Low – 1, Col + 5)
Case “D”
Cells(Low, Col + 8) = Cells(Low, Col + 8) + 10
Cells(Low, Col + 9) = Cells(Low, Col + 9) + 10
Cells(Low, Col + 11) = Cells(Low, Col + 11) + 10
Case “C”
Cells(Low, Col + 7) = Cells(Low, Col + 7) + 10
Cells(Low, Col + 8) = Cells(Low, Col + 8) + 10
Cells(Low, Col + 11) = Cells(Low, Col + 11) + 10
Case “B”, “B+”
Cells(Low, Col + 6) = Cells(Low, Col + 6) + 10
Cells(Low, Col + 7) = Cells(Low, Col + 7) + 10
Cells(Low, Col + 10) = Cells(Low, Col + 10) + 10
Case Else
Cells(Low, Col + 7) = Cells(Low, Col + 7) + 10
Cells(Low, Col + 8) = Cells(Low, Col + 8) + 10
Cells(Low, Col + 10) = Cells(Low, Col + 10) + 10
End Select
End If

‘投手スタイル取得
PStyle = Right(Cells(Low – 1, Col + 4), 1)
PStyle2 = Left(Cells(Low – 1, Col + 5), 1)

‘年齢の再取得
Nenrei = Cells(Low – 1, Col)
‘年齢差取得
Nenreisa = Nenrei – 15 + 3
If Nenreisa >= 30 Then
Nenreisa = 29
End If

‘現在の成長モード取得
‘心の成長モードセル取得
Select Case Kokoro(0)
Case “早熟”
Kokoro(1) = “I” & CStr(Nenreisa)
Case “普通”
Kokoro(1) = “L” & CStr(Nenreisa)
Case “晩成”
Kokoro(1) = “O” & CStr(Nenreisa)
Case “安定”
Kokoro(1) = “R” & CStr(Nenreisa)
Case Else
Kokoro(1) = “U” & CStr(Nenreisa)
End Select

‘技の成長モードセル取得
Select Case Waza(0)
Case “早熟”
Waza(1) = “J” & CStr(Nenreisa)
Case “普通”
Waza(1) = “M” & CStr(Nenreisa)
Case “晩成”
Waza(1) = “P” & CStr(Nenreisa)
Case “安定”
Waza(1) = “S” & CStr(Nenreisa)
Case Else
Waza(1) = “V” & CStr(Nenreisa)
End Select

‘体の成長モードセル取得
Select Case Karada(0)
Case “早熟”
Karada(1) = “K” & CStr(Nenreisa)
Case “普通”
Karada(1) = “N” & CStr(Nenreisa)
Case “晩成”
Karada(1) = “Q” & CStr(Nenreisa)
Case “安定”
Karada(1) = “T” & CStr(Nenreisa)
Case Else
Karada(1) = “W” & CStr(Nenreisa)
End Select

‘心技体成長モード取得
Kokoro(1) = Sheets(“設定表”).Range(Kokoro(1))
Waza(1) = Sheets(“設定表”).Range(Waza(1))
Karada(1) = Sheets(“設定表”).Range(Karada(1))

Col = Col + 6
Avipoint = 0

‘球速
‘アベレージポイント判定
Avipoint = Cells(Low + 1, Col)

‘能力指数Up
IntNoryoku = Cells(Low, Col)
Call NouryokuUp(Karada(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku

‘能力指数Down
IntNoryoku = Cells(Low, Col)
Call NouryokuDown(Karada(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku

If PStyle2 = “B” Then
IntNoryoku = IntNoryoku + 8
ElseIf PStyle2 = “A” Then
IntNoryoku = IntNoryoku + 7
End If

‘能力値決定
Cells(Low – 1, Col) = Get_Kyusoku(IntNoryoku, PStyle)

‘変数の値変更
Col = Col + 1

‘切れ決定
‘アベレージポイント判定
Avipoint = Cells(Low + 1, Col)

‘能力指数Up
IntNoryoku = Cells(Low, Col)
Call NouryokuUp(Waza(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku

‘能力指数Down
IntNoryoku = Cells(Low, Col)
Call NouryokuDown(Waza(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku
‘能力値決定
If Right(PStyle, 1) = “s” Then
IntNoryoku = IntNoryoku + 8
ElseIf Right(PStyle, 1) = “u” Then
IntNoryoku = IntNoryoku + 5
End If

If PStyle2 = “A” Then
IntNoryoku = IntNoryoku + 7
ElseIf PStyle2 = “C” Then
IntNoryoku = IntNoryoku + 7
ElseIf PStyle2 = “D” Then
IntNoryoku = IntNoryoku + 3
End If

Cells(Low – 1, Col) = Get_Nouryoku(IntNoryoku)

‘変数の値変更
Col = Col + 1

‘制球決定
‘アベレージポイント判定
Avipoint = Cells(Low + 1, Col)

‘能力指数Up
IntNoryoku = Cells(Low, Col)
Call NouryokuUp(Waza(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku

‘能力指数Down
IntNoryoku = Cells(Low, Col)
Call NouryokuDown(Waza(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku
‘能力値決定
If Right(PStyle, 1) = “s” Then
IntNoryoku = IntNoryoku + 7
ElseIf Right(PStyle, 1) = “u” Then
IntNoryoku = IntNoryoku + 10
End If

If PStyle2 = “B” Then
IntNoryoku = IntNoryoku + 6
ElseIf PStyle2 = “C” Then
IntNoryoku = IntNoryoku + 7
ElseIf PStyle2 = “D” Then
IntNoryoku = IntNoryoku + 5
End If

Cells(Low – 1, Col) = Get_Nouryoku(IntNoryoku)

‘変数の値変更
Col = Col + 1

‘安定決定
‘アベレージポイント判定
Avipoint = Cells(Low + 1, Col)

‘能力指数Up
IntNoryoku = Cells(Low, Col)
Call NouryokuUp(Kokoro(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku

‘能力指数Down
IntNoryoku = Cells(Low, Col)
Call NouryokuDown(Kokoro(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku

‘能力値決定
If Right(PStyle, 1) = “u” Then
IntNoryoku = IntNoryoku + 10
ElseIf Right(PStyle, 1) = “s” Then
IntNoryoku = IntNoryoku + 5
End If

If PStyle2 = “D” Then
IntNoryoku = IntNoryoku + 7
End If

Cells(Low – 1, Col) = Get_Nouryoku(IntNoryoku)

‘変数の値変更
Col = Col + 1

‘球質決定
‘アベレージポイント判定
Avipoint = Cells(Low + 1, Col)

‘能力指数Up
IntNoryoku = Cells(Low, Col)
Call NouryokuUp(Karada(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku

‘能力指数Down
IntNoryoku = Cells(Low, Col)
Call NouryokuDown(Karada(1), IntNoryoku, , Avipoint)
Cells(Low, Col) = IntNoryoku

‘能力値決定
If PStyle2 = “B” Then
IntNoryoku = IntNoryoku + 6
End If

Cells(Low – 1, Col) = Get_Nouryoku(IntNoryoku)

‘変数の値変更
Col = Col + 1

‘技術決定
‘アベレージポイント判定
Avipoint = Cells(Low + 1, Col)

‘能力指数Up
IntNoryoku = Cells(Low, Col)
Call NouryokuUp(Kokoro(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku

‘能力指数Down
IntNoryoku = Cells(Low, Col)
Call NouryokuDown(Kokoro(1), IntNoryoku, , Avipoint)
Cells(Low, Col) = IntNoryoku
‘能力値決定
If Right(PStyle, 1) = “u” Then
IntNoryoku = IntNoryoku + 10
End If

If PStyle2 = “D” Then
IntNoryoku = IntNoryoku + 5
End If

Cells(Low – 1, Col) = Get_Nouryoku(IntNoryoku)

‘変数の値変更
Col = Col + 1

‘体力決定
‘アベレージポイント判定
Avipoint = Cells(Low + 1, Col)

‘能力指数Up
IntNoryoku = Cells(Low, Col)
Call NouryokuUp(Karada(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku

‘能力指数Down
IntNoryoku = Cells(Low, Col)
Call NouryokuDown(Karada(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku

‘能力値決定
If Right(PStyle, 1) = “u” Then
IntNoryoku = IntNoryoku + 5
End If

IntNoryoku = IntNoryoku + 20

Cells(Low – 1, Col) = Get_Nouryoku(IntNoryoku)

‘変数の値変更
Col = Col + 1

‘回復決定
‘アベレージポイント判定
Avipoint = Cells(Low + 1, Col)

‘能力指数Up
IntNoryoku = Cells(Low, Col)
Call NouryokuUp(Waza(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku

‘能力指数Down
IntNoryoku = Cells(Low, Col)
Call NouryokuDown(Waza(1), IntNoryoku, GetFrg, Avipoint)
Cells(Low, Col) = IntNoryoku

‘能力値決定
Cells(Low – 1, Col) = Get_Kaifuku(IntNoryoku)

‘年齢を加算
Col = Col – 13
Cells(Low – 1, Col) = (Cells(Low – 1, Col)) + 1
If Cells(Low – 1, Col) >= 50 Then
GetFrg = True
End If

Col = Col + 13
‘引退フラグ
If GetFrg = True Then
Cells(Low – 1, Col + 1) = “退団”

For i = 0 To 6
Cells(Low – 1, Col – i) = “”
Next i

Else
Select Case k
Case Is <= 6
Cells(Low – 1, Col + 1) = “先発”
Cells(Low, Col + 1) = k
Case Is <= 10
Cells(Low – 1, Col + 1) = “中継ぎ”
Cells(Low, Col + 1) = k
Case Is <= 12
Cells(Low – 1, Col + 1) = “抑え”
Cells(Low, Col + 1) = k
Case Is <= 36
Cells(Low – 1, Col + 1) = “2軍”
Cells(Low, Col + 1) = k
Case Is <= 41
Cells(Low – 1, Col + 1) = “外人”
Cells(Low, Col + 1) = k
Case Else
Cells(Low – 1, Col + 1) = “新人”
Cells(Low, Col + 1) = k
End Select
End If
Next j

End If

Next k

Exit Function

err:
MsgBox err.Description
Resume Next

End Function

 

↑ここまでです。

 

プログラム を 動かして 確認する。

これで 初期の投手選手(成長後)のデータを作る準備が出来上がりました。

 

開発画面、一番下のイミティエイト ウィンドウ に

投手成長(”T_野手”)

と打ち込んで ENTER キーを打ち込めば

投手⑦完成

16歳からプロ入り後現在の年齢まで成長した、各パラメータの入ったシートが出来上がります。

⇓ 前回作成した 投手選手データ(16歳)

投手④4初期能力入りどうですか? 少しは成長してますね。

 

年齢欄が黄色の選手は30歳を超えているのでそろそろ能力が落ちていきます。

 

見比べると 能力が高い選手は30歳を超えています。

投手の寿命は短い(一つでも能力が低いと使えない…)ので

選手数も多めです。能力も高めです。

 

これで投手は完了です。

これで1チーム分の開幕前の選手データが出来上がりました。

 

次回はリーグ情報を作成し、12球団分の選手を一気に作ってみたいと思います。

 

⇐前の記事 【目次】 次の記事⇒

 

ベストプレープロ野球を知りたい方は

ベストプレープロ野球…自由度が最強で一生遊べる野球ゲーム

 

ベストプレープロ野球 ソフトのお求めは⇓の画像から(Win,GBA,PS2)

  

タイトルとURLをコピーしました