mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2025-07-13 15:52:44 +08:00
update daily
This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -8,7 +8,7 @@
|
||||
"name": "Launch Chrome",
|
||||
"request": "launch",
|
||||
"type": "pwa-chrome",
|
||||
"url": "http://172.27.192.1:8000/public/index.html",
|
||||
"url": "http://127.0.0.1:8000/public/index.html",
|
||||
"webRoot": "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"x":0,
|
||||
"type":"View",
|
||||
"selectedBox":16,
|
||||
"selecteID":77,
|
||||
"selectedBox":10,
|
||||
"selecteID":150,
|
||||
"props":{"width":1125,"sceneColor":"#000000","sceneBg":"laya/views/view/CyberTheme/CyberSummary.png","runtime":"ViewBase","height":2436},
|
||||
"nodeParent":-1,
|
||||
"label":"View",
|
||||
@ -403,14 +403,13 @@
|
||||
"props":{"width":120,"left":0,"height":120,"centerY":0},
|
||||
"nodeParent":17,
|
||||
"label":"Box",
|
||||
"isOpen":true,
|
||||
"isOpen":false,
|
||||
"isDirectory":true,
|
||||
"isAniNode":true,
|
||||
"hasChild":true,
|
||||
"compId":18,
|
||||
"child":[
|
||||
{
|
||||
"x":75,
|
||||
"type":"Image",
|
||||
"props":{"skin":"images/icons/icon_chr@3x.png","scaleY":1.1,"scaleX":1.1,"centerY":0,"centerX":0},
|
||||
"nodeParent":18,
|
||||
@ -439,9 +438,9 @@
|
||||
{
|
||||
"x":60,
|
||||
"type":"Box",
|
||||
"props":{"top":20,"runtime":"ColorFilterItem","right":240,"left":255,"bottom":20},
|
||||
"props":{"var":"boxCharmGrade","top":20,"runtime":"ColorFilterItem","right":240,"name":"boxCharmGrade","left":255,"bottom":20},
|
||||
"nodeParent":17,
|
||||
"label":"Box",
|
||||
"label":"Box(boxCharmGrade)",
|
||||
"isOpen":true,
|
||||
"isDirectory":true,
|
||||
"isAniNode":true,
|
||||
@ -460,6 +459,19 @@
|
||||
"compId":199,
|
||||
"child":[
|
||||
]
|
||||
},
|
||||
{
|
||||
"x":75,
|
||||
"type":"Label",
|
||||
"props":{"var":"labCharm","text":"100","strokeColor":"#323232","stroke":8,"name":"labCharm","fontSize":50,"font":"方正像素12","color":"#ffffff","centerY":0,"centerX":0,"anchorY":0.5,"anchorX":0.5,"align":"center"},
|
||||
"nodeParent":200,
|
||||
"label":"Label(labCharm)",
|
||||
"isDirectory":false,
|
||||
"isAniNode":true,
|
||||
"hasChild":false,
|
||||
"compId":251,
|
||||
"child":[
|
||||
]
|
||||
}]
|
||||
},
|
||||
{
|
||||
@ -530,9 +542,9 @@
|
||||
{
|
||||
"x":60,
|
||||
"type":"Box",
|
||||
"props":{"top":20,"runtime":"ColorFilterItem","right":240,"left":255,"bottom":20},
|
||||
"props":{"var":"boxIntelligenceGrade","top":20,"runtime":"ColorFilterItem","right":240,"name":"boxIntelligenceGrade","left":255,"bottom":20},
|
||||
"nodeParent":47,
|
||||
"label":"Box",
|
||||
"label":"Box(boxIntelligenceGrade)",
|
||||
"isOpen":true,
|
||||
"isDirectory":true,
|
||||
"isAniNode":true,
|
||||
@ -551,6 +563,19 @@
|
||||
"compId":212,
|
||||
"child":[
|
||||
]
|
||||
},
|
||||
{
|
||||
"x":75,
|
||||
"type":"Label",
|
||||
"props":{"var":"labIntelligence","text":"100","strokeColor":"#323232","stroke":8,"name":"labIntelligence","fontSize":50,"font":"方正像素12","color":"#ffffff","centerY":0,"centerX":0,"anchorY":0.5,"anchorX":0.5,"align":"center"},
|
||||
"nodeParent":211,
|
||||
"label":"Label(labIntelligence)",
|
||||
"isDirectory":false,
|
||||
"isAniNode":true,
|
||||
"hasChild":false,
|
||||
"compId":249,
|
||||
"child":[
|
||||
]
|
||||
}]
|
||||
},
|
||||
{
|
||||
@ -621,9 +646,9 @@
|
||||
{
|
||||
"x":60,
|
||||
"type":"Box",
|
||||
"props":{"top":20,"runtime":"ColorFilterItem","right":240,"left":255,"bottom":20},
|
||||
"props":{"var":"boxStrengthGrade","top":20,"runtime":"ColorFilterItem","right":240,"name":"boxStrengthGrade","left":255,"bottom":20},
|
||||
"nodeParent":77,
|
||||
"label":"Box",
|
||||
"label":"Box(boxStrengthGrade)",
|
||||
"isOpen":true,
|
||||
"isDirectory":true,
|
||||
"isAniNode":true,
|
||||
@ -642,6 +667,19 @@
|
||||
"compId":214,
|
||||
"child":[
|
||||
]
|
||||
},
|
||||
{
|
||||
"x":75,
|
||||
"type":"Label",
|
||||
"props":{"var":"labStrength","text":"100","strokeColor":"#323232","stroke":8,"name":"labStrength","fontSize":50,"font":"方正像素12","color":"#ffffff","centerY":0,"centerX":0,"anchorY":0.5,"anchorX":0.5,"align":"center"},
|
||||
"nodeParent":213,
|
||||
"label":"Label(labStrength)",
|
||||
"isDirectory":false,
|
||||
"isAniNode":true,
|
||||
"hasChild":false,
|
||||
"compId":246,
|
||||
"child":[
|
||||
]
|
||||
}]
|
||||
},
|
||||
{
|
||||
@ -712,9 +750,9 @@
|
||||
{
|
||||
"x":60,
|
||||
"type":"Box",
|
||||
"props":{"top":20,"runtime":"ColorFilterItem","right":240,"left":255,"bottom":20},
|
||||
"props":{"var":"boxMoneyGrade","top":20,"runtime":"ColorFilterItem","right":240,"name":"boxMoneyGrade","left":255,"bottom":20},
|
||||
"nodeParent":107,
|
||||
"label":"Box",
|
||||
"label":"Box(boxMoneyGrade)",
|
||||
"isOpen":true,
|
||||
"isDirectory":true,
|
||||
"isAniNode":true,
|
||||
@ -733,6 +771,19 @@
|
||||
"compId":216,
|
||||
"child":[
|
||||
]
|
||||
},
|
||||
{
|
||||
"x":75,
|
||||
"type":"Label",
|
||||
"props":{"var":"labMoney","text":"100","strokeColor":"#323232","stroke":8,"name":"labMoney","fontSize":50,"font":"方正像素12","color":"#ffffff","centerY":0,"centerX":0,"anchorY":0.5,"anchorX":0.5,"align":"center"},
|
||||
"nodeParent":215,
|
||||
"label":"Label(labMoney)",
|
||||
"isDirectory":false,
|
||||
"isAniNode":true,
|
||||
"hasChild":false,
|
||||
"compId":250,
|
||||
"child":[
|
||||
]
|
||||
}]
|
||||
},
|
||||
{
|
||||
@ -803,9 +854,9 @@
|
||||
{
|
||||
"x":60,
|
||||
"type":"Box",
|
||||
"props":{"top":20,"runtime":"ColorFilterItem","right":240,"left":255,"bottom":20},
|
||||
"props":{"var":"boxSpiritGrade","top":20,"runtime":"ColorFilterItem","right":240,"name":"boxSpiritGrade","left":255,"bottom":20},
|
||||
"nodeParent":195,
|
||||
"label":"Box",
|
||||
"label":"Box(boxSpiritGrade)",
|
||||
"isOpen":true,
|
||||
"isDirectory":true,
|
||||
"isAniNode":true,
|
||||
@ -824,6 +875,19 @@
|
||||
"compId":218,
|
||||
"child":[
|
||||
]
|
||||
},
|
||||
{
|
||||
"x":75,
|
||||
"type":"Label",
|
||||
"props":{"var":"labSpirit","text":"100","strokeColor":"#323232","stroke":8,"name":"labSpirit","fontSize":50,"font":"方正像素12","color":"#ffffff","centerY":0,"centerX":0,"anchorY":0.5,"anchorX":0.5,"align":"center"},
|
||||
"nodeParent":217,
|
||||
"label":"Label(labSpirit)",
|
||||
"isDirectory":false,
|
||||
"isAniNode":true,
|
||||
"hasChild":false,
|
||||
"compId":252,
|
||||
"child":[
|
||||
]
|
||||
}]
|
||||
},
|
||||
{
|
||||
@ -1009,17 +1073,18 @@
|
||||
"props":{"x":10,"width":1000,"name":"buttonGroup","height":200,"centerX":0,"bottom":70},
|
||||
"nodeParent":1,
|
||||
"label":"Box(buttonGroup)",
|
||||
"isOpen":false,
|
||||
"isOpen":true,
|
||||
"isDirectory":true,
|
||||
"isAniNode":true,
|
||||
"hasChild":true,
|
||||
"compId":10,
|
||||
"child":[
|
||||
{
|
||||
"x":30,
|
||||
"type":"Button",
|
||||
"props":{"y":100,"x":250,"width":500,"skin":"images/button/button_main@3x.png","name":"btnRandomAllocate","label":"UI_Remake_Again","centerY":0,"centerX":0},
|
||||
"props":{"y":100,"x":250,"width":500,"var":"btnAgain","skin":"images/button/button_main@3x.png","name":"btnAgain","label":"UI_Remake_Again","centerY":0,"centerX":0},
|
||||
"nodeParent":10,
|
||||
"label":"Button(btnRandomAllocate)",
|
||||
"label":"Button(btnAgain)",
|
||||
"isOpen":true,
|
||||
"isDirectory":true,
|
||||
"isAniNode":true,
|
||||
@ -1027,6 +1092,7 @@
|
||||
"compId":150,
|
||||
"child":[
|
||||
{
|
||||
"x":45,
|
||||
"type":"Box",
|
||||
"props":{},
|
||||
"nodeParent":150,
|
||||
@ -1207,6 +1273,7 @@
|
||||
}]
|
||||
},
|
||||
{
|
||||
"x":45,
|
||||
"type":"Box",
|
||||
"props":{},
|
||||
"nodeParent":150,
|
||||
@ -1286,13 +1353,14 @@
|
||||
"props":{"visible":false,"name":"colorBox"},
|
||||
"nodeParent":1,
|
||||
"label":"VBox(colorBox)",
|
||||
"isOpen":false,
|
||||
"isOpen":true,
|
||||
"isDirectory":true,
|
||||
"isAniNode":true,
|
||||
"hasChild":true,
|
||||
"compId":210,
|
||||
"child":[
|
||||
{
|
||||
"x":30,
|
||||
"type":"Label",
|
||||
"props":{"y":0,"var":"colorGrade0","text":"#ccccccff","fontSize":40,"font":"方正像素12","color":"#cccccc"},
|
||||
"nodeParent":210,
|
||||
@ -1305,6 +1373,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"x":30,
|
||||
"type":"Label",
|
||||
"props":{"y":10,"var":"colorGrade1","text":"#55fffeff","fontSize":40,"font":"方正像素12","color":"#55fffe"},
|
||||
"nodeParent":210,
|
||||
@ -1317,6 +1386,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"x":30,
|
||||
"type":"Label",
|
||||
"props":{"y":20,"var":"colorGrade2","text":"#b17cffff","fontSize":40,"font":"方正像素12","color":"#b17cff"},
|
||||
"nodeParent":210,
|
||||
@ -1329,6 +1399,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"x":30,
|
||||
"type":"Label",
|
||||
"props":{"y":30,"var":"colorGrade3","text":"#ffce45ff","fontSize":40,"font":"方正像素12","color":"#ffce45"},
|
||||
"nodeParent":210,
|
||||
|
@ -1,41 +0,0 @@
|
||||
export function getRate(type, value) {
|
||||
switch(type) {
|
||||
case 'times':
|
||||
if(value >= 100) return {2:6};
|
||||
if(value >= 70) return {2:5};
|
||||
if(value >= 50) return {2:4};
|
||||
if(value >= 30) return {2:3};
|
||||
if(value >= 10) return {2:2};
|
||||
return {2: 1};
|
||||
case 'achievement':
|
||||
if(value >= 100) return {3:6};
|
||||
if(value >= 70) return {3:5};
|
||||
if(value >= 50) return {3:4};
|
||||
if(value >= 30) return {3:3};
|
||||
if(value >= 10) return {3:2};
|
||||
return {3:1};
|
||||
default: return {};
|
||||
}
|
||||
}
|
||||
|
||||
export function getGrade(type, value) {
|
||||
switch(type) {
|
||||
case 'times':
|
||||
case 'achievement':
|
||||
if(value >= 100) return 3;
|
||||
if(value >= 50) return 2;
|
||||
if(value >= 10) return 1;
|
||||
return 0;
|
||||
case 'talentRate':
|
||||
if(value >= 0.9) return 3;
|
||||
if(value >= 0.6) return 2;
|
||||
if(value >= 0.3) return 1;
|
||||
return 0;
|
||||
case 'eventRate':
|
||||
if(value >= 0.6) return 3;
|
||||
if(value >= 0.4) return 2;
|
||||
if(value >= 0.2) return 1;
|
||||
return 0;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
@ -1,89 +0,0 @@
|
||||
const data = {
|
||||
"CHR": [
|
||||
{"judge": "地狱", "grade": 0},
|
||||
{"min":1, "judge": "折磨", "grade": 0},
|
||||
{"min":2, "judge": "不佳", "grade": 0},
|
||||
{"min":4, "judge": "普通", "grade": 0},
|
||||
{"min":7, "judge": "优秀", "grade": 1},
|
||||
{"min":9, "judge": "罕见", "grade": 2},
|
||||
{"min":11, "judge": "逆天", "grade": 3},
|
||||
],
|
||||
"MNY": [
|
||||
{"judge": "地狱", "grade": 0},
|
||||
{"min":1, "judge": "折磨", "grade": 0},
|
||||
{"min":2, "judge": "不佳", "grade": 0},
|
||||
{"min":4, "judge": "普通", "grade": 0},
|
||||
{"min":7, "judge": "优秀", "grade": 1},
|
||||
{"min":9, "judge": "罕见", "grade": 2},
|
||||
{"min":11, "judge": "逆天", "grade": 3},
|
||||
],
|
||||
"SPR": [
|
||||
{"judge": "地狱", "grade": 0},
|
||||
{"min":1, "judge": "折磨", "grade": 0},
|
||||
{"min":2, "judge": "不幸", "grade": 0},
|
||||
{"min":4, "judge": "普通", "grade": 0},
|
||||
{"min":7, "judge": "幸福", "grade": 1},
|
||||
{"min":9, "judge": "极乐", "grade": 2},
|
||||
{"min":11, "judge": "天命", "grade": 3},
|
||||
],
|
||||
"INT": [
|
||||
{"judge": "地狱", "grade": 0},
|
||||
{"min":1, "judge": "折磨", "grade": 0},
|
||||
{"min":2, "judge": "不佳", "grade": 0},
|
||||
{"min":4, "judge": "普通", "grade": 0},
|
||||
{"min":7, "judge": "优秀", "grade": 1},
|
||||
{"min":9, "judge": "罕见", "grade": 2},
|
||||
{"min":11, "judge": "逆天", "grade": 3},
|
||||
{"min":21, "judge": "识海", "grade": 3},
|
||||
{"min":131, "judge": "元神", "grade": 3},
|
||||
{"min":501, "judge": "仙魂", "grade": 3},
|
||||
],
|
||||
"STR": [
|
||||
{"judge": "地狱", "grade": 0},
|
||||
{"min":1, "judge": "折磨", "grade": 0},
|
||||
{"min":2, "judge": "不佳", "grade": 0},
|
||||
{"min":4, "judge": "普通", "grade": 0},
|
||||
{"min":7, "judge": "优秀", "grade": 1},
|
||||
{"min":9, "judge": "罕见", "grade": 2},
|
||||
{"min":11, "judge": "逆天", "grade": 3},
|
||||
{"min":21, "judge": "凝气", "grade": 3},
|
||||
{"min":101, "judge": "筑基", "grade": 3},
|
||||
{"min":401, "judge": "金丹", "grade": 3},
|
||||
{"min":1001, "judge": "元婴", "grade": 3},
|
||||
{"min":2001, "judge": "仙体", "grade": 3},
|
||||
],
|
||||
"AGE": [
|
||||
{"judge": "胎死腹中", "grade": 0},
|
||||
{"min":1, "judge": "早夭", "grade": 0},
|
||||
{"min":10, "judge": "少年", "grade": 0},
|
||||
{"min":18, "judge": "盛年", "grade": 0},
|
||||
{"min":40, "judge": "中年", "grade": 0},
|
||||
{"min":60, "judge": "花甲", "grade": 1},
|
||||
{"min":70, "judge": "古稀", "grade": 1},
|
||||
{"min":80, "judge": "杖朝", "grade": 2},
|
||||
{"min":90, "judge": "南山", "grade": 2},
|
||||
{"min":95, "judge": "不老", "grade": 3},
|
||||
{"min":100, "judge": "修仙", "grade": 3},
|
||||
{"min":500, "judge": "仙寿", "grade": 3},
|
||||
],
|
||||
"SUM": [
|
||||
{"judge": "地狱", "grade": 0},
|
||||
{"min":41, "judge": "折磨", "grade": 0},
|
||||
{"min":50, "judge": "不佳", "grade": 0},
|
||||
{"min":60, "judge": "普通", "grade": 0},
|
||||
{"min":80, "judge": "优秀", "grade": 1},
|
||||
{"min":100, "judge": "罕见", "grade": 2},
|
||||
{"min":110, "judge": "逆天", "grade": 3},
|
||||
{"min":120, "judge": "传说", "grade": 3},
|
||||
]
|
||||
}
|
||||
|
||||
function summary(type, value) {
|
||||
let length = data[type].length;
|
||||
while(length--) {
|
||||
const {min, judge, grade} = data[type][length];
|
||||
if(min==void 0 || value >= min) return {judge, grade};
|
||||
}
|
||||
}
|
||||
|
||||
export { summary };
|
@ -44,4 +44,22 @@ function listRandom(list) {
|
||||
return list[Math.floor(Math.random() * list.length)];
|
||||
}
|
||||
|
||||
export { clone, max, min, sum, average, weightRandom, listRandom };
|
||||
function getListValuesMap(list, fn) {
|
||||
const map = {};
|
||||
list.forEach(key=>map[key] = fn(key));
|
||||
return map;
|
||||
}
|
||||
|
||||
function mapConvert(map, fn) {
|
||||
for(const key in map)
|
||||
map[key] = fn(key, map[key]);
|
||||
}
|
||||
|
||||
function getConvertedMap(map, fn) {
|
||||
const newMap = {};
|
||||
for(const key in map)
|
||||
newMap[key] = fn(key, map[key]);
|
||||
return newMap;
|
||||
}
|
||||
|
||||
export { clone, max, min, sum, average, weightRandom, listRandom, getListValuesMap, mapConvert, getConvertedMap };
|
@ -47,4 +47,44 @@ export default ({
|
||||
|
||||
UI_Final_Age: 'Age',
|
||||
UI_Total_Judge: 'Judge',
|
||||
|
||||
'UI_Judge_Level_0': '地狱',
|
||||
'UI_Judge_Level_1': '折磨',
|
||||
'UI_Judge_Level_2': '不佳',
|
||||
'UI_Judge_Level_3': '普通',
|
||||
'UI_Judge_Level_4': '优秀',
|
||||
'UI_Judge_Level_5': '罕见',
|
||||
'UI_Judge_Level_6': '逆天',
|
||||
'UI_Judge_Level_7': '传说',
|
||||
|
||||
'UI_Spirit_Judge_Level_0': '地狱',
|
||||
'UI_Spirit_Judge_Level_1': '折磨',
|
||||
'UI_Spirit_Judge_Level_2': '不幸',
|
||||
'UI_Spirit_Judge_Level_3': '普通',
|
||||
'UI_Spirit_Judge_Level_4': '幸福',
|
||||
'UI_Spirit_Judge_Level_5': '极乐',
|
||||
'UI_Spirit_Judge_Level_6': '天命',
|
||||
|
||||
'UI_AGE_Judge_Level_0': '胎死腹中',
|
||||
'UI_AGE_Judge_Level_1': '早夭',
|
||||
'UI_AGE_Judge_Level_2': '少年',
|
||||
'UI_AGE_Judge_Level_3': '盛年',
|
||||
'UI_AGE_Judge_Level_4': '中年',
|
||||
'UI_AGE_Judge_Level_5': '花甲',
|
||||
'UI_AGE_Judge_Level_6': '古稀',
|
||||
'UI_AGE_Judge_Level_7': '杖朝',
|
||||
'UI_AGE_Judge_Level_8': '南山',
|
||||
'UI_AGE_Judge_Level_9': '不老',
|
||||
'UI_AGE_Judge_Level_10': '修仙',
|
||||
'UI_AGE_Judge_Level_11': '仙寿',
|
||||
|
||||
'UI_Intelligence_Judge_Level_7': '识海',
|
||||
'UI_Intelligence_Judge_Level_8': '元神',
|
||||
'UI_Intelligence_Judge_Level_9': '仙魂',
|
||||
|
||||
'UI_Strength_Judge_Level_7': '凝气',
|
||||
'UI_Strength_Judge_Level_8': '筑基',
|
||||
'UI_Strength_Judge_Level_9': '金丹',
|
||||
'UI_Strength_Judge_Level_10': '元婴',
|
||||
'UI_Strength_Judge_Level_11': '仙体',
|
||||
});
|
@ -46,4 +46,44 @@ export default ({
|
||||
|
||||
UI_Final_Age: '享年',
|
||||
UI_Total_Judge: '总评',
|
||||
|
||||
'UI_Judge_Level_0': '地狱',
|
||||
'UI_Judge_Level_1': '折磨',
|
||||
'UI_Judge_Level_2': '不佳',
|
||||
'UI_Judge_Level_3': '普通',
|
||||
'UI_Judge_Level_4': '优秀',
|
||||
'UI_Judge_Level_5': '罕见',
|
||||
'UI_Judge_Level_6': '逆天',
|
||||
'UI_Judge_Level_7': '传说',
|
||||
|
||||
'UI_Spirit_Judge_Level_0': '地狱',
|
||||
'UI_Spirit_Judge_Level_1': '折磨',
|
||||
'UI_Spirit_Judge_Level_2': '不幸',
|
||||
'UI_Spirit_Judge_Level_3': '普通',
|
||||
'UI_Spirit_Judge_Level_4': '幸福',
|
||||
'UI_Spirit_Judge_Level_5': '极乐',
|
||||
'UI_Spirit_Judge_Level_6': '天命',
|
||||
|
||||
'UI_AGE_Judge_Level_0': '胎死腹中',
|
||||
'UI_AGE_Judge_Level_1': '早夭',
|
||||
'UI_AGE_Judge_Level_2': '少年',
|
||||
'UI_AGE_Judge_Level_3': '盛年',
|
||||
'UI_AGE_Judge_Level_4': '中年',
|
||||
'UI_AGE_Judge_Level_5': '花甲',
|
||||
'UI_AGE_Judge_Level_6': '古稀',
|
||||
'UI_AGE_Judge_Level_7': '杖朝',
|
||||
'UI_AGE_Judge_Level_8': '南山',
|
||||
'UI_AGE_Judge_Level_9': '不老',
|
||||
'UI_AGE_Judge_Level_10': '修仙',
|
||||
'UI_AGE_Judge_Level_11': '仙寿',
|
||||
|
||||
'UI_Intelligence_Judge_Level_7': '识海',
|
||||
'UI_Intelligence_Judge_Level_8': '元神',
|
||||
'UI_Intelligence_Judge_Level_9': '仙魂',
|
||||
|
||||
'UI_Strength_Judge_Level_7': '凝气',
|
||||
'UI_Strength_Judge_Level_8': '筑基',
|
||||
'UI_Strength_Judge_Level_9': '金丹',
|
||||
'UI_Strength_Judge_Level_10': '元婴',
|
||||
'UI_Strength_Judge_Level_11': '仙体',
|
||||
});
|
132
src/index.js
132
src/index.js
@ -33,13 +33,137 @@ location.search.substr(1).split('&').forEach(item => {
|
||||
core.config({
|
||||
defaultPropertyPoints: 20, // default number of points for a property
|
||||
talentSelectLimit: 3, // max number of talents that can be selected
|
||||
propertyAllocateLimit: [0, 10], // scoop of properties that can be allocated
|
||||
propertyAllocateLimit: [0, 10], // scoop of properties that can be allocated,
|
||||
defaultPropertys: { SPR: 5 }, // default properties
|
||||
talentConfig: { // config for talent
|
||||
talentPullCount: 10, // number of talents to pull from the talent pool
|
||||
talentRate: { 1:100, 2:10, 3:1, total: 1000 }, // rate of talent pull
|
||||
additions: {
|
||||
TMS: [
|
||||
[ 10, { 2: 1 }],
|
||||
[ 30, { 2: 2 }],
|
||||
[ 50, { 2: 3 }],
|
||||
[ 70, { 2: 4 }],
|
||||
[100, { 2: 5 }],
|
||||
],
|
||||
CACHV: [
|
||||
[ 10, { 2: 1 }],
|
||||
[ 30, { 2: 2 }],
|
||||
[ 50, { 2: 3 }],
|
||||
[ 70, { 2: 4 }],
|
||||
[100, { 2: 5 }],
|
||||
]
|
||||
},
|
||||
},
|
||||
propertyConfig: { // config for property
|
||||
judge: {
|
||||
// type: [min, grade, judge]
|
||||
RTLT: [
|
||||
[ 0, 0],
|
||||
[ 0.3, 1],
|
||||
[ 0.6, 2],
|
||||
[ 0.9, 3],
|
||||
],
|
||||
REVT: [
|
||||
[ 0, 0],
|
||||
[ 0.2, 1],
|
||||
[ 0.4, 2],
|
||||
[ 0.6, 3],
|
||||
],
|
||||
TMS: [
|
||||
[ 0, 0, 'UI_Remake_Times_Judge_Level_0'],
|
||||
[ 10, 1, 'UI_Remake_Times_Judge_Level_1'],
|
||||
[ 30, 1, 'UI_Remake_Times_Judge_Level_2'],
|
||||
[ 50, 2, 'UI_Remake_Times_Judge_Level_3'],
|
||||
[ 70, 2, 'UI_Remake_Times_Judge_Level_4'],
|
||||
[ 100, 3, 'UI_Remake_Times_Judge_Level_5'],
|
||||
],
|
||||
CACHV: [
|
||||
[ 0, 0, 'UI_Achievement_Count_Judge_Level_0'],
|
||||
[ 10, 1, 'UI_Achievement_Count_Judge_Level_1'],
|
||||
[ 30, 1, 'UI_Achievement_Count_Judge_Level_2'],
|
||||
[ 50, 2, 'UI_Achievement_Count_Judge_Level_3'],
|
||||
[ 70, 2, 'UI_Achievement_Count_Judge_Level_4'],
|
||||
[ 100, 3, 'UI_Achievement_Count_Judge_Level_5'],
|
||||
],
|
||||
HCHR: [
|
||||
[ 0, 0, 'UI_Judge_Level_0'],
|
||||
[ 1, 0, 'UI_Judge_Level_1'],
|
||||
[ 2, 0, 'UI_Judge_Level_2'],
|
||||
[ 4, 0, 'UI_Judge_Level_3'],
|
||||
[ 7, 1, 'UI_Judge_Level_4'],
|
||||
[ 9, 2, 'UI_Judge_Level_5'],
|
||||
[ 11, 3, 'UI_Judge_Level_6'],
|
||||
],
|
||||
HMNY: [
|
||||
[ 0, 0, 'UI_Judge_Level_0'],
|
||||
[ 1, 0, 'UI_Judge_Level_1'],
|
||||
[ 2, 0, 'UI_Judge_Level_2'],
|
||||
[ 4, 0, 'UI_Judge_Level_3'],
|
||||
[ 7, 1, 'UI_Judge_Level_4'],
|
||||
[ 9, 2, 'UI_Judge_Level_5'],
|
||||
[ 11, 3, 'UI_Judge_Level_6'],
|
||||
],
|
||||
HSPR: [
|
||||
[ 0, 0, 'UI_Spirit_Judge_Level_0'],
|
||||
[ 1, 0, 'UI_Spirit_Judge_Level_1'],
|
||||
[ 2, 0, 'UI_Spirit_Judge_Level_2'],
|
||||
[ 4, 0, 'UI_Spirit_Judge_Level_3'],
|
||||
[ 7, 1, 'UI_Spirit_Judge_Level_4'],
|
||||
[ 9, 2, 'UI_Spirit_Judge_Level_5'],
|
||||
[ 11, 3, 'UI_Spirit_Judge_Level_6'],
|
||||
],
|
||||
HINT: [
|
||||
[ 0, 0, 'UI_Judge_Level_0'],
|
||||
[ 1, 0, 'UI_Judge_Level_1'],
|
||||
[ 2, 0, 'UI_Judge_Level_2'],
|
||||
[ 4, 0, 'UI_Judge_Level_3'],
|
||||
[ 7, 1, 'UI_Judge_Level_4'],
|
||||
[ 9, 2, 'UI_Judge_Level_5'],
|
||||
[ 11, 3, 'UI_Judge_Level_6'],
|
||||
[ 21, 3, 'UI_Intelligence_Judge_Level_7'],
|
||||
[ 131, 3, 'UI_Intelligence_Judge_Level_8'],
|
||||
[ 501, 3, 'UI_Intelligence_Judge_Level_9'],
|
||||
],
|
||||
HSTR: [
|
||||
[ 0, 0, 'UI_Judge_Level_0'],
|
||||
[ 1, 0, 'UI_Judge_Level_1'],
|
||||
[ 2, 0, 'UI_Judge_Level_2'],
|
||||
[ 4, 0, 'UI_Judge_Level_3'],
|
||||
[ 7, 1, 'UI_Judge_Level_4'],
|
||||
[ 9, 2, 'UI_Judge_Level_5'],
|
||||
[ 11, 3, 'UI_Judge_Level_6'],
|
||||
[ 21, 3, 'UI_Strength_Judge_Level_7'],
|
||||
[ 101, 3, 'UI_Strength_Judge_Level_8'],
|
||||
[ 401, 3, 'UI_Strength_Judge_Level_9'],
|
||||
[1001, 3, 'UI_Strength_Judge_Level_10'],
|
||||
[2001, 3, 'UI_Strength_Judge_Level_11'],
|
||||
],
|
||||
HAGE: [
|
||||
[ 0, 0, 'UI_AGE_Judge_Level_0'],
|
||||
[ 1, 0, 'UI_AGE_Judge_Level_1'],
|
||||
[ 10, 0, 'UI_AGE_Judge_Level_2'],
|
||||
[ 18, 0, 'UI_AGE_Judge_Level_3'],
|
||||
[ 40, 0, 'UI_AGE_Judge_Level_4'],
|
||||
[ 60, 1, 'UI_AGE_Judge_Level_5'],
|
||||
[ 70, 1, 'UI_AGE_Judge_Level_6'],
|
||||
[ 80, 2, 'UI_AGE_Judge_Level_7'],
|
||||
[ 90, 2, 'UI_AGE_Judge_Level_8'],
|
||||
[ 95, 3, 'UI_AGE_Judge_Level_9'],
|
||||
[ 100, 3, 'UI_AGE_Judge_Level_10'],
|
||||
[ 500, 3, 'UI_AGE_Judge_Level_11'],
|
||||
],
|
||||
SUM: [
|
||||
[ 0, 0, 'UI_Judge_Level_0'],
|
||||
[ 41, 0, 'UI_Judge_Level_1'],
|
||||
[ 50, 0, 'UI_Judge_Level_2'],
|
||||
[ 60, 0, 'UI_Judge_Level_3'],
|
||||
[ 80, 1, 'UI_Judge_Level_4'],
|
||||
[ 100, 2, 'UI_Judge_Level_5'],
|
||||
[ 110, 3, 'UI_Judge_Level_6'],
|
||||
[ 120, 3, 'UI_Judge_Level_7'],
|
||||
],
|
||||
},
|
||||
},
|
||||
defaultPropertys: {
|
||||
SPR: 5,
|
||||
}
|
||||
})
|
||||
game.start(query);
|
||||
|
@ -16,9 +16,10 @@ class Achievement {
|
||||
|
||||
initial({achievements}) {
|
||||
this.#achievements = achievements;
|
||||
return this.count;
|
||||
}
|
||||
|
||||
count() {
|
||||
get count() {
|
||||
return Object.keys(this.#achievements).length;
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,10 @@ class Event {
|
||||
return b;
|
||||
});
|
||||
}
|
||||
return this.count;
|
||||
}
|
||||
|
||||
count() {
|
||||
get count() {
|
||||
return Object.keys(this.#events).length;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { clone, weightRandom } from '../functions/util.js'
|
||||
import { clone, weightRandom, getListValuesMap, getConvertedMap } from '../functions/util.js'
|
||||
import Property from './property.js';
|
||||
import Event from './event.js';
|
||||
import Talent from './talent.js';
|
||||
@ -29,10 +29,14 @@ class Life {
|
||||
loadJSON('events'),
|
||||
loadJSON('achievement'),
|
||||
]);
|
||||
this.#property.initial({age});
|
||||
this.#talent.initial({talents});
|
||||
this.#event.initial({events});
|
||||
this.#achievement.initial({achievements});
|
||||
|
||||
const total = {
|
||||
[this.PropertyTypes.TACEV]: this.#achievement.initial({achievements}),
|
||||
[this.PropertyTypes.TEVT]: this.#event.initial({events}),
|
||||
[this.PropertyTypes.TTLT]: this.#talent.initial({talents}),
|
||||
};
|
||||
|
||||
this.#property.initial({age, total});
|
||||
}
|
||||
|
||||
config({
|
||||
@ -41,12 +45,14 @@ class Life {
|
||||
propertyAllocateLimit = [0, 10], // scoop of properties that can be allocated
|
||||
defaultPropertys = {}, // default propertys
|
||||
talentConfig, // config for talent
|
||||
propertyConfig, // config for property
|
||||
} = {}) {
|
||||
this.#defaultPropertyPoints = defaultPropertyPoints;
|
||||
this.#talentSelectLimit = talentSelectLimit;
|
||||
this.#propertyAllocateLimit = propertyAllocateLimit;
|
||||
this.#defaultPropertys = defaultPropertys;
|
||||
this.#talent.config(talentConfig);
|
||||
this.#property.config(propertyConfig);
|
||||
}
|
||||
|
||||
restart(allocation) {
|
||||
@ -60,7 +66,7 @@ class Life {
|
||||
this.doTalent()
|
||||
this.#property.restartLastStep();
|
||||
this.#achievement.achieve(
|
||||
this.#achievement.Opportunity.START,
|
||||
this.AchievementOpportunity.START,
|
||||
this.#property
|
||||
)
|
||||
return contents;
|
||||
@ -84,7 +90,7 @@ class Life {
|
||||
|
||||
const content = [talentContent, eventContent].flat();
|
||||
this.#achievement.achieve(
|
||||
this.#achievement.Opportunity.TRAJECTORY,
|
||||
this.AchievementOpportunity.TRAJECTORY,
|
||||
this.#property
|
||||
)
|
||||
return { age, content, isEnd };
|
||||
@ -106,8 +112,8 @@ class Life {
|
||||
}
|
||||
|
||||
doTalent(talents) {
|
||||
if(talents) this.#property.change(this.#property.TYPES.TLT, talents);
|
||||
talents = this.#property.get(this.#property.TYPES.TLT)
|
||||
if(talents) this.#property.change(this.PropertyTypes.TLT, talents);
|
||||
talents = this.#property.get(this.PropertyTypes.TLT)
|
||||
.filter(talentId => this.getTalentCurrentTriggerCount(talentId) < this.#talent.get(talentId).max_triggers);
|
||||
|
||||
const contents = [];
|
||||
@ -117,7 +123,7 @@ class Life {
|
||||
this.#triggerTalents[talentId] = this.getTalentCurrentTriggerCount(talentId) + 1;
|
||||
const { effect, name, description, grade } = result;
|
||||
contents.push({
|
||||
type: this.#property.TYPES.TLT,
|
||||
type: this.PropertyTypes.TLT,
|
||||
name,
|
||||
grade,
|
||||
description,
|
||||
@ -130,10 +136,10 @@ class Life {
|
||||
|
||||
doEvent(eventId) {
|
||||
const { effect, next, description, postEvent } = this.#event.do(eventId, this.#property);
|
||||
this.#property.change(this.#property.TYPES.EVT, eventId);
|
||||
this.#property.change(this.PropertyTypes.EVT, eventId);
|
||||
this.#property.effect(effect);
|
||||
const content = {
|
||||
type: this.#property.TYPES.EVT,
|
||||
type: this.PropertyTypes.EVT,
|
||||
description,
|
||||
postEvent,
|
||||
}
|
||||
@ -150,47 +156,60 @@ class Life {
|
||||
}
|
||||
|
||||
talentRandom() {
|
||||
const times = this.#property.get(this.#property.TYPES.TMS);
|
||||
const achievement = this.#property.get(this.#property.TYPES.CACHV);
|
||||
return this.#talent.talentRandom(this.getLastExtendTalent(), { times, achievement });
|
||||
return this.#talent.talentRandom(
|
||||
this.lastExtendTalent,
|
||||
this.#getPropertys(
|
||||
this.PropertyTypes.TMS,
|
||||
this.PropertyTypes.CACHV,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
talentExtend(talentId) {
|
||||
this.#property.set(this.#property.TYPES.EXT, talentId);
|
||||
}
|
||||
|
||||
getLastExtendTalent() {
|
||||
return this.#property.get(this.#property.TYPES.EXT);
|
||||
}
|
||||
|
||||
getSummary() {
|
||||
this.#achievement.achieve(
|
||||
this.#achievement.Opportunity.SUMMARY,
|
||||
this.#property
|
||||
)
|
||||
return {
|
||||
AGE: this.#property.get(this.#property.TYPES.HAGE),
|
||||
CHR: this.#property.get(this.#property.TYPES.HCHR),
|
||||
INT: this.#property.get(this.#property.TYPES.HINT),
|
||||
STR: this.#property.get(this.#property.TYPES.HSTR),
|
||||
MNY: this.#property.get(this.#property.TYPES.HMNY),
|
||||
SPR: this.#property.get(this.#property.TYPES.HSPR),
|
||||
SUM: this.#property.get(this.#property.TYPES.SUM),
|
||||
};
|
||||
}
|
||||
|
||||
getLastRecord() {
|
||||
return this.#property.getLastRecord();
|
||||
this.#property.set(this.PropertyTypes.EXT, talentId);
|
||||
}
|
||||
|
||||
exclusive(talents, exclusive) {
|
||||
return this.#talent.exclusive(talents, exclusive);
|
||||
}
|
||||
|
||||
getAchievements() {
|
||||
#getJudges(...types) {
|
||||
return getListValuesMap(types.flat(), key => this.#property.judge(key));
|
||||
}
|
||||
|
||||
#getPropertys(...types) {
|
||||
return getListValuesMap(types.flat(), key => this.#property.get(key));
|
||||
}
|
||||
|
||||
get lastExtendTalent() {
|
||||
return this.#property.get(this.PropertyTypes.EXT);
|
||||
}
|
||||
|
||||
get summary() {
|
||||
this.#achievement.achieve(
|
||||
this.AchievementOpportunity.SUMMARY,
|
||||
this.#property
|
||||
)
|
||||
|
||||
const pt = this.PropertyTypes;
|
||||
|
||||
return this.#getJudges(pt.SUM,
|
||||
pt.HAGE, pt.HCHR, pt.HINT,
|
||||
pt.HSTR, pt.HMNY, pt.HSPR,
|
||||
);
|
||||
}
|
||||
|
||||
get status() {
|
||||
const pt = this.PropertyTypes;
|
||||
|
||||
return this.#getJudges( pt.TMS,
|
||||
pt.CACHV, pt.RTLT, pt.REVT,
|
||||
);
|
||||
}
|
||||
get achievements() {
|
||||
const ticks = {};
|
||||
this.#property
|
||||
.get(this.#property.TYPES.ACHV)
|
||||
.get(this.PropertyTypes.ACHV)
|
||||
.forEach(([id, tick]) => ticks[id] = tick);
|
||||
return this
|
||||
.#achievement
|
||||
@ -213,38 +232,20 @@ class Life {
|
||||
});
|
||||
}
|
||||
|
||||
getTotal() {
|
||||
const TMS = this.#property.get(this.#property.TYPES.TMS);
|
||||
const CACHV = this.#property.get(this.#property.TYPES.CACHV);
|
||||
const CTLT = this.#property.get(this.#property.TYPES.CTLT);
|
||||
const CEVT = this.#property.get(this.#property.TYPES.CEVT);
|
||||
|
||||
const totalTalent = this.#talent.count();
|
||||
const totalEvent = this.#event.count();
|
||||
|
||||
return {
|
||||
times: TMS,
|
||||
achievement: CACHV,
|
||||
talentRate: CTLT / totalTalent,
|
||||
eventRate: CEVT / totalEvent,
|
||||
}
|
||||
}
|
||||
|
||||
get PropertyTypes() { return clone(this.#property.TYPES); }
|
||||
|
||||
get PropertyTypes() { return this.#property.TYPES; }
|
||||
get AchievementOpportunity() { return this.#achievement.Opportunity; }
|
||||
get talentSelectLimit() { return this.#talentSelectLimit; }
|
||||
get propertyAllocateLimit() { return clone(this.#propertyAllocateLimit); }
|
||||
|
||||
get propertys() { return this.#property.getPropertys(); }
|
||||
get times() { return this.#property?.get(this.#property.TYPES.TMS) || 0; }
|
||||
get times() { return this.#property.get(this.PropertyTypes.TMS) || 0; }
|
||||
set times(v) {
|
||||
this.#property?.set(this.#property.TYPES.TMS, v) || 0;
|
||||
this.#property.set(this.PropertyTypes.TMS, v);
|
||||
this.#achievement.achieve(
|
||||
this.#achievement.Opportunity.END,
|
||||
this.AchievementOpportunity.END,
|
||||
this.#property
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Life;
|
||||
|
||||
export default Life;
|
@ -40,10 +40,20 @@ class Property {
|
||||
AEVT: "AEVT", // 触发过的事件 Achieve Event
|
||||
ACHV: "ACHV", // 达成的成就 Achievement
|
||||
|
||||
CTLT: "RTLT", // 天赋选择数 Count Talent
|
||||
CEVT: "REVT", // 事件收集数 Count Event
|
||||
CTLT: "CTLT", // 天赋选择数 Count Talent
|
||||
CEVT: "CEVT", // 事件收集数 Count Event
|
||||
CACHV: "CACHV", // 成就达成数 Count Achievement
|
||||
|
||||
// 总数
|
||||
TTLT: "TTLT", // 总天赋数 Total Talent
|
||||
TEVT: "TEVT", // 总事件数 Total Event
|
||||
TACHV: "TACHV", // 总成就数 Total Achievement
|
||||
|
||||
// 比率
|
||||
REVT: "REVT", // 事件收集率 Rate Event
|
||||
RTLT: "RTLT", // 天赋选择率 Rate Talent
|
||||
RACHV: "RACHV", // 成就达成率 Rate Achievement
|
||||
|
||||
// SPECIAL
|
||||
RDM: 'RDM', // 随机属性 random RDM
|
||||
|
||||
@ -62,9 +72,10 @@ class Property {
|
||||
|
||||
#ageData;
|
||||
#data = {};
|
||||
#total;
|
||||
#judge;
|
||||
|
||||
initial({age}) {
|
||||
|
||||
initial({age, total}) {
|
||||
this.#ageData = age;
|
||||
for(const a in age) {
|
||||
let { event, talent } = age[a];
|
||||
@ -84,6 +95,11 @@ class Property {
|
||||
|
||||
age[a] = { event, talent };
|
||||
}
|
||||
this.#total = total;
|
||||
}
|
||||
|
||||
config({judge = {}}) {
|
||||
this.#judge = judge;
|
||||
}
|
||||
|
||||
restart(data) {
|
||||
@ -188,6 +204,15 @@ class Property {
|
||||
return this.get(
|
||||
this.fallback(prop)
|
||||
).length;
|
||||
case this.TYPES.TTLT:
|
||||
case this.TYPES.TEVT:
|
||||
case this.TYPES.TACHV:
|
||||
return this.#total[prop];
|
||||
case this.TYPES.RTLT:
|
||||
case this.TYPES.REVT:
|
||||
case this.TYPES.RACHV:
|
||||
const fb = this.fallback(prop);
|
||||
return this.get(fb[0]) / this.get(fb[1]);
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@ -209,6 +234,10 @@ class Property {
|
||||
case this.TYPES.CTLT: return this.TYPES.ATLT;
|
||||
case this.TYPES.CEVT: return this.TYPES.AEVT;
|
||||
case this.TYPES.CACHV: return this.TYPES.ACHV;
|
||||
case this.TYPES.LIF: return this.TYPES.LIF;
|
||||
case this.TYPES.RTLT: return [this.TYPES.CTLT, this.TYPES.TTLT];
|
||||
case this.TYPES.REVT: return [this.TYPES.CEVT, this.TYPES.TEVT];
|
||||
case this.TYPES.RACHV: return [this.TYPES.CACHV, this.TYPES.TACHV];
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
@ -299,6 +328,26 @@ class Property {
|
||||
);
|
||||
}
|
||||
|
||||
judge(prop) {
|
||||
const value = this.get(prop);
|
||||
|
||||
const d = this.#judge[prop];
|
||||
let length = d.length;
|
||||
const p = 1/length;
|
||||
|
||||
const progress = () => {
|
||||
const min = d[length][0] || 0;
|
||||
const max = d[length+1]?.[0] || value;
|
||||
if(max == min) return 1;
|
||||
return p * (length + (value - min) / (max - min));
|
||||
}
|
||||
|
||||
while(length--) {
|
||||
const [min, grade, judge] = d[length];
|
||||
if(min==void 0 || value >= min) return {prop, value, judge, grade, progress: progress()};
|
||||
}
|
||||
}
|
||||
|
||||
isEnd() {
|
||||
return this.get(this.TYPES.LIF) < 1;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { clone, weightRandom } from '../functions/util.js';
|
||||
import { checkCondition, extractMaxTriggers } from '../functions/condition.js';
|
||||
import { getRate } from '../functions/addition.js';
|
||||
|
||||
class Talent {
|
||||
constructor() {}
|
||||
@ -8,7 +7,7 @@ class Talent {
|
||||
#talents;
|
||||
#talentPullCount;
|
||||
#talentRate;
|
||||
#rateAddition;
|
||||
#additions;
|
||||
|
||||
initial({talents}) {
|
||||
this.#talents = talents;
|
||||
@ -28,19 +27,23 @@ class Talent {
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.count;
|
||||
}
|
||||
|
||||
get count() {
|
||||
return Object.keys(this.#talents).length;
|
||||
}
|
||||
|
||||
config({
|
||||
talentPullCount = 10, // number of talents to pull from the talent pool
|
||||
talentRate = { 1:100, 2:10, 3:1, total: 1000 }, // rate of talent pull
|
||||
additions = {}, // additional additions
|
||||
} = {}) {
|
||||
this.#talentPullCount = talentPullCount;
|
||||
this.#talentRate = talentRate;
|
||||
this.#additions = additions;
|
||||
}
|
||||
|
||||
count() {
|
||||
return Object.keys(this.#talents).length;
|
||||
}
|
||||
|
||||
check(talentId, property) {
|
||||
const { condition } = this.get(talentId);
|
||||
@ -69,20 +72,32 @@ class Talent {
|
||||
return null;
|
||||
}
|
||||
|
||||
talentRandom(include, {times = 0, achievement = 0} = {}) {
|
||||
getAddition(type, value) {
|
||||
if(!this.#additions[type]) return {};
|
||||
for(const [min, addition] of this.#additions[type]) {
|
||||
if(value >= min) return addition;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
getRate(additionValues = {}) {
|
||||
const rate = clone(this.#talentRate);
|
||||
const rateAddition = { 1:1, 2:1, 3:1, };
|
||||
const timesRate = getRate('times', times);
|
||||
const achievementRate = getRate('achievement', achievement);
|
||||
const addition = { 1:1, 2:1, 3:1, };
|
||||
|
||||
for(const grade in timesRate)
|
||||
rateAddition[grade] += timesRate[grade] - 1;
|
||||
Object.keys(additionValues).forEach(key => {
|
||||
const addi = this.getAddition(key, additionValues[key])
|
||||
for(const grade in addi)
|
||||
addition[grade] += addi[grade];
|
||||
});
|
||||
|
||||
for(const grade in achievementRate)
|
||||
rateAddition[grade] += achievementRate[grade] - 1;
|
||||
for(const grade in addition)
|
||||
rate[grade] *= addition[grade];
|
||||
|
||||
for(const grade in rateAddition)
|
||||
rate[grade] *= rateAddition[grade];
|
||||
return rate;
|
||||
}
|
||||
|
||||
talentRandom(include, additionValues) {
|
||||
const rate = this.getRate(additionValues);
|
||||
|
||||
const randomGrade = () => {
|
||||
let randomNumber = Math.floor(Math.random() * rate.total);
|
||||
@ -92,7 +107,6 @@ class Talent {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 1000, 100, 10, 1
|
||||
const talentList = {};
|
||||
for(const talentId in this.#talents) {
|
||||
const { id, grade, name, description } = this.#talents[talentId];
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,10 @@
|
||||
export default class cyberAchievement extends CyberAchievementUI {
|
||||
constructor() {
|
||||
super();
|
||||
this.btnBack.on(Laya.Event.CLICK, this, () => UIManager.getInstance().switchView(UIManager.getInstance().themes.MAIN));
|
||||
}
|
||||
|
||||
init() {
|
||||
const status = core.status;
|
||||
}
|
||||
}
|
@ -5,4 +5,9 @@ export default class cyberMain extends CyberMainUI {
|
||||
this.btnAchievement.on(Laya.Event.CLICK, this, ()=>UIManager.getInstance().switchView(UIManager.getInstance().themes.ACHIEVEMENT));
|
||||
this.btnThanks.on(Laya.Event.CLICK, this, ()=>UIManager.getInstance().switchView(UIManager.getInstance().themes.THANKS));
|
||||
}
|
||||
|
||||
init() {
|
||||
this.btnAchievement.visible =
|
||||
this.btnThanks.visible = !!core.times;
|
||||
}
|
||||
}
|
@ -2,9 +2,88 @@ export default class cyberSummary extends CyberSummaryUI {
|
||||
constructor() {
|
||||
super();
|
||||
this.listSelectedTalents.renderHandler = Laya.Handler.create(this, this.renderTalent, null, false);
|
||||
this.btnAgain.on(Laya.Event.CLICK, this, this.onAgain);
|
||||
}
|
||||
|
||||
get gradeFilters() {
|
||||
return [
|
||||
this.colorGrade0.text,
|
||||
this.colorGrade1.text,
|
||||
this.colorGrade2.text,
|
||||
this.colorGrade3.text,
|
||||
];
|
||||
}
|
||||
|
||||
get gradeColors() {
|
||||
return [
|
||||
this.colorGrade0.color,
|
||||
this.colorGrade1.color,
|
||||
this.colorGrade2.color,
|
||||
this.colorGrade3.color,
|
||||
];
|
||||
}
|
||||
|
||||
onAgain() {
|
||||
UIManager.getInstance().switchView(UIManager.getInstance().themes.MAIN);
|
||||
core.times ++;
|
||||
}
|
||||
|
||||
init({talents}) {
|
||||
const {summary, lastExtendTalent} = core;
|
||||
const gradeFilters = this.gradeFilters;
|
||||
const gradeColors = this.gradeColors;
|
||||
|
||||
console.debug(summary, lastExtendTalent);
|
||||
const age = summary[core.PropertyTypes.HAGE];
|
||||
this.labAge.text = ''+age.value;
|
||||
this.labAgeJudge.text = age.judge;
|
||||
this.labAgeJudge.color = gradeColors[age.grade];
|
||||
|
||||
const sum = summary[core.PropertyTypes.SUM];
|
||||
this.labTotal.text = ''+sum.value;
|
||||
this.labTotalJudge.text = sum.judge;
|
||||
this.labTotalJudge.color = gradeColors[sum.grade];
|
||||
|
||||
const chr = summary[core.PropertyTypes.HCHR];
|
||||
this.labCharm.text = ''+chr.value;
|
||||
this.prgCharm.value = chr.progress;
|
||||
this.labCharmJudge.text = chr.judge;
|
||||
this.labCharmJudge.color = gradeColors[chr.grade];
|
||||
this.boxCharmGrade.colorFilter = gradeFilters[chr.grade];
|
||||
|
||||
const int = summary[core.PropertyTypes.HINT];
|
||||
this.labIntelligence.text = ''+int.value;
|
||||
this.prgIntelligence.value = int.progress;
|
||||
this.labIntelligenceJudge.text = int.judge;
|
||||
this.labIntelligenceJudge.color = gradeColors[int.grade];
|
||||
this.boxIntelligenceGrade.colorFilter = gradeFilters[int.grade];
|
||||
|
||||
const str = summary[core.PropertyTypes.HSTR];
|
||||
this.labStrength.text = ''+str.value;
|
||||
this.prgStrength.value = str.progress;
|
||||
this.labStrengthJudge.text = str.judge;
|
||||
this.labStrengthJudge.color = gradeColors[str.grade];
|
||||
this.boxStrengthGrade.colorFilter = gradeFilters[str.grade];
|
||||
|
||||
const mny = summary[core.PropertyTypes.HMNY];
|
||||
this.labMoney.text = ''+mny.value;
|
||||
this.prgMoney.value = mny.progress;
|
||||
this.labMoneyJudge.text = mny.judge;
|
||||
this.labMoneyJudge.color = gradeColors[mny.grade];
|
||||
this.boxMoneyGrade.colorFilter = gradeFilters[mny.grade];
|
||||
|
||||
const spr = summary[core.PropertyTypes.HSPR];
|
||||
this.labSpirit.text = ''+spr.value;
|
||||
this.prgSpirit.value = spr.progress;
|
||||
this.labSpiritJudge.text = spr.judge;
|
||||
this.labSpiritJudge.color = gradeColors[spr.grade];
|
||||
this.boxSpiritGrade.colorFilter = gradeFilters[spr.grade];
|
||||
|
||||
talents.sort(({id:a, grade:ag}, {id:b, grade:bg},)=>{
|
||||
if(a == lastExtendTalent) return -1;
|
||||
if(b == lastExtendTalent) return 1;
|
||||
return bg - ag;
|
||||
});
|
||||
this.listSelectedTalents.array = talents;
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,7 @@ export default class CyberTrajectory extends CyberTrajectoryUI {
|
||||
#talents;
|
||||
|
||||
init({propertyAllocate, talents}) {
|
||||
this.btnSummary.visible = false;
|
||||
this.#trajectoryItems = [];
|
||||
this.#isEnd = false;
|
||||
this.#talents = talents;
|
||||
@ -100,7 +101,7 @@ export default class CyberTrajectory extends CyberTrajectoryUI {
|
||||
this.#isEnd = isEnd;
|
||||
|
||||
if(isEnd) {
|
||||
console.debug('end');
|
||||
this.btnSummary.visible = true;
|
||||
}
|
||||
|
||||
const item = this.#createTrajectoryItem();
|
||||
|
Reference in New Issue
Block a user