From 3baf33379d941fcbb073f96500cbfac6e804c894 Mon Sep 17 00:00:00 2001 From: strawberry42271 <2806566736@qq.com> Date: Fri, 29 Nov 2024 12:33:31 +0800 Subject: [PATCH] _codelab --- _codelab/L1.md | 57 ++++++++++ _codelab/L1_answer.md | 244 ++++++++++++++++++++++++++++++++++++++++ _codelab/L2.md | 102 +++++++++++++++++ _codelab/L2_answer.md | 153 +++++++++++++++++++++++++ _codelab/L3.md | 38 +++++++ _codelab/_sidebar.md | 4 + _codelab/docsify.min.js | 2 + _codelab/index.html | 86 ++++++++++++++ _codelab/index.md | 5 + _codelab/vue.css | 1 + 10 files changed, 692 insertions(+) create mode 100644 _codelab/L1.md create mode 100644 _codelab/L1_answer.md create mode 100644 _codelab/L2.md create mode 100644 _codelab/L2_answer.md create mode 100644 _codelab/L3.md create mode 100644 _codelab/_sidebar.md create mode 100644 _codelab/docsify.min.js create mode 100644 _codelab/index.html create mode 100644 _codelab/index.md create mode 100644 _codelab/vue.css diff --git a/_codelab/L1.md b/_codelab/L1.md new file mode 100644 index 0000000..e5dd9e9 --- /dev/null +++ b/_codelab/L1.md @@ -0,0 +1,57 @@ +# 第一章:伤害计算函数(getDamageInfo) + +要求:读懂脚本编辑 - 伤害计算函数(getDamageInfo)的全部脚本代码(无需理解支援的实现)。 + +回答如下几个问题: + +1. 如下几个局部变量分别是什么意义? + + `mon_atk`, `init_damage`, `per_damage`, `hero_per_damage`, `turn`, `damage` + +2. 如何理解下面这几句话? + + `if (core.hasSpecial(mon_special, 2)) per_damage = mon_atk;` + + `var turn = Math.ceil(mon_hp / hero_per_damage);` + + `var damage = init_damage + (turn - 1) * per_damage + turn * counterDamage;` + +3. 负伤在哪里实现的? + +依次实现如下几个怪物属性(仅允许修改`getDamageInfo`函数): + +1. **闪避(编号31):** 受到伤害降低40%。 + +2. **穿刺(编号32):** 无视角色70%防御力。 + +3. **冰冻(编号33):** 怪物首先冰冻角色3回合,冰冻期间每回合额外造成角色护盾的20%伤害。 + +4. **中子束(编号34):** 每回合普攻两次,魔攻一次。 + +5. **残暴斩杀(编号35):** 战斗开始时,如果角色血量不大于怪物血量的200%,则直接暴毙。 + +6. **窥血为攻(编号36):** 战斗开始时,自身攻击力变为角色当前生命值的10%,向下取整。 + +7. **匙之力(编号37):** 角色身上每存在一把黄钥匙,最终伤害提升5%;蓝钥匙视为三把黄钥匙,红钥匙视为九把黄钥匙,线性叠加。 + +8. **崩甲(编号38):** 怪物每回合附加勇士战斗开始时的护盾数值的0.1倍作为伤害。 + +9. **混乱(编号39):** 战斗中,勇士攻防互换。 + +10. **强击(编号40):** 怪物第一回合三倍攻击。 + +11. **暗影庇护(编号41):** 处于无敌状态,但每回合损耗自身2%的最大生命值。 + +再依次实现如下几个角色技能: + +1. 角色每回合回复`flag:x1`%倍护盾的生命值。(如,`flag:x1`是10时,每回合回复10%护盾值的生命) + +2. 角色每回合造成和受到的伤害均提升`flag:x2`%。(如,`flag:x2`为10时,每回合造成和受到伤害都提升10%) + +3. 角色攻击在战斗时减少`flag:x3`,防御力增加`flag:x3`。 + +4. 角色无视怪物的`flag:x4`%的防御力。(如,`flag:x4`是10时,无视怪物的10%防御力) + +5. 角色额外抢攻`flag:x5`回合。 + +[点此查看答案](L1_answer) diff --git a/_codelab/L1_answer.md b/_codelab/L1_answer.md new file mode 100644 index 0000000..2619e75 --- /dev/null +++ b/_codelab/L1_answer.md @@ -0,0 +1,244 @@ +```js +function (enemy, hero, x, y, floorId) { + // 获得战斗伤害信息(实际伤害计算函数) + // + // 参数说明: + // enemy:该怪物信息 + // hero:勇士的当前数据;如果对应项不存在则会从core.status.hero中取。 + // x,y:该怪物的坐标(查看手册和强制战斗时为undefined) + // floorId:该怪物所在的楼层 + // 后面三个参数主要是可以在光环等效果上可以适用 + floorId = floorId || core.status.floorId; + + var hero_hp = core.getRealStatusOrDefault(hero, 'hp'), + hero_atk = core.getRealStatusOrDefault(hero, 'atk'), + hero_def = core.getRealStatusOrDefault(hero, 'def'), + hero_mdef = core.getRealStatusOrDefault(hero, 'mdef'), + origin_hero_hp = core.getStatusOrDefault(hero, 'hp'), + origin_hero_atk = core.getStatusOrDefault(hero, 'atk'), + origin_hero_def = core.getStatusOrDefault(hero, 'def'); + + // 勇士的负属性都按0计算 + hero_hp = Math.max(0, hero_hp); + hero_atk = Math.max(0, hero_atk); + hero_def = Math.max(0, hero_def); + hero_mdef = Math.max(0, hero_mdef); + + // 怪物的各项数据 + // 对坚固模仿等处理扔到了脚本编辑-getEnemyInfo之中 + var enemyInfo = core.enemys.getEnemyInfo(enemy, hero, x, y, floorId); + var mon_hp = enemyInfo.hp, + mon_atk = enemyInfo.atk, + mon_def = enemyInfo.def, + mon_special = enemyInfo.special; + + // 混乱(编号39):战斗中,勇士攻防互换。 + if (core.hasSpecial(mon_special, 39)) { + var temp = hero_atk; + hero_atk = hero_def; + hero_def = temp; + } + + // 残暴斩杀(编号35):战斗开始时,如果角色血量不大于怪物血量的200%,则直接暴毙。 + if (core.hasSpecial(mon_special, 35) && hero_hp < mon_hp * 2) { + return null; + } + + // 窥血为攻(编号36):战斗开始时,自身攻击力变为角色当前生命值的10%,向下取整。 + if (core.hasSpecial(mon_special, 36)) { + mon_atk = Math.floor(hero_hp / 10); + } + + // 技能3:角色攻击在战斗时减少`flag:x3`,防御力增加`flag:x3`。 + if (core.getFlag('skill', 0) == 3) { + // 注意这里直接改变的面板攻击力(经过装备增幅后的)而不是基础攻击力。 + hero_atk -= core.getFlag('x3', 0); + hero_def += core.getFlag('x3', 0); + } + + // 技能4:角色无视怪物的`flag:x4`%的防御力。(如,`flag:x4`是10时,无视怪物的10%防御力) + if (core.getFlag('skill', 0) == 4) { + mon_def -= Math.floor(core.getFlag('x4', 0) / 100); + } + + // 如果是无敌属性,且勇士未持有十字架 + if (core.hasSpecial(mon_special, 20) && !core.hasItem("cross")) + return null; // 不可战斗 + + // 战前造成的额外伤害(可被护盾抵消) + var init_damage = 0; + + // 吸血 + if (core.hasSpecial(mon_special, 11)) { + var vampire_damage = hero_hp * enemy.value; + + // 如果有神圣盾免疫吸血等可以在这里写 + // 也可以用hasItem和hasEquip来判定装备 + // if (core.hasFlag('shield5')) vampire_damage = 0; + + vampire_damage = Math.floor(vampire_damage) || 0; + // 加到自身 + if (enemy.add) // 如果加到自身 + mon_hp += vampire_damage; + + init_damage += vampire_damage; + } + + // 每回合怪物对勇士造成的战斗伤害 + var per_damage = mon_atk - hero_def; + // 魔攻:战斗伤害就是怪物攻击力 + if (core.hasSpecial(mon_special, 2)) per_damage = mon_atk; + // 穿刺(编号32):无视角色70%防御力。 + if (core.hasSpecial(mon_special, 32)) per_damage = Math.floor(mon_atk - 0.3 * hero_def); + // 战斗伤害不能为负值 + if (per_damage < 0) per_damage = 0; + + // 中子束(编号34):每回合普攻两次,魔攻一次。 + if (core.hasSpecial(mon_special, 34)) { + per_damage *= 2; + per_damage += mon_atk; + } + + // 崩甲(编号38):怪物每回合附加勇士战斗开始时的护盾数值的0.1倍作为伤害。 + if (core.hasSpecial(mon_special, 38)) { + per_damage += Math.floor(hero_mdef * 0.1); + } + + // 2连击 & 3连击 & N连击 + if (core.hasSpecial(mon_special, 4)) per_damage *= 2; + if (core.hasSpecial(mon_special, 5)) per_damage *= 3; + if (core.hasSpecial(mon_special, 6)) per_damage *= (enemy.n || 4); + + // 每回合的反击伤害;反击是按照勇士的攻击次数来计算回合 + var counterDamage = 0; + if (core.hasSpecial(mon_special, 8)) + counterDamage += Math.floor((enemy.atkValue || core.values.counterAttack) * hero_atk); + + // 先攻 + if (core.hasSpecial(mon_special, 1)) init_damage += per_damage; + + // 破甲 + if (core.hasSpecial(mon_special, 7)) + init_damage += Math.floor((enemy.defValue || core.values.breakArmor) * hero_def); + + // 净化 + if (core.hasSpecial(mon_special, 9)) + init_damage += Math.floor((enemy.n || core.values.purify) * hero_mdef); + + // 冰冻(编号33):怪物首先冰冻角色3回合,冰冻期间每回合额外造成角色护盾的20%伤害。 + if (core.hasSpecial(mon_special, 33)) { + init_damage += Math.floor(3 * (per_damage + 0.2 * hero_mdef)); + } + + // 勇士每回合对怪物造成的伤害 + var hero_per_damage = Math.max(hero_atk - mon_def, 0); + + // 技能2:角色每回合造成和受到的伤害均提升`flag:x2`%。(如,`flag:x2`为10时,每回合造成和受到伤害都提升10%) + if (core.getFlag("skill", 0) == 2) { + per_damage += Math.floor(per_damage * core.getFlag('x2', 0) / 100); + hero_per_damage += Math.floor(hero_per_damage * core.getFlag('x2', 0) / 100); + } + + // 闪避(编号31):受到伤害降低40%。 + if (core.hasSpecial(mon_special, 31)) { + hero_per_damage = Math.floor(hero_per_damage * 0.6); + } + + // 如果没有破防,则不可战斗 + if (hero_per_damage <= 0) return null; + + // 技能5:角色额外抢攻`flag:x5`回合。 + if (core.getFlag("skill", 0) == 5) { + mon_hp -= core.getFlag('x5', 0) * hero_per_damage; + // 判定是否已经秒杀 -> 注意mon_hp不能小于等于0否则回合计算会出问题 + if (mon_hp <= 0) mon_hp = 1; + } + + // 暗影庇护(编号41):处于无敌状态,但每回合损耗自身2%的最大生命值。 + if (core.hasSpecial(mon_special, 41)) { + hero_per_damage = Math.floor(mon_hp * 0.02); + } + + // 强击(编号40):怪物第一回合三倍攻击。 + // 注意:需要判定角色是否秒杀怪物 + if (core.hasSpecial(mon_special, 40) && hero_per_damage < mon_hp) { + init_damage += 2 * mon_atk; + } + + + // 勇士的攻击回合数;为怪物生命除以每回合伤害向上取整 + var turn = Math.ceil(mon_hp / hero_per_damage); + + // ------ 支援 ----- // + // 这个递归最好想明白为什么,flag:__extraTurn__是怎么用的 + var guards = core.getFlag("__guards__" + x + "_" + y, enemyInfo.guards); + var guard_before_current_enemy = false; // ------ 支援怪是先打(true)还是后打(false)? + turn += core.getFlag("__extraTurn__", 0); + if (guards.length > 0) { + if (!guard_before_current_enemy) { // --- 先打当前怪物,记录当前回合数 + core.setFlag("__extraTurn__", turn); + } + // 获得那些怪物组成小队战斗 + for (var i = 0; i < guards.length; i++) { + var gx = guards[i][0], + gy = guards[i][1], + gid = guards[i][2]; + // 递归计算支援怪伤害信息,这里不传x,y保证不会重复调用 + // 这里的mdef传0,因为护盾应该只会被计算一次 + var info = core.enemys.getDamageInfo(core.material.enemys[gid], { hp: origin_hero_hp, atk: origin_hero_atk, def: origin_hero_def, mdef: 0 }); + if (info == null) { // 小队中任何一个怪物不可战斗,直接返回null + core.removeFlag("__extraTurn__"); + return null; + } + // 已经进行的回合数 + core.setFlag("__extraTurn__", info.turn); + init_damage += info.damage; + } + if (guard_before_current_enemy) { // --- 先打支援怪物,增加当前回合数 + turn += core.getFlag("__extraTurn__", 0); + } + } + core.removeFlag("__extraTurn__"); + // ------ 支援END ------ // + + // 最终伤害:初始伤害 + 怪物对勇士造成的伤害 + 反击伤害 + var damage = init_damage + (turn - 1) * per_damage + turn * counterDamage; + // 再扣去护盾 + damage -= hero_mdef; + + // 匙之力(编号37):角色身上每存在一把黄钥匙,最终伤害提升5%;蓝钥匙视为三把黄钥匙,红钥匙视为九把黄钥匙,线性叠加。 + // 需要判定是否负伤 + if (core.hasSpecial(mon_special, 37) && damage > 0) { + var cnt = core.itemCount("yellowKey") + 3 * core.itemCount("blueKey") + 9 * core.itemCount("redKey"); + damage += Math.floor(damage * 0.05 * cnt); + } + + // 检查是否允许负伤 + if (!core.flags.enableNegativeDamage) + damage = Math.max(0, damage); + + // 最后处理仇恨和固伤(因为这两个不能被护盾减伤) + if (core.hasSpecial(mon_special, 17)) { // 仇恨 + damage += core.getFlag('hatred', 0); + } + if (core.hasSpecial(mon_special, 22)) { // 固伤 + damage += enemy.damage || 0; + } + + // 技能1:角色每回合回复`flag:x1`%倍护盾的生命值。(如,`flag:x1`是10时,每回合回复10%护盾值的生命) + if (core.getFlag("skill", 0) == 1) { + damage -= Math.floor(core.getFlag('x1', 0) / 100 * hero_mdef * turn); + } + + return { + "mon_hp": Math.floor(mon_hp), + "mon_atk": Math.floor(mon_atk), + "mon_def": Math.floor(mon_def), + "init_damage": Math.floor(init_damage), + "per_damage": Math.floor(per_damage), + "hero_per_damage": Math.floor(hero_per_damage), + "turn": Math.floor(turn), + "damage": Math.floor(damage) + }; +} +``` diff --git a/_codelab/L2.md b/_codelab/L2.md new file mode 100644 index 0000000..f4423ff --- /dev/null +++ b/_codelab/L2.md @@ -0,0 +1,102 @@ +# 第二章:怪物特殊属性定义(getSpecials),表格配置 + +要求:读懂脚本编辑 - 怪物特殊属性定义(getSpecials)的实现。理解如何定义一个新的怪物属性。同时,还需要理解如何给怪物表格增加新项目。 + +回答如下问题: + +1. 如何定义一个新的怪物属性? + +2. 如何取得当前怪物的各项数值? + +3. 第五项参数在哪些情况下写1?为什么需要? + +4. 如何给怪物表格定义新项目?如何在伤害计算等地方取用定义的新项目? + +5. 当前,有一部分怪物属性使用了相同的表格项,如阻激夹域都使用了`value`等;这样无法同时给怪物增加吸血和领域两个属性。那应该怎么做才能同时支持这两项? + +6. 理解《咕工智障》的下述怪物特殊属性并回答: + - 如果一个该属性怪物设置了`hpValue = 10, range = 2`,那么怪物手册中显示该怪物的特殊属性名和描述是什么? + - 如果一个该属性怪物设置了`hpValue = -20, defValue = 30`,那么怪物手册中显示该怪物的特殊属性名和描述是什么? + - 如果一个该属性怪物设置了`hpValue = 10, atkValue = 20, defValue = 30, add = true`,那么怪物手册中显示该怪物的特殊属性名和描述是什么? + - 如果怪物手册中的描述是`周围方形范围内5格的友军生命提升10%,攻击降低20%,线性叠加`,那么该怪物的哪些项被设置了成了多少?该怪物的特殊属性名是什么? + - 如果怪物手册中的描述是`周围十字范围内3格的友军生命提升20%,攻击提升10%,防御提升5%,不可叠加`,那么该怪物的哪些项被设置了成了多少?该怪物的特殊属性名是什么? + + ```js + [25, function (enemy) { + if (enemy.auraName) return enemy.auraName; + if (enemy.hpValue && enemy.atkValue && enemy.defValue) return "魔力光环"; + if (enemy.hpValue) { + if (enemy.hpValue > 0) return "活力光环"; + return "懒散光环"; + } + if (enemy.atkValue) { + if (enemy.atkValue > 0) return "狂暴光环"; + return "静谧光环"; + } + if (enemy.defValue) { + if (enemy.defValue > 0) return "坚毅光环"; + return "软弱光环"; + } + return "光环"; + }, function (enemy) { + var str; + if (!enemy.range) { + str = "同楼层所有友军"; + } else { + str = "周围" + (enemy.zoneSquare ? "方形" : "十字") + + "范围内\r[yellow]" + (enemy.range || 1) + "\r格的友军"; + } + if (enemy.hpValue) { + if (enemy.hpValue > 0) str += "生命提升\r[yellow]" + enemy.hpValue + "%\r,"; + else str += "生命降低\r[yellow]" + (-enemy.hpValue) + "%\r,"; + } + if (enemy.atkValue) { + if (enemy.atkValue > 0) str += "攻击提升\r[yellow]" + enemy.atkValue + "%\r,"; + else str += "攻击降低\r[yellow]" + (-enemy.atkValue) + "%\r,"; + } + if (enemy.defValue) { + if (enemy.defValue > 0) str += "防御提升\r[yellow]" + enemy.defValue + "%\r,"; + else str += "防御降低\r[yellow]" + (-enemy.defValue) + "%\r,"; + } + str += (enemy.add ? "线性叠加" : "不可叠加"); + return str; + }, "#e6e099", 1], + ``` + +7. 理解《咕工智障》的下述怪物特殊属性并回答: + - 吸血数值是如何计算在怪物手册之中的? + - 如何根据角色当前拥有的道具或者变量来修改怪物属性描述? + - 如果要让简单难度下,怪物吸血值减半,特殊属性定义中应该怎么修改? + + ```js + [11, "吸血", function (enemy) { + var str = "\r[\#e525ff]【红海技能】\r战斗前,首先吸取对方的" + + Math.floor(100 * enemy.value || 0) + "%生命(约" + + Math.floor((enemy.value || 0) * core.getRealStatus('hp')) + "点)作为伤害" + + (enemy.add ? ",并把伤害数值加到自身生命上" : ""); + if (core.hasItem("I_noVampire")) str += "\r[yellow](对你无效)\r"; + return str; + }, "#ff00d2"], + ``` + +8. 定义同时满足如下条件的特殊属性(编号`28`),并和《咕工智障》的写法进行比较。 + - 当怪物的 `value28 > 0` 时,特殊属性名为`迅捷光环` + - 当怪物的 `value28 <= 0` 时,特殊属性名为`怠惰光环` + - 当难度为简单(`flag:hard = 1`)时,描述为`此技能在简单难度下无效!` + - 当角色拥有道具 `I123` 时,描述为`此技能已被魔杖抵消!` + - 当怪物的 `range > 0` 时,描述存在`周围[方形/十字]范围内[?]格的友军`;其中这`[]`里面内容由怪物的 `zoneSquare` 和 `range` 决定。 + - 当怪物的 `range = null` 时,描述存在`当前楼层的友军` + - 当怪物的 `value28 > 0` 时,描述存在`先攻X回合`,其中X由`value28`决定(如,`value28 = 5`时,描述存在`先攻5回合`) + - 当怪物的 `value28 <= 0` 时,描述存在`被先攻X回合`,其中X由`value28`决定(如,`value28 = -5`时,描述存在`被先攻5回合`) + +9. 定义同时满足如下条件的特殊属性(编号`30`),并和《咕工智障》的写法进行比较。 + - 特殊属性名:匙之力 + - 当怪物的 `range > 0` 时,描述存在`周围[方形/十字]范围内[?]格内`;其中这`[]`里面内容由怪物的 `zoneSquare` 和 `range` 决定。 + - 当怪物的 `range = null` 时,描述存在`同楼层内` + - 描述存在 `每存在一个黄钥匙,生命增加X点,攻击增加Y点,防御增加Z点`,其中`X, Y, Z`由怪物的`value, atkValue, defValue`决定。如果其中某一项为0或null则不显示对应项。(例如,如果`value = 30, defValue = 20`则只显示`生命增加30点,防御增加20点`) + +10. 将阻击、激光、领域、吸血所使用的特殊属性值(当前均为`value`)分离,并实现一个怪物同时拥有`阻击伤害100点,激光伤害50点,领域伤害200点,且吸血20%`这四个特殊属性。 + - 需在怪物手册正确显示 + - 需正确实现对应的效果(需要修改`伤害计算(getDamageInfo)和阻激夹域伤害(updateCheckBlock)`两个函数) + +[点此查看答案](L2_answer) diff --git a/_codelab/L2_answer.md b/_codelab/L2_answer.md new file mode 100644 index 0000000..227fd1c --- /dev/null +++ b/_codelab/L2_answer.md @@ -0,0 +1,153 @@ +1. 在怪物特殊属性中增加一行,分别定义特殊属性的数字、名字、描述、颜色,以及是否是地图类技能(如光环)。 + +2. 使用`function (enemy) {}`,里面可以取用`enemy.xxx`调用数值;例如`enemy.value`可以调用怪物的value值。 + +3. 仅在地图类技能时需要写1。当怪物的该项为1时,意味着该怪物的技能是和地图上其他图块有关的(而不是怪物自身独立的)。例如,先攻魔攻这些技能就是自身独立(和地图上其他图块无关),而光环,匙之力(根据周边钥匙数量提升属性)等这些技能就是与地图上其他怪物有关的。 + +4. 点击「配置表格」,找到怪物相关项目,并照葫芦画瓢即可。常见写法如下。 + + ```js + "value": { + "_leaf": true, + "_type": "textarea", + "_docs": "特殊属性数值", + "_data": "特殊属性的数值\n如:领域/阻激/激光怪的伤害值;吸血怪的吸血比例;光环怪增加生命的比例" + }, + ``` + +5. 可定义不同项目如v1, v2, v3等分别表示伤害值;然后修改特殊描述和实际效果以取用v1, v2, v3等来代替原来的value。参见第10题解答。 + +6. + - 活力光环;周围十字范围内2格的友军生命提升10%,不可叠加。 + - 懒散光环;同楼层所有友军生命降低20%,防御提升30%,不可叠加。(注意,不会显示坚毅光环!) + - 魔力光环:同楼层所有友军生命提升10%,攻击提升20%,防御提升30%,线性叠加。 + - range=5, zoneSquare = true, hpValue=10, atkValue=-20, add=true;活力光环。 + - range=3, hpValue = 20, atkValue = 10, defValue = 5;魔力光环。 + +7. + - 直接使用`enemy.value`获得当前吸血比例,乘以玩家当前生命值`core.getRealStatus('hp')`获得吸血数值,并取整再显示。 + - 可以通过额外的if来修改具体的描述。 + - 可以在简单难度下将value减半以达到效果。 + + ```js + [11, "吸血", function (enemy) { + var value = enemy.value || 0; // 怪物吸血比例 + if (flags.hard == 1) value /= 2; // 简单难度下吸血值减半 + // 使用局部变量 value 代替 enemy.value + var str = "\r[\#e525ff]【红海技能】\r战斗前,首先吸取对方的" + + Math.floor(100 * value) + "%生命(约" + + Math.floor(value * core.getRealStatus('hp')) + "点)作为伤害" + + (enemy.add ? ",并把伤害数值加到自身生命上" : ""); + if (core.hasItem("I_noVampire")) str += "\r[yellow](对你无效)\r"; + return str; + }, "#ff00d2"], + ``` + +8. + ```js + [28, function (enemy) { + if (enemy.value28 > 0) return "迅捷光环"; + return "怠惰光环"; + }, function (enemy) { + var str; + // 直接 return 可以不显示具体技能内容。 + if (flags.hard == 1) return '此技能在简单难度下无效!'; + if (core.hasItem('I123')) return '此技能已被魔杖抵消!'; + if (!enemy.range) { + str = "同楼层所有友军"; + } else { + str = "周围" + (enemy.zoneSquare ? "方形" : "十字") + "范围内\r[yellow]" + (enemy.range || 1) + "\r格的友军"; + } + if (enemy.value28 > 0) { + str += "先攻\r[yellow]" + (enemy.value28 || 0) + "\r回合。"; + } else { + str += "被先攻\r[yellow]" + (-enemy.value28 || 0) + "\r回合。"; + } + return str; + }, "#00dd00", 1], + ``` + +9. + ```js + [30, "匙之力", function (enemy) { + var str = ""; + if (enemy.range) { + str += "周围" + (enemy.zoneSquare ? "方形" : "十字") + "范围内\r[yellow]" + enemy.range + "\r格,每存在一把黄钥匙,"; + } + else str += "同楼层每存在一把黄钥匙,"; + if (enemy.value) str += "生命增加\r[yellow]" + enemy.value + "\r点,"; + if (enemy.atkValue) str += "攻击增加\r[yellow]" + enemy.atkValue + "\r点,"; + if (enemy.defValue) str += "防御增加\r[yellow]" + enemy.defValue + "\r点,"; + str += "线性叠加。1把蓝钥匙=3把黄钥匙,1把红钥匙=10把黄钥匙。"; + return str; + }, "#A0A000", 1], + ``` + +10. 使用配置表格增设如下项目(也可以使用更好的名称如laserValue): + ```js + "v1": { + "_leaf": true, + "_type": "textarea", + "_docs": "阻击伤害" + }, + "v2": { + "_leaf": true, + "_type": "textarea", + "_docs": "激光伤害" + }, + "v3": { + "_leaf": true, + "_type": "textarea", + "_docs": "领域伤害" + }, + "v4": { + "_leaf": true, + "_type": "textarea", + "_docs": "吸血比例" + }, + ``` + 然后,特殊描述可以如下修改(分别使用v1, v2, v3, v4代替value): + ```js + [11, "吸血", function (enemy) { return "战斗前,怪物首先吸取角色的" + Math.floor(100 * enemy.v4 || 0) + "%生命(约" + Math.floor((enemy.v4 || 0) * core.getStatus('hp')) + "点)作为伤害" + (enemy.add ? ",并把伤害数值加到自身生命上" : ""); }, "#dd4448"], + [15, "领域", function (enemy) { return "经过怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "范围内" + (enemy.range || 1) + "格时自动减生命" + (enemy.v3 || 0) + "点"; }, "#c677dd"], + [18, "阻击", function (enemy) { return "经过怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时自动减生命" + (enemy.v1 || 0) + "点,同时怪物后退一格"; }, "#8888e6"], + [24, "激光", function (enemy) { return "经过怪物同行或同列时自动减生命" + (enemy.v2 || 0) + "点"; }, "#dda0dd"], + ``` + 最后,修改实际效果。 + ```js + // 吸血:getDamageInfo(节选) + if (core.hasSpecial(mon_special, 11)) { + /** !!使用enemy.v4替代enemy.value!! **/ + var vampire_damage = hero_hp * enemy.v4; + + // 如果有神圣盾免疫吸血等可以在这里写 + // 也可以用hasItem和hasEquip来判定装备 + // if (core.hasFlag('shield5')) vampire_damage = 0; + + vampire_damage = Math.floor(vampire_damage) || 0; + // 加到自身 + if (enemy.add) // 如果加到自身 + mon_hp += vampire_damage; + + init_damage += vampire_damage; + } + ``` + ```js + // 领域:updateCheckBlock(节选) + for (var dx = -range; dx <= range; dx++) { + for (var dy = -range; dy <= range; dy++) { + if (dx == 0 && dy == 0) continue; + var nx = x + dx, + ny = y + dy, + currloc = nx + "," + ny; + if (nx < 0 || nx >= width || ny < 0 || ny >= height) continue; + // 如果是十字领域,则还需要满足 |dx|+|dy|<=range + if (!zoneSquare && Math.abs(dx) + Math.abs(dy) > range) continue; + /** !!使用enemy.v3替代enemy.value!! **/ + damage[currloc] = (damage[currloc] || 0) + (enemy.v3 || 0); + type[currloc] = type[currloc] || {}; + type[currloc]["领域伤害"] = true; + } + } + ``` + 激光和阻击同领域实现。 diff --git a/_codelab/L3.md b/_codelab/L3.md new file mode 100644 index 0000000..548eb2a --- /dev/null +++ b/_codelab/L3.md @@ -0,0 +1,38 @@ +# 第三章:怪物真实属性获取(getEnemyInfo) + +要求:读懂脚本编辑 - 怪物真实属性(getEnemyInfo)的实现(无需理解支援)。理解如何动态修改怪物的三维,理解光环效果的实现并知晓如何新增光环效果,理解如何定义新变量并在getDamageInfo中取用。 + +回答如下问题: + +1. 为什么要存在`getEnemyInfo`函数以获得怪物真实属性?所有东西都写在`getDamageInfo`里面不好吗? + +2. 实现**仿攻(编号45)**:怪物攻击不低于勇士攻击。 + +3. 实现**窥血为攻(编号36)**: 战斗开始时,自身攻击力变为角色当前生命值的10%,向下取整。这种写法比第一章中在`getDamageInfo`中写法效果更好,为什么? + +4. 仅修改`getEnemyInfo`,实现一个怪物`E345`满足: + - 简单难度(flag:hard==1)下,无特殊属性。 + - 普通难度(flag:hard==2)下,拥有先攻属性。 + - 困难难度(flag:hard==3)下,拥有三连击属性。 + - 噩梦难度(flag:hard==4)下,同时拥有先攻、魔攻、二连击属性。 + - 如果玩家拥有道具`I123`,则直接无视此怪物所有属性。 + +5. 仅修改`getEnemyInfo`,实现一个道具`I234`:**当玩家持有此道具时,怪物的血攻防均降低10%。** + +6. 仅修改`getEnemyInfo`,实现特殊属性 **「上位压制」(特殊编号46)**:玩家每低于怪物一个等级(通过`core.getStatus('lv')`获得当前玩家等级,通过`enemy.level`获得该怪物的等级),怪物三维提升10%;玩家每高于怪物一个等级,怪物三维降低5%。 + +7. 解释光环的缓存原理。为什么光环需要缓存? + +8. `index`是什么意思? `var cache = core.status.checkBlock.cache[index];` 是干什么的? + +9. 在默认光环的实现中,`hp_buff`, `atk_buff`, `def_buff`, `usedEnemyIds` 分别是干什么的? + +10. 在默认光环的实现中,怪物属性的`value`, `atkValue`和`defValue`用于控制怪物的比例增幅。将其效果修改成数值增幅(例如 `value = 50` 表示生命提升50点,而不是50%)。 + +11. 局部光环的实现原理是什么?十字和九宫格光环是如何区分的? + +12. 实现 **「协同作战」(特殊属性47)**:同楼层/周围X格(由range和zoneSquare决定),每存在一个该属性的队友(包括自身),生命和攻防对应比例提升(提升比例由怪物value, atkValue, defValue决定,线性叠加)。并在游戏中实际验证效果。(注意这个效果和默认光环的区别)。 + +13. 实现 **「迅捷光环」(特殊属性28)**:同楼层/周围X格(由range和zoneSquare决定)的怪物额外先攻X回合(由此怪物的value28决定)。并在游戏中实际验证效果。 + +14. 实现 **「吸血光环」(特殊属性48)**:同楼层/周围X格(由range和zoneSquare决定)的怪物拥有「吸血」特殊属性,吸血比例由光环怪的`vampireValue`项决定。并在游戏中实际验证效果。 diff --git a/_codelab/_sidebar.md b/_codelab/_sidebar.md new file mode 100644 index 0000000..cd67979 --- /dev/null +++ b/_codelab/_sidebar.md @@ -0,0 +1,4 @@ + +- [第一章:伤害计算函数](L1) +- [第二章:特殊属性定义,表格配置](L2) +- [第三章:怪物真实属性](L3) diff --git a/_codelab/docsify.min.js b/_codelab/docsify.min.js new file mode 100644 index 0000000..4c22486 --- /dev/null +++ b/_codelab/docsify.min.js @@ -0,0 +1,2 @@ +!function(){"use strict";function e(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}function t(e){return"string"==typeof e||"number"==typeof e}function n(){}function r(e){return"function"==typeof e}function i(e){var t=["init","mounted","beforeEach","afterEach","doneEach","ready"];e._hooks={},e._lifecycle={},t.forEach(function(t){var n=e._hooks[t]=[];e._lifecycle[t]=function(e){return n.push(e)}})}function o(e,t,r,i){void 0===i&&(i=n);var o=e._hooks[t],a=function(e){var t=o[e];if(e>=o.length)i(r);else if("function"==typeof t)if(2===t.length)t(r,function(t){r=t,a(e+1)});else{var n=t(r);r=void 0!==n?n:r,a(e+1)}else a(e+1)};a(0)}function a(e,t){if(void 0===t&&(t=!1),"string"==typeof e){if(void 0!==window.Vue)return s(e);e=t?s(e):fe[e]||(fe[e]=s(e))}return e}function s(e,t){return t?e.querySelector(t):ge.querySelector(e)}function l(e,t){return[].slice.call(t?e.querySelectorAll(t):ge.querySelectorAll(e))}function u(e,t){return e=ge.createElement(e),t&&(e.innerHTML=t),e}function c(e,t){return e.appendChild(t)}function h(e,t){return e.insertBefore(t,e.children[0])}function p(e,t,n){r(t)?window.addEventListener(e,t):e.addEventListener(t,n)}function d(e,t,n){r(t)?window.removeEventListener(e,t):e.removeEventListener(t,n)}function f(e,t,n){e&&e.classList[n?t:"toggle"](n||t)}function g(e){c(ve,u("style",e))}function m(e){return e?(/\/\//.test(e)||(e="https://github.com/"+e),''):""}function v(e){var t='';return(ke?t+"
":"
"+t)+'
\x3c!--main--\x3e
'}function y(){var e=", 100%, 85%";return'
'}function b(e,t){return void 0===t&&(t=""),e&&e.length?(e.forEach(function(e){t+='
  • '+e.title+"
  • ",e.children&&(t+='
  • ")}),t):""}function k(e,t){return'

    '+t.slice(5).trim()+"

    "}function w(e){return""}function x(){var e=u("div");e.classList.add("progress"),c(me,e),pe=e}function _(e,t){void 0===t&&(t=!1);var r=new XMLHttpRequest,i=function(){r.addEventListener.apply(r,arguments)},o=_e[e];return o?{then:function(e){return e(o.content,o.opt)},abort:n}:(r.open("GET",e),r.send(),{then:function(o,a){if(void 0===a&&(a=n),t){var s=setInterval(function(e){return xe({step:Math.floor(5*Math.random()+1)})},500);i("progress",xe),i("loadend",function(e){xe(e),clearInterval(s)})}i("error",a),i("load",function(t){var n=t.target;if(n.status>=400)a(n);else{var i=_e[e]={content:n.response,opt:{updatedAt:r.getResponseHeader("last-modified")}};o(i.content,i.opt)}})},abort:function(e){return 4!==r.readyState&&r.abort()}})}function S(e,t){e.innerHTML=e.innerHTML.replace(/var\(\s*--theme-color.*?\)/g,t)}function C(e,t){return t={exports:{}},e(t,t.exports),t.exports}function L(e,t){var n=[],r={};return e.forEach(function(e){var i=e.level||1,o=i-1;i>t||(r[o]?r[o].children=(r[o].children||[]).concat(e):n.push(e),r[i]=e)}),n}function E(e){return e.toLowerCase()}function T(e){if("string"!=typeof e)return"";var t=e.trim().replace(/[A-Z]+/g,E).replace(/<[^>\d]+>/g,"").replace(Oe,"").replace(/\s/g,"-").replace(/-+/g,"-").replace(/^(\d)/,"_$1"),n=Pe[t];return n=Pe.hasOwnProperty(t)?n+1:0,Pe[t]=n,n&&(t=t+"-"+n),t}function $(e,t){return''+t+''}function A(e){return e.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g,function(e){return e.replace(/:/g,"__colon__")}).replace(/:(\w+?):/gi,be&&window.emojify||$).replace(/__colon__/g,":")}function P(e){var t={};return(e=e.trim().replace(/^(\?|#|&)/,""))?(e.split("&").forEach(function(e){var n=e.replace(/\+/g," ").split("=");t[n[0]]=n[1]&&je(n[1])}),t):t}function O(e,t){void 0===t&&(t=[]);var n=[];for(var r in e)t.indexOf(r)>-1||n.push(e[r]?(Me(r)+"="+Me(e[r])).toLowerCase():Me(r));return n.length?"?"+n.join("&"):""}function j(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return Re(e.join("/"))}function M(e){void 0===e&&(e="");var t={};return e&&(e=e.replace(/:([\w-]+)=?([\w-]+)?/g,function(e,n,r){return t[n]=r||!0,""}).trim()),{str:e,config:t}}function q(e,t){var n=function(e){return me.classList.toggle("close")};e=a(e),p(e,"click",function(e){e.stopPropagation(),n()});var r=a(".sidebar");ke&&p(me,"click",function(e){return me.classList.contains("close")&&n()}),p(r,"click",function(e){return setTimeout(0)})}function N(){var e=a("section.cover");if(e){var t=e.getBoundingClientRect().height;window.pageYOffset>=t||e.classList.contains("hidden")?f(me,"add","sticky"):f(me,"remove","sticky")}}function R(e,t,n,r){t=a(t);var i,o=l(t,"a"),s=e.toURL(e.getCurrentPath());return o.sort(function(e,t){return t.href.length-e.href.length}).forEach(function(e){var t=e.getAttribute("href"),r=n?e.parentNode:e;0!==s.indexOf(t)||i?f(r,"remove","active"):(i=e,f(r,"add","active"))}),r&&(ge.title=i?i.innerText+" - "+ze:ze),i}function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function H(e){Ue&&Ue.stop(),Ye=!1,Ue=new Ie({start:window.pageYOffset,end:e.getBoundingClientRect().top+window.pageYOffset,duration:500}).on("tick",function(e){return window.scrollTo(0,e)}).on("done",function(){Ye=!0,Ue=null}).begin()}function z(e){if(Ye){for(var t,n=a(".sidebar"),r=l(".anchor"),i=s(n,".sidebar-nav"),o=s(n,"li.active"),u=document.documentElement,c=(u&&u.scrollTop||document.body.scrollTop)-Ze,h=0,p=r.length;hc){t||(t=d);break}t=d}if(t){var f=De[B(e,t.getAttribute("data-id"))];if(f&&f!==o&&(o&&o.classList.remove("active"),f.classList.add("active"),o=f,!We&&me.classList.contains("sticky"))){var g=n.clientHeight,m=o.offsetTop+o.clientHeight+40,v=o.offsetTop>=i.scrollTop&&m<=i.scrollTop+g,y=m-0script").filter(function(e){return!/template/.test(e.type)})[0];if(!e)return!1;var t=e.innerText.trim();if(!t)return!1;setTimeout(function(e){window.__EXECUTE_RESULT__=new Function(t)()},0)}function Y(e,t,n){return t="function"==typeof n?n(t):"string"==typeof n?Ee(n)(new Date(t)):t,e.replace(/{docsify-updated}/g,t)}function Z(e){e||(e="not found"),this._renderTo(".markdown-section",e),!this.config.loadSidebar&&this._renderSidebar(),!1===this.config.executeScript||void 0===window.Vue||U()?this.config.executeScript&&U():setTimeout(function(e){var t=window.__EXECUTE_RESULT__;t&&t.$destroy&&t.$destroy(),window.__EXECUTE_RESULT__=(new window.Vue).$mount("#main")},0)}function G(e){var n=a(".app-name-link"),r=e.config.nameLink,i=e.route.path;if(n)if(t(e.config.nameLink))n.setAttribute("href",r);else if("object"==typeof r){var o=Object.keys(r).filter(function(e){return i.indexOf(e)>-1})[0];n.setAttribute("href",r[o])}}function X(e){var t=e.config;e.compiler=new He(t,e.router);var n=t.el||"#app",r=s("nav")||u("nav"),i=s(n),o="",a=me;i?(t.repo&&(o+=m(t.repo)),t.coverpage&&(o+=y()),o+=v(t),e._renderTo(i,o,!0)):e.rendered=!0,t.mergeNavbar&&ke?a=s(".sidebar"):(r.classList.add("app-nav"),t.repo||r.classList.add("no-badge")),h(a,r),t.themeColor&&(ge.head.appendChild(u("div",w(t.themeColor)).firstElementChild),Se(t.themeColor)),e._updateRender(),f(me,"ready")}function V(e,t,n){var r=Object.keys(t).filter(function(t){return(Xe[t]||(Xe[t]=new RegExp("^"+t+"$"))).test(e)&&e!==n})[0];return r?V(e.replace(Xe[r],t[r]),t,e):e}function J(e){return/\.(md|html)$/g.test(e)?e:/\/$/g.test(e)?e+"README.md":e+".md"}function Q(e){var t=location.href.indexOf("#");location.replace(location.href.slice(0,t>=0?t:0)+"#"+e)}function K(e){e.router.normalize(),e.route=e.router.parse(),me.setAttribute("data-page",e.route.file)}function ee(e){var t,n=e.config,r=n.routerMode||"hash";t="history"===r&&we?new Ke(n):new Qe(n),e.router=t,K(e),et=e.route,t.onchange(function(t){if(K(e),e._updateRender(),et.path===e.route.path)return void e.$resetEvents();e.$fetch(),et=e.route})}function te(e){q("button.sidebar-toggle",e.router),e.config.coverpage?!ke&&p("scroll",N):me.classList.add("sticky")}function ne(e,t,n,r,i,o){e=o?e:e.replace(/\/$/,""),(e=Ne(e))&&_(i.router.getFile(e+n)+t).then(r,function(o){return ne(e,t,n,r,i)})}function re(e){var t=e.config,n=t.loadSidebar;if(e.rendered){var r=R(e.router,".sidebar-nav",!0,!0);n&&r&&(r.parentNode.innerHTML+=window.__SUB_SIDEBAR__),e._bindEventOnRendered(r),e._fetchCover(),e.$resetEvents(),o(e,"doneEach"),o(e,"ready")}else e.$fetch(function(t){return o(e,"ready")})}function ie(e){[].concat(e.config.plugins).forEach(function(t){return r(t)&&t(e._lifecycle,e)})}function oe(){this._init()}var ae=e(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),se=Object.assign||function(e){for(var t=arguments,n=Object.prototype.hasOwnProperty,r=1;r80?80:t):t=Math.floor(n/r*100),pe.style.opacity=1,pe.style.width=t>=95?"100%":t+"%",t>=95&&(clearTimeout(de),de=setTimeout(function(e){pe.style.opacity=0,pe.style.width="0%"},200))},_e={},Se=function(e){if(!(window.CSS&&window.CSS.supports&&window.CSS.supports("(--v:red)"))){var t=l("style:not(.inserted),link");[].forEach.call(t,function(t){if("STYLE"===t.nodeName)S(t,e);else if("LINK"===t.nodeName){var n=t.getAttribute("href");if(!/\.css$/.test(n))return;_(n).then(function(t){var n=u("style",t);ve.appendChild(n),S(n,e)})}})}},Ce=/([^{]*?)\w(?=\})/g,Le={YYYY:"getFullYear",YY:"getYear",MM:function(e){return e.getMonth()+1},DD:"getDate",HH:"getHours",mm:"getMinutes",ss:"getSeconds"},Ee=function(e){var t=[],n=0;return e.replace(Ce,function(r,i,o){t.push(e.substring(n,o-1)),n=o+=r.length+1,t.push(function(e){return("00"+("string"==typeof Le[r]?e[Le[r]]():Le[r](e))).slice(-r.length)})}),n!==e.length&&t.push(e.substring(n)),function(e){for(var n="",r=0,i=e||new Date;r/g,">").replace(/"/g,""").replace(/'/g,"'")}function a(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/g,function(e,t){return t=t.toLowerCase(),"colon"===t?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function s(e,t){return e=e.source,t=t||"",function n(r,i){return r?(i=i.source||i,i=i.replace(/(^|[^\[])\^/g,"$1"),e=e.replace(r,i),n):new RegExp(e,t)}}function l(){}function u(e){for(var t,n,r=arguments,i=1;iAn error occured:

    "+o(e.message+"",!0)+"
    ";throw e}}var h={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:l,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:l,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:l,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};h.bullet=/(?:[*+-]|\d+\.)/,h.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,h.item=s(h.item,"gm")(/bull/g,h.bullet)(),h.list=s(h.list)(/bull/g,h.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+h.def.source+")")(),h.blockquote=s(h.blockquote)("def",h.def)(),h._tag="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b",h.html=s(h.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,h._tag)(),h.paragraph=s(h.paragraph)("hr",h.hr)("heading",h.heading)("lheading",h.lheading)("blockquote",h.blockquote)("tag","<"+h._tag)("def",h.def)(),h.normal=u({},h),h.gfm=u({},h.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\s*\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),h.gfm.paragraph=s(h.paragraph)("(?!","(?!"+h.gfm.fences.source.replace("\\1","\\2")+"|"+h.list.source.replace("\\1","\\3")+"|")(),h.tables=u({},h.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/}),t.rules=h,t.lex=function(e,n){return new t(n).lex(e)},t.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},t.prototype.token=function(e,t,n){for(var r,i,o,a,s,l,u,c,p,d=this,e=e.replace(/^ +$/gm,"");e;)if((o=d.rules.newline.exec(e))&&(e=e.substring(o[0].length),o[0].length>1&&d.tokens.push({type:"space"})),o=d.rules.code.exec(e))e=e.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),d.tokens.push({type:"code",text:d.options.pedantic?o:o.replace(/\n+$/,"")});else if(o=d.rules.fences.exec(e))e=e.substring(o[0].length),d.tokens.push({type:"code",lang:o[2],text:o[3]||""});else if(o=d.rules.heading.exec(e))e=e.substring(o[0].length),d.tokens.push({type:"heading",depth:o[1].length,text:o[2]});else if(t&&(o=d.rules.nptable.exec(e))){for(e=e.substring(o[0].length),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/\n$/,"").split("\n")},c=0;c ?/gm,""),d.token(o,t,!0),d.tokens.push({type:"blockquote_end"});else if(o=d.rules.list.exec(e)){for(e=e.substring(o[0].length),a=o[2],d.tokens.push({type:"list_start",ordered:a.length>1}),o=o[0].match(d.rules.item),r=!1,p=o.length,c=0;c1&&s.length>1||(e=o.slice(c+1).join("\n")+e,c=p-1)),i=r||/\n\n(?!\s*$)/.test(l),c!==p-1&&(r="\n"===l.charAt(l.length-1),i||(i=r)),d.tokens.push({type:i?"loose_item_start":"list_item_start"}),d.token(l,!1,n),d.tokens.push({type:"list_item_end"});d.tokens.push({type:"list_end"})}else if(o=d.rules.html.exec(e))e=e.substring(o[0].length),d.tokens.push({type:d.options.sanitize?"paragraph":"html",pre:!d.options.sanitizer&&("pre"===o[1]||"script"===o[1]||"style"===o[1]),text:o[0]});else if(!n&&t&&(o=d.rules.def.exec(e)))e=e.substring(o[0].length),d.tokens.links[o[1].toLowerCase()]={href:o[2],title:o[3]};else if(t&&(o=d.rules.table.exec(e))){for(e=e.substring(o[0].length),l={type:"table",header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},c=0;c])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:l,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:l,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/,p.link=s(p.link)("inside",p._inside)("href",p._href)(),p.reflink=s(p.reflink)("inside",p._inside)(),p.normal=u({},p),p.pedantic=u({},p.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),p.gfm=u({},p.normal,{escape:s(p.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:s(p.text)("]|","~]|")("|","|https?://|")()}),p.breaks=u({},p.gfm,{br:s(p.br)("{2,}","*")(),text:s(p.gfm.text)("{2,}","*")()}),n.rules=p,n.output=function(e,t,r){return new n(t,r).output(e)},n.prototype.output=function(e){for(var t,n,r,i,a=this,s="";e;)if(i=a.rules.escape.exec(e))e=e.substring(i[0].length),s+=i[1];else if(i=a.rules.autolink.exec(e))e=e.substring(i[0].length),"@"===i[2]?(n=":"===i[1].charAt(6)?a.mangle(i[1].substring(7)):a.mangle(i[1]),r=a.mangle("mailto:")+n):(n=o(i[1]),r=n),s+=a.renderer.link(r,null,n);else if(a.inLink||!(i=a.rules.url.exec(e))){if(i=a.rules.tag.exec(e))!a.inLink&&/^/i.test(i[0])&&(a.inLink=!1),e=e.substring(i[0].length),s+=a.options.sanitize?a.options.sanitizer?a.options.sanitizer(i[0]):o(i[0]):i[0];else if(i=a.rules.link.exec(e))e=e.substring(i[0].length),a.inLink=!0,s+=a.outputLink(i,{href:i[2],title:i[3]}),a.inLink=!1;else if((i=a.rules.reflink.exec(e))||(i=a.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=a.links[t.toLowerCase()])||!t.href){s+=i[0].charAt(0),e=i[0].substring(1)+e;continue}a.inLink=!0,s+=a.outputLink(i,t),a.inLink=!1}else if(i=a.rules.strong.exec(e))e=e.substring(i[0].length),s+=a.renderer.strong(a.output(i[2]||i[1]));else if(i=a.rules.em.exec(e))e=e.substring(i[0].length),s+=a.renderer.em(a.output(i[2]||i[1]));else if(i=a.rules.code.exec(e))e=e.substring(i[0].length),s+=a.renderer.codespan(o(i[2],!0));else if(i=a.rules.br.exec(e))e=e.substring(i[0].length),s+=a.renderer.br();else if(i=a.rules.del.exec(e))e=e.substring(i[0].length),s+=a.renderer.del(a.output(i[1]));else if(i=a.rules.text.exec(e))e=e.substring(i[0].length),s+=a.renderer.text(o(a.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(i[0].length),n=o(i[1]),r=n,s+=a.renderer.link(r,null,n);return s},n.prototype.outputLink=function(e,t){var n=o(t.href),r=t.title?o(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,o(e[1]))},n.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},n.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,i=0;i.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},r.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'
    '+(n?e:o(e,!0))+"\n
    \n":"
    "+(n?e:o(e,!0))+"\n
    "},r.prototype.blockquote=function(e){return"
    \n"+e+"
    \n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n){return"'+e+"\n"},r.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},r.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"\n"},r.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},r.prototype.paragraph=function(e){return"

    "+e+"

    \n"},r.prototype.table=function(e,t){return"\n\n"+e+"\n\n"+t+"\n
    \n"},r.prototype.tablerow=function(e){return"\n"+e+"\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">")+e+"\n"},r.prototype.strong=function(e){return""+e+""},r.prototype.em=function(e){return""+e+""},r.prototype.codespan=function(e){return""+e+""},r.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},r.prototype.del=function(e){return""+e+""},r.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(a(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:"))return""}var i='
    "},r.prototype.image=function(e,t,n){var r=''+n+'":">"},r.prototype.text=function(e){return e},i.parse=function(e,t,n){return new i(t,n).parse(e)},i.prototype.parse=function(e){var t=this;this.inline=new n(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var r="";this.next();)r+=t.tok();return r},i.prototype.next=function(){return this.token=this.tokens.pop()},i.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},i.prototype.parseText=function(){for(var e=this,t=this.token.text;"text"===this.peek().type;)t+="\n"+e.next().text;return this.inline.output(t)},i.prototype.tok=function(){var e=this;switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var t,n,r,i,o="",a="";for(r="",t=0;te.length)break e;if(!(b instanceof i)){c.lastIndex=0;var k=c.exec(b),w=1;if(!k&&d&&v!=o.length-1){if(c.lastIndex=y,!(k=c.exec(e)))break;for(var x=k.index+(p?k[1].length:0),_=k.index+k[0].length,S=v,C=y,L=o.length;S=C&&(++v,y=C);if(o[v]instanceof i||o[S-1].greedy)continue;w=S-v,b=e.slice(y,C),k.index-=y}if(k){p&&(f=k[1].length);var x=k.index+f,k=k[0].slice(f),_=x+k.length,E=b.slice(0,x),T=b.slice(_),$=[v,w];E&&$.push(E);var A=new i(s,h?r.tokenize(k,h):k,g,k,d);$.push(A),T&&$.push(T),Array.prototype.splice.apply(o,$)}}}}}return o},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var i,o=0;i=n[o++];)i(t)}}},i=r.Token=function(e,t,n,r,i){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length,this.greedy=!!i};if(i.stringify=function(e,t,n){if("string"==typeof e)return e;if("Array"===r.util.type(e))return e.map(function(n){return i.stringify(n,t,e)}).join("");var o={type:e.type,content:i.stringify(e.content,t,n),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:n};if("comment"==o.type&&(o.attributes.spellcheck="true"),e.alias){var a="Array"===r.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(o.classes,a)}r.hooks.run("wrap",o);var s=Object.keys(o.attributes).map(function(e){return e+'="'+(o.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+o.tag+' class="'+o.classes.join(" ")+'"'+(s?" "+s:"")+">"+o.content+""},!t.document)return t.addEventListener?(t.addEventListener("message",function(e){var n=JSON.parse(e.data),i=n.language,o=n.code,a=n.immediateClose;t.postMessage(r.highlight(o,r.languages[i],i)),a&&t.close()},!1),t.Prism):t.Prism;var o=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return o&&(r.filename=o.src,document.addEventListener&&!o.hasAttribute("data-manual")&&("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(r.highlightAll):window.setTimeout(r.highlightAll,16):document.addEventListener("DOMContentLoaded",r.highlightAll))),t.Prism}();e.exports&&(e.exports=n),void 0!==Te&&(Te.Prism=n),n.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},n.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),n.languages.xml=n.languages.markup,n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},n.languages.css.atrule.inside.rest=n.util.clone(n.languages.css),n.languages.markup&&(n.languages.insertBefore("markup","tag",{style:{pattern:/()[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:n.languages.css,alias:"language-css"}}),n.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:n.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:n.languages.css}},alias:"language-css"}},n.languages.markup.tag)),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:{pattern:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(true|false)\b/,function:/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,function:/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*\*?|\/|~|\^|%|\.{3}/}),n.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0,greedy:!0}}),n.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\\\|\\?[^\\])*?`/,greedy:!0,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:n.languages.javascript}},string:/[\s\S]+/}}}),n.languages.markup&&n.languages.insertBefore("markup","tag",{script:{pattern:/()[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:n.languages.javascript,alias:"language-javascript"}}),n.languages.js=n.languages.javascript,function(){"undefined"!=typeof self&&self.Prism&&self.document&&document.querySelector&&(self.Prism.fileHighlight=function(){var e={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"};Array.prototype.forEach&&Array.prototype.slice.call(document.querySelectorAll("pre[data-src]")).forEach(function(t){for(var r,i=t.getAttribute("data-src"),o=t,a=/\blang(?:uage)?-(?!\*)(\w+)\b/i;o&&!a.test(o.className);)o=o.parentNode;if(o&&(r=(t.className.match(a)||[,""])[1]),!r){var s=(i.match(/\.(\w+)$/)||[,""])[1];r=e[s]||s}var l=document.createElement("code");l.className="language-"+r,t.textContent="",l.textContent="Loading…",t.appendChild(l);var u=new XMLHttpRequest;u.open("GET",i,!0),u.onreadystatechange=function(){4==u.readyState&&(u.status<400&&u.responseText?(l.textContent=u.responseText,n.highlightElement(l)):u.status>=400?l.textContent="✖ Error "+u.status+" while fetching file: "+u.statusText:l.textContent="✖ Error: File does not exist or is empty")},u.send(null)})},document.addEventListener("DOMContentLoaded",self.Prism.fileHighlight))}()}),Pe={},Oe=/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g;T.clear=function(){Pe={}};var je=decodeURIComponent,Me=encodeURIComponent,qe=e(function(e){return/(:|(\/{2}))/g.test(e)}),Ne=e(function(e){return/\/$/g.test(e)?e:(e=e.match(/(\S*\/)[^\/]+$/))?e[1]:""}),Re=e(function(e){return e.replace(/^\/+/,"/").replace(/([^:])\/{2,}/g,"$1/")}),Fe={},He=function(t,n){this.config=t,this.router=n,this.cacheTree={},this.toc=[],this.linkTarget=t.externalLinkTarget||"_blank",this.contentBase=n.getBasePath();var i,o=this._initRenderer(),a=t.markdown||{};r(a)?i=a($e,o):($e.setOptions(se(a,{renderer:se(o,a.renderer)})),i=$e),this.compile=e(function(e){var n="";return e?(n=i(e),n=t.noEmoji?n:A(n),T.clear(),n):e})};He.prototype.matchNotCompileLink=function(e){for(var t=this.config.noCompileLinks,n=0;n'+e+""},a.code=e.code=function(e,t){return void 0===t&&(t=""),'
    '+Ae.highlight(e,Ae.languages[t]||Ae.languages.markup)+"
    "},a.link=e.link=function(e,t,i){void 0===t&&(t="");var a="",s=M(t),l=s.str,u=s.config;return t=l,/:|(\/{2})/.test(e)||o.matchNotCompileLink(e)||u.ignore?a+=' target="'+n+'"':e=r.toURL(e,null,r.getCurrentPath()),u.target&&(a+=" target="+u.target),u.disabled&&(a+=" disabled",e="javascript:void(0)"),t&&(a+=' title="'+t+'"'),'"+i+""},a.paragraph=e.paragraph=function(e){return/^!>/.test(e)?k("tip",e):/^\?>/.test(e)?k("warn",e):"

    "+e+"

    "},a.image=e.image=function(e,t,n){var r=e,o="",a=M(t),s=a.str,l=a.config;return t=s,l["no-zoom"]&&(o+=" data-no-zoom"),t&&(o+=' title="'+t+'"'),qe(e)||(r=j(i,e)),''+n+'"};var s=/^\[([ x])\] +/;return a.listitem=e.listitem=function(e){var t=s.exec(e);return t&&(e=e.replace(s,'")),""+e+"\n"},e.origin=a,e},He.prototype.sidebar=function(e,t){var n=this.router.getCurrentPath(),r="";if(e)r=this.compile(e),r=r&&r.match(/]*>([\s\S]+)<\/ul>/g)[0];else{var i=this.cacheTree[n]||L(this.toc,t);r=b(i,"
      "),this.cacheTree[n]=i}return r},He.prototype.subSidebar=function(e){if(!e)return void(this.toc=[]);var t=this.router.getCurrentPath(),n=this,r=n.cacheTree,i=n.toc;i[0]&&i[0].ignoreAllSubs&&i.splice(0),i[0]&&1===i[0].level&&i.shift();for(var o=0;o')},He.prototype.article=function(e){return this.compile(e)},He.prototype.cover=function(e){var t=this.toc.slice(),n=this.compile(e);return this.toc=t.slice(),n};var ze=ge.title,Be=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};F(this,e),this.duration=t.duration||1e3,this.ease=t.easing||this._defaultEase,this.start=t.start,this.end=t.end,this.frame=null,this.next=null,this.isRunning=!1,this.events={},this.direction=this.startthis.end&&e>=this.next}[this.direction]}},{key:"_defaultEase",value:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t}}]),e}(),De={},We=!1,Ue=null,Ye=!0,Ze=0,Ge=ge.scrollingElement||ge.documentElement,Xe={},Ve=function(e){this.config=e};Ve.prototype.getBasePath=function(){return this.config.basePath},Ve.prototype.getFile=function(e,t){e=e||this.getCurrentPath();var n=this,r=n.config,i=this.getBasePath();return e=r.alias?V(e,r.alias):e,e=J(e),e="/README.md"===e?r.homepage||e:e,e=qe(e)?e:j(i,e),t&&(e=e.replace(new RegExp("^"+i),"")),e},Ve.prototype.onchange=function(e){void 0===e&&(e=n),e()},Ve.prototype.getCurrentPath=function(){},Ve.prototype.normalize=function(){},Ve.prototype.parse=function(){},Ve.prototype.toURL=function(){};var Je=e(function(e){return e.replace("#","?id=")}),Qe=function(e){function t(t){e.call(this,t),this.mode="hash"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getBasePath=function(){var e=window.location.pathname||"",t=this.config.basePath;return/^(\/|https?:)/g.test(t)?t:Re(e+"/"+t)},t.prototype.getCurrentPath=function(){var e=location.href,t=e.indexOf("#");return-1===t?"":e.slice(t+1)},t.prototype.onchange=function(e){void 0===e&&(e=n),p("hashchange",e)},t.prototype.normalize=function(){var e=this.getCurrentPath();if(e=Je(e),"/"===e.charAt(0))return Q(e);Q("/"+e)},t.prototype.parse=function(e){void 0===e&&(e=location.href);var t="",n=e.indexOf("#");n>=0&&(e=e.slice(n+1));var r=e.indexOf("?");return r>=0&&(t=e.slice(r+1),e=e.slice(0,r)),{path:e,file:this.getFile(e,!0),query:P(t)}},t.prototype.toURL=function(e,t,n){var r=n&&"#"===e[0],i=this.parse(Je(e));if(i.query=se({},i.query,t),e=i.path+O(i.query),e=e.replace(/\.md(\?)|\.md$/,"$1"),r){var o=n.indexOf("?");e=(o>0?n.substr(0,o):n)+e}return Re("#/"+e)},t}(Ve),Ke=function(e){function t(t){e.call(this,t),this.mode="history"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getCurrentPath=function(){var e=this.getBasePath(),t=window.location.pathname;return e&&0===t.indexOf(e)&&(t=t.slice(e.length)),(t||"/")+window.location.search+window.location.hash},t.prototype.onchange=function(e){void 0===e&&(e=n),p("click",function(t){var n="A"===t.target.tagName?t.target:t.target.parentNode;if("A"===n.tagName&&!/_blank/.test(n.target)){t.preventDefault();var r=n.href;window.history.pushState({key:r},"",r),e()}}),p("popstate",e)},t.prototype.parse=function(e){void 0===e&&(e=location.href);var t="",n=e.indexOf("?");n>=0&&(t=e.slice(n+1),e=e.slice(0,n));var r=j(location.origin),i=e.indexOf(r);return i>-1&&(e=e.slice(i+r.length)),{path:e,file:this.getFile(e),query:P(t)}},t.prototype.toURL=function(e,t,n){var r=n&&"#"===e[0],i=this.parse(e);return i.query=se({},i.query,t),e=i.path+O(i.query),e=e.replace(/\.md(\?)|\.md$/,"$1"),r&&(e=n+e),Re("/"+e)},t}(Ve),et={},tt=Object.freeze({cached:e,hyphenate:ae,merge:se,isPrimitive:t,noop:n,isFn:r,inBrowser:be,isMobile:ke,supportsPushState:we,parseQuery:P,stringifyQuery:O,getPath:j,isAbsolutePath:qe,getParentPath:Ne,cleanPath:Re}),nt=oe.prototype;!function(e){e._init=function(){var e=this;e.config=le||{},i(e),ie(e),o(e,"init"),ee(e),X(e),te(e),re(e),o(e,"mounted")}}(nt),function(e){e.route={}}(nt),function(e){e._renderTo=function(e,t,n){var r=a(e);r&&(r[n?"outerHTML":"innerHTML"]=t)},e._renderSidebar=function(e){var t=this.config,n=t.maxLevel,r=t.subMaxLevel,i=t.loadSidebar;this._renderTo(".sidebar-nav",this.compiler.sidebar(e,n));var o=R(this.router,".sidebar-nav",!0,!0);i&&o?o.parentNode.innerHTML+=this.compiler.subSidebar(r)||"":this.compiler.subSidebar(),this._bindEventOnRendered(o)},e._bindEventOnRendered=function(e){var t=this.config,n=t.autoHeader,r=t.auto2top;if(I(this.router),n&&e){var i=a("#main"),o=i.children[0];if(o&&"H1"!==o.tagName){var s=u("h1");s.innerText=e.innerText,h(i,s)}}r&&W(r)},e._renderNav=function(e){e&&this._renderTo("nav",this.compiler.compile(e)),R(this.router,"nav")},e._renderMain=function(e,t){var n=this;if(void 0===t&&(t={}),!e)return Z.call(this,e);o(this,"beforeEach",e,function(e){var r=n.isHTML?e:n.compiler.compile(e);t.updatedAt&&(r=Y(r,t.updatedAt,n.config.formatUpdated)),o(n,"afterEach",r,function(e){return Z.call(n,e)})})},e._renderCover=function(e){var t=a(".cover");if(!e)return void f(t,"remove","show");f(t,"add","show");var n=this.coverIsHTML?e:this.compiler.cover(e),r=n.trim().match('

      ([^<]*?)

      $');if(r){if("color"===r[2])t.style.background=r[1]+(r[3]||"");else{var i=r[1];f(t,"add","has-mask"),qe(r[1])||(i=j(this.router.getBasePath(),r[1])),t.style.backgroundImage="url("+i+")",t.style.backgroundSize="cover",t.style.backgroundPosition="center center"}n=n.replace(r[0],"")}this._renderTo(".cover-main",n),N()},e._updateRender=function(){G(this)}}(nt),function(e){var t;e._fetch=function(e){var r=this;void 0===e&&(e=n);var i=this.route,o=i.path,a=i.query,s=O(a,["id"]),l=this.config,u=l.loadNavbar,c=l.loadSidebar;t&&t.abort&&t.abort(),t=_(this.router.getFile(o)+s,!0),this.isHTML=/\.html$/g.test(o);var h=function(){if(!c)return e();ne(o,s,c,function(t){r._renderSidebar(t),e()},r,!0)};t.then(function(e,t){r._renderMain(e,t),h()},function(e){r._renderMain(null),h()}),u&&ne(o,s,u,function(e){return r._renderNav(e)},this,!0)},e._fetchCover=function(){var e=this,t=this.config,n=t.coverpage,r=this.route.query,i=Ne(this.route.path),o=this.router.getFile(i+n);if("/"!==this.route.path||!n)return void this._renderCover();this.coverIsHTML=/\.html$/g.test(o),_(o+O(r,["id"])).then(function(t){return e._renderCover(t)})},e.$fetch=function(e){var t=this;void 0===e&&(e=n),this._fetchCover(),this._fetch(function(n){t.$resetEvents(),o(t,"doneEach"),e()})}}(nt),function(e){e.$resetEvents=function(){D(this.route.path,this.route.query.id),R(this.router,"nav")}}(nt),function(){window.Docsify={util:tt,dom:ye,get:_,slugify:T},window.DocsifyCompiler=He,window.marked=$e,window.Prism=Ae}(),oe.version="4.5.5",function(e){var t=document.readyState;if("complete"===t||"interactive"===t)return setTimeout(e,0);document.addEventListener("DOMContentLoaded",e)}(function(e){return new oe})}(); \ No newline at end of file diff --git a/_codelab/index.html b/_codelab/index.html new file mode 100644 index 0000000..15de4cb --- /dev/null +++ b/_codelab/index.html @@ -0,0 +1,86 @@ + + + + + HTML5魔塔样板JS进阶 + + + + + + + + + + +
      + +
      + + + + + + diff --git a/_codelab/index.md b/_codelab/index.md new file mode 100644 index 0000000..0789843 --- /dev/null +++ b/_codelab/index.md @@ -0,0 +1,5 @@ +# H5脚本进阶顺序 + +``` +伤害计算 - 战后 - 自绘状态栏 - 其他脚本编辑如检查地图伤害 - 插件中简单的复写libs - 自己根据API写插件函数 - 使用register系列注册点击和动画等 - 啃libs的实现 - 啃编辑器 +``` diff --git a/_codelab/vue.css b/_codelab/vue.css new file mode 100644 index 0000000..a38b902 --- /dev/null +++ b/_codelab/vue.css @@ -0,0 +1 @@ +@import url("https://fonts.googleapis.com/css?family=Roboto+Mono|Source+Sans+Pro:300,400,600");*{-webkit-font-smoothing:antialiased;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-text-size-adjust:none;-webkit-touch-callout:none;box-sizing:border-box}body:not(.ready){overflow:hidden}body:not(.ready) .app-nav,body:not(.ready)>nav,body:not(.ready) [data-cloak]{display:none}div#app{font-size:30px;font-weight:lighter;margin:40vh auto;text-align:center}div#app:empty:before{content:"Loading..."}.emoji{height:19.2px;height:1.2rem;vertical-align:middle}.progress{background-color:#42b983;background-color:var(--theme-color,#42b983);height:2px;left:0;position:fixed;right:0;top:0;transition:width .2s,opacity .4s;width:0;z-index:5}.search .search-keyword,.search a:hover{color:#42b983;color:var(--theme-color,#42b983)}.search .search-keyword{font-style:normal;font-weight:700}body,html{height:100%}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:#34495e;font-family:Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:15px;letter-spacing:0;margin:0;overflow-x:hidden}img{max-width:100%}a[disabled]{cursor:not-allowed;opacity:.6}kbd{border:1px solid #ccc;border-radius:3px;display:inline-block;font-size:12px!important;line-height:12px;margin-bottom:3px;padding:3px 5px;vertical-align:middle}.task-list-item{list-style-type:none}li input[type=checkbox]{margin:0 .2em .25em -1.6em;vertical-align:middle}.app-nav{left:0;margin:25px 60px 0 0;position:absolute;right:0;text-align:right;z-index:2}.app-nav p{margin:0}.app-nav>a{margin:0 16px;margin:0 1rem;padding:5px 0}.app-nav li,.app-nav ul{display:inline-block;list-style:none;margin:0}.app-nav a{color:inherit;font-size:16px;text-decoration:none;transition:color .3s}.app-nav a.active,.app-nav a:hover{color:#42b983;color:var(--theme-color,#42b983)}.app-nav a.active{border-bottom:2px solid #42b983;border-bottom:2px solid var(--theme-color,#42b983)}.app-nav li{display:inline-block;margin:0 16px;margin:0 1rem;padding:5px 0;position:relative}.app-nav li ul{background-color:#fff;border:1px solid #ddd;border-bottom-color:#ccc;border-radius:4px;box-sizing:border-box;display:none;max-height:calc(100vh - 61px);overflow-y:scroll;padding:10px 0;position:absolute;right:-15px;text-align:left;top:100%;white-space:nowrap}.app-nav li ul li{display:block;font-size:14px;line-height:16px;line-height:1rem;margin:0;margin:8px 14px;white-space:nowrap}.app-nav li ul a{display:block;font-size:inherit;margin:0;padding:0}.app-nav li ul a.active{border-bottom:0}.app-nav li:hover ul{display:block}.app-nav.no-badge{margin-right:25px}.github-corner{border-bottom:0;position:fixed;right:0;text-decoration:none;top:0;z-index:1}.github-corner svg{color:#fff;fill:#42b983;fill:var(--theme-color,#42b983);height:80px;width:80px}.github-corner:hover .octo-arm{-webkit-animation:a .56s ease-in-out;animation:a .56s ease-in-out}main{display:block;position:relative;width:100vw;height:100%;z-index:0}.anchor{display:inline-block;text-decoration:none;transition:all .3s}.anchor span{color:#34495e}.anchor:hover{text-decoration:underline}.sidebar{border-right:1px solid rgba(0,0,0,.07);overflow-y:auto;padding:40px 0 0;top:0;bottom:0;left:0;position:absolute;transition:-webkit-transform .25s ease-out;transition:transform .25s ease-out;transition:transform .25s ease-out,-webkit-transform .25s ease-out;width:300px;z-index:3}.sidebar>h1{margin:0 auto 16px;margin:0 auto 1rem;font-size:24px;font-size:1.5rem;font-weight:300;text-align:center}.sidebar>h1 a{color:inherit;text-decoration:none}.sidebar>h1 .app-nav{display:block;position:static}.sidebar .sidebar-nav{line-height:2em;padding-bottom:40px}.sidebar ul{margin:0;padding:0}.sidebar li>p{font-weight:700;margin:0}.sidebar ul,.sidebar ul li{list-style:none}.sidebar ul li a{border-bottom:none;display:block}.sidebar ul li ul{padding-left:20px}.sidebar::-webkit-scrollbar{width:4px}.sidebar::-webkit-scrollbar-thumb{background:transparent;border-radius:4px}.sidebar:hover::-webkit-scrollbar-thumb{background:hsla(0,0%,53%,.4)}.sidebar:hover::-webkit-scrollbar-track{background:hsla(0,0%,53%,.1)}.sidebar-toggle{background-color:transparent;background-color:hsla(0,0%,100%,.8);border:0;outline:none;padding:10px;bottom:0;left:0;position:absolute;text-align:center;transition:opacity .3s;width:30px;width:284px;z-index:4}.sidebar-toggle .sidebar-toggle-button:hover{opacity:.4}.sidebar-toggle span{background-color:#42b983;background-color:var(--theme-color,#42b983);display:block;margin-bottom:4px;width:16px;height:2px}body.sticky .sidebar,body.sticky .sidebar-toggle{position:fixed}.content{padding-top:60px;top:0;right:0;bottom:0;left:300px;position:absolute;transition:left .25s ease}.markdown-section{margin:0 auto;max-width:800px;padding:30px 15px 40px;position:relative}.markdown-section>*{box-sizing:border-box;font-size:inherit}.markdown-section>:first-child{margin-top:0!important}.markdown-section hr{border:none;border-bottom:1px solid #eee;margin:2em 0}.markdown-section table{border-collapse:collapse;border-spacing:0;display:block;margin-bottom:16px;margin-bottom:1rem;overflow:auto;width:100%}.markdown-section th{font-weight:700}.markdown-section td,.markdown-section th{border:1px solid #ddd;padding:6px 13px}.markdown-section tr{border-top:1px solid #ccc}.markdown-section p.tip,.markdown-section tr:nth-child(2n){background-color:#f8f8f8}.markdown-section p.tip{border-bottom-right-radius:2px;border-left:4px solid #f66;border-top-right-radius:2px;margin:2em 0;padding:12px 24px 12px 30px;position:relative}.markdown-section p.tip code{background-color:#efefef}.markdown-section p.tip em{color:#34495e}.markdown-section p.tip:before{background-color:#f66;border-radius:100%;color:#fff;content:"!";font-family:Dosis,Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:14px;font-weight:700;left:-12px;line-height:20px;position:absolute;width:20px;height:20px;text-align:center;top:14px}.markdown-section p.warn{background:rgba(66,185,131,.1);border-radius:2px;padding:16px;padding:1rem}body.close .sidebar{-webkit-transform:translateX(-300px);transform:translateX(-300px)}body.close .sidebar-toggle{width:auto}body.close .content{left:0}@media print{.app-nav,.github-corner,.sidebar,.sidebar-toggle{display:none}}@media screen and (max-width:768px){.github-corner,.sidebar,.sidebar-toggle{position:fixed}.app-nav{margin-top:16px}.app-nav li ul{top:30px}main{height:auto;overflow-x:hidden}.sidebar{left:-300px;transition:-webkit-transform .25s ease-out;transition:transform .25s ease-out;transition:transform .25s ease-out,-webkit-transform .25s ease-out}.content{left:0;max-width:100vw;position:static;padding-top:20px;transition:-webkit-transform .25s ease;transition:transform .25s ease;transition:transform .25s ease,-webkit-transform .25s ease}.app-nav,.github-corner{transition:-webkit-transform .25s ease-out;transition:transform .25s ease-out;transition:transform .25s ease-out,-webkit-transform .25s ease-out}.sidebar-toggle{background-color:transparent;width:auto}body.close .sidebar{-webkit-transform:translateX(300px);transform:translateX(300px)}body.close .sidebar-toggle{background-color:hsla(0,0%,100%,.8);transition:background-color 1s;width:284px}body.close .content{-webkit-transform:translateX(300px);transform:translateX(300px)}body.close .app-nav,body.close .github-corner{display:none}.github-corner .octo-arm{-webkit-animation:a .56s ease-in-out;animation:a .56s ease-in-out}.github-corner:hover .octo-arm{-webkit-animation:none;animation:none}}@-webkit-keyframes a{0%,to{-webkit-transform:rotate(0);transform:rotate(0)}20%,60%{-webkit-transform:rotate(-25deg);transform:rotate(-25deg)}40%,80%{-webkit-transform:rotate(10deg);transform:rotate(10deg)}}@keyframes a{0%,to{-webkit-transform:rotate(0);transform:rotate(0)}20%,60%{-webkit-transform:rotate(-25deg);transform:rotate(-25deg)}40%,80%{-webkit-transform:rotate(10deg);transform:rotate(10deg)}}section.cover{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-position:50%;background-repeat:no-repeat;background-size:cover;height:100vh;display:none}section.cover .cover-main{-webkit-box-flex:1;-ms-flex:1;flex:1;margin:-20px 16px 0;text-align:center;z-index:1}section.cover a{color:inherit}section.cover a,section.cover a:hover{text-decoration:none}section.cover p{line-height:24px;line-height:1.5rem;margin:1em 0}section.cover h1{color:inherit;font-size:40px;font-size:2.5rem;font-weight:300;margin:10px 0 40px;margin:.625rem 0 2.5rem;position:relative;text-align:center}section.cover h1 a{display:block}section.cover h1 small{bottom:-7px;bottom:-.4375rem;font-size:16px;font-size:1rem;position:absolute}section.cover blockquote{font-size:24px;font-size:1.5rem;text-align:center}section.cover ul{line-height:1.8;list-style-type:none;margin:1em auto;max-width:500px;padding:0}section.cover .cover-main>p:last-child a{border-color:#42b983;border:1px solid var(--theme-color,#42b983);border-radius:2rem;box-sizing:border-box;color:#42b983;color:var(--theme-color,#42b983);display:inline-block;font-size:16.8px;font-size:1.05rem;letter-spacing:1.6px;letter-spacing:.1rem;margin-right:16px;margin-right:1rem;padding:.75em 32px;padding:.75em 2rem;text-decoration:none;transition:all .15s ease}section.cover .cover-main>p:last-child a:last-child{background-color:#42b983;background-color:var(--theme-color,#42b983);color:#fff;margin-right:0}section.cover .cover-main>p:last-child a:last-child:hover{color:inherit;opacity:.8}section.cover .cover-main>p:last-child a:hover{color:inherit}section.cover blockquote>p>a{border-bottom:2px solid #42b983;border-bottom:2px solid var(--theme-color,#42b983);transition:color .3s}section.cover blockquote>p>a:hover{color:#42b983;color:var(--theme-color,#42b983)}section.cover.show{display:-webkit-box;display:-ms-flexbox;display:flex}section.cover.has-mask .mask{background-color:#fff;opacity:.8;position:absolute;width:100%;height:100%}.sidebar,body{background-color:#fff}.sidebar{color:#364149}.sidebar li{margin:6px 0 6px 15px}.sidebar ul li a{color:#505d6b;font-size:14px;font-weight:400;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.sidebar ul li a:hover{text-decoration:underline}.sidebar ul li ul{padding:0}.sidebar ul li.active>a{border-right:2px solid;color:#42b983;color:var(--theme-color,#42b983);font-weight:600}.app-sub-sidebar li:before{content:"-";padding-right:4px;float:left}.markdown-section h1,.markdown-section h2,.markdown-section h3,.markdown-section h4,.markdown-section strong{color:#2c3e50;font-weight:600}.markdown-section a{color:#42b983;color:var(--theme-color,#42b983);font-weight:600}.markdown-section h1{font-size:32px;font-size:2rem;margin:0 0 16px;margin:0 0 1rem}.markdown-section h2{font-size:28px;font-size:1.75rem;margin:45px 0 12.8px;margin:45px 0 .8rem}.markdown-section h3{font-size:24px;font-size:1.5rem;margin:40px 0 9.6px;margin:40px 0 .6rem}.markdown-section h4{font-size:20px;font-size:1.25rem}.markdown-section h5,.markdown-section h6{font-size:16px;font-size:1rem}.markdown-section h6{color:#777}.markdown-section figure,.markdown-section p{margin:1.2em 0}.markdown-section ol,.markdown-section p,.markdown-section ul{line-height:25.6px;line-height:1.6rem;word-spacing:.8px;word-spacing:.05rem}.markdown-section ol,.markdown-section ul{padding-left:24px;padding-left:1.5rem}.markdown-section blockquote{border-left:4px solid #42b983;border-left:4px solid var(--theme-color,#42b983);color:#858585;margin:2em 0;padding-left:20px}.markdown-section blockquote p{font-weight:600;margin-left:0}.markdown-section iframe{margin:1em 0}.markdown-section em{color:#7f8c8d}.markdown-section code{border-radius:2px;color:#e96900;font-size:12.8px;font-size:.8rem;margin:0 2px;padding:3px 5px;white-space:pre-wrap}.markdown-section code,.markdown-section pre{background-color:#f8f8f8;font-family:Roboto Mono,Monaco,courier,monospace}.markdown-section pre{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;line-height:24px;line-height:1.5rem;margin:1.2em 0;overflow:auto;padding:0 22.4px;padding:0 1.4rem;position:relative;word-wrap:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#8e908c}.token.namespace{opacity:.7}.token.boolean,.token.number{color:#c76b29}.token.punctuation{color:#525252}.token.property{color:#c08b30}.token.tag{color:#2973b7}.token.string{color:#42b983;color:var(--theme-color,#42b983)}.token.selector{color:#6679cc}.token.attr-name{color:#2973b7}.language-css .token.string,.style .token.string,.token.entity,.token.url{color:#22a2c9}.token.attr-value,.token.control,.token.directive,.token.unit{color:#42b983;color:var(--theme-color,#42b983)}.token.keyword{color:#e96900}.token.atrule,.token.regex,.token.statement{color:#22a2c9}.token.placeholder,.token.variable{color:#3d8fd1}.token.deleted{text-decoration:line-through}.token.inserted{border-bottom:1px dotted #202746;text-decoration:none}.token.italic{font-style:italic}.token.bold,.token.important{font-weight:700}.token.important{color:#c94922}.token.entity{cursor:help}.markdown-section pre>code{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;background-color:#f8f8f8;border-radius:2px;color:#525252;display:block;font-family:Roboto Mono,Monaco,courier,monospace;font-size:12.8px;font-size:.8rem;line-height:inherit;margin:0 2px;max-width:inherit;overflow:inherit;padding:2.2em 5px;white-space:inherit}.markdown-section code:after,.markdown-section code:before{letter-spacing:.8px;letter-spacing:.05rem}code .token{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;min-height:24px;min-height:1.5rem}pre:after{color:#ccc;content:attr(data-lang);font-size:9.6px;font-size:.6rem;font-weight:600;height:15px;line-height:15px;padding:5px 10px 0;position:absolute;right:0;text-align:right;top:0} \ No newline at end of file