diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 441efae..b4a2a2f 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -3000,7 +3000,7 @@ return code; */; setWeather_s - : '更改天气' Weather_List '强度' Int '持续到下个本事件' Bool Newline + : '更改天气' Weather_List '强度' Int Newline /* setWeather_s @@ -3009,8 +3009,8 @@ helpUrl : /_docs/#/instruction default : [null,1,true] colour : this.soundColor if(Int_0<1 || Int_0>10) throw new Error('天气的强度等级, 在1-10之间'); -Bool_0 = Bool_0 ? ', "keep": true' : '' -var code = '{"type": "setWeather", "name": "'+Weather_List_0+'", "level": '+Int_0+Bool_0+'},\n'; + +var code = '{"type": "setWeather", "name": "'+Weather_List_0+'", "level": '+Int_0+'},\n'; if(Weather_List_0===''||Weather_List_0==='null'||Weather_List_0==null)code = '{"type": "setWeather"},\n'; return code; */; diff --git a/_server/MotaActionParser.js b/_server/MotaActionParser.js index 7b60bd2..9c9fd92 100644 --- a/_server/MotaActionParser.js +++ b/_server/MotaActionParser.js @@ -1494,7 +1494,6 @@ MotaActionParser = function () { this.next = MotaActionBlocks["setWeather_s"].xmlText([ data.name, data.level || 1, - data.keep || false, this.next, ]); break; diff --git a/project/data.js b/project/data.js index 50b6147..9457803 100644 --- a/project/data.js +++ b/project/data.js @@ -1452,8 +1452,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "HATTEN", "Verdana", "number", - "pala", - "simhei" + "pala" ], "nameMap": { "确定": "confirm.opus", diff --git a/project/fonts/Verdana.ttf b/project/fonts/Verdana.ttf index 8f25a64..ea3c090 100644 Binary files a/project/fonts/Verdana.ttf and b/project/fonts/Verdana.ttf differ diff --git a/project/fonts/simhei.ttf b/project/fonts/simhei.ttf deleted file mode 100644 index 5bd4687..0000000 Binary files a/project/fonts/simhei.ttf and /dev/null differ diff --git a/project/plugins.js b/project/plugins.js index 06ccc6d..cc38544 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -3114,6 +3114,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = "mhp", "speed", "money", + "exp" ]; //属性列表,图标在函数复写core.statusBar.icons中声明,数字为project\materials\icons.png中的图标序号(可使用便捷ps追加,第一个序号为0) const drawStatusList = (baseX, baseY) => { let curh = baseY; @@ -3138,7 +3139,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = curh - 4 * 3, TEXT_COLOR, "#000000", - 6 + 3 ); core.setFont("outerUI", "bold 36px Verdana"); // 四舍五入 @@ -3161,8 +3162,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = curh, TEXT_COLOR, "#000000", - 6 - ); + 3 + ) curh += 24 * 3; if (curh > 130 * 3 && core.domStyle.isVertical) { @@ -3183,7 +3184,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = 22 * 3, TEXT_COLOR, "#000000", - 6 + 3 ); } drawStatusList(96 * 3, 46 * 3); @@ -3200,7 +3201,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = 41 * 3, TEXT_COLOR, "#000000", - 6 + 3 ); } drawStatusList(110 * 3, 93 * 3); @@ -21110,257 +21111,268 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }); }, "天气叠加": function () { - //使用方法:使用core.setWeather(天气,等级)来增加天气,使用core.setWeather()来清空天气 - // 天气叠加功能 - ////// 更改天气效果 ////// - control.prototype.setWeather = function (type, level) { - // 非雨雪 - if (type == null) { - Object.keys(core.control.weathers).forEach(function (one) { - core.deleteCanvas("weather" + one); - }); - core.animateFrame.weather.type = []; - core.animateFrame.weather.nodes = {}; - core.animateFrame.weather.level = {}; - core.animateFrame.weather.time = {}; - return; - } - if (!core.animateFrame.weather.level || level == null) - core.animateFrame.weather.level = {}; - if (!core.animateFrame.weather.type) core.animateFrame.weather.type = []; - level = core.clamp(parseInt(level) || 5, 1, 10); - // 当前天气:则忽略 - if ( - core.animateFrame.weather.type.includes(type) && - level == core.animateFrame.weather.level[type] - ) - return; - if (core.animateFrame.weather.nodes[type]) return; - // 计算当前的宽高 - core.createCanvas( - "weather" + type, - 0, - 0, - core.__PIXELS__, - core.__PIXELS__, - 80 - ); - core.animateFrame.weather.type.push(type); - core.animateFrame.weather.level[type] = level; - this._setWeather_createNodes(type, level); - }; - control.prototype._setWeather_createNodes = function (type, level) { - var number = - level * - parseInt( - (20 * core.bigmap.width * core.bigmap.height) / - (core.__SIZE__ * core.__SIZE__) - ); - if (!core.animateFrame.weather.nodes[type]) - core.animateFrame.weather.nodes[type] = []; - switch (type) { - case "rain": - for (var a = 0; a < number; a++) { - core.animateFrame.weather.nodes.rain.push({ - x: Math.random() * core.bigmap.width * 32, - y: Math.random() * core.bigmap.height * 32, - l: Math.random() * 2.5, - xs: -4 + Math.random() * 4 + 2, - ys: Math.random() * 10 + 10, - }); - } - break; - case "snow": - for (var a = 0; a < number; a++) { - core.animateFrame.weather.nodes.snow.push({ - x: Math.random() * core.bigmap.width * 32, - y: Math.random() * core.bigmap.height * 32, - r: Math.random() * 5 + 1, - d: Math.random() * Math.min(level, 200), - }); - } - break; - case "fog": - if (core.animateFrame.weather.fog) { - core.animateFrame.weather.nodes[type] = [ - { - level: number, - x: 0, - y: -core.__PIXELS__ / 2, - dx: -Math.random() * 1.5, - dy: Math.random(), - delta: 0.001, - }, - ]; - } - break; - case "cloud": - if (core.animateFrame.weather.cloud) { - core.animateFrame.weather.nodes[type] = [ - { - level: number, - x: 0, - y: -core.__PIXELS__ / 2, - dx: -Math.random() * 1.5, - dy: Math.random(), - delta: 0.001, - }, - ]; - } - break; - case "sun": - if (core.animateFrame.weather.sun) { - // 直接绘制 - core.clearMap("weather" + type); - core.setAlpha("weather" + type, level / 10); - core.drawImage( - "weather" + type, - core.animateFrame.weather.sun, - 0, - 0, - core.animateFrame.weather.sun.width, - core.animateFrame.weather.sun.height, - 0, - 0, - core.__PIXELS__, - core.__PIXELS__ - ); - core.setAlpha("weather" + type, 1); - } - break; - } - }; - core.registerAnimationFrame("weather", true, function (timestamp) { - var weather = core.animateFrame.weather; - if (!weather.type) return; - weather.type.forEach(function (one) { - if ( - timestamp - weather.time[one] <= 30 || - !core.dymCanvas["weather" + one] - ) - return; - core.control["_animationFrame_weather_" + one](); - weather.time[one] = timestamp; - }); - }); - // 雨 - control.prototype._animationFrame_weather_rain = function () { - var ctx = core.dymCanvas.weatherrain, - ox = core.bigmap.offsetX, - oy = core.bigmap.offsetY; - core.clearMap("weatherrain"); - ctx.strokeStyle = "rgba(174,194,224,0.8)"; - ctx.lineWidth = 1; - ctx.lineCap = "round"; - core.animateFrame.weather.nodes.rain.forEach(function (p) { - ctx.beginPath(); - ctx.moveTo(p.x - ox, p.y - oy); - ctx.lineTo(p.x + p.l * p.xs - ox, p.y + p.l * p.ys - oy); - ctx.stroke(); - p.x += p.xs; - p.y += p.ys; - if (p.x > core.bigmap.width * 32 || p.y > core.bigmap.height * 32) { - p.x = Math.random() * core.bigmap.width * 32; - p.y = -10; - } - }); - ctx.fill(); - }; - // 雪 - control.prototype._animationFrame_weather_snow = function () { - var ctx = core.dymCanvas.weathersnow, - ox = core.bigmap.offsetX, - oy = core.bigmap.offsetY; - core.clearMap("weathersnow"); - ctx.fillStyle = "rgba(255, 255, 255, 0.8)"; - ctx.beginPath(); - if (!core.animateFrame.weather.data) core.animateFrame.weather.data = {}; - core.animateFrame.weather.data.snow = - core.animateFrame.weather.data.snow || 0; - core.animateFrame.weather.data.snow += 0.01; - var angle = core.animateFrame.weather.data.snow; - core.animateFrame.weather.nodes.snow.forEach(function (p) { - ctx.moveTo(p.x - ox, p.y - oy); - ctx.arc(p.x - ox, p.y - oy, p.r, 0, Math.PI * 2, true); - // update - p.x += Math.sin(angle) * core.animateFrame.weather.level.snow; - p.y += Math.cos(angle + p.d) + 1 + p.r / 2; - if ( - p.x > core.bigmap.width * 32 + 5 || - p.x < -5 || - p.y > core.bigmap.height * 32 - ) { - if (Math.random() > 1 / 3) { - p.x = Math.random() * core.bigmap.width * 32; - p.y = -10; - } else { - if (Math.sin(angle) > 0) p.x = -5; - else p.x = core.bigmap.width * 32 + 5; - p.y = Math.random() * core.bigmap.height * 32; - } - } - }); - ctx.fill(); - }; - // 图片天气 - control.prototype.__animateFrame_weather_image = function (image, type) { - if (!image) return; - var node = core.animateFrame.weather.nodes[type][0]; - core.setAlpha("weather" + type, node.level / 500); - var wind = 1.5; - var width = image.width, - height = image.height; - node.x += node.dx * wind; - node.y += (2 * node.dy - 1) * wind; - if (node.x + 3 * width <= core.__PIXELS__) { - node.x += 4 * width; - while (node.x > 0) node.x -= width; - } - node.dy += node.delta; - if (node.dy >= 1) { - node.delta = -0.001; - } else if (node.dy <= 0) { - node.delta = 0.001; - } - if (node.y + 3 * height <= core.__PIXELS__) { - node.y += 4 * height; - while (node.y > 0) node.y -= height; - } else if (node.y >= 0) { - node.y -= height; - } - for (var i = 0; i < 3; ++i) { - for (var j = 0; j < 3; ++j) { - if ( - node.x + (i + 1) * width <= 0 || - node.x + i * width >= core.__PIXELS__ || - node.y + (j + 1) * height <= 0 || - node.y + j * height >= core.__PIXELS__ - ) - continue; - core.drawImage( - "weather" + type, - image, - node.x + i * width, - node.y + j * height - ); - } - } - core.setAlpha("weather" + type, 1); - }; - // 雾 - control.prototype._animationFrame_weather_fog = function () { - core.clearMap("weatherfog"); - this.__animateFrame_weather_image(core.animateFrame.weather.fog, "fog"); - }; - // 云 - control.prototype._animationFrame_weather_cloud = function () { - core.clearMap("weathercloud"); - this.__animateFrame_weather_image( - core.animateFrame.weather.cloud, - "cloud" - ); - }; - }, + //使用方法:使用core.setWeather(天气,等级)来增加天气,使用core.setWeather()来清空天气 + // 天气叠加功能 + + ////// 更改天气效果 ////// + control.prototype.setWeather = function (type, level) { + // 非雨雪 + if (type == null) { + Object.keys(core.control.weathers).forEach(function (one) { + core.deleteCanvas("weather" + one); + }); + core.animateFrame.weather.type = []; + core.animateFrame.weather.nodes = {}; + core.animateFrame.weather.level = {}; + core.animateFrame.weather.time = {}; + return; + } + if (!core.animateFrame.weather.level || level == null) + core.animateFrame.weather.level = {}; + if (!core.animateFrame.weather.type) core.animateFrame.weather.type = []; + level = core.clamp(parseInt(level) || 5, 1, 10); + // 当前天气:则忽略 + if ( + core.animateFrame.weather.type.includes(type) && + level == core.animateFrame.weather.level[type] + ) + return; + if (core.animateFrame.weather.nodes[type]) return; + // 计算当前的宽高 + core.createCanvas( + "weather" + type, + 0, + 0, + core.__PIXELS__, + core.__PIXELS__, + 80 + ); + core.animateFrame.weather.type.push(type); + core.animateFrame.weather.level[type] = level; + this._setWeather_createNodes(type, level); + }; + control.prototype._setWeather_createNodes = function (type, level) { + var number = + level * + parseInt( + (20 * core.bigmap.width * core.bigmap.height) / + (core.__SIZE__ * core.__SIZE__) + ); + if (!core.animateFrame.weather.nodes[type]) + core.animateFrame.weather.nodes[type] = []; + switch (type) { + case "rain": + for (var a = 0; a < number; a++) { + core.animateFrame.weather.nodes.rain.push({ + x: Math.random() * core.bigmap.width * 32, + y: Math.random() * core.bigmap.height * 32, + l: Math.random() * 2.5, + xs: -4 + Math.random() * 4 + 2, + ys: Math.random() * 10 + 10, + }); + } + break; + case "snow": + for (var a = 0; a < number; a++) { + core.animateFrame.weather.nodes.snow.push({ + x: Math.random() * core.bigmap.width * 32, + y: Math.random() * core.bigmap.height * 32, + r: Math.random() * 5 + 1, + d: Math.random() * Math.min(level, 200), + }); + } + break; + case "fog": + if (core.animateFrame.weather.fog) { + core.animateFrame.weather.nodes[type] = [{ + level: number, + x: 0, + y: -core.__PIXELS__ / 2, + dx: -Math.random() * 1.5, + dy: Math.random(), + delta: 0.001, + }, ]; + } + break; + case "cloud": + if (core.animateFrame.weather.cloud) { + core.animateFrame.weather.nodes[type] = [{ + level: number, + x: 0, + y: -core.__PIXELS__ / 2, + dx: -Math.random() * 1.5, + dy: Math.random(), + delta: 0.001, + }, ]; + } + break; + case "sun": + if (core.animateFrame.weather.sun) { + // 直接绘制 + core.clearMap("weather" + type); + + core.drawImage( + "weather" + type, + core.animateFrame.weather.sun, + 0, + 0, + core.animateFrame.weather.sun.width, + core.animateFrame.weather.sun.height, + 0, + 0, + core.__PIXELS__, + core.__PIXELS__ + ); + core.setAlpha("weather" + type, level / 10); + core.animateFrame.weather.nodes.sun = [{ level: level, opacity: level / 10, delta: 0.01 }] + } + break; + } + }; + core.registerAnimationFrame("weather", true, function (timestamp) { + var weather = core.animateFrame.weather; + if (!weather.type) return; + weather.type.forEach(function (one) { + if ( + timestamp - weather.time[one] <= 30 || + !core.dymCanvas["weather" + one] + ) + return; + core.control["_animationFrame_weather_" + one](); + weather.time[one] = timestamp; + }); + }); + // 晴 + control.prototype._animationFrame_weather_sun = function () { + + var node = core.animateFrame.weather.nodes.sun[0] + var opacity = node.opacity + node.delta; + + if (opacity > node.level / 11 + 0.3 || opacity < node.level / 11 - 0.3) + node.delta = -node.delta; + node.opacity = opacity; + core.setOpacity("weathersun", core.clamp(opacity, 0, 1)); + + }; + // 雨 + control.prototype._animationFrame_weather_rain = function () { + var ctx = core.dymCanvas.weatherrain, + ox = core.bigmap.offsetX, + oy = core.bigmap.offsetY; + core.clearMap("weatherrain"); + ctx.strokeStyle = "rgba(174,194,224,0.8)"; + ctx.lineWidth = 1; + ctx.lineCap = "round"; + core.animateFrame.weather.nodes.rain.forEach(function (p) { + ctx.beginPath(); + ctx.moveTo(p.x - ox, p.y - oy); + ctx.lineTo(p.x + p.l * p.xs - ox, p.y + p.l * p.ys - oy); + ctx.stroke(); + p.x += p.xs; + p.y += p.ys; + if (p.x > core.bigmap.width * 32 || p.y > core.bigmap.height * 32) { + p.x = Math.random() * core.bigmap.width * 32; + p.y = -10; + } + }); + ctx.fill(); + }; + // 雪 + control.prototype._animationFrame_weather_snow = function () { + var ctx = core.dymCanvas.weathersnow, + ox = core.bigmap.offsetX, + oy = core.bigmap.offsetY; + core.clearMap("weathersnow"); + ctx.fillStyle = "rgba(255, 255, 255, 0.8)"; + ctx.beginPath(); + if (!core.animateFrame.weather.data) core.animateFrame.weather.data = {}; + core.animateFrame.weather.data.snow = + core.animateFrame.weather.data.snow || 0; + core.animateFrame.weather.data.snow += 0.01; + var angle = core.animateFrame.weather.data.snow; + core.animateFrame.weather.nodes.snow.forEach(function (p) { + ctx.moveTo(p.x - ox, p.y - oy); + ctx.arc(p.x - ox, p.y - oy, p.r, 0, Math.PI * 2, true); + // update + p.x += Math.sin(angle) * core.animateFrame.weather.level.snow; + p.y += Math.cos(angle + p.d) + 1 + p.r / 2; + if ( + p.x > core.bigmap.width * 32 + 5 || + p.x < -5 || + p.y > core.bigmap.height * 32 + ) { + if (Math.random() > 1 / 3) { + p.x = Math.random() * core.bigmap.width * 32; + p.y = -10; + } else { + if (Math.sin(angle) > 0) p.x = -5; + else p.x = core.bigmap.width * 32 + 5; + p.y = Math.random() * core.bigmap.height * 32; + } + } + }); + ctx.fill(); + }; + // 图片天气 + control.prototype.__animateFrame_weather_image = function (image, type) { + if (!image) return; + var node = core.animateFrame.weather.nodes[type][0]; + core.setAlpha("weather" + type, node.level / 500); + var wind = 1.5; + var width = image.width, + height = image.height; + node.x += node.dx * wind; + node.y += (2 * node.dy - 1) * wind; + if (node.x + 3 * width <= core.__PIXELS__) { + node.x += 4 * width; + while (node.x > 0) node.x -= width; + } + node.dy += node.delta; + if (node.dy >= 1) { + node.delta = -0.001; + } else if (node.dy <= 0) { + node.delta = 0.001; + } + if (node.y + 3 * height <= core.__PIXELS__) { + node.y += 4 * height; + while (node.y > 0) node.y -= height; + } else if (node.y >= 0) { + node.y -= height; + } + for (var i = 0; i < 3; ++i) { + for (var j = 0; j < 3; ++j) { + if ( + node.x + (i + 1) * width <= 0 || + node.x + i * width >= core.__PIXELS__ || + node.y + (j + 1) * height <= 0 || + node.y + j * height >= core.__PIXELS__ + ) + continue; + core.drawImage( + "weather" + type, + image, + node.x + i * width, + node.y + j * height + ); + } + } + core.setAlpha("weather" + type, 1); + }; + // 雾 + control.prototype._animationFrame_weather_fog = function () { + core.clearMap("weatherfog"); + this.__animateFrame_weather_image(core.animateFrame.weather.fog, "fog"); + }; + // 云 + control.prototype._animationFrame_weather_cloud = function () { + core.clearMap("weathercloud"); + this.__animateFrame_weather_image( + core.animateFrame.weather.cloud, + "cloud" + ); + } + +}, "回合战斗动画": function () { // 在此增加新插件 const animateAttack = document.createElement("canvas"); //画布设置