吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 7300|回复: 20
收起左侧

[其他转载] [魔改]人生重开模拟器

  [复制链接]
三水非冰 发表于 2021-9-12 14:41

前言

  不知道为啥,一款开源的文字类web游戏——《人生重开模拟器》突然爆火,好奇玩了一会儿,发现这游戏其实和抽奖差不多,容易激发人的赌徒心理。倍感无聊,决定修改一下,给游戏添加个外挂天赋,毕竟重生总得带点什么逆天功能才合理的嘛。

  游戏代码不是很复杂,来来回回几个js文件,如果你要修改面板属性之类的其他东西,也是如此。这里以添加一个“不灭金身”天赋为例。

  游戏官方源码:https://github.com/VickScarlet/lifeRestart

配置数据

天赋 talent.json

添加:

"1135": { //与id一致
    "id": 1135, //根据原有数据情况进行修改,不要和原有数据id相同
    "name": "不灭金身",  //天赋名
    "description": "体质小于1时体质+10且死亡后会复活",  //天赋说明
    "condition": "STR<1",  //触发天赋的条件
    "grade": 3,  //稀有度,越高越稀有
    "effect": {
        "STR": 10  //体质+10
    }
}

剧情 event.json

修改:

"10000": {
    "id": 10000,
    "event": "你死了。",
    "effect": {
        "LIF": -1
    },
    "NoRandom": 1
},

如下:

"10000": {
    "id": 10000,
    "event": "你死了。",
    "effect": {
        "LIF": -1
    },
    "NoRandom": 1,
    "branch": [
        "TLT?[1135]:40062" // TLT?[不灭金身天赋id]:对应的剧情id
    ]
},

添加:

"40062": { //与id一致
    "id": 40062,  //根据原有数据情况进行修改,不要和原有数据id相同
    "event": "你是神选之子,拥有不灭金身,原地复活,又开始了新的人生。",  //剧情说明
    "effect": {
        "LIF": 1  //生命+1
    },
    "branch": [
        "AGE>499:40050" //目前的游戏设定最高500岁(不修仙99岁),大于499时必须死,看情况修改
    ],
    "NoRandom": 1 //非随机事件
}

修改代码

life.js

添加方法:

talentCheat(){
    return this.#talent.talentCheat();
}

talent.js

添加方法:

talentCheat(){
    return this.#talents;
}

app.js

添加一个按钮:

<button id="cheat" class="sponsor" style="margin:30px">神选之子</button>

如下:

const talentPage = $(`
    <div id="main">
        <div class="head" style="font-size: 1.6rem">天赋抽卡</div>
        <button id="random" class="mainbtn" style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);"">10连抽!</button>
        <ul id="talents" class="selectlist"></ul>
        <button id="next" class="mainbtn">请选择3个</button>
        <button id="cheat" class="sponsor" style="margin:30px">神选之子</button>
    </div>
`);

跳过随机天赋列表:

if(talent.id==1135){ //配置的天赋id
    return true; //如果天赋列表中随机到【不灭金身】天赋则跳过本次循环
}

