update data

add replacemant talent
add random property
This commit is contained in:
Vick Scarlet
2021-09-12 22:04:45 +08:00
parent b833713afe
commit 866acdb8b2
17 changed files with 654 additions and 29 deletions

View File

@@ -1066,7 +1066,7 @@
"name": "刷刷刷",
"description": "集齐橙色天赋",
"grade": 3,
"condition": "(ATLT?[1023])&(ATLT?[1048])&(ATLT?[1064])&(ATLT?[1114])&(ATLT?[1135])",
"condition": "(ATLT?[1023])&(ATLT?[1048])&(ATLT?[1064])&(ATLT?[1114])&(ATLT?[1135])&(ATLT?[1141])",
"hide": 0,
"opportunity": "START"
},
@@ -1120,7 +1120,7 @@
"name": "信条",
"description": "遇到时光倒流",
"grade": 1,
"condition": "EVT?[11468,11469]",
"condition": "EVT?[11468,11469,20390]",
"hide": 0,
"opportunity": "TRAJECTORY"
},
@@ -1438,5 +1438,23 @@
"condition": "EVT?[40070]",
"hide": 1,
"opportunity": "TRAJECTORY"
},
"261": {
"id": 261,
"name": "薅羊毛专家",
"description": "有会员,所以急着投胎",
"grade": 2,
"condition": "(TLT?[1122])&(TLT?[1141])",
"hide": 0,
"opportunity": "START"
},
"262": {
"id": 262,
"name": "上当了",
"description": "太贪婪而被骗",
"grade": 0,
"condition": "TLT?[1136]",
"hide": 1,
"opportunity": "START"
}
}

Binary file not shown.

View File

@@ -66612,6 +66612,7 @@
"20383*0.01",
"20384*0.01",
"40060*1000000000",
"20390",
"40002*1000000340",
"40003*1000000340",
"40004*1000000340",
@@ -71292,6 +71293,7 @@
"20383*0.01",
"20384*0.01",
"40060*1000000000",
"20390",
"40002*1000000385",
"40003*1000000385",
"40004*1000000385",
@@ -71708,6 +71710,7 @@
"20383*0.01",
"20384*0.01",
"40060*1000000000",
"20390",
"40002*1000000389",
"40003*1000000389",
"40004*1000000389",

Binary file not shown.

View File

