ノーマル考察
今日はこんなツールを使ってみます。
HP×防御×特防/(防御+特防)が最大になる配分を求められます。
以下javaのソース
import java.applet.*; import java.awt.*; import java.awt.event.*; public class TaikyuC extends Applet implements ActionListener { TextField hsn=new TextField("100",6); TextField bsn=new TextField("100",6); TextField dsn=new TextField("100",6); TextField hkn=new TextField("31",6); TextField bkn=new TextField("31",6); TextField dkn=new TextField("31",6); TextField lvn=new TextField("50",5); TextField tdn=new TextField("508",8); Choice seikaku =new Choice(); Button button = new Button("計算"); int hsk=0,bsk=0,dsk=0,hkk=0,bkk=0,dkk=0,lvk=0,tdk=0; int tdl,hds,bds,dds,fk,fs,zan,bho,dho,sei=0; int hss,bss,dss,bhs,dhs; int hst,bst,dst; // 初期処理 public void init() { add(new Label("HP種族値")); add(hsn); add(new Label("防御種族値")); add(bsn); add(new Label("特防種族値")); add(dsn); add(new Label("HP個体値")); add(hkn); add(new Label("防御個体値")); add(bkn); add(new Label("特防個体値")); add(dkn); add(new Label("レベル")); add(lvn); add(new Label("振れる努力値")); add(tdn); seikaku.addItem("防御上昇"); seikaku.addItem("特防上昇"); seikaku.addItem("防御下降"); seikaku.addItem("特防下降"); seikaku.addItem("のうてんき"); seikaku.addItem("おとなしい"); seikaku.addItem("上記以外"); add(seikaku); add(BorderLayout.CENTER, button); button.addActionListener(this); } // ボタンクリック public void actionPerformed(ActionEvent e) { fs=0; hsk = Integer.parseInt(hsn.getText()); bsk = Integer.parseInt(bsn.getText()); dsk = Integer.parseInt(dsn.getText()); hkk = Integer.parseInt(hkn.getText()); bkk = Integer.parseInt(bkn.getText()); dkk = Integer.parseInt(dkn.getText()); lvk = Integer.parseInt(lvn.getText()); tdk = Integer.parseInt(tdn.getText()); if ( tdk > 510 ){ tdk = 510;} tdl = tdk/4 ; sei = seikaku.getSelectedIndex(); if (sei==0){ bho=1 ;dho=0; }else{ if (sei==1){ bho=0 ;dho=1; }else{ if (sei==2){ bho=-1;dho=0; }else{ if (sei==3){ bho=0 ;dho=-1; }else{ if (sei==4){ bho=1 ;dho=-1; }else{ if (sei==5){ bho=-1;dho=1; }else{ if (sei==6){ bho=0;dho=0; } } } } } } } for ( int bdk=0 ; bdk<=63 && bdk<=tdl ; bdk++ ){ bst = status( bsk, bkk, bdk, bho, lvk); for ( int ddk=0 ; ddk<=63 && bdk+ddk<=tdl ; ddk++){ dst = status( dsk, dkk, ddk, dho, lvk); int hdk = tdl - bdk - ddk; if ( hdk > 63 ) { hdk=63;} hst = ( hsk*2 + hkk + hdk )*lvk /100 +lvk +10 ; fk = hst * bst * dst / ( bst + dst ) ; if ( fk > fs ) { fs = fk ; hds = hdk; hss = hst; bds = bdk; bss = bst; dds = ddk; dss = dst; } } } repaint(); } public void paint(Graphics g){ g.drawString("最適な配分は",10,100); g.drawString("HP" + hds*4 +": 防御" + bds*4 +": 特防" + dds*4,10,120); zan = tdk-hds*4-bds*4-dds*4; g.drawString("あまり" + zan,10,160); g.drawString("実際のステータス" + hss +":" +bss+":"+dss,10,180); g.drawString("参考" + fs,10,200); } static int status(int shu, int ko, int d, int ho, int l){ int st = ( shu*2 + ko + d )*l /100 +5 ; st = st + ho * st /10; return st; } }