如下:

 talentPage
    .find('#random')
    .click(()=>{
        talentPage.find('#random').hide();
        const ul = talentPage.find('#talents');
        this.#life.talentRandom()
            .forEach(talent=>{
                if(talent.id==1135){ //配置的不灭金身天赋id
                    return true; //如果天赋列表中随机到【不灭金身】天赋则跳过本次循环
                }
                const li = createTalent(talent);
                ul.append(li);

            //其余代码略……

修改方法:

const createTalent = ({ grade, name, description }) => {
    return $(`<li class="grade${grade}b">${name}(${description})</li>`)
};

如下:

const createTalent = ({ id, grade, name, description }) => {
    return $(`<li id="tId_${id}" class="grade${grade}b">${name}(${description})</li>`)
};

添加方法:  

talentPage
    .find('#cheat')
    .click(()=>{
        talentPage.find('#cheat').hide();
        const talent = this.#life.talentCheat()[1135];  //配置的不灭金身天赋id
        const talent2 = this.#life.talentCheat()[1048]; 
        const ul = talentPage.find('#talents');
        ul.children()[0].remove();
        ul.find('#tId_1048').remove();
        const li = createTalent(talent);
        ul.append(li);

        li.click(()=>{
            if(li.hasClass('selected')) {
                li.removeClass('selected')
                this.#talentSelected.delete(talent);
                this.#talentSelected.delete(talent2);
                if(this.#talentSelected.size<3) {
                    talentPage.find('#next').text('请选择3个')
                }
            } else {
                if(this.#talentSelected.size==3) {
                    this.hint('只能选3个天赋');
                    return;
                }
                this.hint(`选择【不灭金身】的同时会附带【神秘的小盒子】,占用两个天赋位`);
                const exclusive = this.#life.exclusive(
                    Array.from(this.#talentSelected).map(({id})=>id),
                    talent.id
                );
                if(exclusive != null) {
                    for(const { name, id } of this.#talentSelected) {
                        if(id == exclusive) {
                            this.hint(`与已选择的天赋【${name}】冲突`);
                            return;
                        }
                    }
                    return;
                }
                li.addClass('selected');
                this.#talentSelected.add(talent);
                this.#talentSelected.add(talent2);
                if(this.#talentSelected.size==3) {
                    talentPage.find('#next').text('开始新人生')
                }
            }
        });
    })

选择天赋时显示按钮:

talentPage.find('#cheat').show();

如下:


//以上代码略……
            if (exclusive != null) {
                for (const { name, id } of this.#talentSelected) {
                    if (id == exclusive) {
                        this.hint(`与已选择的天赋【${name}】冲突`);
                        return;
                    }
                }
                return;
            }
            li.addClass('selected');
            this.#talentSelected.add(talent);
            if (this.#talentSelected.size == 3) {
                talentPage.find('#next').text('开始新人生')
            }
        }
    });
});
talentPage.find('#next').show();
talentPage.find('#cheat').show();

选择天赋前隐藏按钮:

talentPage.find('#cheat').hide();

如下:

talent: {
    page: talentPage,
    talentList: talentPage.find('#talents'),
    btnRandom: talentPage.find('#random'),
    btnNext: talentPage.find('#next'),
    pressEnter: () => {
        const talentList = this.#pages.talent.talentList;
        const btnRandom = this.#pages.talent.btnRandom;
        const btnNext = this.#pages.talent.btnNext;
        if (talentList.children().length) {
            btnNext.click();
        } else {
            btnRandom.click();
        }
    },
    clear: () => {
        this.#currentPage = 'talent';
        talentPage.find('ul.selectlist').empty();
        talentPage.find('#random').show();
        talentPage.find('#cheat').hide();
        this.#totalMax = 20;
    },
},

效果预览

1.gif
2.gif

免费评分

参与人数 5吾爱币 +10 热心值 +4 收起 理由
JgeneralF + 1 用心讨论,共获提升!
tata190711 + 1 + 1 热心回复!
18031371463 + 1 热心回复!
wakfbycf + 1 + 1 鼓励转贴优秀软件安全工具和文档!
苏紫方璇 + 7 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

zhaomingzhi 发表于 2021-9-12 15:17
GitHub:https://github.com/VickScarlet/lifeRestart

原版:http://liferestart.syaro.io/view/

超级人生版:http://restart.typekuon.com/lifeRestart/view/

我是人上人版:https://service-anw3da5k-1251676728.gz.apigw.tencentcs.com/release/view/index.html

免费评分

参与人数 2吾爱币 +2 热心值 +2 收起 理由
何处不惹尘埃 + 1 + 1 我很赞同!
LHGG + 1 + 1 鼓励转贴优秀软件安全工具和文档!

查看全部评分

zhaomingzhi 发表于 2021-9-12 15:13
mosou 发表于 2021-9-12 15:16
mosou 发表于 2021-9-12 15:54
zhaomingzhi 发表于 2021-9-12 15:17
GitHub:https://github.com/VickScarlet/lifeRestart

原版:http://liferestart.syaro.io/view/

你这个代码有吗
15278066219 发表于 2021-9-12 16:51
人上人就是那么草率,要么富贵要么早夭!!!
1631436679(1).jpg
Bimice 发表于 2021-9-12 16:58
好玩,分享了
18031371463 发表于 2021-9-12 17:04
楼主。怎么修改某个天赋的抽中概率呀,我想把某些天赋概率提高,谢谢楼主
 楼主| 三水非冰 发表于 2021-9-12 17:40
18031371463 发表于 2021-9-12 17:04
楼主。怎么修改某个天赋的抽中概率呀,我想把某些天赋概率提高,谢谢楼主

最简单的方式就是修改 grade 属性,看帖子 [天赋 talent.json] 节点,修改天赋对应的 grade  数值越低出现概率越高
guxiaomo 发表于 2021-9-12 18:00
今天刚看到这个就有人分享了
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-4-18 13:17

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表