WIKI冒险团明确声明不支持涉及代练和账号买卖的现金交易活动。
参与者应自行承担对应后果。

全站通知:

Widget:Wiki测试服-生物

来自地下城堡2WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

<script>

class 生物类 {
    属性 (type, exclude) {
        let attr = this.面板[P(type)] + this.增幅[P(type)];
        if (this.域之环 != null) attr += this.域之环.属性(type);
        if (["力量","魔力","技巧","速度","体质","护甲","抗性","武威"].includes(type)) {
            for (let i=0;i<this.状态.length;i++){ if (this.状态[i].类型==type+"buff"  && this.状态[i].上级 != exclude) attr += this.状态[i].数值(); }
            for (let i=0;i<this.状态.length;i++){ if (this.状态[i].类型==type+"debuff"&& this.状态[i].上级 != exclude) attr -= this.状态[i].数值(); }
        }
        if (["物理易伤","魔法易伤"].includes(type)) {
            for (let i=0;i<this.状态.length;i++) { if (this.状态[i].类型==type+"buff") attr *= (1+0.01*this.状态[i].数值()); }
        }
        if (["回复效果","吸血效果","治疗效果"].includes(type)) {
            for (let i=0;i<this.敌方阵营.length;i++){ attr *= (1 - this.敌方阵营[i].属性(type.replace(/效果/,"抑制"))); }
        }
        if (this.允许遗迹 && 遗迹.启用 && type in 遗迹){
            if (["物伤","魔伤","持伤","暴伤","体质"].includes(type)) { attr *= (1 + 遗迹[type]); }
            else { attr += 遗迹[type]; }
            if (["物理单吸","物理群吸","魔法单吸","魔法群吸"].includes(type)) { attr *= (1 + 遗迹["吸血"]); }
        }
        return 舍入取正(attr, type);
    }
    
    准备 (condition) {
        let 触发列表 = ["域之环", "武器", "防具", "饰品1", "饰品2", "魔石"];
        if (condition == "战斗开始") { for (var i=0;i<6;i++) if (this[触发列表[i]]!=null) this[触发列表[i]].触发(condition); }
        else { for (var i=1;i<6;i++) { if (this[触发列表[i]]!=null) {
            const t = this[触发列表[i]].触发(condition);
            if (t != null) return t; 
        }}}
        return null;
    }
    
    拥有 (name) { for (let i=0;i<this.状态.length;i++) { if (this.状态[i].名称==name) return true; } return false; }
    被附加 (status, p=NaN) {
        if (!Rand((p-0.001*this.属性("抗性")))) return;
        let curlayer = 0;
        for (let i=this.状态.length-1;i>=0;i--){ if (this.状态[i].名称==status.名称 && this.状态[i].上级==status.上级) curlayer = this.状态[i].当前层数; }
        for (let i=this.状态.length-1;i>=0;i--){ if (this.状态[i].名称==status.名称) this.状态.splice(i,1); }
        status.当前层数 = Math.min(curlayer+1, status.最大层数);
        this.状态.push(status);
        TimeLine("    "+this.名称+"被附加"+status.名称+",当前数值"+status.数值().toString());
    }
    附加 (caller, target, p=NaN) {
        if (target=="自身") { this.被附加(new 状态类(caller, this)); }
        if (target=="我方单体") { this.我方目标.被附加(new 状态类(caller, this)); }
        if (target=="我方全体") { for (let i=0;i<this.我方阵营.length;i++) if (this.我方阵营[i].存活) this.我方阵营[i].被附加(new 状态类(caller, this)); }
        if (target=="敌方单体") { this.敌方目标.被附加(new 状态类(caller, this), p); }
        if (target=="敌方全体") { for (let i=0;i<this.敌方阵营.length;i++) if (this.敌方阵营[i].存活) this.敌方阵营[i].被附加(new 状态类(caller, this), p); }
    }
    
