N连击
This commit is contained in:
parent
c0d67d431c
commit
9ecccf35de
@ -5,10 +5,10 @@ function enemys() {
|
|||||||
enemys.prototype.init = function () {
|
enemys.prototype.init = function () {
|
||||||
// 怪物属性初始化定义:
|
// 怪物属性初始化定义:
|
||||||
this.enemys = {
|
this.enemys = {
|
||||||
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'special': 0, 'point': 2},
|
'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'special': [1,5,7,8]},
|
||||||
'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'special': 9},
|
'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'special': [1,9]},
|
||||||
'bat': {'name': '小蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 2, 'experience': 0, 'special': 1},
|
'bat': {'name': '小蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 2, 'experience': 0, 'special': 1},
|
||||||
'bigBat': {'name': '大蝙蝠', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'bigBat': {'name': '大蝙蝠', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
'redBat': {'name': '红蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 5, 'experience': 0, 'special': 4},
|
'redBat': {'name': '红蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 5, 'experience': 0, 'special': 4},
|
||||||
@ -58,7 +58,7 @@ enemys.prototype.init = function () {
|
|||||||
'badPrincess': {'name': '痛苦魔女', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'badPrincess': {'name': '痛苦魔女', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
'badFairy': {'name': '黑暗仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'badFairy': {'name': '黑暗仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
'grayPriest': {'name': '中级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'grayPriest': {'name': '中级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
'redSwordsman': {'name': '剑王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 7, 'experience': 0, 'special': 6},
|
'redSwordsman': {'name': '剑王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 7, 'experience': 0, 'special': 6, 'n': 8}, // 多连击需要在后面指定n代表是几连击
|
||||||
'whiteGhost': {'name': '水银战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'whiteGhost': {'name': '水银战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
'poisonZombie': {'name': '绿兽人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 13, 'experience': 0, 'special': 12},
|
'poisonZombie': {'name': '绿兽人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 13, 'experience': 0, 'special': 12},
|
||||||
'magicDragon': {'name': '魔龙', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
'magicDragon': {'name': '魔龙', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0},
|
||||||
@ -104,7 +104,7 @@ enemys.prototype.getSpecialText = function (enemyId) {
|
|||||||
if (this.hasSpecial(special, 18)) text.push("阻击");
|
if (this.hasSpecial(special, 18)) text.push("阻击");
|
||||||
if (this.hasSpecial(special, 19)) text.push("自爆");
|
if (this.hasSpecial(special, 19)) text.push("自爆");
|
||||||
if (this.hasSpecial(special, 20)) text.push("无敌");
|
if (this.hasSpecial(special, 20)) text.push("无敌");
|
||||||
return text.join(" ");
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
////// 获得每个属性的文字提示 //////
|
////// 获得每个属性的文字提示 //////
|
||||||
@ -262,6 +262,10 @@ enemys.prototype.getCurrentEnemys = function () {
|
|||||||
mon_def=core.status.hero.def;
|
mon_def=core.status.hero.def;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var specialText = core.enemys.getSpecialText(monsterId);
|
||||||
|
if (specialText.length>=3) specialText = "多属性...";
|
||||||
|
else specialText = specialText.join(" ");
|
||||||
|
|
||||||
enemys.push({
|
enemys.push({
|
||||||
'id': monsterId,
|
'id': monsterId,
|
||||||
'name': monster.name,
|
'name': monster.name,
|
||||||
@ -270,7 +274,7 @@ enemys.prototype.getCurrentEnemys = function () {
|
|||||||
'def': mon_def,
|
'def': mon_def,
|
||||||
'money': monster.money,
|
'money': monster.money,
|
||||||
'experience': monster.experience,
|
'experience': monster.experience,
|
||||||
'special': core.enemys.getSpecialText(monsterId),
|
'special': specialText,
|
||||||
'damage': this.getDamage(monsterId),
|
'damage': this.getDamage(monsterId),
|
||||||
'critical': this.getCritical(monsterId),
|
'critical': this.getCritical(monsterId),
|
||||||
'criticalDamage': this.getCriticalDamage(monsterId),
|
'criticalDamage': this.getCriticalDamage(monsterId),
|
||||||
|
|||||||
@ -805,11 +805,11 @@ events.prototype.keyUpAction = function (keycode) {
|
|||||||
events.prototype.clickBook = function(x,y) {
|
events.prototype.clickBook = function(x,y) {
|
||||||
// 上一页
|
// 上一页
|
||||||
if ((x == 3 || x == 4) && y == 12) {
|
if ((x == 3 || x == 4) && y == 12) {
|
||||||
core.ui.drawEnemyBook(core.status.event.data - 1);
|
core.ui.drawEnemyBook(core.status.event.data - 6);
|
||||||
}
|
}
|
||||||
// 下一页
|
// 下一页
|
||||||
if ((x == 8 || x == 9) && y == 12) {
|
if ((x == 8 || x == 9) && y == 12) {
|
||||||
core.ui.drawEnemyBook(core.status.event.data + 1);
|
core.ui.drawEnemyBook(core.status.event.data + 6);
|
||||||
}
|
}
|
||||||
// 返回
|
// 返回
|
||||||
if (x>=10 && x<=12 && y==12) {
|
if (x>=10 && x<=12 && y==12) {
|
||||||
|
|||||||
@ -147,7 +147,7 @@ items.prototype.useItem = function (itemId) {
|
|||||||
if (!this.canUseItem(itemId)) return;
|
if (!this.canUseItem(itemId)) return;
|
||||||
var itemCls = core.material.items[itemId].cls;
|
var itemCls = core.material.items[itemId].cls;
|
||||||
|
|
||||||
if (itemId=='book') core.ui.drawEnemyBook(1);
|
if (itemId=='book') core.ui.drawEnemyBook(0);
|
||||||
if (itemId=='fly') core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));
|
if (itemId=='fly') core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));
|
||||||
if (itemId == 'earthquake' || itemId == 'bomb' || itemId == 'pickaxe' || itemId=='icePickaxe'
|
if (itemId == 'earthquake' || itemId == 'bomb' || itemId == 'pickaxe' || itemId=='icePickaxe'
|
||||||
|| itemId == 'snow' || itemId == 'hammer' || itemId=='bigKey') {
|
|| itemId == 'snow' || itemId == 'hammer' || itemId=='bigKey') {
|
||||||
|
|||||||
14
libs/ui.js
14
libs/ui.js
@ -423,7 +423,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
hero_mdef=0;
|
hero_mdef=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var specialText = core.enemys.getSpecialText(monsterId);
|
var specialTexts = core.enemys.getSpecialText(monsterId);
|
||||||
|
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
|
|
||||||
@ -466,7 +466,6 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
|
|||||||
core.canvas.ui.textAlign='center';
|
core.canvas.ui.textAlign='center';
|
||||||
core.fillText('ui', core.status.hero.name, left+margin+boxWidth/2, top+margin+heroHeight+40, '#FFD700', 'bold 22px Verdana');
|
core.fillText('ui', core.status.hero.name, left+margin+boxWidth/2, top+margin+heroHeight+40, '#FFD700', 'bold 22px Verdana');
|
||||||
core.fillText('ui', "怪物", left+right-margin-boxWidth/2, top+margin+32+40);
|
core.fillText('ui', "怪物", left+right-margin-boxWidth/2, top+margin+32+40);
|
||||||
var specialTexts = specialText.split(" ");
|
|
||||||
for (var i=0, j=0; i<specialTexts.length;i++) {
|
for (var i=0, j=0; i<specialTexts.length;i++) {
|
||||||
if (specialTexts[i]!='') {
|
if (specialTexts[i]!='') {
|
||||||
core.fillText('ui', specialTexts[i], left+right-margin-boxWidth/2, top+margin+32+44+20*(++j), '#FF6A6A', '15px Verdana');
|
core.fillText('ui', specialTexts[i], left+right-margin-boxWidth/2, top+margin+32+44+20*(++j), '#FF6A6A', '15px Verdana');
|
||||||
@ -727,9 +726,9 @@ ui.prototype.drawPagination = function (page, totalPage) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 绘制怪物手册
|
* 绘制怪物手册
|
||||||
* @param page 页数
|
* @param index 怪物索引
|
||||||
*/
|
*/
|
||||||
ui.prototype.drawEnemyBook = function (page) {
|
ui.prototype.drawEnemyBook = function (index) {
|
||||||
|
|
||||||
var enemys = core.enemys.getCurrentEnemys();
|
var enemys = core.enemys.getCurrentEnemys();
|
||||||
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
var background = core.canvas.ui.createPattern(core.material.ground, "repeat");
|
||||||
@ -759,11 +758,12 @@ ui.prototype.drawEnemyBook = function (page) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index<0) index=0;
|
||||||
|
if (index>=enemys.length) index=enemys.length-1;
|
||||||
var perpage = 6;
|
var perpage = 6;
|
||||||
|
var page=parseInt(index/perpage)+1;
|
||||||
var totalPage = parseInt((enemys.length - 1) / perpage) + 1;
|
var totalPage = parseInt((enemys.length - 1) / perpage) + 1;
|
||||||
if (page < 1) page = 1;
|
core.status.event.data = index;
|
||||||
if (page > totalPage) page = totalPage;
|
|
||||||
core.status.event.data = page;
|
|
||||||
var start = (page - 1) * perpage, end = Math.min(page * perpage, enemys.length);
|
var start = (page - 1) * perpage, end = Math.min(page * perpage, enemys.length);
|
||||||
|
|
||||||
enemys = enemys.slice(start, end);
|
enemys = enemys.slice(start, end);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user