瀏覽代碼

Stats get number formatting. Fixed some number rendering bugs. Fixed a few text bugs

tags/v0.7.0
Fen Dweller 7 年之前
父節點
當前提交
050bd13ee3
共有 3 個檔案被更改,包括 25 行新增8 行删除
  1. +13
    -5
      game.js
  2. +4
    -2
      stroll.html
  3. +8
    -1
      units.js

+ 13
- 5
game.js 查看文件

@@ -942,24 +942,32 @@ function female_orgasm(vol)
update([sound,line,linesummary,newline]);
}

function transformNumbers(line)
{
return line.toString().replace(/[0-9]+(\.[0-9]+)?(e\+[0-9]+)?/g, function(text) { return number(text, numbers); });
}

function update(lines = [])
{
var log = document.getElementById("log");

lines.forEach(function (x) {
var line = document.createElement('div');
line.innerHTML = x.replace(/[0-9]+(\.[0-9]+)?(e\+[0-9]+)?/g, function(text) { return number(text, numbers); });
line.innerHTML = transformNumbers(x);
log.appendChild(line);
});

if (lines.length > 0)
log.scrollTop = log.scrollHeight;

document.getElementById("height").innerHTML = "Height: " + length(macro.height, unit);
document.getElementById("mass").innerHTML = "Mass: " + mass(macro.mass, unit);
document.getElementById("height").innerHTML = "Height: " + transformNumbers(length(macro.height, unit));
document.getElementById("mass").innerHTML = "Mass: " + transformNumbers(mass(macro.mass, unit));
document.getElementById("arousal").innerHTML = "Arousal: " + round(macro.arousal,0) + "%";
document.getElementById("cum").innerHTML = "Cum: " + volume(macro.cumStorage.amount,unit,false) + "/" + volume(macro.cumStorage.limit,unit,false);
document.getElementById("femcum").innerHTML = "Femcum: " + volume(macro.femcumStorage.amount,unit,false) + "/" + volume(macro.femcumStorage.limit,unit,false);
document.getElementById("cum").innerHTML = "Cum: " + transformNumbers(volume(macro.cumStorage.amount,unit,false))
document.getElementById("cumPercent").innerHTML = Math.round(macro.cumStorage.amount / macro.cumStorage.limit * 100) + "%";
document.getElementById("femcum").innerHTML = "Femcum: " + transformNumbers(volume(macro.femcumStorage.amount,unit,false));
document.getElementById("femcumPercent").innerHTML = Math.round(macro.femcumStorage.amount / macro.femcumStorage.limit * 100) + "%";


for (var type in victims) {
if (victims.hasOwnProperty(type)) {


+ 4
- 2
stroll.html 查看文件

@@ -18,12 +18,14 @@
<div class=stat-line id=mass></div>
<div class=stat-line id=arousal></div>
<div class=stat-line id=cum></div>
<div class=stat-line id=cumPercent></div>
<div class=stat-line id=femcum></div>
<div class=stat-line id=femcumPercent></div>
</div>
</div>
<div id=log-area>
<div id=log>
<div>Welcome to Stroll 0.2.7</div>
<div>Welcome to Stroll 0.2.8</div>
<div><b>This game features 18+ content</b></div>
<div><a href="https://chemicalcrux.org/stroll">Changelog</a></div>
<div>It's a nice day for a walk</div>
@@ -52,7 +54,7 @@


<div class=option-container id=option-panel>
<p>Welcome to Stroll 0.2.7</p>
<p>Welcome to Stroll 0.2.8</p>
<p><b>This game features 18+ content</b></p>
<a href="https://chemicalcrux.org/stroll">Changelog</a>
<br>


+ 8
- 1
units.js 查看文件

@@ -14,6 +14,9 @@ function number(value, type="full", precision=3) {

function number_words(value) {
var scale = Math.floor(Math.log(value) / Math.log(1000));
if (scale < 0) {
return value.toString();
}
switch(scale) {
case 0: return value.toString();
case 1: return Math.round(value / 1e3).toString() + " thousand";
@@ -41,9 +44,11 @@ function number_words(value) {
}

function number_words_repeated(value) {
var scale = Math.floor(Math.log(value) / Math.log(1000));
if (value == Infinity)
return "a lot of";
var scale = Math.floor(Math.log(value) / Math.log(1000));
if (scale < 0)
return value.toString();
switch(scale) {
case 0: return value.toString();
case 1: return Math.round(value / 1e3).toString() + " thousand";
@@ -58,6 +63,8 @@ function number_words_repeated(value) {

function number_prefix(value) {
var scale = Math.floor(Math.log(value) / Math.log(1000));
if (scale < 0)
return value.toString();
switch(scale) {
case 0: return value.toString();
case 1: return Math.round(value / 1e3).toString() + "K";


Loading…
取消
儲存