    被治疗 (that, heal) {
        heal = Max(Int(heal * this.属性("治疗效果")), 1);
        this.当前生命 = Min(this.当前生命 + heal, this.属性("体质")*10);
        TimeLine("    "+this.名称+"受到来自"+that.名称+"的生命恢复"+heal.toString()+",当前生命"+this.当前生命);
    }
    被攻击 (that, harm, type="真实", hitrate=NaN, critrate=NaN, ratio="", rate=0) {
        if (type!="真实" && !Rand(hitrate + that.属性("命中") + 0.3 * that.属性("技巧") / this.属性("速度") - this.属性("闪避"))) return 0;
        if (type!="真实" && Rand(critrate + that.属性("暴击") + that.属性("技巧")/2000)) harm = Int(harm * that.属性("暴伤"));
        if (type!="真实" && this.种族 == ratio) harm = Int(harm * (1 + rate));
        if (type == "物理") {
            this.准备("受到物理攻击");
            let 实际护甲 = Max(this.属性("护甲") - that.属性("无视护甲"), 0);
            harm = Int(harm * 50 / (50 + 实际护甲));
            harm = Int(harm * this.属性("物理易伤") - this.属性("物伤格挡"));
        }
        if (type == "魔法") {
            this.准备("受到魔法攻击");
            let 实际抗性 = Max(this.属性("抗性") - that.属性("无视抗性"), 0);
            harm = Int(harm * 50 / (50 + 实际抗性));
            harm = Int(harm * this.属性("魔法易伤") - this.属性("魔伤格挡"));
        }
        harm = Int(Min(Max(harm, 1), this.当前生命));
        this.当前生命 = Int(this.当前生命 - harm);
        if (this.当前生命 == 0) this.存活 = 0;
        for (let i=0;i<this.状态.length;i++) { if (type!="真实" && this.状态[i].类型=="反击buff") that.被攻击(this, harm*this.状态[i].数值()); }
        for (let i=0;i<属性列表.length;i++) this.增幅[i] = 0;
        TimeLine("    "+this.名称+"受到来自"+that.名称+"的"+type+"伤害"+harm.toString()+",当前生命"+this.当前生命);
        return harm;
    }
    
    技能可施放 (index) {
        if (this.技能[index] == null || this.技能设置[index] <= 0) return false;
        if (index == 0) { if (10*this.当前生命/this.属性("体质") < this.技能设置[index]) return 1; }
        if (index == 1 && !this.拥有("嘲讽")) { if (10*this.当前生命/this.属性("体质") > (100-this.技能设置[index])) return 1; }
        if (index == 2 && !this.拥有("反击")) { return 1; }
        if (index == 3 && 技能设置b != 0) { for (let i=0;i<this.我方阵营.length;i++) { if (this.我方阵营[i].存活!=0 && this.我方阵营[i].站位!=this.站位) {
            if (10*this.我方阵营[i].当前生命/this.我方阵营[i].属性("体质") < this.技能设置[index]) return 1;;
        }}}
        if (index == 4) { 
            let 敌方人数 = 0; 
            for (let i=0;i<this.敌方阵营.length;i++) { if (this.敌方阵营[i].存活!=0) { 敌方人数++; }}
            if (敌方人数 >= Int(5 - this.技能设置[index])) return 1;;
        }
        if (this.技能设置[index] == 2) return 1;
        else return 2;
    }
    技能选择 () {
        if (this.职业 == "夜莺" && this.技能循环 == "夜莺手操" && this.冷却时间增加 != 0) {
            if (this.启动连击 == undefined) this.启动连击 = false;
            let 存在专注 = this.拥有("专注");
            let 存在流血 = 0; for (let i=0;i<this.敌方目标.状态.length;i++){ if (this.敌方目标.状态[i].名称=="流血") 存在流血 = this.敌方目标.状态[i].剩余时间; }
            let 存在瘟疫 = 0; for (let i=0;i<this.敌方目标.状态.length;i++){ if (this.敌方目标.状态[i].名称=="瘟疫") 存在瘟疫 = this.敌方目标.状态[i].剩余时间; }
            if (this.启动连击 == false && !存在专注 && 存在流血 > 0 && 存在瘟疫 > 0){ this.启动连击 = true; }
            else if (this.启动连击 == true && (存在流血 == 0 || 存在瘟疫 == 0)){ this.启动连击 = false; }
            if (this.启动连击 == true) return 6;
            else if (存在流血 < 存在瘟疫) return 5;
            else return 7;
        }
        else {
            for (let i=0;i<8;i++) { if (this.技能可施放(i) == 1) return i; }
            let skills = []; for (let i=5;i<8;i++) { if (this.技能设置[i]==1) skills.push(i); }
            if (skills.length == 1){
                return skills[0];
            }
            if (skills.length == 2){
                let lastskill = skills.indexOf(this.上个技能);
                if (lastskill == -1 && Rand(0.5)) return skills[0];
                else if (lastskill == -1) return skills[1];
                else if (lastskill+1>=skills.length) return skills[0];
                else return skills[lastskill+1]
            }
            if (skills.length == 3){
                if (Rand(1/3)) return skills[0];
                if (Rand(1/2)) return skills[1];
                return skills[2];
            }
        }
        return -1;
    }
    
