-
-
Save ir-norn/ce08a6102bee2eb37eb9623a442dc091 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 精錬値と成功率 | |
class Success_rate | |
attr_accessor :rate , # 成功率Array | |
:cost , # 精錬費用Array | |
:pote , # ポテンシャル | |
:v, # 最初の精錬値 | |
:arrival_value, # 目標の精錬値 | |
:arrival_pote, # 目標のポテンシャル減少 | |
:level , # 装備レベル | |
:rarity # 装備レアリティ :未使用 | |
def initialize type: , pote: , arrival_pote: , v: , arrival_value: , level: 1 , rarity: :white | |
@pote = pote | |
@arrival_pote = arrival_pote | |
@v = v | |
@arrival_value = arrival_value | |
@level = level | |
@rarity = rarity | |
if type == 0 # 武器 # 精錬成功率 | |
@rate = [ | |
100, 100, 100, 100, 100, | |
88, 78, 68, 59, | |
51, 51, 51, 51, 51, 51, 51, | |
] + [51]*100 | |
@cost = | |
[ | |
[:dymmy] , | |
[ 115 ,193 ,386 ,579 ,772 ,965 ,1158 ,1351 ,1544 ,1737 ,1930 ,2123 ,2316 ,2509 ,2702 ] , | |
[ 493 ,821 ,1643 ,2465 ,3287 ,4108 ,4930 ,5752 ,6574 ,7395 ,8217 ,9039 ,9861 ,10682 ,11504 ] , | |
[ 2562 , 4271 , 8542 , 12813 , 17085 ,21356 ,25627 ,29898 ,34170 , 38441 , 42712 , 46983 , 51255 , 55526 , 59797 ] , | |
[ 8265 ,13775 ,27551 ,41326 ,55102 ,68878 ,82653 ,96429 ,110205 ,123980 , 137756 , 151531 , 165307 , 179083 , 192858 ] , | |
[ 14229, 23715, 47430, 71145, 94860,118575,142290,166005,189720, 213435, 237150, 260865, 284580, 308295, 332010 ] , | |
[ 27725, 46209, 92418, 138628, 184837,231046,277256,323465, 369675, 415884, 462093, 508303, 554512, 600721, 646931 ] , | |
[ 32643, 54405, 108810, 163215, 217620,272025,326430,380835, 435240, 489645, 544050, 598455, 652860, 707265, 761670 ] , | |
[ 111530, 185883, 371767, 557651, 743535, 929418, 1115302, 1301186, 1487070, 1672953, 1858837, 2044721, 2230605, 2416488, 2602372 ] , | |
][@level] | |
elsif type == 1 # 防具 | |
end | |
end | |
end | |
s = Success_rate.new type:0 , pote:8 , arrival_pote:3 , v:0 , arrival_value:12 , | |
rarity: :white , level: 6 | |
print "精錬値:+" , s.v , " " | |
print "武器ランク:#{s.level}" , " " | |
print "レアリティ:#{s.rarity}" , "\n" | |
print "#{s.pote}のポテンシャルが#{s.arrival_pote}になるか精錬値#{s.arrival_value}になるまで精錬する" , "\n" | |
stack = [] | |
total = 0 | |
rate = s.rate | |
loop do | |
total += s.cost[s.v] | |
if rate[s.v] >= rand(100) # Success | |
s.v += 1 | |
else # Failure | |
s.v -= 1 # if rate[s.v-1] != 100 | |
s.pote -= 1 | |
end | |
stack << s.v | |
if s.v >= s.arrival_value or s.pote <= s.arrival_pote | |
break | |
end | |
end | |
print "---精錬しみゅ---\n" | |
print "ポテンシャル残り:" , s.pote , "\n" | |
print "精錬値:+" , s.v , "\n" | |
print "歴史:" | |
p stack | |
# | |
#class Integer ; def jpy_comma ;self.to_s.gsub(/(\d)(?=(\d{3})+(?!\d))/, '\1,') ; end ; end | |
def comma n ;n.to_s.gsub(/(\d)(?=(\d{3})+(?!\d))/, '\1,') ; end | |
#print "費用:#{total.jpy_comma}" | |
print "費用:#{ comma total}" | |
__END__ | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title></title> | |
<pre> | |
<script type="text/javascript" language="javascript"> | |
function onButtonClick() { | |
target = document.getElementById("output"); | |
// target.innerText = document.forms.id_form1.id_textBox1.value; | |
// target.innerText += String(Number(document.forms.id_form1.id_textBox1.value) + Number(document.forms.id_form1.id_textBox2.value)) ; | |
target.innerText = "\n"; | |
target.innerText += "精錬値:" + document.forms.id_form1.id_textBox1.value + " "; | |
target.innerText += "装備ランク:" + document.forms.id_form1.id_textBox2.value + " "; | |
target.innerText += "レアリティ:" + document.forms.id_form1.id_textBox3.value + "\n\n"; | |
target.innerText += document.forms.id_form1.id_textBox4.value + "のポテンシャルが" + document.forms.id_form1.id_textBox5.value + "になるか精錬値" + document.forms.id_form1.id_textBox6.value + "になるまで精錬する" + "\n\n"; | |
// 最初の精錬値 , ポテンシャル ループで使う | |
var sv = Number(document.forms.id_form1.id_textBox1.value); | |
var pote = Number(document.forms.id_form1.id_textBox4.value); | |
var sav = Number(document.forms.id_form1.id_textBox6.value); | |
var sap = Number(document.forms.id_form1.id_textBox5.value); | |
// | |
var level = Number(document.forms.id_form1.id_textBox2.value); | |
var cost = | |
[ | |
["dymmy"] , | |
[ 115 ,193 ,386 ,579 ,772 ,965 ,1158 ,1351 ,1544 ,1737 ,1930 ,2123 ,2316 ,2509 ,2702 ] , | |
[ 493 ,821 ,1643 ,2465 ,3287 ,4108 ,4930 ,5752 ,6574 ,7395 ,8217 ,9039 ,9861 ,10682 ,11504 ] , | |
[ 2562 , 4271 , 8542 , 12813 , 17085 ,21356 ,25627 ,29898 ,34170 , 38441 , 42712 , 46983 , 51255 , 55526 , 59797 ] , | |
[ 8265 ,13775 ,27551 ,41326 ,55102 ,68878 ,82653 ,96429 ,110205 ,123980 , 137756 , 151531 , 165307 , 179083 , 192858 ] , | |
[ 14229, 23715, 47430, 71145, 94860,118575,142290,166005,189720, 213435, 237150, 260865, 284580, 308295, 332010 ] , | |
[ 27725, 46209, 92418, 138628, 184837,231046,277256,323465, 369675, 415884, 462093, 508303, 554512, 600721, 646931 ] , | |
[ 32643, 54405, 108810, 163215, 217620,272025,326430,380835, 435240, 489645, 544050, 598455, 652860, 707265, 761670 ] , | |
[ 111530, 185883, 371767, 557651, 743535, 929418, 1115302, 1301186, 1487070, 1672953, 1858837, 2044721, 2230605, 2416488, 2602372 ] , | |
][level] | |
var rate = [ | |
100, 100, 100, 100, 100, | |
88, 78, 68, 59, | |
51, 51, 51, 51, 51, 51, 51, | |
51, 51, 51, 51, 51, 51, 51, | |
] | |
var stack = []; | |
var total = 0; | |
for (var i = 0; i < 99999; i++) { | |
total += cost[sv] ; | |
if(rate[sv] >= Math.random()*100){ | |
sv += 1; | |
} else { | |
sv -= 1; | |
pote -= 1; | |
} | |
stack.push(sv); | |
if(sv >= sav || pote <= sap) { break ; } | |
} // for | |
target.innerText += "---------精錬しみゅ--------\n\n"; | |
target.innerText += "ポンテンシャル残り:" + pote +"\n\n"; | |
target.innerText += "精錬値:+" + sv +"\n\n"; | |
target.innerText += "歴史:"; | |
target.innerText += "["; | |
for (var i = 0; i < stack.length; i++) { | |
target.innerText += String( stack[i] ); | |
if(i!=stack.length-1){target.innerText += ", ";} | |
} | |
target.innerText += "]"; | |
target.innerText += "\n\n"; | |
target.innerText += "費用:" + total.toLocaleString() + "\n\n"; | |
// document.write ( total.toLocaleString() ); | |
} | |
</script> | |
</head> | |
<body > | |
Tos精錬シミュレータ<br> | |
<form name="form1" id="id_form1" action=""> | |
装備 | |
<input name="textBox1" id="id_textBox0" type="text" value="武器" disabled /><br> | |
精錬値 | |
<input name="textBox1" id="id_textBox1" type="text" value="0" /><br> | |
装備ランク | |
<input name="textBox2" id="id_textBox2" type="text" value="1" /><br> | |
レアリティ | |
<input name="textBox3" id="id_textBox3" type="text" value="白" disabled /><br> | |
ポテンシャル | |
<input name="textBox4" id="id_textBox4" type="text" value="10" /><br> | |
目標ポテ | |
<input name="textBox5" id="id_textBox5" type="text" value="1" /><br> | |
目標精錬値 | |
<input name="textBox6" id="id_textBox6" type="text" value="12" /><br> | |
<input type="button" value="Exec" onclick="onButtonClick();" /> | |
</form> | |
<hr/> | |
<div id="output"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment