Equipment Buff
This commit is contained in:
parent
83a8ccbad7
commit
9941d12689
@ -16,27 +16,27 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
"images": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "在此存放所有可能使用的图片(tilesets除外) \n 图片可以被作为背景图(的一部分),也可以直接用自定义事件进行显示。 \n 图片名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n 建议对于较大的图片,在网上使用在线的“图片压缩工具(http://compresspng.com/zh/)”来进行压缩,以节省流量 \n 依次向后添加"
|
||||
"_data": "在此存放所有可能使用的图片(tilesets除外) \n图片可以被作为背景图(的一部分),也可以直接用自定义事件进行显示。 \n 图片名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n 建议对于较大的图片,在网上使用在线的“图片压缩工具(http://compresspng.com/zh/)”来进行压缩,以节省流量 \n 依次向后添加"
|
||||
},
|
||||
"tilesets": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "在此存放额外素材的图片名, \n 可以自定导入任意张素材图片,无需PS,无需注册,即可直接在游戏中使用 \n 形式如[\"1.png\", \"2.png\"] ,将需要的素材图片放在images目录下 \n 素材的宽高必须都是32的倍数,且图片上的总图块数不超过1000(即最多有1000个32*32的图块在该图片上)"
|
||||
"_data": "在此存放额外素材的图片名, \n可以自定导入任意张素材图片,无需PS,无需注册,即可直接在游戏中使用 \n 形式如[\"1.png\", \"2.png\"] ,将需要的素材图片放在images目录下 \n 素材的宽高必须都是32的倍数,且图片上的总图块数不超过1000(即最多有1000个32*32的图块在该图片上)"
|
||||
},
|
||||
"animates": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "在此存放所有可能使用的动画,必须是animate格式,在这里不写后缀名 \n 动画必须放在animates目录下;文件名不能使用中文,不能带空格或特殊字符 \n \"jianji\", \"thunder\" \n 根据需求自行添加"
|
||||
"_data": "在此存放所有可能使用的动画,必须是animate格式,在这里不写后缀名 \n动画必须放在animates目录下;文件名不能使用中文,不能带空格或特殊字符 \n \"jianji\", \"thunder\" \n 根据需求自行添加"
|
||||
},
|
||||
"bgms": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "在此存放所有的bgm,和文件名一致。第一项为默认播放项 \n 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好"
|
||||
"_data": "在此存放所有的bgm,和文件名一致。第一项为默认播放项 \n音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好"
|
||||
},
|
||||
"sounds": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_data": "在此存放所有的SE,和文件名一致 \n 音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好"
|
||||
"_data": "在此存放所有的SE,和文件名一致 \n音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好"
|
||||
},
|
||||
"startBackground": {
|
||||
"_leaf": true,
|
||||
@ -445,7 +445,13 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_bool": "bool",
|
||||
"_data": "若此项为true则将状态栏中的楼层转换器按钮换为装备栏按钮"
|
||||
"_data": "状态栏的装备按钮。若此项为true则将状态栏中的楼层转换器按钮换为装备栏按钮"
|
||||
},
|
||||
"equipPercentage": {
|
||||
"_leaf": true,
|
||||
"_type": "checkbox",
|
||||
"_bool": "bool",
|
||||
"_data": "装备增加百分比属性。如果此项为true,则装备属性全部按照百分比进行计算,比如\"atk\": 20意味着攻击增加20%。\n如果多个装备百分比增加同一个属性的,按加算处理。(即一个10%一个20%总共是30%而不是32%)"
|
||||
},
|
||||
/*
|
||||
"enableDeleteItem": {
|
||||
|
||||
@ -67,6 +67,24 @@ animate为该装备的攻击动画,仅对type为0时有效。具体可参见[
|
||||
{"type": 3, "atk": -20, "def": 50, "mdef": 50} // 装备类型是魔杖,效果是攻击-20,防御和魔防各+50
|
||||
```
|
||||
|
||||
### 装备按比例增加属性
|
||||
|
||||
从V2.4.2开始,装备可以选择按照比例来增加属性。
|
||||
|
||||
在全塔属性中有个`equipPercentage`开关,如果将其打开,则会所有值都按照比例计算。(也就是类似Buff一样)
|
||||
|
||||
例如,上面的例子就变成了:
|
||||
|
||||
``` js
|
||||
{"type": 0, "atk": 10} // 装备类型是武器,效果是攻击提升10%,使用默认的攻击动画
|
||||
{"type": 0, "atk": 40, "animate": "sword"} // 装备类型为武器,效果是攻击提升10%,攻击动画是sword
|
||||
{"type": 1, "def": 40} // 装备类型是防具,效果是防御提升40%
|
||||
{"type": 1, "def": 100, "mdef": 100} // 装备类型是防具,效果是防御和魔防各提升100%
|
||||
{"type": 3, "atk": -20, "def": 50, "mdef": 50} // 装备类型是魔杖,效果是攻击下降20%,防御和魔防各提升50%
|
||||
```
|
||||
|
||||
值得注意的是:多装备增加同一属性使用加法计算;也就是比如武器增加30%攻击,防具增加10%攻击,最终合起来增加的是40%而不是43%的属性。
|
||||
|
||||
### 检测是否存在装备
|
||||
|
||||
可以使用`core.hasEquip(itemId)`来检测是否装上某个装备。
|
||||
|
||||
@ -129,7 +129,7 @@ enemys.prototype.getExtraDamage = function (enemy) {
|
||||
enemys.prototype.nextCriticals = function (enemy, number) {
|
||||
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
|
||||
|
||||
var useTurn = !core.flags.useLoop; // 是否使用回合法计算临界值;如果要用循环法,则直接改为false。
|
||||
var useTurn = !core.flags.useLoop;
|
||||
|
||||
number = number||1;
|
||||
|
||||
@ -161,6 +161,10 @@ enemys.prototype.nextCriticals = function (enemy, number) {
|
||||
if (useTurn) { // 回合数计算法
|
||||
for (var t = turn-1;t>=1;t--) {
|
||||
var nextAtk = Math.ceil(mon_hp/t) + mon_def;
|
||||
// 装备提升比例的计算临界
|
||||
if (core.flags.equipPercentage) {
|
||||
nextAtk = Math.ceil(nextAtk / core.getFlag('equip_atk_buff', 1));
|
||||
}
|
||||
if (nextAtk<=hero_atk) break;
|
||||
if (nextAtk!=pre) {
|
||||
var nextInfo = this.getDamageInfo(enemy, core.status.hero.hp, nextAtk, core.status.hero.def, core.status.hero.mdef);
|
||||
@ -235,12 +239,19 @@ enemys.prototype.getCurrentEnemys = function (floorId) {
|
||||
|
||||
var enemy = core.material.enemys[enemyId];
|
||||
var mon_hp = enemy.hp, mon_atk = enemy.atk, mon_def = enemy.def;
|
||||
if (this.hasSpecial(enemy.special, 10)) {
|
||||
mon_atk=core.status.hero.atk;
|
||||
mon_def=core.status.hero.def;
|
||||
var hero_atk = core.status.hero.atk, hero_def = core.status.hero.def, hero_mdef = core.status.hero.mdef;
|
||||
|
||||
if (core.flags.equipPercentage) {
|
||||
hero_atk = Math.floor(core.getFlag('equip_atk_buff',1)*hero_atk);
|
||||
hero_def = Math.floor(core.getFlag('equip_def_buff',1)*hero_def);
|
||||
hero_mdef = Math.floor(core.getFlag('equip_mdef_buff',1)*hero_mdef);
|
||||
}
|
||||
if (this.hasSpecial(enemy.special, 3) && mon_def < core.status.hero.atk - 1)
|
||||
mon_def = core.status.hero.atk - 1;
|
||||
if (this.hasSpecial(enemy.special, 10)) {
|
||||
mon_atk=hero_atk;
|
||||
mon_def=hero_def;
|
||||
}
|
||||
if (this.hasSpecial(enemy.special, 3) && mon_def < hero_atk - 1)
|
||||
mon_def = hero_atk - 1;
|
||||
|
||||
var specialText = core.enemys.getSpecialText(enemyId);
|
||||
if (specialText.length>=3) specialText = "多属性...";
|
||||
|
||||
@ -175,10 +175,17 @@ items.prototype.loadEquip = function (equipId, callback) {
|
||||
|
||||
// 比较能力值
|
||||
var result = core.compareEquipment(equipId,unloadEquipId);
|
||||
|
||||
core.status.hero.atk += result.atk;
|
||||
core.status.hero.def += result.def;
|
||||
core.status.hero.mdef += result.mdef;
|
||||
|
||||
if (core.flags.equipPercentage) {
|
||||
core.setFlag('equip_atk_buff', core.getFlag('equip_atk_buff',1)+result.atk/100);
|
||||
core.setFlag('equip_def_buff', core.getFlag('equip_def_buff',1)+result.def/100);
|
||||
core.setFlag('equip_mdef_buff', core.getFlag('equip_mdef_buff',1)+result.mdef/100);
|
||||
}
|
||||
else {
|
||||
core.status.hero.atk += result.atk;
|
||||
core.status.hero.def += result.def;
|
||||
core.status.hero.mdef += result.mdef;
|
||||
}
|
||||
|
||||
// 更新装备状态
|
||||
core.status.hero.equipment[loadEquipType] = equipId;
|
||||
@ -214,9 +221,16 @@ items.prototype.unloadEquip = function (equipType, callback) {
|
||||
var unloadEquip = core.material.items[unloadEquipId];
|
||||
|
||||
// 处理能力值改变
|
||||
core.status.hero.atk -= unloadEquip.equip.atk || 0;
|
||||
core.status.hero.def -= unloadEquip.equip.def || 0;
|
||||
core.status.hero.mdef -= unloadEquip.equip.mdef || 0;
|
||||
if (core.flags.equipPercentage) {
|
||||
core.setFlag('equip_atk_buff', core.getFlag('equip_atk_buff',1)-(unloadEquip.equip.atk||0)/100);
|
||||
core.setFlag('equip_def_buff', core.getFlag('equip_def_buff',1)-(unloadEquip.equip.def||0)/100);
|
||||
core.setFlag('equip_mdef_buff', core.getFlag('equip_mdef_buff',1)-(unloadEquip.equip.mdef||0)/100);
|
||||
}
|
||||
else {
|
||||
core.status.hero.atk -= unloadEquip.equip.atk || 0;
|
||||
core.status.hero.def -= unloadEquip.equip.def || 0;
|
||||
core.status.hero.mdef -= unloadEquip.equip.mdef || 0;
|
||||
}
|
||||
|
||||
// 更新装备状态
|
||||
core.status.hero.equipment[equipType] = null;
|
||||
|
||||
15
libs/ui.js
15
libs/ui.js
@ -865,6 +865,12 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||
var monster = core.material.enemys[monsterId];
|
||||
var mon_hp = monster.hp, mon_atk = monster.atk, mon_def = monster.def, mon_money=monster.money, mon_exp = monster.experience, mon_special=monster.special;
|
||||
|
||||
if (core.flags.equipPercentage) {
|
||||
hero_atk = Math.floor(core.getFlag('equip_atk_buff',1)*hero_atk);
|
||||
hero_def = Math.floor(core.getFlag('equip_def_buff',1)*hero_def);
|
||||
hero_mdef = Math.floor(core.getFlag('equip_mdef_buff',1)*hero_mdef);
|
||||
}
|
||||
|
||||
var initDamage = 0; // 战前伤害
|
||||
|
||||
// 吸血
|
||||
@ -1849,10 +1855,15 @@ ui.prototype.drawEquipbox = function(index) {
|
||||
if (!core.isset(compare[name]) || compare[name]==0) return;
|
||||
var color = '#00FF00';
|
||||
if (compare[name]<0) color = '#FF0000';
|
||||
var content = title + ' ' + core.getStatus(name) + '->';
|
||||
var nowValue = core.getStatus(name), newValue = nowValue + compare[name];
|
||||
if (core.flags.equipPercentage) {
|
||||
var nowBuff = core.getFlag('equip_'+name+"_buff",1), newBuff = nowBuff+compare[name]/100;
|
||||
nowValue = Math.floor(nowBuff*core.getStatus(name));
|
||||
newValue = Math.floor(newBuff*core.getStatus(name));
|
||||
}
|
||||
var content = title + ' ' + nowValue + '->';
|
||||
core.fillText('ui', content, drawOffset, 89, '#CCCCCC', 'bold 14px Verdana');
|
||||
drawOffset += core.canvas.ui.measureText(content).width;
|
||||
var newValue = core.getStatus(name) + compare[name] + "";
|
||||
core.fillText('ui', newValue, drawOffset, 89, color);
|
||||
drawOffset += core.canvas.ui.measureText(newValue).width + 15;
|
||||
})
|
||||
|
||||
@ -203,6 +203,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"bigKeyIsBox": false,
|
||||
"equipment": false,
|
||||
"equipboxButton": false,
|
||||
"equipPercentage": false,
|
||||
"enableAddPoint": false,
|
||||
"enableNegativeDamage": false,
|
||||
"hatredDecrease": true,
|
||||
|
||||
@ -366,7 +366,17 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 怪物生命,怪物攻击、防御、特殊属性
|
||||
var mon_hp = enemy.hp, mon_atk = enemy.atk, mon_def = enemy.def, mon_special = enemy.special;
|
||||
// 勇士的负属性都按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);
|
||||
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);
|
||||
|
||||
// 装备按比例增加属性
|
||||
if (core.flags.equipPercentage) {
|
||||
hero_atk = Math.floor(core.getFlag('equip_atk_buff',1)*hero_atk);
|
||||
hero_def = Math.floor(core.getFlag('equip_def_buff',1)*hero_def);
|
||||
hero_mdef = Math.floor(core.getFlag('equip_mdef_buff',1)*hero_mdef);
|
||||
}
|
||||
|
||||
// 如果是无敌属性,且勇士未持有十字架
|
||||
if (this.hasSpecial(mon_special, 20) && !core.hasItem("cross"))
|
||||
@ -495,6 +505,13 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.statusBar[item].innerHTML = core.formatBigNumber(core.getStatus(item));
|
||||
});
|
||||
|
||||
// 装备按比例增加属性
|
||||
if (core.flags.equipPercentage) {
|
||||
core.statusBar.atk.innerHTML = core.formatBigNumber(Math.floor(core.getFlag('equip_atk_buff',1)*core.getStatus('atk')));
|
||||
core.statusBar.def.innerHTML = core.formatBigNumber(Math.floor(core.getFlag('equip_def_buff',1)*core.getStatus('def')));
|
||||
core.statusBar.mdef.innerHTML = core.formatBigNumber(Math.floor(core.getFlag('equip_mdef_buff',1)*core.getStatus('mdef')));
|
||||
}
|
||||
|
||||
// 可以在这里添加自己额外的状态栏信息,比如想攻击显示 +0.5 可以这么写:
|
||||
// if (core.hasFlag('halfAtk')) core.statusBar.atk.innerHTML += "+0.5";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user