創作內容

1 GP

追傷倍率計算器 v1.0

作者:海星│2017-08-18 16:24:30│巴幣:2│人氣:698
承上篇(基礎傷害計算器),
更進一步地計算追傷的效果

公式:
顯示傷害 = floor( ( 基礎傷害*平衡隨機值 + 追加傷害*追傷倍率*平衡隨機值 ) * 技能倍率 )
(不考慮暴擊)

已知 基礎傷害,求 追加傷害*追傷倍率 (反過來也可以)

用法:六個參數分別為[基礎傷害] [技能倍率] [平衡] [最小值] [最大值] [精準度]
將記錄傷害數值的txt檔以重新導入的方式輸入到程式中
例:./a 10606.7 0.18575 90 10000 12000 0.01 < data.txt


#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[])
{
  float ATK    = argc > 1 ? atof(argv[1]) : 11606.65;
  float FACTOR = argc > 2 ? atof(argv[2]) : 0.0192;
  int   BAL    = argc > 3 ? atoi(argv[3]) : 90;
  float MIN    = argc > 4 ? atof(argv[4]) : 0.0;
  float MAX    = argc > 5 ? atof(argv[5]) : 12000.0;
  float STEP   = argc > 6 ? atof(argv[6]) : 0.1;
  
  cout << " ATK:" << ATK;
  cout << " FACTOR:" << FACTOR;
  cout << " BAL:" << BAL;
  cout << " MIN:" << MIN;
  cout << " MAX:" << MAX;
  cout << " STEP:" << STEP << endl;
  
  vector<int> exp_damage;
  int i;

  while(cin >> i)
    exp_damage.push_back (i);
  
    
  cout << "origin size:" << exp_damage.size() << endl;

  std::sort (exp_damage.begin(), exp_damage.end());
  
  vector<int>::iterator it;  
  it = std::unique (exp_damage.begin(), exp_damage.end());
  exp_damage.resize( std::distance(exp_damage.begin(),it) );
  
  cout << "unique size:" << exp_damage.size() << endl;
  
  int pre = *exp_damage.begin(); // 前一個數字
  for( it = exp_damage.begin(); it != exp_damage.end(); ++it) {
    cout << *it << " [ " << *it-pre << " ]\n" ;
    pre = *it;
  }
  
  float add_attack,bal_0,bal_1;  
  vector<int> theo_damage(((100-BAL)*2+1)*((100-BAL)*2+1),0);
  vector<float> output;
  
  for( add_attack = MIN; add_attack <= MAX; add_attack += STEP) {
    it = theo_damage.begin();
    for( bal_0 = float(BAL)/100; bal_0 <= 1.0; bal_0 += 0.005) {
      for( bal_1 = float(BAL)/100; bal_1 <= 1.0; bal_1 += 0.005 ) {
        *it = floor( (ATK*bal_0 + add_attack*bal_1) * FACTOR );
        ++it;
      }
    }

    int flag = 0;
    for( unsigned int i = 0; i < exp_damage.size(); i++ ) {
      it = find (theo_damage.begin(), theo_damage.end(), exp_damage[i]);
      if( it == theo_damage.end() ) {
        flag = 1;
        break;
      }
    }
   
    if( flag == 0 )
      output.push_back(add_attack);
  }
  
  i = 0;
  for(float f=STEP; f < 0.99; i++)
    f = f * 10;
  cout << fixed;
  cout.precision(i);
  
  for( unsigned int i=0; i<output.size(); ++i )
    cout << output[i] << " ";
  return 0;
}

引用網址:https://home.gamer.com.tw/TrackBack.php?sn=3688410
All rights reserved. 版權所有,保留一切權利

相關創作

留言共 0 篇留言

我要留言提醒:您尚未登入,請先登入再留言

1喜歡★starfi5h 可決定是否刪除您的留言,請勿發表違反站規文字。

前一篇:瑪英 - 過去到現今的傷... 後一篇:瑪英 - RISE傷害公...

追蹤私訊切換新版閱覽

作品資料夾

Charles021來此小屋參觀的觀眾
新篇小說上線,有興趣的觀眾歡迎來看(被學務主任喜歡的壞學生)的最新章節,最新頁數看更多我要大聲說5小時前


face基於日前微軟官方表示 Internet Explorer 不再支援新的網路標準,可能無法使用新的應用程式來呈現網站內容,在瀏覽器支援度及網站安全性的雙重考量下,為了讓巴友們有更好的使用體驗,巴哈姆特即將於 2019年9月2日 停止支援 Internet Explorer 瀏覽器的頁面呈現和功能。
屆時建議您使用下述瀏覽器來瀏覽巴哈姆特:
。Google Chrome(推薦)
。Mozilla Firefox
。Microsoft Edge(Windows10以上的作業系統版本才可使用)

face我們了解您不想看到廣告的心情⋯ 若您願意支持巴哈姆特永續經營,請將 gamer.com.tw 加入廣告阻擋工具的白名單中,謝謝 !【教學】