@@ -7155,7 +7155,7 @@
"10926": {
"id": 10926,
"event": "虽然你还小但你几乎和20岁左右的青年差不多成熟了。",
"include": "EVT?[10871]",
"include": "(EVT?[10871])&(INT>7)",
"exclude": "EVT?[10926]"
},
"10927": {

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1346,6 +1346,137 @@
"group": 2,
"name": "我是原P"
},
{
"group": 2,
"name": "天湮"
},
{
"group": 2,
"name": "荪"
},
{
"group": 2,
"name": "煮饭233"
},
{
"group": 2,
"name": "千里未来"
},
{
"group": 2,
"name": "haooo"
},
{
"group": 2,
"name": "闵佳瑶"
},
{
"group": 2,
"name": "阿婆朱"
},
{
"group": 2,
"name": "油腻的Wink😉"
},
{
"group": 1,
"name": "带你嫖娼的馆长",
"comment": "支持国产游戏,吾辈义不容辞!————读完本科自称硕士的沙雕的高质量网友"
},
{
"group": 2,
"name": "Obento"
},
{
"group": 2,
"name": "银子舟"
},
{
"group": 2,
"name": "大户爱"
},
{
"group": 2,
"name": "冥渊"
},
{
"group": 2,
"name": "Tony"
},
{
"group": 2,
"name": "蜜汁帅气小彩蛋"
},
{
"group": 2,
"name": "abc"
},
{
"group": 2,
"name": "陌云铃"
},
{
"group": 2,
"name": "arT"
},
{
"group": 2,
"name": "忆丶醉"
},
{
"group": 2,
"name": "宇宙空间法师"
},
{
"group": 2,
"name": "玛瑙星mnx"
},
{
"group": 2,
"name": "幻海"
},
{
"group": 2,
"name": "陌云铃"
},
{
"group": 2,
"name": "Marvin"
},
{
"group": 2,
"name": "神烦"
},
{
"group": 2,
"name": "Joke"
},
{
"group": 2,
"name": "有酸萝卜别吃"
},
{
"group": 2,
"name": "m子会梦见花之暴君吗"
},
{
"group": 1,
"name": "刘云金",
"comment": "我知道我们没有缘分,这也不是我想要的结果,事与愿违,曾经我们都想好好的,即使现在我也是想要跟你好好的,虽然你看不见,但还是想留下这么一句话(可能会有人看到会觉得挺可笑的 确实挺幼稚的)十年的恋情,不希望给你带来生活的压力, 希望你快快乐乐的 这也是我一直给你说的 也是一直希望的—GQQ"
},
{
"group": 2,
"name": "蟹老板的老公"
},
{
"group": 2,
"name": "小小书童"
},
{
"group": 2,
"name": "雪华",
"color": "#00BFFF"
},
{
"group": 2,
"name": "有梦人天涯若比邻"
@@ -1710,5 +1841,225 @@
{
"group": 2,
"name": "宇宙房地产大亨弗利萨"
},
{
"group": 2,
"name": "你的薛爸爸"
},
{
"group": 2,
"name": "妖怪蜀黍"
},
{
"group": 2,
"name": "刘沈钧"
},
{
"group": 2,
"name": "饭饭"
},
{
"group": 2,
"name": "加利斯"
},
{
"group": 2,
"name": "滑稽拌饭"
},
{
"group": 2,
"name": "敖鹏柽"
},
{
"group": 2,
"name": "张逸尘"
},
{
"group": 2,
"name": "红茶坊"
},
{
"group": 2,
"name": "小灰"
},
{
"group": 2,
"name": "七海Nana7mi",
"color": "#ff70cb"
},
{
"group": 2,
"name": "松松小笨蛋"
},
{
"group": 1,
"name": "NeroCloud",
"comment": "挺好玩的小游戏"
},
{
"group": 2,
"name": "策划大大的大跌"
},
{
"group": 2,
"name": "tiny cherry petal"
},
{
"group": 2,
"name": "啊哈哈"
},
{
"group": 2,
"name": "多多"
},
{
"group": 2,
"name": "般若鬼面 ",
"color": "#921AFF"
},
{
"group": 2,
"name": "璟年"
},
{
"group": 2,
"name": "FAY"
},
{
"group": 2,
"name": "干死黄旭东"
},
{
"group": 2,
"name": "五胖是真的"
},
{
"group": 2,
"name": "狗贼给箱子"
},
{
"group": 2,
"name": "尹东洋"
},
{
"group": 2,
"name": "红阳"
},
{
"group": 2,
"name": "barusamikosu"
},
{
"group": 2,
"name": "小保安"
},
{
"group": 2,
"name": "Tony"
},
{
"group": 2,
"name": "戒( "
},
{
"group": 2,
"name": "下半鸭"
},
{
"group": 2,
"name": "Xiaosaye"
},
{
"group": 2,
"name": "NAKAS"
},
{
"group": 2,
"name": "icefrog"
},
{
"group": 2,
"name": "南怪"
},
{
"group": 2,
"name": "梁一斤"
},
{
"group": 2,
"name": "熊公子nice哥"
},
{
"group": 2,
"name": "徙南"
},
{
"group": 2,
"name": "粟粟"
},
{
"group": 2,
"name": "王哲"
},
{
"group": 2,
"name": "HPENG"
},
{
"group": 2,
"name": "残梦空恨"
},
{
"group": 2,
"name": "测试名字的长度"
},
{
"group": 2,
"name": "夏吉野"
},
{
"group": 2,
"name": "你的名字"
},
{
"group": 2,
"name": "幻想丶当时"
},
{
"group": 2,
"name": "琦琦"
},
{
"group": 2,
"name": "执笔诉情"
},
{
"group": 2,
"name": "陈声"
},
{
"group": 2,
"name": "恶魔在右丷"
},
{
"group": 2,
"name": "苏苏",
"color": "pink"
},
{
"group": 2,
"name": "哈哈和大叔"
},
{
"group": 2,
"name": "攀大大"
},
{
"group": 2,
"name": "电饭锅"
},
{
"group": 2,
"name": "梦鼠"
}
]

View File

