Update Values

This commit is contained in:
oc 2017-12-05 19:47:46 +08:00
parent 26dfcb9819
commit 661e848b7b
5 changed files with 74 additions and 66 deletions

View File

@ -113,6 +113,7 @@ core.prototype.init = function (dom, statusBar, canvas, images, sounds, floorIds
core[key] = coreData[key];
}
core.flags = core.data.flags;
core.values = core.clone(core.data.values);
core.firstData = core.data.getFirstData();
core.initStatus.shops = core.firstData.shops;
core.initStatus.npcs = core.firstData.npcs;
@ -1290,7 +1291,7 @@ core.prototype.moveOneStep = function() {
core.status.hero.steps++;
// 中毒状态
if (core.hasFlag('poison')) {
core.status.hero.hp -= core.flags.poisonDamage;
core.status.hero.hp -= core.values.poisonDamage;
if (core.status.hero.hp<=0) {
core.status.hero.hp=0;
core.updateStatusBar();
@ -2788,8 +2789,8 @@ core.prototype.clearStatusBar = function() {
core.prototype.updateStatusBar = function () {
// 上限999999
if (core.flags.HPMAX>0) {
core.setStatus('hp', Math.min(core.flags.HPMAX, core.getStatus('hp')));
if (core.values.HPMAX>0) {
core.setStatus('hp', Math.min(core.values.HPMAX, core.getStatus('hp')));
}
// core.statusBar.floor.innerHTML = core.maps.maps[core.status.floorId].name;

View File

@ -86,19 +86,13 @@ data.prototype.init = function() {
'npcs': {},
'animateSpeed': 500,
}
// 系统FLAG在游戏运行中中请不要修改它。
this.flags = {
/****** 角色状态相关 ******/
// 各种数值;一些数值可以在这里设置
this.values = {
/****** 角色相关 ******/
"HPMAX": 999999, // HP上限-1则无上限
"enableMDef": true, // 是否涉及勇士的魔防值如果此项为false则状态栏不会显示勇士的魔防值
"enableExperience": false, // 是否涉及经验值如果此项为false则状态栏和怪物手册均将不会显示经验值
// 重要说明如果enableMDef和enableExperience均为true则在状态栏不会显示当前楼层 //
"lavaDamage": 100, // 经过血网受到的伤害
"poisonDamage": 10, // 经过毒网受到的伤害
"weakValue": 20, // 衰弱状态下攻防减少的数值
/****** 道具相关 ******/
"redJewel": 3, // 红宝石加攻击的数值
"blueJewel": 3, // 蓝宝石加防御的数值
@ -118,7 +112,18 @@ data.prototype.init = function() {
"sword5": 160, // 神圣剑加攻数值
"shield5": 160, // 神圣盾加防数值
"moneyPocket": 500, // 金钱袋加金币的数值
}
// 系统FLAG在游戏运行中中请不要修改它。
this.flags = {
/****** 角色状态相关 ******/
"enableMDef": true, // 是否涉及勇士的魔防值如果此项为false则状态栏不会显示勇士的魔防值
"enableExperience": false, // 是否涉及经验值如果此项为false则状态栏和怪物手册均将不会显示经验值
// 重要说明如果enableMDef和enableExperience均为true则在状态栏不会显示当前楼层 //
/****** 道具相关 ******/
"flyNearStair": false, // 是否需要在楼梯边使用传送器
"bombTrigger": true, // 使用炸弹后是否触发怪物事件(如开门)
"pickaxeFourDirections": true, // 使用破墙镐是否四个方向都破坏如果false则只破坏面前的墙壁

View File

@ -249,8 +249,8 @@ events.prototype.afterBattle = function(enemyId,x,y,callback) {
// 衰弱
if (special==13 && !core.hasFlag('weak')) {
core.setFlag('weak', true);
core.status.hero.atk-=core.flags.weakValue;
core.status.hero.def-=core.flags.weakValue;
core.status.hero.atk-=core.values.weakValue;
core.status.hero.def-=core.values.weakValue;
core.updateStatusBar();
}
// 诅咒
@ -290,7 +290,7 @@ events.prototype.passNet = function (data) {
// 有鞋子
if (core.hasItem('shoes')) return;
if (data.event.id=='lavaNet') {
core.status.hero.hp -= core.flags.lavaDamage;
core.status.hero.hp -= core.values.lavaDamage;
if (core.status.hero.hp<=0) {
core.status.hero.hp=0;
core.updateStatusBar();
@ -298,7 +298,7 @@ events.prototype.passNet = function (data) {
return;
}
core.updateStatusBar();
core.drawTip('经过血网,生命-'+core.flags.lavaDamage);
core.drawTip('经过血网,生命-'+core.values.lavaDamage);
}
if (data.event.id=='poisonNet') {
if (core.hasFlag('poison')) return;
@ -308,8 +308,8 @@ events.prototype.passNet = function (data) {
if (data.event.id=='weakNet') {
if (core.hasFlag('weak')) return;
core.setFlag('weak', true);
core.status.hero.atk-=core.flags.weakValue;
core.status.hero.def-=core.flags.weakValue;
core.status.hero.atk-=core.values.weakValue;
core.status.hero.def-=core.values.weakValue;
core.updateStatusBar();
}
if (data.event.id=='curseNet') {

View File

@ -67,8 +67,8 @@ main.floors.sample0 = {
],
/****** 楼层转换事件 ******/
"6,0": {"trigger": "changeFloor", "data": {"floorId": "sample0", "stair": "downFloor"}},
"0,11": {"trigger": "changeFloor", "data": {"floorId": "sample0", "loc": [0,12]}},
"6,0": {"trigger": "changeFloor", "data": {"floorId": "sample0", "stair": "downFloor"}}, // 目标点sample0层的下楼梯位置
"0,11": {"trigger": "changeFloor", "data": {"floorId": "sample0", "loc": [0,12]}}, // 目标点sample0层的x=0,y=12位置
"0,12": {"trigger": "changeFloor", "data": {"floorId": "sample0", "stair": "upFloor"}}, // 注意目标层有多个楼梯的话写stair可能会导致到达位置不确定。这时候推荐写loc指明目标点位置。
"1,12": {"trigger": "changeFloor", "data": {"floorId": "sample0", "loc": [1,12]}},
"2,12": {"trigger": "changeFloor", "data": {"floorId": "sample0", "loc": [2,12]}},
@ -79,14 +79,16 @@ main.floors.sample0 = {
/****** 领域、夹击检查事件 ******/
// 所有可能的的领域、夹击点均需要加上 {"trigger": "ckeckBlock"},否则将不会触发检查事件
// 另外如果该点已经存在events事件上面有相同点位置定义则会覆盖
// 所以 |****** 强烈要求可能的夹击、领域点不要存在事件!! ******|
"1,0": {"trigger": "checkBlock"},
"0,1": {"trigger": "checkBlock"},
"1,1": {"trigger": "checkBlock"},
"1,2": {"trigger": "checkBlock"},
"2,1": {"trigger": "checkBlock"},
"3,0": {"trigger": "checkBlock"},
"3,2": {"trigger": "checkBlock"},
"0,1": {"trigger": "checkBlock"},
"2,1": {"trigger": "checkBlock"},
"4,1": {"trigger": "checkBlock"},
"1,2": {"trigger": "checkBlock"},
"3,2": {"trigger": "checkBlock"},
},
"afterOpenDoor": { // 开完门后可能触发的事件列表
@ -98,7 +100,7 @@ main.floors.sample0 = {
"afterGetItem": { // 获得道具后可能触发的事件列表
"11,8": "由于状态栏放不下绿钥匙和铁门钥匙均视为tools\n放入工具栏中。\n碰到绿门和铁门仍然会自动使用开门。",
"8,6": "由于吸血和夹击等的存在,血瓶默认自动被绕路。\n你可以修改data.js中的系统Flag来设置这一项。",
"8,7": "如需修改消耗品的效果,请前往items.js修改\ngetItemEffect 和 getItemEffectTip 两个函数\n的具体数值即可。",
"8,7": "如需修改消耗品的效果,请前往 data.js ,找到\n并修改values内对应的具体数值即可。\n\n如果有更高级的需求如每个区域宝石数值变化\n详见doc文档内的做法说明。",
"9,5": [
"每层楼的 canFlyTo 决定了该楼层能否被飞到。\n\n不能被飞到的楼层也无法使用楼层传送器。",
"飞行的楼层顺序由 main.js 中 floorIds 加载顺序\n所决定。\n\n是否必须在楼梯边使用楼传器由 data.js 中的系统\nFlag所决定。"

View File

@ -77,36 +77,36 @@ items.prototype.getItemEffect = function(itemId, itemNum) {
var itemCls = core.material.items[itemId].cls;
// 消耗品
if (itemCls === 'items') {
if (itemId === 'redJewel') core.status.hero.atk += core.flags.redJewel;
if (itemId === 'blueJewel') core.status.hero.def += core.flags.blueJewel;
if (itemId === 'greenJewel') core.status.hero.mdef += core.flags.greenJewel;
if (itemId === 'redJewel') core.status.hero.atk += core.values.redJewel;
if (itemId === 'blueJewel') core.status.hero.def += core.values.blueJewel;
if (itemId === 'greenJewel') core.status.hero.mdef += core.values.greenJewel;
if (itemId == 'yellowJewel') { // 黄宝石属性:需自己定义
core.status.hero.hp+=1000;
core.status.hero.atk+=6;
core.status.hero.def+=6;
core.status.hero.mdef+=10;
}
if (itemId === 'redPotion') core.status.hero.hp += core.flags.redPotion;
if (itemId === 'bluePotion') core.status.hero.hp += core.flags.bluePotion;
if (itemId === 'yellowPotion') core.status.hero.hp += core.flags.yellowPotion;
if (itemId === 'greenPotion') core.status.hero.hp += core.flags.greenPotion;
if (itemId === 'sword1') core.status.hero.atk += core.flags.sword1;
if (itemId === 'sword2') core.status.hero.atk += core.flags.sword2;
if (itemId == 'sword3') core.status.hero.atk += core.flags.sword3;
if (itemId == 'sword4') core.status.hero.atk += core.flags.sword4;
if (itemId === 'sword5') core.status.hero.atk += core.flags.sword5;
if (itemId === 'shield1') core.status.hero.def += core.flags.shield1;
if (itemId === 'shield2') core.status.hero.def += core.flags.shield2;
if (itemId === 'shield3') core.status.hero.def += core.flags.shield3;
if (itemId === 'shield4') core.status.hero.def += core.flags.shield4;
if (itemId === 'shield5') core.status.hero.def += core.flags.shield5;
if (itemId === 'redPotion') core.status.hero.hp += core.values.redPotion;
if (itemId === 'bluePotion') core.status.hero.hp += core.values.bluePotion;
if (itemId === 'yellowPotion') core.status.hero.hp += core.values.yellowPotion;
if (itemId === 'greenPotion') core.status.hero.hp += core.values.greenPotion;
if (itemId === 'sword1') core.status.hero.atk += core.values.sword1;
if (itemId === 'sword2') core.status.hero.atk += core.values.sword2;
if (itemId == 'sword3') core.status.hero.atk += core.values.sword3;
if (itemId == 'sword4') core.status.hero.atk += core.values.sword4;
if (itemId === 'sword5') core.status.hero.atk += core.values.sword5;
if (itemId === 'shield1') core.status.hero.def += core.values.shield1;
if (itemId === 'shield2') core.status.hero.def += core.values.shield2;
if (itemId === 'shield3') core.status.hero.def += core.values.shield3;
if (itemId === 'shield4') core.status.hero.def += core.values.shield4;
if (itemId === 'shield5') core.status.hero.def += core.values.shield5;
if (itemId === 'bigKey') { // 只有是钥匙盒才会执行这一步
core.status.hero.items.keys.yellowKey++;
core.status.hero.items.keys.blueKey++;
core.status.hero.items.keys.redKey++;
}
if (itemId == 'superPotion') core.status.hero.hp *= 2;
if (itemId == 'moneyPocket') core.status.hero.money += core.flags.moneyPocket;
if (itemId == 'moneyPocket') core.status.hero.money += core.values.moneyPocket;
}
else {
core.addItem(itemId, itemNum);
@ -114,27 +114,27 @@ items.prototype.getItemEffect = function(itemId, itemNum) {
}
items.prototype.getItemEffectTip = function(itemId) {
if (itemId === 'redJewel') return ",攻击+"+core.flags.redJewel;
if (itemId === 'blueJewel') return ",防御+"+core.flags.blueJewel;
if (itemId === 'greenJewel') return ",魔防+"+core.flags.greenJewel;
if (itemId === 'redJewel') return ",攻击+"+core.values.redJewel;
if (itemId === 'blueJewel') return ",防御+"+core.values.blueJewel;
if (itemId === 'greenJewel') return ",魔防+"+core.values.greenJewel;
if (itemId == 'yellowJewel') return ",全属性提升";
if (itemId === 'redPotion') return ",生命+"+core.flags.redPotion;
if (itemId === 'bluePotion') return ",生命+"+core.flags.bluePotion;
if (itemId === 'yellowPotion') return ",生命+"+core.flags.yellowPotion;
if (itemId === 'greenPotion') return ",生命+"+core.flags.greenPotion;
if (itemId === 'sword1') return ",攻击+"+core.flags.sword1;
if (itemId === 'sword2') return ",攻击+"+core.flags.sword2;
if (itemId === 'sword3') return ",攻击+"+core.flags.sword3;
if (itemId === 'sword4') return ",攻击+"+core.flags.sword4;
if (itemId === 'sword5') return ",攻击+"+core.flags.sword5;
if (itemId === 'shield1') return ",防御+"+core.flags.shield1;
if (itemId === 'shield2') return ",防御+"+core.flags.shield2;
if (itemId === 'shield3') return ",防御+"+core.flags.shield3;
if (itemId === 'shield4') return ",防御+"+core.flags.shield4;
if (itemId === 'shield5') return ",防御+"+core.flags.shield5;
if (itemId === 'redPotion') return ",生命+"+core.values.redPotion;
if (itemId === 'bluePotion') return ",生命+"+core.values.bluePotion;
if (itemId === 'yellowPotion') return ",生命+"+core.values.yellowPotion;
if (itemId === 'greenPotion') return ",生命+"+core.values.greenPotion;
if (itemId === 'sword1') return ",攻击+"+core.values.sword1;
if (itemId === 'sword2') return ",攻击+"+core.values.sword2;
if (itemId === 'sword3') return ",攻击+"+core.values.sword3;
if (itemId === 'sword4') return ",攻击+"+core.values.sword4;
if (itemId === 'sword5') return ",攻击+"+core.values.sword5;
if (itemId === 'shield1') return ",防御+"+core.values.shield1;
if (itemId === 'shield2') return ",防御+"+core.values.shield2;
if (itemId === 'shield3') return ",防御+"+core.values.shield3;
if (itemId === 'shield4') return ",防御+"+core.values.shield4;
if (itemId === 'shield5') return ",防御+"+core.values.shield5;
if (itemId === 'bigKey') return ",全钥匙+1";
if (itemId === 'superPotion') return ",生命值翻倍";
if (itemId == 'moneyPocket') return ",金币+"+core.flags.moneyPocket;
if (itemId == 'moneyPocket') return ",金币+"+core.values.moneyPocket;
return "";
}
@ -180,15 +180,15 @@ items.prototype.useItem = function (itemId) {
if (itemId == 'poisonWine') core.setFlag('poison', false);
if (itemId == 'weakWine') {
core.setFlag('weak', false);
core.status.hero.atk += core.flags.weakValue;
core.status.hero.def += core.flags.weakValue;
core.status.hero.atk += core.values.weakValue;
core.status.hero.def += core.values.weakValue;
}
if (itemId == 'curseWine') core.setFlag('curse', false);
if (itemId == 'superWine') {
core.setFlag('poison', false);
core.setFlag('weak', false);
core.status.hero.atk += core.flags.weakValue;
core.status.hero.def += core.flags.weakValue;
core.status.hero.atk += core.values.weakValue;
core.status.hero.def += core.values.weakValue;
core.setFlag('curse', false);
}
core.updateStatusBar();