    状态时钟 () {
        for (let i=0;i<this.状态.length;i++) {
            this.状态[i].剩余时间 = Fix(this.状态[i].剩余时间 - 0.1);
            if (this.状态[i].类型 == "hot" && Number.isInteger(this.状态[i].剩余时间)) { this.被治疗(this.状态[i], this.状态[i].数值()); }
            if (this.状态[i].类型 == "dot" && Number.isInteger(this.状态[i].剩余时间)) { this.被攻击(this.状态[i], this.状态[i].数值()); }
        }
        for (let i=this.状态.length-1;i>=0;i--) { if (this.状态[i].剩余时间 == 0) this.状态.splice(i, 1); }
    }
    技能时钟 () {
        if (this.拥有("眩晕")) return;
        this.冷却等待时间 = Fix(this.冷却等待时间 + 0.1);
        let 卸负后力量 = Max(this.属性("力量") - this.属性("卸负"), 1);
        let 力速比 = Min(Math.floor(卸负后力量*10/(this.属性("速度")+1))/10, 3);
        let 当前CD = Fix(Max(1.5 + 力速比 + this.冷却时间增加, 0.5));
        if (this.冷却等待时间 < 当前CD) return;
        let index = this.技能选择();
        if (index == -1) { return; }
        this.冷却时间增加 = this.技能[index].冷却时间增加; this.冷却等待时间 = 0; this.上个技能 = index;
        TimeLine(this.名称+"施放"+this.技能[index].名称);
        this.技能[index].施放();
    }
    
