getEnemyInfo & Aura
This commit is contained in:
parent
3d17624898
commit
41d9c5a298
@ -103,6 +103,12 @@ functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
||||
"_lint": true,
|
||||
"_data": "怪物特殊属性的定义(获得怪物的特殊属性)"
|
||||
},
|
||||
"getEnemyInfo": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_lint": true,
|
||||
"_data": "获得某个怪物的当前属性数据\n该函数主要是会被伤害计算和怪物手册等使用"
|
||||
},
|
||||
"getDamageInfo": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
|
||||
14
docs/api.md
14
docs/api.md
@ -349,34 +349,36 @@ core.enemys.getSpecialHint(enemy, special)
|
||||
获得怪物某个(或全部)特殊属性的文字说明。
|
||||
|
||||
|
||||
core.enemys.canBattle(enemyId)
|
||||
core.enemys.canBattle(enemyId, x, y, floorId)
|
||||
返回当前能否战胜某个怪物。
|
||||
后面三个参数是怪物坐标和楼层。
|
||||
|
||||
|
||||
core.enemys.getDamage(enemyId)
|
||||
core.enemys.getDamage(enemyId, x, y, floorId)
|
||||
返回当前对某个怪物的战斗伤害。如果无法战斗,返回null。
|
||||
后面三个参数是怪物坐标和楼层。
|
||||
|
||||
|
||||
core.enemys.getExtraDamage(enemyId)
|
||||
返回某个怪物会对勇士造成的额外伤害(不可被魔防抵消),例如仇恨、固伤等等。
|
||||
|
||||
|
||||
core.enemys.nextCriticals(enemyId, number)
|
||||
core.enemys.nextCriticals(enemyId, number, x, y, floorId)
|
||||
返回一个列表,为接下来number(可忽略,默认为1)个该怪物的临界值和临界减伤。
|
||||
列表每一项类似 [x,y] 表示临界值为x,且临界减伤为y。
|
||||
如果无临界值,则返回空列表。
|
||||
|
||||
|
||||
core.enemys.getDefDamage(enemyId, k)
|
||||
core.enemys.getDefDamage(enemyId, k, x, y, floorId)
|
||||
获得k(可忽略,默认为1)防减伤值。
|
||||
|
||||
|
||||
core.enemys.getDamageInfo(enemy, hero_hp, hero_atk, hero_def, hero_mdef)
|
||||
core.enemys.getDamageInfo(enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId)
|
||||
获得实际战斗信息,比如伤害,回合数,每回合伤害等等。
|
||||
此函数是实际战斗过程的计算。
|
||||
|
||||
|
||||
core.enemys.calDamage(enemy, hero_hp, hero_atk, hero_def, hero_mdef)
|
||||
core.enemys.calDamage(enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId)
|
||||
获得在某个勇士属性下怪物伤害;实际返回的是上面getDamageInfo中伤害的数值。
|
||||
|
||||
|
||||
|
||||
@ -320,7 +320,7 @@ core.setFlag("shield5", true); // 增加一个自定义Flag:已经拿到神圣
|
||||
```
|
||||
2. 免疫吸血效果:在脚本编辑的getDamageInfo中,编辑成如果存在神圣盾标记,吸血伤害为0。
|
||||
``` js
|
||||
function (enemy, hero_hp, hero_atk, hero_def, hero_mdef) {
|
||||
function (enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId) {
|
||||
// ... 上略
|
||||
// 吸血
|
||||
if (this.hasSpecial(mon_special, 11)) {
|
||||
|
||||
@ -1030,14 +1030,14 @@ actions.prototype.clickViewMaps = function (x,y) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(x>=2 && x<=10 && y<=4) {
|
||||
if(y<=4 && (mh==13 || (x>=2 && x<=10))) {
|
||||
index++;
|
||||
while (index<core.floorIds.length && index!=now && core.floors[core.floorIds[index]].cannotViewMap)
|
||||
index++;
|
||||
if (index<core.floorIds.length)
|
||||
core.ui.drawMaps(index);
|
||||
}
|
||||
else if (x>=2 && x<=10 && y>=8) {
|
||||
else if (y>=8 && (mh==13 || (x>=2 && x<=10))) {
|
||||
index--;
|
||||
while (index>=0 && index!=now && core.floors[core.floorIds[index]].cannotViewMap)
|
||||
index--;
|
||||
@ -2067,6 +2067,10 @@ actions.prototype.clickSyncSave = function (x,y) {
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
core.status.event.selection=0;
|
||||
core.ui.drawReplay();
|
||||
break;
|
||||
case 5:
|
||||
if (core.hasFlag('debug')) {
|
||||
core.drawText("\t[系统提示]调试模式下无法下载录像");
|
||||
break;
|
||||
@ -2078,11 +2082,11 @@ actions.prototype.clickSyncSave = function (x,y) {
|
||||
'route': core.encodeRoute(core.status.route)
|
||||
}));
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
core.status.event.selection=0;
|
||||
core.ui.drawStorageRemove();
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
core.status.event.selection=3;
|
||||
core.ui.drawSettings();
|
||||
break;
|
||||
|
||||
@ -1280,7 +1280,7 @@ control.prototype.snipe = function (snipes) {
|
||||
snipe.blockImage = core.material.images[cls];
|
||||
snipe.height = height;
|
||||
|
||||
var damage = core.enemys.getDamage(block.event.id);
|
||||
var damage = core.enemys.getDamage(block.event.id, x, y);
|
||||
var color = '#000000';
|
||||
|
||||
if (damage == null) {
|
||||
@ -1514,7 +1514,7 @@ control.prototype.updateDamage = function () {
|
||||
var id = mapBlocks[b].event.id;
|
||||
|
||||
if (core.flags.displayEnemyDamage) {
|
||||
var damage = core.enemys.getDamage(id);
|
||||
var damage = core.enemys.getDamage(id, x, y);
|
||||
var color = '#000000';
|
||||
|
||||
if (damage == null) {
|
||||
|
||||
28
libs/core.js
28
libs/core.js
@ -232,19 +232,23 @@ core.prototype.init = function (coreData, callback) {
|
||||
core.platform.isQQ = /QQ/i.test(navigator.userAgent);
|
||||
core.platform.isWeChat = /MicroMessenger/i.test(navigator.userAgent);
|
||||
core.platform.useLocalForage = core.getLocalStorage('useLocalForage', true);
|
||||
if (core.platform.isIOS) core.platform.useLocalForage=false;
|
||||
if (core.platform.useLocalForage) {
|
||||
try {
|
||||
core.setLocalForage("__test__", "__test__", function() {
|
||||
core.setLocalForage("__test__", LZString.compress("__test__"), function() {
|
||||
try {
|
||||
core.getLocalForage("__test__", null, function(data) {
|
||||
if (data!="__test__") {
|
||||
console.log("localForage unsupported!");
|
||||
core.platform.useLocalForage=false;
|
||||
}
|
||||
else {
|
||||
console.log("localForage supported!")
|
||||
core.removeLocalForage("__test__");
|
||||
try {
|
||||
if (LZString.decompress(data)!="__test__") {
|
||||
console.log("localForage unsupported!");
|
||||
core.platform.useLocalForage=false;
|
||||
}
|
||||
else {
|
||||
console.log("localForage supported!")
|
||||
core.removeLocalForage("__test__");
|
||||
}
|
||||
}
|
||||
catch (e) {console.log(e); core.platform.useLocalForage=false;}
|
||||
}, function(e) {console.log(e); core.platform.useLocalForage=false;})
|
||||
}
|
||||
catch (e) {console.log(e); core.platform.useLocalForage=false;}
|
||||
@ -821,13 +825,13 @@ core.prototype.hasSpecial = function (special, test) {
|
||||
}
|
||||
|
||||
////// 判断能否战斗 //////
|
||||
core.prototype.canBattle = function(enemyId) {
|
||||
return core.enemys.canBattle(enemyId);
|
||||
core.prototype.canBattle = function(enemyId, x, y, floorId) {
|
||||
return core.enemys.canBattle(enemyId, x, y, floorId);
|
||||
}
|
||||
|
||||
////// 获得伤害数值 //////
|
||||
core.prototype.getDamage = function(enemy) {
|
||||
return core.enemys.getDamage(enemy);
|
||||
core.prototype.getDamage = function(enemy, x, y, floorId) {
|
||||
return core.enemys.getDamage(enemy, x, y, floorId);
|
||||
}
|
||||
|
||||
////// 获得某个物品的个数 //////
|
||||
|
||||
@ -99,15 +99,15 @@ enemys.prototype.getSpecialHint = function (enemy, special) {
|
||||
}
|
||||
|
||||
////// 能否获胜 //////
|
||||
enemys.prototype.canBattle = function (enemyId) {
|
||||
var damage = this.getDamage(enemyId);
|
||||
enemys.prototype.canBattle = function (enemyId, x, y, floorId) {
|
||||
var damage = this.getDamage(enemyId, x, y, floorId);
|
||||
return damage != null && damage < core.status.hero.hp;
|
||||
}
|
||||
|
||||
////// 获得某个怪物的伤害 //////
|
||||
enemys.prototype.getDamage = function (enemy) {
|
||||
enemys.prototype.getDamage = function (enemy, x, y, floorId) {
|
||||
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
|
||||
var damage = this.calDamage(enemy, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef);
|
||||
var damage = this.calDamage(enemy, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
|
||||
if (damage == null) return null;
|
||||
return damage + this.getExtraDamage(enemy);
|
||||
}
|
||||
@ -126,7 +126,7 @@ enemys.prototype.getExtraDamage = function (enemy) {
|
||||
}
|
||||
|
||||
////// 接下来N个临界值和临界减伤计算 //////
|
||||
enemys.prototype.nextCriticals = function (enemy, number) {
|
||||
enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) {
|
||||
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
|
||||
|
||||
var useTurn = !core.flags.useLoop;
|
||||
@ -142,7 +142,7 @@ enemys.prototype.nextCriticals = function (enemy, number) {
|
||||
|
||||
// 坚固、模仿怪物没有临界!
|
||||
if (this.hasSpecial(enemy.special, 10)) return [];
|
||||
var info = this.getDamageInfo(enemy, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef);
|
||||
var info = this.getDamageInfo(enemy, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
|
||||
|
||||
if (info == null) {
|
||||
if (core.status.hero.atk<=enemy.def) {
|
||||
@ -167,7 +167,7 @@ enemys.prototype.nextCriticals = function (enemy, number) {
|
||||
}
|
||||
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);
|
||||
var nextInfo = this.getDamageInfo(enemy, core.status.hero.hp, nextAtk, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
|
||||
if (nextInfo==null) break;
|
||||
list.push([nextAtk-hero_atk,info.damage-nextInfo.damage]);
|
||||
if (nextInfo.damage<=0 && !core.flags.enableNegativeDamage) break;
|
||||
@ -180,7 +180,7 @@ enemys.prototype.nextCriticals = function (enemy, number) {
|
||||
else { // 暴力for循环法
|
||||
pre = info.damage;
|
||||
for (var atk=hero_atk+1;atk<=mon_hp+mon_def;atk++) {
|
||||
var nextInfo = this.getDamageInfo(enemy, core.status.hero.hp, atk, core.status.hero.def, core.status.hero.mdef);
|
||||
var nextInfo = this.getDamageInfo(enemy, core.status.hero.hp, atk, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
|
||||
if (nextInfo==null) break;
|
||||
if (pre>nextInfo.damage) {
|
||||
pre = nextInfo.damage;
|
||||
@ -195,27 +195,32 @@ enemys.prototype.nextCriticals = function (enemy, number) {
|
||||
}
|
||||
|
||||
////// N防减伤计算 //////
|
||||
enemys.prototype.getDefDamage = function (enemy, k) {
|
||||
enemys.prototype.getDefDamage = function (enemy, k, x, y, floorId) {
|
||||
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
|
||||
k = k || 1;
|
||||
var nowDamage = this.calDamage(enemy, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef);
|
||||
var nextDamage = this.calDamage(enemy, core.status.hero.hp, core.status.hero.atk, core.status.hero.def + k, core.status.hero.mdef);
|
||||
var nowDamage = this.calDamage(enemy, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef, x, y, floorId);
|
||||
var nextDamage = this.calDamage(enemy, core.status.hero.hp, core.status.hero.atk, core.status.hero.def + k, core.status.hero.mdef, x, y, floorId);
|
||||
if (nowDamage == null || nextDamage ==null) return "???";
|
||||
return nowDamage - nextDamage;
|
||||
}
|
||||
|
||||
enemys.prototype.getEnemyInfo = function (enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId) {
|
||||
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
|
||||
return this.enemydata.getEnemyInfo(enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId)
|
||||
}
|
||||
|
||||
////// 获得战斗伤害信息(实际伤害计算函数) //////
|
||||
enemys.prototype.getDamageInfo = function(enemy, hero_hp, hero_atk, hero_def, hero_mdef) {
|
||||
enemys.prototype.getDamageInfo = function(enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId) {
|
||||
// 移动到了脚本编辑 - getDamageInfo中
|
||||
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
|
||||
return this.enemydata.getDamageInfo(enemy, hero_hp, hero_atk, hero_def, hero_mdef);
|
||||
return this.enemydata.getDamageInfo(enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId);
|
||||
}
|
||||
|
||||
////// 获得在某个勇士属性下怪物伤害 //////
|
||||
enemys.prototype.calDamage = function (enemy, hero_hp, hero_atk, hero_def, hero_mdef) {
|
||||
enemys.prototype.calDamage = function (enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId) {
|
||||
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
|
||||
|
||||
var info = this.getDamageInfo(enemy, hero_hp, hero_atk, hero_def, hero_mdef);
|
||||
var info = this.getDamageInfo(enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId);
|
||||
if (info == null) return null;
|
||||
return info.damage;
|
||||
}
|
||||
@ -246,12 +251,7 @@ enemys.prototype.getCurrentEnemys = function (floorId) {
|
||||
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, 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 enemyInfo = this.getEnemyInfo(enemy, core.status.hero.hp, hero_atk, hero_def, hero_mdef, null, null, floorId);
|
||||
|
||||
var specialText = core.enemys.getSpecialText(enemyId);
|
||||
if (specialText.length>=3) specialText = "多属性...";
|
||||
@ -263,17 +263,17 @@ enemys.prototype.getCurrentEnemys = function (floorId) {
|
||||
enemys.push({
|
||||
'id': enemyId,
|
||||
'name': enemy.name,
|
||||
'hp': mon_hp,
|
||||
'atk': mon_atk,
|
||||
'def': mon_def,
|
||||
'money': enemy.money,
|
||||
'experience': enemy.experience,
|
||||
'point': enemy.point||0, // 加点
|
||||
'hp': enemyInfo.hp,
|
||||
'atk': enemyInfo.atk,
|
||||
'def': enemyInfo.def,
|
||||
'money': enemyInfo.money||0,
|
||||
'experience': enemyInfo.experience||0,
|
||||
'point': enemyInfo.point||0, // 加点
|
||||
'special': specialText,
|
||||
'damage': this.getDamage(enemyId),
|
||||
'damage': this.getDamage(enemyId,null,null,floorId),
|
||||
'critical': critical[0],
|
||||
'criticalDamage': critical[1],
|
||||
'defDamage': this.getDefDamage(enemyId)
|
||||
'defDamage': this.getDefDamage(enemyId,1,null,null,floorId)
|
||||
});
|
||||
|
||||
used[enemyId] = true;
|
||||
|
||||
@ -1120,7 +1120,7 @@ events.prototype.battle = function (id, x, y, force, callback) {
|
||||
core.stopAutomaticRoute();
|
||||
|
||||
// 非强制战斗
|
||||
if (!core.enemys.canBattle(id) && !force && !core.isset(core.status.event.id)) {
|
||||
if (!core.enemys.canBattle(id, x, y) && !force && !core.isset(core.status.event.id)) {
|
||||
core.drawTip("你打不过此怪物!");
|
||||
core.clearContinueAutomaticRoute();
|
||||
return;
|
||||
|
||||
31
libs/ui.js
31
libs/ui.js
@ -862,8 +862,11 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||
|
||||
var hero_hp = core.getStatus('hp'), hero_atk = core.getStatus('atk'), hero_def = core.getStatus('def'),
|
||||
hero_mdef = core.getStatus('mdef');
|
||||
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;
|
||||
|
||||
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);
|
||||
@ -871,30 +874,30 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||
hero_mdef = Math.floor(core.getFlag('equip_mdef_buff',1)*hero_mdef);
|
||||
}
|
||||
|
||||
var enemy = core.material.enemys[monsterId];
|
||||
var enemyInfo = core.enemys.getEnemyInfo(enemy, hero_hp, hero_atk, hero_def, hero_mdef);
|
||||
var mon_hp = enemyInfo.hp, mon_atk = enemyInfo.atk, mon_def = enemyInfo.def, mon_money=enemyInfo.money,
|
||||
mon_exp = enemyInfo.experience, mon_special=enemyInfo.special;
|
||||
|
||||
var initDamage = 0; // 战前伤害
|
||||
|
||||
// 吸血
|
||||
if (core.enemys.hasSpecial(mon_special, 11)) {
|
||||
var vampireDamage = hero_hp * monster.value;
|
||||
var vampireDamage = hero_hp * enemy.value;
|
||||
|
||||
// 如果有神圣盾免疫吸血等可以在这里写
|
||||
|
||||
vampireDamage = Math.floor(vampireDamage);
|
||||
vampireDamage = Math.floor(vampireDamage) || 0;
|
||||
// 加到自身
|
||||
if (monster.add) // 如果加到自身
|
||||
if (enemy.add) // 如果加到自身
|
||||
mon_hp += vampireDamage;
|
||||
|
||||
initDamage += vampireDamage;
|
||||
}
|
||||
|
||||
hero_hp -= core.enemys.getExtraDamage(monster);
|
||||
hero_hp -= core.enemys.getExtraDamage(enemy);
|
||||
|
||||
if (core.enemys.hasSpecial(mon_special, 10)) { // 模仿
|
||||
mon_atk=hero_atk;
|
||||
mon_def=hero_def;
|
||||
}
|
||||
if (core.enemys.hasSpecial(mon_special, 2)) hero_def=0; // 魔攻
|
||||
if (core.enemys.hasSpecial(mon_special, 3) && mon_def<hero_atk) mon_def=hero_atk-1; // 坚固
|
||||
|
||||
// 实际操作
|
||||
var turn = 0; // 0为勇士攻击
|
||||
@ -904,7 +907,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||
var turns = 2;
|
||||
if (core.enemys.hasSpecial(mon_special, 4)) turns=3;
|
||||
if (core.enemys.hasSpecial(mon_special, 5)) turns=4;
|
||||
if (core.enemys.hasSpecial(mon_special, 6)) turns=1+(monster.n||4);
|
||||
if (core.enemys.hasSpecial(mon_special, 6)) turns=1+(enemy.n||4);
|
||||
|
||||
// 初始伤害
|
||||
if (core.enemys.hasSpecial(mon_special, 7)) initDamage+=Math.floor(core.values.breakArmor * hero_def);
|
||||
@ -1158,7 +1161,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
||||
return;
|
||||
}
|
||||
|
||||
}, 500);
|
||||
}, 400);
|
||||
}
|
||||
|
||||
////// 绘制等待界面 //////
|
||||
@ -1192,7 +1195,7 @@ ui.prototype.drawSyncSave = function () {
|
||||
core.status.event.id = 'syncSave';
|
||||
|
||||
this.drawChoices(null, [
|
||||
"同步存档到服务器", "从服务器加载存档", "存档至本地文件", "从本地文件读档", "下载当前录像", "清空本地存档", "返回主菜单"
|
||||
"同步存档到服务器", "从服务器加载存档", "存档至本地文件", "从本地文件读档", "回放当前录像", "下载当前录像", "清空本地存档", "返回主菜单"
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.playSound('attack.mp3');
|
||||
core.drawAnimate(equipAnimate, x, y);
|
||||
|
||||
var damage = core.enemys.getDamage(enemyId);
|
||||
var damage = core.enemys.getDamage(enemyId, x, y);
|
||||
if (damage == null) damage = core.status.hero.hp+1;
|
||||
|
||||
// 扣减体力值
|
||||
@ -367,14 +367,86 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
[21, "退化", function (enemy) {return "战斗后勇士永久下降"+(enemy.atkValue||0)+"点攻击和"+(enemy.defValue||0)+"点防御";}],
|
||||
[22, "固伤", function (enemy) {return "战斗前,怪物对勇士造成"+(enemy.damage||0)+"点固定伤害,无视勇士魔防。";}],
|
||||
[23, "重生", "怪物被击败后,角色转换楼层则怪物将再次出现"],
|
||||
[24, "激光", function (enemy) {return "经过怪物同行或同列时自动减生命"+(enemy.value||0)+"点";}]
|
||||
[24, "激光", function (enemy) {return "经过怪物同行或同列时自动减生命"+(enemy.value||0)+"点";}],
|
||||
[25, "光环", function (enemy) {return "同楼层所有怪物生命提升"+(enemy.value||0)+"%,攻击提升"+(enemy.atkValue||0)+"%,防御提升"+(enemy.defValue||0)+"%,"+(enemy.add?"可叠加":"不可叠加");}]
|
||||
];
|
||||
},
|
||||
"getDamageInfo": function (enemy, hero_hp, hero_atk, hero_def, hero_mdef) {
|
||||
// 获得战斗伤害信息(实际伤害计算函数)
|
||||
|
||||
// 怪物生命,怪物攻击、防御、特殊属性
|
||||
"getEnemyInfo": function (enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId) {
|
||||
// 获得某个怪物变化后的数据;该函数将被伤害计算和怪物手册使用
|
||||
// 例如:坚固、模仿、仿攻等等
|
||||
//
|
||||
// 参数说明:
|
||||
// enemy:该怪物信息
|
||||
// hero_hp,hero_atk,hero_def,hero_mdef:勇士的生命攻防魔防数据
|
||||
// x,y:该怪物的坐标(查看手册和强制战斗时为undefined)
|
||||
// floorId:该怪物所在的楼层
|
||||
// 后面三个参数主要是可以在光环等效果上可以适用(也可以按需制作部分范围光环效果)
|
||||
floorId = floorId || core.status.floorId;
|
||||
var mon_hp = enemy.hp, mon_atk = enemy.atk, mon_def = enemy.def, mon_special = enemy.special;
|
||||
var mon_money = enemy.money, mon_experience = enemy.experience, mon_point = enemy.point;
|
||||
// 模仿
|
||||
if (this.hasSpecial(mon_special, 10)) {
|
||||
mon_atk = hero_atk;
|
||||
mon_def = hero_def;
|
||||
}
|
||||
// 坚固
|
||||
if (this.hasSpecial(mon_special, 3) && mon_def < hero_atk - 1) {
|
||||
mon_def = hero_atk - 1;
|
||||
}
|
||||
|
||||
// 光环效果
|
||||
// 检查当前楼层所有光环怪物(数字25)
|
||||
var hp_delta = 0, atk_delta = 0, def_delta = 0, cnt = 0;
|
||||
// 遍历每个图块
|
||||
core.status.maps[floorId].blocks.forEach(function (block) {
|
||||
if (core.isset(block.event) && !block.disable) {
|
||||
// 获得该图块的ID
|
||||
var id = block.event.id, enemy = core.material.enemys[id];
|
||||
// 检查是不是怪物,且是否拥有该特殊属性
|
||||
if (core.isset(enemy) && core.hasSpecial(enemy.special, 25)) {
|
||||
// 检查是否可叠加
|
||||
if (enemy.add || cnt == 0) {
|
||||
hp_delta += enemy.value || 0;
|
||||
atk_delta += enemy.atkValue || 0;
|
||||
def_delta += enemy.defValue || 0;
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// 增加比例;如果要增加数值可以直接在这里修改
|
||||
mon_hp *= (1+hp_delta/100);
|
||||
mon_atk *= (1+atk_delta/100);
|
||||
mon_def *= (1+def_delta/100);
|
||||
|
||||
// TODO:可以在这里新增其他的怪物数据变化
|
||||
// 比如仿攻(怪物攻击不低于勇士攻击):
|
||||
// if (this.hasSpecial(mon_special, 27) && mon_atk < hero_atk) {
|
||||
// mon_atk = hero_atk;
|
||||
// }
|
||||
// 也可以按需增加各种自定义内容(比如幻塔的魔杖效果等)
|
||||
|
||||
return {
|
||||
"hp": Math.floor(mon_hp),
|
||||
"atk": Math.floor(mon_atk),
|
||||
"def": Math.floor(mon_def),
|
||||
"money": Math.floor(mon_money),
|
||||
"experience": Math.floor(mon_experience),
|
||||
"point": Math.floor(mon_point),
|
||||
"special": mon_special
|
||||
};
|
||||
},
|
||||
"getDamageInfo": function (enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId) {
|
||||
// 获得战斗伤害信息(实际伤害计算函数)
|
||||
//
|
||||
// 参数说明:
|
||||
// enemy:该怪物信息
|
||||
// hero_hp,hero_atk,hero_def,hero_mdef:勇士的生命攻防魔防数据
|
||||
// x,y:该怪物的坐标(查看手册和强制战斗时为undefined)
|
||||
// floorId:该怪物所在的楼层
|
||||
// 后面三个参数主要是可以在光环等效果上可以适用
|
||||
floorId = floorId || core.status.floorId;
|
||||
|
||||
// 勇士的负属性都按0计算
|
||||
hero_hp=Math.max(0, hero_hp);
|
||||
hero_atk=Math.max(0, hero_atk);
|
||||
@ -387,11 +459,16 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
hero_def = Math.floor(core.getFlag('equip_def_buff',1)*hero_def);
|
||||
hero_mdef = Math.floor(core.getFlag('equip_mdef_buff',1)*hero_mdef);
|
||||
}
|
||||
|
||||
// 怪物的各项数据
|
||||
// 对坚固模仿等处理扔到了脚本编辑-getEnemyInfo之中
|
||||
var enemyInfo = core.enemys.getEnemyInfo(enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId);
|
||||
var mon_hp = enemyInfo.hp, mon_atk = enemyInfo.atk, mon_def = enemyInfo.def, mon_special = enemyInfo.special;
|
||||
|
||||
// 如果是无敌属性,且勇士未持有十字架
|
||||
if (this.hasSpecial(mon_special, 20) && !core.hasItem("cross"))
|
||||
return null; // 不可战斗
|
||||
|
||||
|
||||
// 战前造成的额外伤害(可被魔防抵消)
|
||||
var init_damage = 0;
|
||||
|
||||
@ -410,15 +487,6 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
init_damage += vampire_damage;
|
||||
}
|
||||
|
||||
// 模仿
|
||||
if (this.hasSpecial(mon_special, 10)) {
|
||||
mon_atk = hero_atk;
|
||||
mon_def = hero_def;
|
||||
}
|
||||
// 坚固
|
||||
if (this.hasSpecial(mon_special, 3) && mon_def < hero_atk - 1)
|
||||
mon_def = hero_atk - 1;
|
||||
|
||||
// 检查是否破防;否则直接返回不可战斗
|
||||
if (hero_atk <= mon_def) return null;
|
||||
|
||||
@ -657,7 +725,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 检测左右是否存在相同的怪物,且拥有夹击属性
|
||||
if (x>0 && x<core.bigmap.width-1) {
|
||||
var id1=core.status.checkBlock.map[x-1+core.bigmap.width*y],
|
||||
id2=core.status.checkBlock.map[x+1+core.bigmap.height*y];
|
||||
id2=core.status.checkBlock.map[x+1+core.bigmap.width*y];
|
||||
if (core.isset(id1) && core.isset(id2) && id1==id2) {
|
||||
var enemy = core.material.enemys[id1];
|
||||
if (core.isset(enemy) && core.enemys.hasSpecial(enemy.special, 16)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user