創作內容

1 GP

基礎傷害計算器 v1.1

作者:海星│2017-08-06 17:56:16│巴幣:2│人氣:634
根據Ainama的raw damage calculator修改而成
以C++的方式改寫,並且加入印出不重複傷害數值和它們的間距
以便快速排除錯誤數據

原理:假設傷害模型為 Displayed dmg = floor ( [ (Effective ATT excluding Add Dmg) * (BAL random number) ] * (skill multiplier & bonuses) * (crit dmg multiplier if crit procs) )
利用BAL random number是有限個的特性,以暴力法找到指定範圍中所有能符合傷害數值的有效攻擊力。

用法:五個參數分別為[技能倍率] [平衡] [有效攻擊力最小值] [有效攻擊力最大值] [精準度]
將記錄傷害數值的txt檔以重新導入的方式輸入到程式中
例:颶風連弩技能倍率0.18575 角色平衡為90 希望在10000~12000的範圍尋找符合記錄於data.txt傷害()的攻擊力 精度為0.01
./a 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 FACTOR = argc > 1 ? atof(argv[1]) : 0.0192;
  int   BAL    = argc > 2 ? atoi(argv[2]) : 90;
  float MIN    = argc > 3 ? atof(argv[3]) : 0.0;
  float MAX    = argc > 4 ? atof(argv[4]) : 12000.0;
  float STEP   = argc > 5 ? atof(argv[5]) : 0.1;
  
  cout << " FACTOR:" << FACTOR;
  cout << " BAL:" << BAL;
  cout << " MIN:" << MIN;
  cout << " MAX:" << MAX;
  cout << " STEP:" << STEP << endl;
  
  vector<int> exp_damage;
  int i,damage;

  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 raw_attack,bal;  
  vector<int> theo_damage((100-BAL)*2+1,0);
  vector<float> output;
  
  for( raw_attack = MIN; raw_attack <= MAX; raw_attack += STEP) {
    it = theo_damage.begin();
    for( bal = float(BAL)/100; bal<=1.0; bal += 0.005) {
       *it = floor( raw_attack * FACTOR * bal );
   ++it;
    }
    
    //for( it = theo_damage.begin(); it != theo_damage.end(); ++it)
    //  cout << *it << " ";
    //cout << "\n";
  
    int flag = 0;
    for( 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(raw_attack);
  }
  
  i = 0;
  for(float f=STEP; f < 0.99; i++)
f = f * 10;
  cout << fixed;
  cout.precision(i);
  
  
  for( i=0; i<output.size(); ++i )
cout << output[i] << " ";
  
  return 0;
}

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

相關創作

留言共 0 篇留言

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

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

前一篇:瑪英 - 槍凱倍率表... 後一篇:杜拉漢模式和招式...

追蹤私訊切換新版閱覽

作品資料夾

dhreekingdon幸運看見的你
給你一顆紅心~讓你能保有一整天的好心情~祝你有個愉快的一天喲(<ゝω・)~❤看更多我要大聲說昨天09:43


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

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