    constructor (way, stand, arg1, arg2) {
        this.constructor_general(stand);
        if (way == "冒险者") { this.constructor_adventuror(arg1); }
        if (way == "战力测试装置") { this.constructor_trunk (arg1, arg2); }
    }
    constructor_general(stand){
        this.存活 = 1;
        this.站位 = 生物列表[stand].length;
        生物列表[stand].push(this);
        
        this.面板 = []; this.增幅 = []; for (let i=0;i<属性列表.length;i++){ this.面板.push(0); this.增幅.push(0); }
        let 初始为一 = ["物伤", "魔伤", "持伤", "物理易伤", "魔法易伤", "回复效果", "吸血效果", "治疗效果"];
        for (let i=0;i<初始为一.length;i++){ this.面板[P(初始为一[i])] = 1; } this.面板[P("暴伤")] = 1.5; 
        this.免疫 = [];
        this.状态 = []; this.允许遗迹 = 0;
        let equipments = ["武器","防具","饰品1","饰品2","魔石","域之环"]; for (let i=0;i<6;i++) this[equipments[i]] = null;
        this.技能 = [null, null, null, null, null, null, null, null]; 
        this.技能设置 = [0, 0, 0, 0, 0, 0, 0, 0];
        this.我方阵营 = 生物列表[stand]; this.敌方阵营 = 生物列表[1 - stand]; this.我方目标 = null; this.敌方目标 = null;
        
        this.当前生命 = 0;
        this.冷却时间增加 = 0; this.冷却等待时间 = 0; this.上个技能 = -1; this.优先目标 = "随意攻击"; this.技能循环 = "默认";
    }
    constructor_adventuror (array){
        this.允许遗迹 = 1;
        this.种族 = "人型生物";
        
        let list1 = ["命中","闪避","暴击","异常","暴伤","无视护甲","无视抗性","卸负"];
        let eq = ["武器", "防具", "饰品1", "饰品2"];
        for (let e=0;e<4;e++){ 
            if (array[酒馆组件列表.indexOf(eq[e]+"下拉框")] != ""){
                this[eq[e]] = new 装备类(this, array[酒馆组件列表.indexOf(eq[e]+"下拉框")]);
                this[eq[e]].Decode();
                for (var i=0;i<list1.length;i++) this.面板[P(list1[i])] += this[eq[e]][list1[i]];
                this.面板[P("物理单吸")] += this[eq[e]].吸血;
                this.面板[P("物理群吸")] += this[eq[e]].吸血;
                this.面板[P("魔法单吸")] += this[eq[e]].吸血;
                this.面板[P("魔法群吸")] += this[eq[e]].吸血;
                this.面板[P("回复效果")] += this[eq[e]].回复;
                this.面板[P("治疗抑制")] = 1-(1-this.面板[P("治疗抑制")])*(1-this[eq[e]].治疗抑制);
                for (let i=0;i<this[eq[e]].免疫.length;i++) if (!this.免疫.includes(this[eq[e]].免疫[i])) this.免疫.push(this[eq[e]].免疫[i]);
            }
            else { this[eq[e]] = null; }
        }
        if (array[酒馆组件列表.indexOf("魔石类型下拉框")] != ""){
            this.魔石 = new 魔石类(this, array[酒馆组件列表.indexOf("魔石类型下拉框")], array[酒馆组件列表.indexOf("魔石数值下拉框")]); 
            this.面板[P("命中")] += this.魔石.属性("命中");
            this.面板[P("异常")] += this.魔石.属性("异常");
            this.面板[P("无视护甲")] += this.魔石.属性("无视护甲");
            this.面板[P("无视抗性")] += this.魔石.属性("无视抗性");
        }
        else { this.魔石 = null; }
        if (array[酒馆组件列表.indexOf("环类型下拉框")] != ""){
            this.域之环 = new 域之环类(this, array[酒馆组件列表.indexOf("环类型下拉框")], 
                                  array[酒馆组件列表.indexOf("环特效下拉框")], 
                                  array[酒馆组件列表.indexOf("环数值百分框")]); 
        }
        else { this.域之环 = null; }
        
        this.名称 = array[酒馆组件列表.indexOf("冒险者名称输入框")]; 
        this.分支 = array[酒馆组件列表.indexOf("分支下拉框")]; 
        this.阶位 = "日阶";
        this.职业 = array[酒馆组件列表.indexOf("职业下拉框")];
        let list2 = ["力量","魔力","技巧","速度","体质","护甲","抗性","武威"];
        for (var i=0;i<list2.length;i++) this.面板[P(list2[i])] += 百分数解析(array[酒馆组件列表.indexOf(list2[i]+"输入框")]); 
        let list3 = ["命中","闪避","暴击","物伤","魔伤","回复效果","物理单吸","物理群吸","魔法单吸","魔法群吸"];
        for (var i=0;i<list3.length;i++) this.面板[P(list3[i])] += 百分数解析(array[酒馆组件列表.indexOf(list3[i]+"百分框")]); 
        this.当前生命 = this.面板[P("体质")] * 10;
        if (Int(array[酒馆组件列表.indexOf("生命")]) > 0) this.当前生命 = Int(array[酒馆组件列表.indexOf("生命")]);
        
        let 技能1 = new 技能类(this, this.职业, 0); let 技能2 = null; let 技能3 = null;
        if (this.分支!="牧星者") 技能2 = new 技能类(this, this.职业, 1); 
        if (this.分支!="牧星者") 技能3 = new 技能类(this, this.职业, 2); 
        let 技能槽 = ["自奶", "嘲讽", "反击", "治疗", "群攻", "单攻", "单攻", "单攻"]; 
        for (let i=0;i<8;i++) { if (this.技能[i] == null && 技能槽[i] == 技能1.类型) { this.技能[i] = 技能1; break; } }
        for (let i=0;i<8;i++) { if (this.技能[i] == null && 技能槽[i] == "自奶" && 技能1.类型 == "治疗") { this.技能[i] = 技能1; break; } }
        if (this.分支!="牧星者") {
        for (let i=0;i<8;i++) { if (this.技能[i] == null && 技能槽[i] == 技能2.类型) { this.技能[i] = 技能2; break; } }
        for (let i=0;i<8;i++) { if (this.技能[i] == null && 技能槽[i] == "自奶" && 技能2.类型 == "治疗") { this.技能[i] = 技能2; break; } }
        for (let i=0;i<8;i++) { if (this.技能[i] == null && 技能槽[i] == 技能3.类型) { this.技能[i] = 技能3; break; } }
        for (let i=0;i<8;i++) { if (this.技能[i] == null && 技能槽[i] == "自奶" && 技能3.类型 == "治疗") { this.技能[i] = 技能3; break; } }
        }
        for (let i=0;i<8;i++) { this.技能设置[i] = Int(array[酒馆组件列表.indexOf("技能设置滑块" + i.toString())]); }
        for (let i=0;i<8;i++) { if (this.技能[i] == null)this.技能设置[i] = 0; }
        this.优先目标 = 优先目标列表[Int(array[酒馆组件列表.indexOf("技能设置滑块8")])];
        this.技能循环 = 技能循环列表[Int(array[酒馆组件列表.indexOf("技能设置滑块9")])];
    }
    constructor_trunk (blood, speed) {
        this.种族 = "傀儡";
        this.名称 = "战力测试装置";
        this.面板[P("体质")] = blood / 10;
        this.当前生命 = blood;
        this.面板[P("速度")] = speed;
    }
}
let 生物列表 = [[],[]];
function End(){
    let end = true;
    for (let i=0;i<生物列表[1].length;i++)if (生物列表[1][i].存活==1) end = false;
    if (end) return true;
    for (let i=0;i<生物列表[0].length;i++)if (生物列表[0][i].存活==1) end = false;
    if (end) return true;
    return false;
}

</script>