@@ -19,8 +19,7 @@
"exclusive": [
"1004",
"1025",
"1024",
1113
"1024"
]
},
"1004": {
@@ -974,14 +973,14 @@
"id": "1104",
"name": "紫色胶囊",
"description": "跳过你的40~50岁",
"condition": "AGE?[40,41,42,43,44,45,46,47,48,49,50]",
"condition": "AGE?[40]",
"grade": 2
},
"1105": {
"id": "1105",
"name": "蓝色胶囊",
"description": "你20、30岁时无事发生",
"condition": "AGE?[20,30]",
"condition": "AGE?[20]",
"grade": 1
},
"1106": {
@@ -1044,7 +1043,7 @@
"id": "1114",
"name": "橙色胶囊",
"description": "跳过你的60~90岁",
"condition": "AGE?[60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90]",
"condition": "AGE?[60]",
"grade": 3
},
"1115": {
@@ -1178,5 +1177,139 @@
"name": "轮回之外",
"description": "死后可能灵魂离体",
"grade": 3
},
"1136": {
"id": 1136,
"name": "贪婪",
"description": "家境+10",
"grade": 0,
"effect": {
"INT": -5
}
},
"1137": {
"id": 1137,
"name": "百岁百世丸",
"description": "某条件下所有属性+2",
"condition": "(AGE?[100])&(TMS>99)",
"grade": 1,
"effect": {
"SPR": 2,
"MNY": 2,
"CHR": 2,
"STR": 2,
"INT": 2
}
},
"1138": {
"id": 1138,
"name": "意外之喜",
"description": "随机属性+1",
"grade": 0,
"effect": {
"RDM": 1
}
},
"1139": {
"id": 1139,
"name": "培养爱好",
"description": "随机属性+2",
"grade": 1,
"effect": {
"RDM": 2
}
},
"1140": {
"id": 1140,
"name": "觉醒",
"description": "随机属性+4",
"grade": 2,
"effect": {
"RDM": 4
}
},
"1141": {
"id": 1141,
"name": "阴间大会员",
"description": "随机属性+8",
"grade": 3,
"effect": {
"RDM": 8
}
},
"1142": {
"id": 1142,
"name": "蓝色转盘",
"description": "变成随机蓝色天赋",
"grade": 0,
"replacement": {
"grade": [
1
]
},
"exclusive": [
"1012",
"1013",
"1014",
1110,
1103,
1104,
1124,
1125
]
},
"1143": {
"id": 1143,
"name": "紫色转盘",
"description": "变成随机紫色天赋",
"grade": 1,
"replacement": {
"grade": [
2
]
},
"exclusive": [
"1012",
"1013",
"1014",
1110,
1103,
1104,
1124,
1125
]
},
"1144": {
"id": 1144,
"name": "橙色转盘",
"description": "变成随机橙色天赋",
"grade": 2,
"replacement": {
"grade": [
3
]
}
},
"1145": {
"id": 1145,
"name": "阴间福袋",
"description": "可能开出好天赋",
"grade": 1,
"replacement": {
"talent": [
"1138,1133,1125,1128,1129,1131,1111,1108,1071,1072,1044,1039,1040,1033,1031,1002"
]
}
},
"1146": {
"id": 1146,
"name": "轮盘赌",
"description": "1/6几率变橙色天赋",
"grade": 1,
"replacement": {
"talent": [
"1141*0.2,1135*0.2,1114*0.2,1023*0.2,1048*0.2,1033*5"
]
}
}
}

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -328,7 +328,7 @@ class App{
this.hint(`你多使用了${total() - this.#totalMax}属性点`);
return;
}
this.#life.restart({
const contents = this.#life.restart({
CHR: groups.CHR.get(),
INT: groups.INT.get(),
STR: groups.STR.get(),
@@ -337,7 +337,7 @@ class App{
TLT: Array.from(this.#talentSelected).map(({id})=>id),
});
this.switch('trajectory');
this.#pages.trajectory.born();
this.#pages.trajectory.born(contents);
// $(document).keydown(function(event){
// if(event.which == 32 || event.which == 13){
// $('#lifeTrajectory').click();
@@ -646,7 +646,15 @@ class App{
trajectoryPage.find('#auto2x').show();
this.#isEnd = false;
},
born: ()=>{
born: contents => {
if(contents.length > 0)
$('#lifeTrajectory')
.append(`<li><span>初始:</span><span>${
contents.map(
({source, target}) => `天赋${source.name}发动替换为天赋${target.name}`
).join('<br>')
}</span></li>`);
trajectoryPage.find('#lifeTrajectory').trigger("click");
}
},

View File

@@ -28,4 +28,20 @@ function average(...arr) {
return s / arr.flat().length;
}
export { clone, max, min, sum, average };
function weightRandom(list) {
let totalWeights = 0;
for(const [, weight] of list)
totalWeights += weight;
let random = Math.random() * totalWeights;
for(const [id, weight] of list)
if((random-=weight)<0)
return id;
return list[list.length-1];
}
function listRandom(list) {
return list[Math.floor(Math.random() * list.length)];
}
export { clone, max, min, sum, average, weightRandom, listRandom };

View File

@@ -1,3 +1,4 @@
import { weightRandom } from './functions/util.js'
import Property from './property.js';
import Event from './event.js';
import Talent from './talent.js';
@@ -32,13 +33,15 @@ class Life {
restart(allocation) {
this.#triggerTalents = {};
const contents = this.talentReplace(allocation.TLT);
this.#property.restart(allocation);
this.doTalent();
this.doTalent()
this.#property.restartLastStep();
this.#achievement.achieve(
this.#achievement.Opportunity.START,
this.#property
)
return contents;
}
getTalentAllocationAddition(talents) {
@@ -65,6 +68,21 @@ class Life {
return { age, content, isEnd };
}
talentReplace(talents) {
const result = this.#talent.replace(talents);
const contents = [];
for(const id in result) {
talents.push(result[id]);
const source = this.#talent.get(id);
const target = this.#talent.get(result[id]);
contents.push({
type: 'talentReplace',
source, target
});
}
return contents;
}
doTalent(talents) {
if(talents) this.#property.change(this.#property.TYPES.TLT, talents);
talents = this.#property.get(this.#property.TYPES.TLT)
@@ -102,17 +120,11 @@ class Life {
}
random(events) {
events = events.filter(([eventId])=>this.#event.check(eventId, this.#property));
let totalWeights = 0;
for(const [, weight] of events)
totalWeights += weight;
let random = Math.random() * totalWeights;
for(const [eventId, weight] of events)
if((random-=weight)<0)
return eventId;
return events[events.length-1];
return weightRandom(
events.filter(
([eventId])=>this.#event.check(eventId, this.#property)
)
);
}
talentRandom() {

View File

@@ -1,4 +1,4 @@
import { max, min, sum, clone } from './functions/util.js';
import { max, min, sum, clone, listRandom } from './functions/util.js';
class Property {
constructor() {}
@@ -44,8 +44,22 @@ class Property {
CEVT: "REVT", // 事件收集数 Count Event
CACHV: "CACHV", // 成就达成数 Count Achievement
// SPECIAL
RDM: 'RDM', // 随机属性 random RDM
};
// 特殊类型
SPECIAL = {
RDM: [ // 随机属性 random RDM
this.TYPES.CHR,
this.TYPES.INT,
this.TYPES.STR,
this.TYPES.MNY,
this.TYPES.SPR,
]
}
#ageData;
#data = {};
@@ -270,9 +284,19 @@ class Property {
}
}
hookSpecial(prop) {
switch(prop) {
case this.TYPES.RDM: return listRandom(this.SPECIAL.RDM);
default: return prop;
}
}
effect(effects) {
for(const prop in effects)
this.change(prop, Number(effects[prop]));
for(let prop in effects)
this.change(
this.hookSpecial(prop),
Number(effects[prop])
);
}
isEnd() {

View File

@@ -1,4 +1,4 @@
import { clone } from './functions/util.js';
import { clone, weightRandom } from './functions/util.js';
import { checkCondition, extractMaxTriggers } from './functions/condition.js';
import { getRate } from './functions/addition.js';
@@ -14,6 +14,16 @@ class Talent {
talent.id= Number(id);
talent.grade = Number(talent.grade);
talent.max_triggers = extractMaxTriggers(talent.condition);
if(talent.replacement) {
for(let key in talent.replacement) {
const obj = {};
for(let value of talent.replacement[key]) {
value = `${value}`.split('*');
obj[value[0]||0] = Number(value[1]) || 1;
}
talent.replacement[key] = obj;
}
}
}
}
@@ -111,6 +121,56 @@ class Talent {
return null;
return { effect, grade, name, description };
}
replace(talents) {
const getReplaceList = (talent, talents) => {
const { replacement } = this.get(talent);
if(!replacement) return null;
const list = [];
if(replacement.grade) {
this.forEach(({id, grade})=>{
if(!replacement.grade[grade]) return;
if(this.exclusive(talents, id)) return;
list.push([id, replacement.grade[grade]]);
})
}
if(replacement.talent) {
for(let id in replacement.talent) {
id = Number(id);
if(this.exclusive(talents, id)) continue;
list.push([id, replacement.talent[id]]);
}
}
return list;
}
const replace = (talent, talents) => {
const replaceList = getReplaceList(talent, talents);
if(!replaceList) return talent;
const rand = weightRandom(replaceList);
return replace(
rand, talents.concat(rand)
);
}
const newTalents = clone(talents);
const result = {};
for(const talent of talents) {
const replaceId = replace(talent, newTalents);
if(replaceId != talent) {
result[talent] = replaceId;
newTalents.push(replaceId);
}
}
return result;
}
forEach(callback) {
if(typeof callback != 'function') return;
for(const id in this.#talents)
callback(clone(this.#talents[id]), id);
}
}
export default Talent;