Compare commits
	
		
			No commits in common. "362314055806e1aa9fac1f003edd005c6574c3f5" and "2b8e9d25b0e80a4714557e360b4fb9b90d859392" have entirely different histories.
		
	
	
		
			3623140558
			...
			2b8e9d25b0
		
	
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -32,23 +32,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { | |||||||
| 					"_docs": "道具类别", | 					"_docs": "道具类别", | ||||||
| 					"_data": "items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)" | 					"_data": "items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)" | ||||||
| 				}, | 				}, | ||||||
| 				"equipCls": { |  | ||||||
| 					"_leaf": true, |  | ||||||
| 					"_type": "select", |  | ||||||
| 					"_select": { |  | ||||||
| 						"values": [ |  | ||||||
| 							"单手剑", |  | ||||||
| 							"法杖", |  | ||||||
| 							"双手剑", |  | ||||||
| 							"匕首", |  | ||||||
| 							"盾牌", |  | ||||||
| 							"护具", |  | ||||||
| 							"饰品" |  | ||||||
| 						] |  | ||||||
| 					}, |  | ||||||
| 					"_docs": "装备类别", |  | ||||||
| 					"_data": "单手剑作为副手时主手必须为单手剑,匕首作为副手时主手武器必须为单手剑、法杖、匕首之一,盾牌仅可作为副手使用且主手必须为单手剑、法杖之一" |  | ||||||
| 				}, |  | ||||||
| 				"name": { | 				"name": { | ||||||
| 					"_leaf": true, | 					"_leaf": true, | ||||||
| 					"_type": "textarea", | 					"_type": "textarea", | ||||||
| @ -187,23 +170,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { | |||||||
| 				"def": { | 				"def": { | ||||||
| 					"_leaf": true, | 					"_leaf": true, | ||||||
| 					"_type": "textarea", | 					"_type": "textarea", | ||||||
| 					"_data": "物理防御力" | 					"_data": "防御力" | ||||||
| 				}, |  | ||||||
| 				"mdef": { |  | ||||||
| 					"_leaf": true, |  | ||||||
| 					"_type": "textarea", |  | ||||||
| 					"_data": "魔法防御力" |  | ||||||
| 				}, |  | ||||||
| 				"speed": { |  | ||||||
| 					"_leaf": true, |  | ||||||
| 					"_type": "textarea", |  | ||||||
| 					"_data": "速度" |  | ||||||
| 				}, |  | ||||||
| 				"magic": { |  | ||||||
| 					"_leaf": true, |  | ||||||
| 					"_type": "checkbox", |  | ||||||
| 					"_docs": "是否为魔法攻击", |  | ||||||
| 					"_data": "勾选以魔法攻击计算,不勾选以物理攻击计算" |  | ||||||
| 				}, | 				}, | ||||||
| 				"money": { | 				"money": { | ||||||
| 					"_leaf": true, | 					"_leaf": true, | ||||||
|  | |||||||
| @ -257,48 +257,17 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { | |||||||
| 						"atk": { | 						"atk": { | ||||||
| 							"_leaf": true, | 							"_leaf": true, | ||||||
| 							"_type": "textarea", | 							"_type": "textarea", | ||||||
| 							"_data": "攻击" | 							"_data": "初始攻击" | ||||||
| 						}, | 						}, | ||||||
| 						"def": { | 						"def": { | ||||||
| 							"_leaf": true, | 							"_leaf": true, | ||||||
| 							"_type": "textarea", | 							"_type": "textarea", | ||||||
| 							"_data": "物理防御" | 							"_data": "初始防御" | ||||||
| 						}, | 						}, | ||||||
| 						"mdef": { | 						"mdef": { | ||||||
| 							"_leaf": true, | 							"_leaf": true, | ||||||
| 							"_type": "textarea", | 							"_type": "textarea", | ||||||
| 							"_data": "魔法防御" | 							"_data": "初始护盾" | ||||||
| 						}, |  | ||||||
| 						"speed": { |  | ||||||
| 							"_leaf": true, |  | ||||||
| 							"_type": "textarea", |  | ||||||
| 							"_data": "攻击速度" |  | ||||||
| 						}, |  | ||||||
| 						"str": { |  | ||||||
| 							"_leaf": true, |  | ||||||
| 							"_type": "textarea", |  | ||||||
| 							"_data": "力量" |  | ||||||
| 						}, |  | ||||||
| 						"agi": { |  | ||||||
| 							"_leaf": true, |  | ||||||
| 							"_type": "textarea", |  | ||||||
| 							"_data": "敏捷" |  | ||||||
| 						}, |  | ||||||
| 						"int": { |  | ||||||
| 							"_leaf": true, |  | ||||||
| 							"_type": "textarea", |  | ||||||
| 							"_data": "智力" |  | ||||||
| 						}, |  | ||||||
| 						"con": { |  | ||||||
| 							"_leaf": true, |  | ||||||
| 							"_type": "textarea", |  | ||||||
| 							"_data": "体质" |  | ||||||
| 						}, |  | ||||||
| 						"magic": { |  | ||||||
| 							"_leaf": true, |  | ||||||
| 							"_type": "checkbox", |  | ||||||
| 							"_docs": "攻击类型", |  | ||||||
| 							"_data": "攻击类型是否是魔法" |  | ||||||
| 						}, | 						}, | ||||||
| 						"money": { | 						"money": { | ||||||
| 							"_leaf": true, | 							"_leaf": true, | ||||||
|  | |||||||
| @ -239,9 +239,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = | |||||||
| 		"levelChoose": null, | 		"levelChoose": null, | ||||||
| 		"equipName": [ | 		"equipName": [ | ||||||
| 			"武器", | 			"武器", | ||||||
| 			"武器", | 			"盾牌" | ||||||
| 			"防具", |  | ||||||
| 			"饰品" |  | ||||||
| 		], | 		], | ||||||
| 		"startBgm": "theme.mp3", | 		"startBgm": "theme.mp3", | ||||||
| 		"styles": { | 		"styles": { | ||||||
| @ -317,14 +315,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = | |||||||
| 				"useBetweenLight": true | 				"useBetweenLight": true | ||||||
| 			}, | 			}, | ||||||
| 			"followers": [], | 			"followers": [], | ||||||
| 			"steps": 0, | 			"steps": 0 | ||||||
| 			"matk": 0, |  | ||||||
| 			"speed": 0, |  | ||||||
| 			"str": 10, |  | ||||||
| 			"agi": 10, |  | ||||||
| 			"int": 10, |  | ||||||
| 			"con": 10, |  | ||||||
| 			"magic": false |  | ||||||
| 		}, | 		}, | ||||||
| 		"startCanvas": [ | 		"startCanvas": [ | ||||||
| 			{ | 			{ | ||||||
|  | |||||||
| @ -10,7 +10,7 @@ var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = | |||||||
| 	"vampire": {"name":"冥灵魔王","hp":888,"atk":888,"def":888,"money":888,"exp":888,"point":0,"special":[6],"n":8}, | 	"vampire": {"name":"冥灵魔王","hp":888,"atk":888,"def":888,"money":888,"exp":888,"point":0,"special":[6],"n":8}, | ||||||
| 	"skeleton": {"name":"骷髅人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, | 	"skeleton": {"name":"骷髅人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, | ||||||
| 	"skeletonCaptain": {"name":"骷髅队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, | 	"skeletonCaptain": {"name":"骷髅队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, | ||||||
| 	"zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0,"magic":false}, | 	"zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, | ||||||
| 	"zombieKnight": {"name":"兽人武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, | 	"zombieKnight": {"name":"兽人武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, | ||||||
| 	"rock": {"name":"石头人","hp":50,"atk":50,"def":0,"money":3,"exp":0,"point":0,"special":3}, | 	"rock": {"name":"石头人","hp":50,"atk":50,"def":0,"money":3,"exp":0,"point":0,"special":3}, | ||||||
| 	"bluePriest": {"name":"初级法师","hp":100,"atk":120,"def":0,"money":3,"exp":0,"point":1,"special":[9]}, | 	"bluePriest": {"name":"初级法师","hp":100,"atk":120,"def":0,"money":3,"exp":0,"point":1,"special":[9]}, | ||||||
|  | |||||||
| @ -485,316 +485,322 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
|     }, |     }, | ||||||
|     "enemys": { |     "enemys": { | ||||||
|         "getSpecials": function () { |         "getSpecials": function () { | ||||||
| 	// 获得怪物的特殊属性,每一行定义一个特殊属性。
 | 			// 获得怪物的特殊属性,每一行定义一个特殊属性。
 | ||||||
| 	// 分为五项,第一项为该特殊属性的数字,第二项为特殊属性的名字,第三项为特殊属性的描述
 | 			// 分为五项,第一项为该特殊属性的数字,第二项为特殊属性的名字,第三项为特殊属性的描述
 | ||||||
| 	// 第四项为该特殊属性的颜色,可以写十六进制 #RRGGBB 或者 [r,g,b,a] 四元数组
 | 			// 第四项为该特殊属性的颜色,可以写十六进制 #RRGGBB 或者 [r,g,b,a] 四元数组
 | ||||||
| 	// 第五项为该特殊属性的标记;目前 1 代表是地图类技能(需要进行遍历全图)
 | 			// 第五项为该特殊属性的标记;目前 1 代表是地图类技能(需要进行遍历全图)
 | ||||||
| 	// 名字和描述可以直接写字符串,也可以写个function将怪物传进去
 | 			// 名字和描述可以直接写字符串,也可以写个function将怪物传进去
 | ||||||
| 	return [ | 			return [ | ||||||
| 		[1, "先攻", "怪物首先攻击", "#ffcc33"], | 				[1, "先攻", "怪物首先攻击", "#ffcc33"], | ||||||
| 		[3, "坚固", "怪物防御不小于角色攻击-1", "#c0b088"], | 				[2, "魔攻", "怪物无视角色的防御", "#bbb0ff"], | ||||||
| 		[6, function (enemy) { return (enemy.n || '') + "连击"; }, function (enemy) { return "怪物每回合攻击" + (enemy.n || 4) + "次"; }, "#ffee77"], | 				[3, "坚固", "怪物防御不小于角色攻击-1", "#c0b088"], | ||||||
| 		[7, "破甲", function (enemy) { return "战斗前,怪物附加角色防御的" + Math.floor(100 * (enemy.breakArmor || core.values.breakArmor || 0)) + "%作为伤害"; }, "#88c0ff"], | 				[4, "2连击", "怪物每回合攻击2次", "#ffee77"], | ||||||
| 		[8, "反击", function (enemy) { return "战斗时,怪物每回合附加角色攻击的" + Math.floor(100 * (enemy.counterAttack || core.values.counterAttack || 0)) + "%作为伤害,无视角色防御"; }, "#ffaa44"], | 				[5, "3连击", "怪物每回合攻击3次", "#ffee77"], | ||||||
| 		[9, "净化", function (enemy) { return "战斗前,怪物附加角色护盾的" + (enemy.purify || core.values.purify) + "倍作为伤害"; }, "#80eed6"], | 				[6, function (enemy) { return (enemy.n || '') + "连击"; }, function (enemy) { return "怪物每回合攻击" + (enemy.n || 4) + "次"; }, "#ffee77"], | ||||||
| 		[10, "模仿", "怪物的攻防和角色攻防相等", "#b0c0dd"], | 				[7, "破甲", function (enemy) { return "战斗前,怪物附加角色防御的" + Math.floor(100 * (enemy.breakArmor || core.values.breakArmor || 0)) + "%作为伤害"; }, "#88c0ff"], | ||||||
| 		[11, "吸血", function (enemy) { return "战斗前,怪物首先吸取角色的" + Math.floor(100 * enemy.vampire || 0) + "%生命(约" + Math.floor((enemy.vampire || 0) * core.getStatus('hp')) + "点)作为伤害" + (enemy.add ? ",并把伤害数值加到自身生命上" : ""); }, "#dd4448"], | 				[8, "反击", function (enemy) { return "战斗时,怪物每回合附加角色攻击的" + Math.floor(100 * (enemy.counterAttack || core.values.counterAttack || 0)) + "%作为伤害,无视角色防御"; }, "#ffaa44"], | ||||||
| 		[12, "中毒", "战斗后,角色陷入中毒状态,每一步损失生命" + core.values.poisonDamage + "点", "#99ee88"], | 				[9, "净化", function (enemy) { return "战斗前,怪物附加角色护盾的" + (enemy.purify || core.values.purify) + "倍作为伤害"; }, "#80eed6"], | ||||||
| 		[13, "衰弱", "战斗后,角色陷入衰弱状态,攻防暂时下降" + (core.values.weakValue >= 1 ? core.values.weakValue + "点" : parseInt(core.values.weakValue * 100) + "%"), "#f0bbcc"], | 				[10, "模仿", "怪物的攻防和角色攻防相等", "#b0c0dd"], | ||||||
| 		[14, "诅咒", "战斗后,角色陷入诅咒状态,战斗无法获得金币和经验", "#bbeef0"], | 				[11, "吸血", function (enemy) { return "战斗前,怪物首先吸取角色的" + Math.floor(100 * enemy.vampire || 0) + "%生命(约" + Math.floor((enemy.vampire || 0) * core.getStatus('hp')) + "点)作为伤害" + (enemy.add ? ",并把伤害数值加到自身生命上" : ""); }, "#dd4448"], | ||||||
| 		[15, "领域", function (enemy) { return "经过怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "范围内" + (enemy.range || 1) + "格时自动减生命" + (enemy.zone || 0) + "点"; }, "#c677dd"], | 				[12, "中毒", "战斗后,角色陷入中毒状态,每一步损失生命" + core.values.poisonDamage + "点", "#99ee88"], | ||||||
| 		[16, "夹击", "经过两只相同的怪物中间,角色生命值变成一半", "#bb99ee"], | 				[13, "衰弱", "战斗后,角色陷入衰弱状态,攻防暂时下降" + (core.values.weakValue >= 1 ? core.values.weakValue + "点" : parseInt(core.values.weakValue * 100) + "%"), "#f0bbcc"], | ||||||
| 		[17, "仇恨", "战斗前,怪物附加之前积累的仇恨值作为伤害;战斗后,释放一半的仇恨值。(每杀死一个怪物获得" + (core.values.hatred || 0) + "点仇恨值)", "#b0b666"], | 				[14, "诅咒", "战斗后,角色陷入诅咒状态,战斗无法获得金币和经验", "#bbeef0"], | ||||||
| 		[18, "阻击", function (enemy) { return "经过怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时自动减生命" + (enemy.repulse || 0) + "点,同时怪物后退一格"; }, "#8888e6"], | 				[15, "领域", function (enemy) { return "经过怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "范围内" + (enemy.range || 1) + "格时自动减生命" + (enemy.zone || 0) + "点"; }, "#c677dd"], | ||||||
| 		[19, "自爆", "战斗后角色的生命值变成1", "#ff6666"], | 				[16, "夹击", "经过两只相同的怪物中间,角色生命值变成一半", "#bb99ee"], | ||||||
| 		[20, "无敌", "角色无法打败怪物,除非拥有十字架", "#aaaaaa"], | 				[17, "仇恨", "战斗前,怪物附加之前积累的仇恨值作为伤害;战斗后,释放一半的仇恨值。(每杀死一个怪物获得" + (core.values.hatred || 0) + "点仇恨值)", "#b0b666"], | ||||||
| 		[21, "退化", function (enemy) { return "战斗后角色永久下降" + (enemy.atkValue || 0) + "点攻击和" + (enemy.defValue || 0) + "点防御"; }], | 				[18, "阻击", function (enemy) { return "经过怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时自动减生命" + (enemy.repulse || 0) + "点,同时怪物后退一格"; }, "#8888e6"], | ||||||
| 		[22, "固伤", function (enemy) { return "战斗前,怪物对角色造成" + (enemy.damage || 0) + "点固定伤害,未开启负伤时无视角色护盾。"; }, "#ff9977"], | 				[19, "自爆", "战斗后角色的生命值变成1", "#ff6666"], | ||||||
| 		[23, "重生", "怪物被击败后,角色转换楼层则怪物将再次出现", "#a0e0ff"], | 				[20, "无敌", "角色无法打败怪物,除非拥有十字架", "#aaaaaa"], | ||||||
| 		[24, "激光", function (enemy) { return "经过怪物同行或同列时自动减生命" + (enemy.laser || 0) + "点"; }, "#dda0dd"], | 				[21, "退化", function (enemy) { return "战斗后角色永久下降" + (enemy.atkValue || 0) + "点攻击和" + (enemy.defValue || 0) + "点防御"; }], | ||||||
| 		[25, "光环", function (enemy) { return (enemy.range != null ? ((enemy.haloSquare ? "该怪物九宫格" : "该怪物十字") + enemy.haloRange + "格范围内") : "同楼层所有") + "怪物生命提升" + (enemy.hpBuff || 0) + "%,攻击提升" + (enemy.atkBuff || 0) + "%,防御提升" + (enemy.defBuff || 0) + "%," + (enemy.haloAdd ? "可叠加" : "不可叠加"); }, "#e6e099", 1], | 				[22, "固伤", function (enemy) { return "战斗前,怪物对角色造成" + (enemy.damage || 0) + "点固定伤害,未开启负伤时无视角色护盾。"; }, "#ff9977"], | ||||||
| 		[26, "支援", "当周围一圈的怪物受到攻击时将上前支援,并组成小队战斗。", "#77c0b6", 1], | 				[23, "重生", "怪物被击败后,角色转换楼层则怪物将再次出现", "#a0e0ff"], | ||||||
| 		[27, "捕捉", function (enemy) { return "当走到怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时会强制进行战斗。"; }, "#c0ddbb"] | 				[24, "激光", function (enemy) { return "经过怪物同行或同列时自动减生命" + (enemy.laser || 0) + "点"; }, "#dda0dd"], | ||||||
| 	]; | 				[25, "光环", function (enemy) { return (enemy.range != null ? ((enemy.haloSquare ? "该怪物九宫格" : "该怪物十字") + enemy.haloRange + "格范围内") : "同楼层所有") + "怪物生命提升" + (enemy.hpBuff || 0) + "%,攻击提升" + (enemy.atkBuff || 0) + "%,防御提升" + (enemy.defBuff || 0) + "%," + (enemy.haloAdd ? "可叠加" : "不可叠加"); }, "#e6e099", 1], | ||||||
| }, | 				[26, "支援", "当周围一圈的怪物受到攻击时将上前支援,并组成小队战斗。", "#77c0b6", 1], | ||||||
|  | 				[27, "捕捉", function (enemy) { return "当走到怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时会强制进行战斗。"; }, "#c0ddbb"] | ||||||
|  | 			]; | ||||||
|  | 		}, | ||||||
|         "getEnemyInfo": function (enemy, hero, x, y, floorId) { |         "getEnemyInfo": function (enemy, hero, x, y, floorId) { | ||||||
| 	// 获得某个怪物变化后的数据;该函数将被伤害计算和怪物手册使用
 | 			// 获得某个怪物变化后的数据;该函数将被伤害计算和怪物手册使用
 | ||||||
| 	// 例如:坚固、模仿、仿攻等等
 | 			// 例如:坚固、模仿、仿攻等等
 | ||||||
| 	// 
 | 			// 
 | ||||||
| 	// 参数说明:
 | 			// 参数说明:
 | ||||||
| 	// enemy:该怪物信息
 | 			// enemy:该怪物信息
 | ||||||
| 	// hero_hp,hero_atk,hero_def,hero_mdef:勇士的生命攻防护盾数据
 | 			// hero_hp,hero_atk,hero_def,hero_mdef:勇士的生命攻防护盾数据
 | ||||||
| 	// x,y:该怪物的坐标(查看手册和强制战斗时为undefined)
 | 			// x,y:该怪物的坐标(查看手册和强制战斗时为undefined)
 | ||||||
| 	// floorId:该怪物所在的楼层
 | 			// floorId:该怪物所在的楼层
 | ||||||
| 	// 后面三个参数主要是可以在光环等效果上可以适用(也可以按需制作部分范围光环效果)
 | 			// 后面三个参数主要是可以在光环等效果上可以适用(也可以按需制作部分范围光环效果)
 | ||||||
| 	floorId = floorId || core.status.floorId; | 			floorId = floorId || core.status.floorId; | ||||||
| 	var hero_hp = core.getRealStatusOrDefault(hero, 'hp'), | 			var hero_hp = core.getRealStatusOrDefault(hero, 'hp'), | ||||||
| 		hero_atk = core.getRealStatusOrDefault(hero, 'atk'), | 				hero_atk = core.getRealStatusOrDefault(hero, 'atk'), | ||||||
| 		hero_def = core.getRealStatusOrDefault(hero, 'def'), | 				hero_def = core.getRealStatusOrDefault(hero, 'def'), | ||||||
| 		hero_mdef = core.getRealStatusOrDefault(hero, 'mdef'); | 				hero_mdef = core.getRealStatusOrDefault(hero, 'mdef'); | ||||||
| 
 | 
 | ||||||
| 	var mon_hp = core.getEnemyValue(enemy, 'hp', x, y, floorId), | 			var mon_hp = core.getEnemyValue(enemy, 'hp', x, y, floorId), | ||||||
| 		mon_atk = core.getEnemyValue(enemy, 'atk', x, y, floorId), | 				mon_atk = core.getEnemyValue(enemy, 'atk', x, y, floorId), | ||||||
| 		mon_def = core.getEnemyValue(enemy, 'def', x, y, floorId), | 				mon_def = core.getEnemyValue(enemy, 'def', x, y, floorId), | ||||||
| 		mon_special = core.getEnemyValue(enemy, 'special', x, y, floorId); | 				mon_special = core.getEnemyValue(enemy, 'special', x, y, floorId); | ||||||
| 	var mon_money = core.getEnemyValue(enemy, 'money', x, y, floorId), | 			var mon_money = core.getEnemyValue(enemy, 'money', x, y, floorId), | ||||||
| 		mon_exp = core.getEnemyValue(enemy, 'exp', x, y, floorId), | 				mon_exp = core.getEnemyValue(enemy, 'exp', x, y, floorId), | ||||||
| 		mon_point = core.getEnemyValue(enemy, 'point', x, y, floorId); | 				mon_point = core.getEnemyValue(enemy, 'point', x, y, floorId); | ||||||
| 	// 模仿
 | 			// 模仿
 | ||||||
| 	if (core.hasSpecial(mon_special, 10)) { | 			if (core.hasSpecial(mon_special, 10)) { | ||||||
| 		mon_atk = hero_atk; | 				mon_atk = hero_atk; | ||||||
| 		mon_def = hero_def; | 				mon_def = hero_def; | ||||||
| 	} |  | ||||||
| 	// 坚固
 |  | ||||||
| 	if (core.hasSpecial(mon_special, 3) && mon_def < hero_atk - 1) { |  | ||||||
| 		mon_def = hero_atk - 1; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	var guards = []; |  | ||||||
| 
 |  | ||||||
| 	// 光环和支援检查
 |  | ||||||
| 	if (!core.status.checkBlock) core.status.checkBlock = {}; |  | ||||||
| 
 |  | ||||||
| 	if (core.status.checkBlock.needCache) { |  | ||||||
| 		// 从V2.5.4开始,对光环效果增加缓存,以解决多次重复计算的问题,从而大幅提升运行效率。
 |  | ||||||
| 		var hp_buff = 0, |  | ||||||
| 			atk_buff = 0, |  | ||||||
| 			def_buff = 0; |  | ||||||
| 		// 已经计算过的光环怪ID列表,用于判定叠加
 |  | ||||||
| 		var usedEnemyIds = {}; |  | ||||||
| 		// 检查光环和支援的缓存
 |  | ||||||
| 		var index = x != null && y != null ? (x + "," + y) : floorId; |  | ||||||
| 		if (!core.status.checkBlock.cache) core.status.checkBlock.cache = {}; |  | ||||||
| 		var cache = core.status.checkBlock.cache[index]; |  | ||||||
| 		if (!cache) { |  | ||||||
| 			// 没有该点的缓存,则遍历每个图块
 |  | ||||||
| 			core.extractBlocks(floorId); |  | ||||||
| 			core.status.maps[floorId].blocks.forEach(function (block) { |  | ||||||
| 				if (!block.disable) { |  | ||||||
| 					// 获得该图块的ID
 |  | ||||||
| 					var id = block.event.id, |  | ||||||
| 						enemy = core.material.enemys[id]; |  | ||||||
| 					// 检查【光环】技能,数字25
 |  | ||||||
| 					if (enemy && core.hasSpecial(enemy.special, 25)) { |  | ||||||
| 						// 检查是否是范围光环
 |  | ||||||
| 						var inRange = enemy.haloRange == null; |  | ||||||
| 						if (enemy.haloRange != null && x != null && y != null) { |  | ||||||
| 							var dx = Math.abs(block.x - x), |  | ||||||
| 								dy = Math.abs(block.y - y); |  | ||||||
| 							// 检查十字和九宫格光环
 |  | ||||||
| 							if (dx + dy <= enemy.haloRange) inRange = true; |  | ||||||
| 							if (enemy.haloSquare && dx <= enemy.haloRange && dy <= enemy.haloRange) inRange = true; |  | ||||||
| 						} |  | ||||||
| 						// 检查是否可叠加
 |  | ||||||
| 						if (inRange && (enemy.haloAdd || !usedEnemyIds[enemy.id])) { |  | ||||||
| 							hp_buff += enemy.hpBuff || 0; |  | ||||||
| 							atk_buff += enemy.atkBuff || 0; |  | ||||||
| 							def_buff += enemy.defBuff || 0; |  | ||||||
| 							usedEnemyIds[enemy.id] = true; |  | ||||||
| 						} |  | ||||||
| 					} |  | ||||||
| 					// 检查【支援】技能,数字26
 |  | ||||||
| 					if (enemy && core.hasSpecial(enemy.special, 26) && |  | ||||||
| 						// 检查支援条件,坐标存在,距离为1,且不能是自己
 |  | ||||||
| 						// 其他类型的支援怪,比如十字之类的话.... 看着做是一样的
 |  | ||||||
| 						x != null && y != null && Math.abs(block.x - x) <= 1 && Math.abs(block.y - y) <= 1 && !(x == block.x && y == block.y)) { |  | ||||||
| 						// 记录怪物的x,y,ID
 |  | ||||||
| 						guards.push([block.x, block.y, id]); |  | ||||||
| 					} |  | ||||||
| 
 |  | ||||||
| 					// TODO:如果有其他类型光环怪物在这里仿照添加检查
 |  | ||||||
| 					// 注:新增新的类光环属性(需要遍历全图的)需要在特殊属性定义那里的第五项写1,参见光环和支援的特殊属性定义。
 |  | ||||||
| 				} |  | ||||||
| 			}); |  | ||||||
| 
 |  | ||||||
| 			core.status.checkBlock.cache[index] = { "hp_buff": hp_buff, "atk_buff": atk_buff, "def_buff": def_buff, "guards": guards }; |  | ||||||
| 		} else { |  | ||||||
| 			// 直接使用缓存数据
 |  | ||||||
| 			hp_buff = cache.hp_buff; |  | ||||||
| 			atk_buff = cache.atk_buff; |  | ||||||
| 			def_buff = cache.def_buff; |  | ||||||
| 			guards = cache.guards; |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		// 增加比例;如果要增加数值可以直接在这里修改
 |  | ||||||
| 		mon_hp *= (1 + hp_buff / 100); |  | ||||||
| 		mon_atk *= (1 + atk_buff / 100); |  | ||||||
| 		mon_def *= (1 + def_buff / 100); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// TODO:可以在这里新增其他的怪物数据变化
 |  | ||||||
| 	// 比如仿攻(怪物攻击不低于勇士攻击):
 |  | ||||||
| 	// if (core.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), |  | ||||||
| 		"exp": Math.floor(mon_exp), |  | ||||||
| 		"point": Math.floor(mon_point), |  | ||||||
| 		"special": mon_special, |  | ||||||
| 		"guards": guards, // 返回支援情况
 |  | ||||||
| 	}; |  | ||||||
| }, |  | ||||||
|         "getDamageInfo": function (enemy, hero, x, y, floorId) { |  | ||||||
| 	// 获得战斗伤害信息(实际伤害计算函数)
 |  | ||||||
| 	// 
 |  | ||||||
| 	// 参数说明:
 |  | ||||||
| 	// enemy:该怪物信息
 |  | ||||||
| 	// hero:勇士的当前数据;如果对应项不存在则会从core.status.hero中取。
 |  | ||||||
| 	// x,y:该怪物的坐标(查看手册和强制战斗时为undefined)
 |  | ||||||
| 	// floorId:该怪物所在的楼层
 |  | ||||||
| 	// 后面三个参数主要是可以在光环等效果上可以适用
 |  | ||||||
| 	floorId = floorId || core.status.floorId; |  | ||||||
| 
 |  | ||||||
| 	var hero_hp = core.getRealStatusOrDefault(hero, 'hp'), |  | ||||||
| 		hero_atk = core.getRealStatusOrDefault(hero, 'atk'), |  | ||||||
| 		hero_def = core.getRealStatusOrDefault(hero, 'def'), |  | ||||||
| 		hero_mdef = core.getRealStatusOrDefault(hero, 'mdef'), |  | ||||||
| 		origin_hero_hp = core.getStatusOrDefault(hero, 'hp'), |  | ||||||
| 		origin_hero_atk = core.getStatusOrDefault(hero, 'atk'), |  | ||||||
| 		origin_hero_def = core.getStatusOrDefault(hero, 'def'); |  | ||||||
| 
 |  | ||||||
| 	// 勇士的负属性都按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); |  | ||||||
| 
 |  | ||||||
| 	// 怪物的各项数据
 |  | ||||||
| 	// 对坚固模仿等处理扔到了脚本编辑-getEnemyInfo之中
 |  | ||||||
| 	var enemyInfo = core.enemys.getEnemyInfo(enemy, hero, x, y, floorId); |  | ||||||
| 	var mon_hp = enemyInfo.hp, |  | ||||||
| 		mon_atk = enemyInfo.atk, |  | ||||||
| 		mon_def = enemyInfo.def, |  | ||||||
| 		mon_special = enemyInfo.special; |  | ||||||
| 
 |  | ||||||
| 	// 技能的处理
 |  | ||||||
| 	if (core.getFlag('skill', 0) == 1) { // 开启了技能1:二倍斩
 |  | ||||||
| 		hero_atk *= 2; // 计算时攻击力翻倍	
 |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// 如果是无敌属性,且勇士未持有十字架
 |  | ||||||
| 	if (core.hasSpecial(mon_special, 20) && !core.hasItem("cross")) |  | ||||||
| 		return null; // 不可战斗
 |  | ||||||
| 
 |  | ||||||
| 	// 战前造成的额外伤害(可被护盾抵消)
 |  | ||||||
| 	var init_damage = 0; |  | ||||||
| 
 |  | ||||||
| 	// 吸血
 |  | ||||||
| 	if (core.hasSpecial(mon_special, 11)) { |  | ||||||
| 		var vampire_damage = hero_hp * enemy.vampire; |  | ||||||
| 
 |  | ||||||
| 		// 如果有神圣盾免疫吸血等可以在这里写
 |  | ||||||
| 		// 也可以用hasItem和hasEquip来判定装备
 |  | ||||||
| 		// if (core.hasFlag('shield5')) vampire_damage = 0;
 |  | ||||||
| 
 |  | ||||||
| 		vampire_damage = Math.floor(vampire_damage) || 0; |  | ||||||
| 		// 加到自身
 |  | ||||||
| 		if (enemy.add) // 如果加到自身
 |  | ||||||
| 			mon_hp += vampire_damage; |  | ||||||
| 
 |  | ||||||
| 		init_damage += vampire_damage; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// 每回合怪物对勇士造成的战斗伤害
 |  | ||||||
| 	var per_damage = mon_atk - hero_def; |  | ||||||
| 
 |  | ||||||
| 	// 战斗伤害不能为负值
 |  | ||||||
| 	if (per_damage < 0) per_damage = 0; |  | ||||||
| 
 |  | ||||||
| 	// 连击
 |  | ||||||
| 	if (core.hasSpecial(mon_special, 6)) per_damage *= (enemy.n || 2); |  | ||||||
| 
 |  | ||||||
| 	// 每回合的反击伤害;反击是按照勇士的攻击次数来计算回合
 |  | ||||||
| 	var counterDamage = 0; |  | ||||||
| 	if (core.hasSpecial(mon_special, 8)) |  | ||||||
| 		counterDamage += Math.floor((enemy.counterAttack || core.values.counterAttack) * hero_atk); |  | ||||||
| 
 |  | ||||||
| 	// 先攻
 |  | ||||||
| 	if (core.hasSpecial(mon_special, 1)) init_damage += per_damage; |  | ||||||
| 
 |  | ||||||
| 	// 破甲
 |  | ||||||
| 	if (core.hasSpecial(mon_special, 7)) |  | ||||||
| 		init_damage += Math.floor((enemy.breakArmor || core.values.breakArmor) * hero_def); |  | ||||||
| 
 |  | ||||||
| 	// 净化
 |  | ||||||
| 	if (core.hasSpecial(mon_special, 9)) |  | ||||||
| 		init_damage += Math.floor((enemy.purify || core.values.purify) * hero_mdef); |  | ||||||
| 
 |  | ||||||
| 	// 勇士每回合对怪物造成的伤害
 |  | ||||||
| 	var hero_per_damage = Math.max(hero_atk - mon_def, 0); |  | ||||||
| 
 |  | ||||||
| 	// 如果没有破防,则不可战斗
 |  | ||||||
| 	if (hero_per_damage <= 0) return null; |  | ||||||
| 
 |  | ||||||
| 	// 勇士的攻击回合数;为怪物生命除以每回合伤害向上取整
 |  | ||||||
| 	var turn = Math.ceil(mon_hp / hero_per_damage); |  | ||||||
| 
 |  | ||||||
| 	// ------ 支援 ----- //
 |  | ||||||
| 	// 这个递归最好想明白为什么,flag:__extraTurn__是怎么用的
 |  | ||||||
| 	var guards = core.getFlag("__guards__" + x + "_" + y, enemyInfo.guards); |  | ||||||
| 	var guard_before_current_enemy = false; // ------ 支援怪是先打(true)还是后打(false)?
 |  | ||||||
| 	turn += core.getFlag("__extraTurn__", 0); |  | ||||||
| 	if (guards.length > 0) { |  | ||||||
| 		if (!guard_before_current_enemy) { // --- 先打当前怪物,记录当前回合数
 |  | ||||||
| 			core.setFlag("__extraTurn__", turn); |  | ||||||
| 		} |  | ||||||
| 		// 获得那些怪物组成小队战斗
 |  | ||||||
| 		for (var i = 0; i < guards.length; i++) { |  | ||||||
| 			var gx = guards[i][0], |  | ||||||
| 				gy = guards[i][1], |  | ||||||
| 				gid = guards[i][2]; |  | ||||||
| 			// 递归计算支援怪伤害信息,这里不传x,y保证不会重复调用
 |  | ||||||
| 			// 这里的mdef传0,因为护盾应该只会被计算一次
 |  | ||||||
| 			var info = core.enemys.getDamageInfo(core.material.enemys[gid], { hp: origin_hero_hp, atk: origin_hero_atk, def: origin_hero_def, mdef: 0 }); |  | ||||||
| 			if (info == null) { // 小队中任何一个怪物不可战斗,直接返回null
 |  | ||||||
| 				core.removeFlag("__extraTurn__"); |  | ||||||
| 				return null; |  | ||||||
| 			} | 			} | ||||||
| 			// 已经进行的回合数
 | 			// 坚固
 | ||||||
| 			core.setFlag("__extraTurn__", info.turn); | 			if (core.hasSpecial(mon_special, 3) && mon_def < hero_atk - 1) { | ||||||
| 			init_damage += info.damage; | 				mon_def = hero_atk - 1; | ||||||
| 		} | 			} | ||||||
| 		if (guard_before_current_enemy) { // --- 先打支援怪物,增加当前回合数
 | 
 | ||||||
|  | 			var guards = []; | ||||||
|  | 
 | ||||||
|  | 			// 光环和支援检查
 | ||||||
|  | 			if (!core.status.checkBlock) core.status.checkBlock = {}; | ||||||
|  | 
 | ||||||
|  | 			if (core.status.checkBlock.needCache) { | ||||||
|  | 				// 从V2.5.4开始,对光环效果增加缓存,以解决多次重复计算的问题,从而大幅提升运行效率。
 | ||||||
|  | 				var hp_buff = 0, | ||||||
|  | 					atk_buff = 0, | ||||||
|  | 					def_buff = 0; | ||||||
|  | 				// 已经计算过的光环怪ID列表,用于判定叠加
 | ||||||
|  | 				var usedEnemyIds = {}; | ||||||
|  | 				// 检查光环和支援的缓存
 | ||||||
|  | 				var index = x != null && y != null ? (x + "," + y) : floorId; | ||||||
|  | 				if (!core.status.checkBlock.cache) core.status.checkBlock.cache = {}; | ||||||
|  | 				var cache = core.status.checkBlock.cache[index]; | ||||||
|  | 				if (!cache) { | ||||||
|  | 					// 没有该点的缓存,则遍历每个图块
 | ||||||
|  | 					core.extractBlocks(floorId); | ||||||
|  | 					core.status.maps[floorId].blocks.forEach(function (block) { | ||||||
|  | 						if (!block.disable) { | ||||||
|  | 							// 获得该图块的ID
 | ||||||
|  | 							var id = block.event.id, | ||||||
|  | 								enemy = core.material.enemys[id]; | ||||||
|  | 							// 检查【光环】技能,数字25
 | ||||||
|  | 							if (enemy && core.hasSpecial(enemy.special, 25)) { | ||||||
|  | 								// 检查是否是范围光环
 | ||||||
|  | 								var inRange = enemy.haloRange == null; | ||||||
|  | 								if (enemy.haloRange != null && x != null && y != null) { | ||||||
|  | 									var dx = Math.abs(block.x - x), | ||||||
|  | 										dy = Math.abs(block.y - y); | ||||||
|  | 									// 检查十字和九宫格光环
 | ||||||
|  | 									if (dx + dy <= enemy.haloRange) inRange = true; | ||||||
|  | 									if (enemy.haloSquare && dx <= enemy.haloRange && dy <= enemy.haloRange) inRange = true; | ||||||
|  | 								} | ||||||
|  | 								// 检查是否可叠加
 | ||||||
|  | 								if (inRange && (enemy.haloAdd || !usedEnemyIds[enemy.id])) { | ||||||
|  | 									hp_buff += enemy.hpBuff || 0; | ||||||
|  | 									atk_buff += enemy.atkBuff || 0; | ||||||
|  | 									def_buff += enemy.defBuff || 0; | ||||||
|  | 									usedEnemyIds[enemy.id] = true; | ||||||
|  | 								} | ||||||
|  | 							} | ||||||
|  | 							// 检查【支援】技能,数字26
 | ||||||
|  | 							if (enemy && core.hasSpecial(enemy.special, 26) && | ||||||
|  | 								// 检查支援条件,坐标存在,距离为1,且不能是自己
 | ||||||
|  | 								// 其他类型的支援怪,比如十字之类的话.... 看着做是一样的
 | ||||||
|  | 								x != null && y != null && Math.abs(block.x - x) <= 1 && Math.abs(block.y - y) <= 1 && !(x == block.x && y == block.y)) { | ||||||
|  | 								// 记录怪物的x,y,ID
 | ||||||
|  | 								guards.push([block.x, block.y, id]); | ||||||
|  | 							} | ||||||
|  | 
 | ||||||
|  | 							// TODO:如果有其他类型光环怪物在这里仿照添加检查
 | ||||||
|  | 							// 注:新增新的类光环属性(需要遍历全图的)需要在特殊属性定义那里的第五项写1,参见光环和支援的特殊属性定义。
 | ||||||
|  | 						} | ||||||
|  | 					}); | ||||||
|  | 
 | ||||||
|  | 					core.status.checkBlock.cache[index] = { "hp_buff": hp_buff, "atk_buff": atk_buff, "def_buff": def_buff, "guards": guards }; | ||||||
|  | 				} else { | ||||||
|  | 					// 直接使用缓存数据
 | ||||||
|  | 					hp_buff = cache.hp_buff; | ||||||
|  | 					atk_buff = cache.atk_buff; | ||||||
|  | 					def_buff = cache.def_buff; | ||||||
|  | 					guards = cache.guards; | ||||||
|  | 				} | ||||||
|  | 
 | ||||||
|  | 				// 增加比例;如果要增加数值可以直接在这里修改
 | ||||||
|  | 				mon_hp *= (1 + hp_buff / 100); | ||||||
|  | 				mon_atk *= (1 + atk_buff / 100); | ||||||
|  | 				mon_def *= (1 + def_buff / 100); | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			// TODO:可以在这里新增其他的怪物数据变化
 | ||||||
|  | 			// 比如仿攻(怪物攻击不低于勇士攻击):
 | ||||||
|  | 			// if (core.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), | ||||||
|  | 				"exp": Math.floor(mon_exp), | ||||||
|  | 				"point": Math.floor(mon_point), | ||||||
|  | 				"special": mon_special, | ||||||
|  | 				"guards": guards, // 返回支援情况
 | ||||||
|  | 			}; | ||||||
|  | 		}, | ||||||
|  |         "getDamageInfo": function (enemy, hero, x, y, floorId) { | ||||||
|  | 			// 获得战斗伤害信息(实际伤害计算函数)
 | ||||||
|  | 			// 
 | ||||||
|  | 			// 参数说明:
 | ||||||
|  | 			// enemy:该怪物信息
 | ||||||
|  | 			// hero:勇士的当前数据;如果对应项不存在则会从core.status.hero中取。
 | ||||||
|  | 			// x,y:该怪物的坐标(查看手册和强制战斗时为undefined)
 | ||||||
|  | 			// floorId:该怪物所在的楼层
 | ||||||
|  | 			// 后面三个参数主要是可以在光环等效果上可以适用
 | ||||||
|  | 			floorId = floorId || core.status.floorId; | ||||||
|  | 
 | ||||||
|  | 			var hero_hp = core.getRealStatusOrDefault(hero, 'hp'), | ||||||
|  | 				hero_atk = core.getRealStatusOrDefault(hero, 'atk'), | ||||||
|  | 				hero_def = core.getRealStatusOrDefault(hero, 'def'), | ||||||
|  | 				hero_mdef = core.getRealStatusOrDefault(hero, 'mdef'), | ||||||
|  | 				origin_hero_hp = core.getStatusOrDefault(hero, 'hp'), | ||||||
|  | 				origin_hero_atk = core.getStatusOrDefault(hero, 'atk'), | ||||||
|  | 				origin_hero_def = core.getStatusOrDefault(hero, 'def'); | ||||||
|  | 
 | ||||||
|  | 			// 勇士的负属性都按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); | ||||||
|  | 
 | ||||||
|  | 			// 怪物的各项数据
 | ||||||
|  | 			// 对坚固模仿等处理扔到了脚本编辑-getEnemyInfo之中
 | ||||||
|  | 			var enemyInfo = core.enemys.getEnemyInfo(enemy, hero, x, y, floorId); | ||||||
|  | 			var mon_hp = enemyInfo.hp, | ||||||
|  | 				mon_atk = enemyInfo.atk, | ||||||
|  | 				mon_def = enemyInfo.def, | ||||||
|  | 				mon_special = enemyInfo.special; | ||||||
|  | 
 | ||||||
|  | 			// 技能的处理
 | ||||||
|  | 			if (core.getFlag('skill', 0) == 1) { // 开启了技能1:二倍斩
 | ||||||
|  | 				hero_atk *= 2; // 计算时攻击力翻倍	
 | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			// 如果是无敌属性,且勇士未持有十字架
 | ||||||
|  | 			if (core.hasSpecial(mon_special, 20) && !core.hasItem("cross")) | ||||||
|  | 				return null; // 不可战斗
 | ||||||
|  | 
 | ||||||
|  | 			// 战前造成的额外伤害(可被护盾抵消)
 | ||||||
|  | 			var init_damage = 0; | ||||||
|  | 
 | ||||||
|  | 			// 吸血
 | ||||||
|  | 			if (core.hasSpecial(mon_special, 11)) { | ||||||
|  | 				var vampire_damage = hero_hp * enemy.vampire; | ||||||
|  | 
 | ||||||
|  | 				// 如果有神圣盾免疫吸血等可以在这里写
 | ||||||
|  | 				// 也可以用hasItem和hasEquip来判定装备
 | ||||||
|  | 				// if (core.hasFlag('shield5')) vampire_damage = 0;
 | ||||||
|  | 
 | ||||||
|  | 				vampire_damage = Math.floor(vampire_damage) || 0; | ||||||
|  | 				// 加到自身
 | ||||||
|  | 				if (enemy.add) // 如果加到自身
 | ||||||
|  | 					mon_hp += vampire_damage; | ||||||
|  | 
 | ||||||
|  | 				init_damage += vampire_damage; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			// 每回合怪物对勇士造成的战斗伤害
 | ||||||
|  | 			var per_damage = mon_atk - hero_def; | ||||||
|  | 			// 魔攻:战斗伤害就是怪物攻击力
 | ||||||
|  | 			if (core.hasSpecial(mon_special, 2)) per_damage = mon_atk; | ||||||
|  | 			// 战斗伤害不能为负值
 | ||||||
|  | 			if (per_damage < 0) per_damage = 0; | ||||||
|  | 
 | ||||||
|  | 			// 2连击 & 3连击 & N连击
 | ||||||
|  | 			if (core.hasSpecial(mon_special, 4)) per_damage *= 2; | ||||||
|  | 			if (core.hasSpecial(mon_special, 5)) per_damage *= 3; | ||||||
|  | 			if (core.hasSpecial(mon_special, 6)) per_damage *= (enemy.n || 4); | ||||||
|  | 
 | ||||||
|  | 			// 每回合的反击伤害;反击是按照勇士的攻击次数来计算回合
 | ||||||
|  | 			var counterDamage = 0; | ||||||
|  | 			if (core.hasSpecial(mon_special, 8)) | ||||||
|  | 				counterDamage += Math.floor((enemy.counterAttack || core.values.counterAttack) * hero_atk); | ||||||
|  | 
 | ||||||
|  | 			// 先攻
 | ||||||
|  | 			if (core.hasSpecial(mon_special, 1)) init_damage += per_damage; | ||||||
|  | 
 | ||||||
|  | 			// 破甲
 | ||||||
|  | 			if (core.hasSpecial(mon_special, 7)) | ||||||
|  | 				init_damage += Math.floor((enemy.breakArmor || core.values.breakArmor) * hero_def); | ||||||
|  | 
 | ||||||
|  | 			// 净化
 | ||||||
|  | 			if (core.hasSpecial(mon_special, 9)) | ||||||
|  | 				init_damage += Math.floor((enemy.purify || core.values.purify) * hero_mdef); | ||||||
|  | 
 | ||||||
|  | 			// 勇士每回合对怪物造成的伤害
 | ||||||
|  | 			var hero_per_damage = Math.max(hero_atk - mon_def, 0); | ||||||
|  | 
 | ||||||
|  | 			// 如果没有破防,则不可战斗
 | ||||||
|  | 			if (hero_per_damage <= 0) return null; | ||||||
|  | 
 | ||||||
|  | 			// 勇士的攻击回合数;为怪物生命除以每回合伤害向上取整
 | ||||||
|  | 			var turn = Math.ceil(mon_hp / hero_per_damage); | ||||||
|  | 
 | ||||||
|  | 			// ------ 支援 ----- //
 | ||||||
|  | 			// 这个递归最好想明白为什么,flag:__extraTurn__是怎么用的
 | ||||||
|  | 			var guards = core.getFlag("__guards__" + x + "_" + y, enemyInfo.guards); | ||||||
|  | 			var guard_before_current_enemy = false; // ------ 支援怪是先打(true)还是后打(false)?
 | ||||||
| 			turn += core.getFlag("__extraTurn__", 0); | 			turn += core.getFlag("__extraTurn__", 0); | ||||||
|  | 			if (guards.length > 0) { | ||||||
|  | 				if (!guard_before_current_enemy) { // --- 先打当前怪物,记录当前回合数
 | ||||||
|  | 					core.setFlag("__extraTurn__", turn); | ||||||
|  | 				} | ||||||
|  | 				// 获得那些怪物组成小队战斗
 | ||||||
|  | 				for (var i = 0; i < guards.length; i++) { | ||||||
|  | 					var gx = guards[i][0], | ||||||
|  | 						gy = guards[i][1], | ||||||
|  | 						gid = guards[i][2]; | ||||||
|  | 					// 递归计算支援怪伤害信息,这里不传x,y保证不会重复调用
 | ||||||
|  | 					// 这里的mdef传0,因为护盾应该只会被计算一次
 | ||||||
|  | 					var info = core.enemys.getDamageInfo(core.material.enemys[gid], { hp: origin_hero_hp, atk: origin_hero_atk, def: origin_hero_def, mdef: 0 }); | ||||||
|  | 					if (info == null) { // 小队中任何一个怪物不可战斗,直接返回null
 | ||||||
|  | 						core.removeFlag("__extraTurn__"); | ||||||
|  | 						return null; | ||||||
|  | 					} | ||||||
|  | 					// 已经进行的回合数
 | ||||||
|  | 					core.setFlag("__extraTurn__", info.turn); | ||||||
|  | 					init_damage += info.damage; | ||||||
|  | 				} | ||||||
|  | 				if (guard_before_current_enemy) { // --- 先打支援怪物,增加当前回合数
 | ||||||
|  | 					turn += core.getFlag("__extraTurn__", 0); | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			core.removeFlag("__extraTurn__"); | ||||||
|  | 			// ------ 支援END ------ //
 | ||||||
|  | 
 | ||||||
|  | 			// 最终伤害:初始伤害 + 怪物对勇士造成的伤害 + 反击伤害
 | ||||||
|  | 			var damage = init_damage + (turn - 1) * per_damage + turn * counterDamage; | ||||||
|  | 			// 再扣去护盾
 | ||||||
|  | 			damage -= hero_mdef; | ||||||
|  | 
 | ||||||
|  | 			// 检查是否允许负伤
 | ||||||
|  | 			if (!core.flags.enableNegativeDamage) | ||||||
|  | 				damage = Math.max(0, damage); | ||||||
|  | 
 | ||||||
|  | 			// 最后处理仇恨和固伤(因为这两个不能被护盾减伤)
 | ||||||
|  | 			if (core.hasSpecial(mon_special, 17)) { // 仇恨
 | ||||||
|  | 				damage += core.getFlag('hatred', 0); | ||||||
|  | 			} | ||||||
|  | 			if (core.hasSpecial(mon_special, 22)) { // 固伤
 | ||||||
|  | 				damage += enemy.damage || 0; | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			return { | ||||||
|  | 				"mon_hp": Math.floor(mon_hp), | ||||||
|  | 				"mon_atk": Math.floor(mon_atk), | ||||||
|  | 				"mon_def": Math.floor(mon_def), | ||||||
|  | 				"init_damage": Math.floor(init_damage), | ||||||
|  | 				"per_damage": Math.floor(per_damage), | ||||||
|  | 				"hero_per_damage": Math.floor(hero_per_damage), | ||||||
|  | 				"turn": Math.floor(turn), | ||||||
|  | 				"damage": Math.floor(damage) | ||||||
|  | 			}; | ||||||
| 		} | 		} | ||||||
| 	} |  | ||||||
| 	core.removeFlag("__extraTurn__"); |  | ||||||
| 	// ------ 支援END ------ //
 |  | ||||||
| 
 |  | ||||||
| 	// 最终伤害:初始伤害 + 怪物对勇士造成的伤害 + 反击伤害
 |  | ||||||
| 	var damage = init_damage + (turn - 1) * per_damage + turn * counterDamage; |  | ||||||
| 	// 再扣去护盾
 |  | ||||||
| 	damage -= hero_mdef; |  | ||||||
| 
 |  | ||||||
| 	// 检查是否允许负伤
 |  | ||||||
| 	if (!core.flags.enableNegativeDamage) |  | ||||||
| 		damage = Math.max(0, damage); |  | ||||||
| 
 |  | ||||||
| 	// 最后处理仇恨和固伤(因为这两个不能被护盾减伤)
 |  | ||||||
| 	if (core.hasSpecial(mon_special, 17)) { // 仇恨
 |  | ||||||
| 		damage += core.getFlag('hatred', 0); |  | ||||||
| 	} |  | ||||||
| 	if (core.hasSpecial(mon_special, 22)) { // 固伤
 |  | ||||||
| 		damage += enemy.damage || 0; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return { |  | ||||||
| 		"mon_hp": Math.floor(mon_hp), |  | ||||||
| 		"mon_atk": Math.floor(mon_atk), |  | ||||||
| 		"mon_def": Math.floor(mon_def), |  | ||||||
| 		"init_damage": Math.floor(init_damage), |  | ||||||
| 		"per_damage": Math.floor(per_damage), |  | ||||||
| 		"hero_per_damage": Math.floor(hero_per_damage), |  | ||||||
| 		"turn": Math.floor(turn), |  | ||||||
| 		"damage": Math.floor(damage) |  | ||||||
| 	}; |  | ||||||
| } |  | ||||||
|     }, |     }, | ||||||
|     "actions": { |     "actions": { | ||||||
|         "onKeyUp": function (keyCode, altKey) { |         "onKeyUp": function (keyCode, altKey) { | ||||||
| @ -1162,8 +1168,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = | |||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
|         "updateStatusBar": function () { |         "updateStatusBar": function () { | ||||||
| 	//更新属性映射
 |  | ||||||
| 	core.updateStatus() |  | ||||||
| 	// 更新状态栏
 | 	// 更新状态栏
 | ||||||
| 	core.ui.statusBar.update(); | 	core.ui.statusBar.update(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -144,7 +144,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = | |||||||
| 		"itemEffectTip": ",攻击+0" | 		"itemEffectTip": ",攻击+0" | ||||||
| 	}, | 	}, | ||||||
| 	"sword1": { | 	"sword1": { | ||||||
| 		"cls": "equips", | 		"cls": "items", | ||||||
| 		"name": "铁剑", | 		"name": "铁剑", | ||||||
| 		"text": "一把很普通的铁剑", | 		"text": "一把很普通的铁剑", | ||||||
| 		"equip": { | 		"equip": { | ||||||
| @ -152,31 +152,27 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = | |||||||
| 			"animate": "sword", | 			"animate": "sword", | ||||||
| 			"value": { | 			"value": { | ||||||
| 				"atk": 10 | 				"atk": 10 | ||||||
| 			}, | 			} | ||||||
| 			"percentage": {} |  | ||||||
| 		}, | 		}, | ||||||
| 		"itemEffect": "core.status.hero.atk += 10", | 		"itemEffect": "core.status.hero.atk += 10", | ||||||
| 		"itemEffectTip": ",攻击+10", | 		"itemEffectTip": ",攻击+10" | ||||||
| 		"equipCls": "双手剑" |  | ||||||
| 	}, | 	}, | ||||||
| 	"sword2": { | 	"sword2": { | ||||||
| 		"cls": "equips", | 		"cls": "items", | ||||||
| 		"name": "银剑", | 		"name": "银剑", | ||||||
| 		"text": "一把很普通的银剑", | 		"text": "一把很普通的银剑", | ||||||
| 		"equip": { | 		"equip": { | ||||||
| 			"type": "武器", | 			"type": 0, | ||||||
| 			"animate": "sword", | 			"animate": "sword", | ||||||
| 			"value": { | 			"value": { | ||||||
| 				"atk": 20 | 				"atk": 20 | ||||||
| 			}, | 			} | ||||||
| 			"percentage": {} |  | ||||||
| 		}, | 		}, | ||||||
| 		"itemEffect": "core.status.hero.atk += 20", | 		"itemEffect": "core.status.hero.atk += 20", | ||||||
| 		"itemEffectTip": ",攻击+20", | 		"itemEffectTip": ",攻击+20" | ||||||
| 		"equipCls": "匕首" |  | ||||||
| 	}, | 	}, | ||||||
| 	"sword3": { | 	"sword3": { | ||||||
| 		"cls": "equips", | 		"cls": "items", | ||||||
| 		"name": "骑士剑", | 		"name": "骑士剑", | ||||||
| 		"text": "一把很普通的骑士剑", | 		"text": "一把很普通的骑士剑", | ||||||
| 		"equip": { | 		"equip": { | ||||||
| @ -184,44 +180,38 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = | |||||||
| 			"animate": "sword", | 			"animate": "sword", | ||||||
| 			"value": { | 			"value": { | ||||||
| 				"atk": 40 | 				"atk": 40 | ||||||
| 			}, | 			} | ||||||
| 			"percentage": {} |  | ||||||
| 		}, | 		}, | ||||||
| 		"itemEffect": "core.status.hero.atk += 40", | 		"itemEffect": "core.status.hero.atk += 40", | ||||||
| 		"itemEffectTip": ",攻击+40", | 		"itemEffectTip": ",攻击+40" | ||||||
| 		"equipCls": "法杖" |  | ||||||
| 	}, | 	}, | ||||||
| 	"sword4": { | 	"sword4": { | ||||||
| 		"cls": "equips", | 		"cls": "items", | ||||||
| 		"name": "圣剑", | 		"name": "圣剑", | ||||||
| 		"text": "一把很普通的圣剑", | 		"text": "一把很普通的圣剑", | ||||||
| 		"equip": { | 		"equip": { | ||||||
| 			"type": "武器", | 			"type": 0, | ||||||
| 			"animate": "sword", | 			"animate": "sword", | ||||||
| 			"value": { | 			"value": { | ||||||
| 				"atk": 80 | 				"atk": 80 | ||||||
| 			}, | 			} | ||||||
| 			"percentage": {} |  | ||||||
| 		}, | 		}, | ||||||
| 		"itemEffect": "core.status.hero.atk += 80", | 		"itemEffect": "core.status.hero.atk += 80", | ||||||
| 		"itemEffectTip": ",攻击+80", | 		"itemEffectTip": ",攻击+80" | ||||||
| 		"equipCls": "单手剑" |  | ||||||
| 	}, | 	}, | ||||||
| 	"sword5": { | 	"sword5": { | ||||||
| 		"cls": "equips", | 		"cls": "equips", | ||||||
| 		"name": "神圣剑", | 		"name": "神圣剑", | ||||||
| 		"text": "一把很普通的神圣剑", | 		"text": "一把很普通的神圣剑", | ||||||
| 		"equip": { | 		"equip": { | ||||||
| 			"type": "武器", | 			"type": 0, | ||||||
| 			"animate": "sword", | 			"animate": "sword", | ||||||
| 			"value": { | 			"value": { | ||||||
| 				"atk": 160 | 				"atk": 160 | ||||||
| 			}, | 			} | ||||||
| 			"percentage": {} |  | ||||||
| 		}, | 		}, | ||||||
| 		"itemEffect": "core.status.hero.atk += 100", | 		"itemEffect": "core.status.hero.atk += 100", | ||||||
| 		"itemEffectTip": ",攻击+100", | 		"itemEffectTip": ",攻击+100" | ||||||
| 		"equipCls": "匕首" |  | ||||||
| 	}, | 	}, | ||||||
| 	"shield0": { | 	"shield0": { | ||||||
| 		"cls": "items", | 		"cls": "items", | ||||||
| @ -244,12 +234,10 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = | |||||||
| 			"type": 1, | 			"type": 1, | ||||||
| 			"value": { | 			"value": { | ||||||
| 				"def": 10 | 				"def": 10 | ||||||
| 			}, | 			} | ||||||
| 			"percentage": {} |  | ||||||
| 		}, | 		}, | ||||||
| 		"itemEffect": "core.status.hero.def += 10", | 		"itemEffect": "core.status.hero.def += 10", | ||||||
| 		"itemEffectTip": ",防御+10", | 		"itemEffectTip": ",防御+10" | ||||||
| 		"equipCls": "盾牌" |  | ||||||
| 	}, | 	}, | ||||||
| 	"shield2": { | 	"shield2": { | ||||||
| 		"cls": "items", | 		"cls": "items", | ||||||
|  | |||||||
| @ -2889,7 +2889,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 		this.doEvent(data, x, y, prefix); | 		this.doEvent(data, x, y, prefix); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 |  | ||||||
| }, | }, | ||||||
|     "额外信息": function () { |     "额外信息": function () { | ||||||
| 	/* 宝石血瓶左下角显示数值 | 	/* 宝石血瓶左下角显示数值 | ||||||
| @ -3814,11 +3813,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 			cls: "equips", | 			cls: "equips", | ||||||
| 			name: "未知装备", | 			name: "未知装备", | ||||||
| 			text: "一无所有,又何尝不是一种装备", | 			text: "一无所有,又何尝不是一种装备", | ||||||
| 			equipCls: "无", |  | ||||||
| 			equip: { | 			equip: { | ||||||
| 				type: "装备", | 				type: "装备" | ||||||
| 			} | 			} | ||||||
| 
 |  | ||||||
| 		} | 		} | ||||||
| 		///// ***
 | 		///// ***
 | ||||||
| 
 | 
 | ||||||
| @ -3842,8 +3839,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 		core.setTextBaseline(ctx, "middle"); | 		core.setTextBaseline(ctx, "middle"); | ||||||
| 		core.fillText(ctx, itemName, itemName_x, itemName_middle, itemNameColor, itemNameFont, itemNameMaxWidth); | 		core.fillText(ctx, itemName, itemName_x, itemName_middle, itemNameColor, itemNameFont, itemNameMaxWidth); | ||||||
| 		core.fillText(ctx, "【" + itemClsName + "】", itemCls_x, itemCls_middle, itemClsColor, itemClsFont); | 		core.fillText(ctx, "【" + itemClsName + "】", itemCls_x, itemCls_middle, itemClsColor, itemClsFont); | ||||||
| 		var statusText = "【装备类型】" + item.equipCls + '\n\n'; | 		var statusText = ""; | ||||||
| 		/*if (core.status.event.id == "equipbox") { | 		if (core.status.event.id == "equipbox") { | ||||||
| 			var type = item.equip.type; | 			var type = item.equip.type; | ||||||
| 			if (typeof type == "string") type = core.getEquipTypeByName(type); | 			if (typeof type == "string") type = core.getEquipTypeByName(type); | ||||||
| 			var compare = core.compareEquipment(item.id, core.getEquip(type)); | 			var compare = core.compareEquipment(item.id, core.getEquip(type)); | ||||||
| @ -3861,7 +3858,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 				newValue = core.formatBigNumber(newValue); | 				newValue = core.formatBigNumber(newValue); | ||||||
| 				statusText += core.getStatusLabel(name) + " " + nowValue + "->\r[" + color + "]" + newValue + "\r\n"; | 				statusText += core.getStatusLabel(name) + " " + nowValue + "->\r[" + color + "]" + newValue + "\r\n"; | ||||||
| 			} | 			} | ||||||
| 		}*/ | 		} | ||||||
| 		itemText = statusText + itemText; | 		itemText = statusText + itemText; | ||||||
| 		core.drawTextContent(ctx, itemText, { | 		core.drawTextContent(ctx, itemText, { | ||||||
| 			left: itemText_x, | 			left: itemText_x, | ||||||
| @ -3951,8 +3948,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 		for (var i = 0; i < len; i++) { | 		for (var i = 0; i < len; i++) { | ||||||
| 			var id = core.getEquip(i), | 			var id = core.getEquip(i), | ||||||
| 				name = toDrawList[i]; | 				name = toDrawList[i]; | ||||||
| 			if (i === 0) name = "主手"; |  | ||||||
| 			if (i === 1) name = "副手"; |  | ||||||
| 			var selectBorder = false; | 			var selectBorder = false; | ||||||
| 			if (core.status.thisUIEventInfo.select.type == i) selectBorder = true; | 			if (core.status.thisUIEventInfo.select.type == i) selectBorder = true; | ||||||
| 			var borderStyle = selectBorder ? box_selectBorderStyle : box_borderStyle; | 			var borderStyle = selectBorder ? box_selectBorderStyle : box_borderStyle; | ||||||
| @ -3965,10 +3960,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 				box_y += space_y + oneBoxHeight; | 				box_y += space_y + oneBoxHeight; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		if (core.material.items[core.getEquip(0)]?.equipCls === "双手剑") { |  | ||||||
| 			core.drawLine(ctx, equipList_x + space_x + space_x + oneBoxWidth, equipList_y + space_y, equipList_x + space_x + space_x + oneBoxWidth + box_width + box_borderWidth, equipList_y + space_y + box_height) |  | ||||||
| 			core.drawLine(ctx, equipList_x + space_x + space_x + oneBoxWidth, equipList_y + space_y + box_height, equipList_x + space_x + space_x + oneBoxWidth + box_width + box_borderWidth, equipList_y + space_y) |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	this.drawToolbox = function (ctx) { | 	this.drawToolbox = function (ctx) { | ||||||
| @ -4169,80 +4160,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 			info.index = 1; | 			info.index = 1; | ||||||
| 			if (action == "load") { | 			if (action == "load") { | ||||||
| 				var type = core.getEquipTypeById(id); | 				var type = core.getEquipTypeById(id); | ||||||
| 				let equipClsid = core.material.items[id]?.equipCls; |  | ||||||
| 				let equipCls0 = core.material.items[core.getEquip(0)]?.equipCls; |  | ||||||
| 				let equipCls1 = core.material.items[core.getEquip(1)]?.equipCls; |  | ||||||
| 				if (equipCls0 === "双手剑") { |  | ||||||
| 					core.unloadEquip(0, function () { |  | ||||||
| 						core.status.route.push("unEquip:" + 0); |  | ||||||
| 					}); |  | ||||||
| 				} |  | ||||||
| 				if (equipClsid === "单手剑") { |  | ||||||
| 					if (equipCls1 !== "单手剑" && equipCls1 !== "匕首" && equipCls1 !== "盾牌") { |  | ||||||
| 						core.unloadEquip(0, function () { |  | ||||||
| 							core.status.route.push("unEquip:" + 0); |  | ||||||
| 						}); |  | ||||||
| 						core.unloadEquip(1, function () { |  | ||||||
| 							core.status.route.push("unEquip:" + 1); |  | ||||||
| 						}); |  | ||||||
| 					} else if (equipCls0 !== "单手剑") { |  | ||||||
| 						core.unloadEquip(0, function () { |  | ||||||
| 							core.status.route.push("unEquip:" + 0); |  | ||||||
| 						}); |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 				if (equipClsid === "法杖") { |  | ||||||
| 					if (equipCls1 !== "匕首" && equipCls1 !== "盾牌") { |  | ||||||
| 						core.unloadEquip(0, function () { |  | ||||||
| 							core.status.route.push("unEquip:" + 0); |  | ||||||
| 						}); |  | ||||||
| 						core.unloadEquip(1, function () { |  | ||||||
| 							core.status.route.push("unEquip:" + 1); |  | ||||||
| 						}); |  | ||||||
| 					} else { |  | ||||||
| 						core.unloadEquip(0, function () { |  | ||||||
| 							core.status.route.push("unEquip:" + 0); |  | ||||||
| 						}); |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 				if (equipClsid === "双手剑") { |  | ||||||
| 
 |  | ||||||
| 					core.unloadEquip(0, function () { |  | ||||||
| 						core.status.route.push("unEquip:" + 0); |  | ||||||
| 					}); |  | ||||||
| 					core.unloadEquip(1, function () { |  | ||||||
| 						core.status.route.push("unEquip:" + 1); |  | ||||||
| 					}); |  | ||||||
| 
 |  | ||||||
| 				} |  | ||||||
| 				if (equipClsid === "匕首") { |  | ||||||
| 					if (equipCls0 !== "匕首") { |  | ||||||
| 						core.unloadEquip(0, function () { |  | ||||||
| 							core.status.route.push("unEquip:" + 0); |  | ||||||
| 						}); |  | ||||||
| 						core.unloadEquip(1, function () { |  | ||||||
| 							core.status.route.push("unEquip:" + 1); |  | ||||||
| 						}); |  | ||||||
| 					} else { |  | ||||||
| 						core.unloadEquip(1, function () { |  | ||||||
| 							core.status.route.push("unEquip:" + 1); |  | ||||||
| 						}); |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 				if (equipClsid === "盾牌") { |  | ||||||
| 					if (equipCls0 !== "单手剑" && equipCls0 !== "法杖") { |  | ||||||
| 						core.unloadEquip(0, function () { |  | ||||||
| 							core.status.route.push("unEquip:" + 0); |  | ||||||
| 						}); |  | ||||||
| 						core.unloadEquip(1, function () { |  | ||||||
| 							core.status.route.push("unEquip:" + 1); |  | ||||||
| 						}); |  | ||||||
| 					} else { |  | ||||||
| 						core.unloadEquip(1, function () { |  | ||||||
| 							core.status.route.push("unEquip:" + 1); |  | ||||||
| 						}); |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 				core.loadEquip(id, function () { | 				core.loadEquip(id, function () { | ||||||
| 					core.status.route.push("equip:" + id); | 					core.status.route.push("equip:" + id); | ||||||
| 					info.select.type = type; | 					info.select.type = type; | ||||||
| @ -4260,7 +4177,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = | |||||||
| 				}); | 				}); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		core.updateStatusBar() |  | ||||||
| 	} | 	} | ||||||
| 	this.setIndexAndSelect = function (toChange) { | 	this.setIndexAndSelect = function (toChange) { | ||||||
| 		var info = core.status.thisUIEventInfo; | 		var info = core.status.thisUIEventInfo; | ||||||
| @ -10101,257 +10017,137 @@ core.plugin.animate = { | |||||||
| 
 | 
 | ||||||
| 	} | 	} | ||||||
| 	core.ui.cgText = new cgText() | 	core.ui.cgText = new cgText() | ||||||
|  | 
 | ||||||
| }, | }, | ||||||
| "旁白": function () { |     "旁白": function () { | ||||||
| // 在此增加新插件
 | 	// 在此增加新插件
 | ||||||
| const over = document.createElement('canvas'); //over画布设置
 | 	const over = document.createElement('canvas'); //over画布设置
 | ||||||
| over.style.position = 'absolute'; | 	over.style.position = 'absolute'; | ||||||
| over.style.zIndex = 310; | 	over.style.zIndex = 310; | ||||||
| over.style.display = "none" | 	over.style.display = "none" | ||||||
| over.id = 'over'; | 	over.id = 'over'; | ||||||
| main.dom.gameGroup.insertAdjacentElement('afterend', over) | 	main.dom.gameGroup.insertAdjacentElement('afterend', over) | ||||||
| over.style.top = "50%" | 	over.style.top = "50%" | ||||||
| over.style.left = "50%" | 	over.style.left = "50%" | ||||||
| over.style.transform = "translate(-50%,-50%)" | 	over.style.transform = "translate(-50%,-50%)" | ||||||
| const ctx = over.getContext("2d"); | 	const ctx = over.getContext("2d"); | ||||||
| main.dom.over = over; | 	main.dom.over = over; | ||||||
| 
 | 
 | ||||||
| this.over = function (image, time = 3000, hidetime = 100, sound = "", textColor = "#FFFFFF", boldColor = "#000000", font = "bold 48px Verdana", text = "") { | 	this.over = function (image, time = 3000, hidetime = 100, sound = "", textColor = "#FFFFFF", boldColor = "#000000", font = "bold 48px Verdana", text = "") { | ||||||
| 	if (!core.isPlaying()) { return core.doAction() } | 		if (!core.isPlaying()) { return core.doAction() } | ||||||
| 	const img = core.material.images.images?.[image] | 		const img = core.material.images.images?.[image] | ||||||
| 	core.lockControl(); | 		core.lockControl(); | ||||||
| 	over.style.display = "block"; | 		over.style.display = "block"; | ||||||
| 	let globalAlpha = 0 | 		let globalAlpha = 0 | ||||||
| 	core.registerAnimationFrame("overshow", true, () => { | 		core.registerAnimationFrame("overshow", true, () => { | ||||||
| 
 | 
 | ||||||
| 		core.clearMap(ctx) | 			core.clearMap(ctx) | ||||||
| 		if (core.domStyle.isVertical) { | 			if (core.domStyle.isVertical) { | ||||||
| 			ctx.canvas.width = 1248; | 				ctx.canvas.width = 1248; | ||||||
| 			ctx.canvas.height = 2028; | 				ctx.canvas.height = 2028; | ||||||
| 			ctx.save(); //保存设置
 | 				ctx.save(); //保存设置
 | ||||||
| 			ctx.translate(1248, 0) //重新定位右上角为基准
 | 				ctx.translate(1248, 0) //重新定位右上角为基准
 | ||||||
| 			ctx.rotate(Math.PI / 2) //旋转90度
 | 				ctx.rotate(Math.PI / 2) //旋转90度
 | ||||||
| 		} else { |  | ||||||
| 			ctx.canvas.width = 2028; |  | ||||||
| 			ctx.canvas.height = 1248; |  | ||||||
| 		} |  | ||||||
| 		ctx.globalAlpha = 1 |  | ||||||
| 
 |  | ||||||
| 		if (img) { //绘制背景
 |  | ||||||
| 			ctx.drawImage(img, 0, 0, 2028, 1248) |  | ||||||
| 
 |  | ||||||
| 		} else { |  | ||||||
| 			core.fillRect(ctx, 0, 0, 2028, 1248) |  | ||||||
| 		} |  | ||||||
| 		globalAlpha++ |  | ||||||
| 		ctx.globalAlpha = globalAlpha / hidetime |  | ||||||
| 		core.setTextAlign(ctx, 'center'); |  | ||||||
| 		core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font) |  | ||||||
| 
 |  | ||||||
| 		ctx.restore(); |  | ||||||
| 		if (globalAlpha >= hidetime) { |  | ||||||
| 			core.unregisterAnimationFrame("overshow") |  | ||||||
| 			if (sound && core.material.sounds[sound] && core.musicStatus.soundStatus) { |  | ||||||
| 				core.playSound(sound, null, () => { |  | ||||||
| 					core.registerAnimationFrame("overhide", true, () => { |  | ||||||
| 
 |  | ||||||
| 						core.clearMap(ctx) |  | ||||||
| 						if (core.domStyle.isVertical) { |  | ||||||
| 							ctx.canvas.width = 1248; |  | ||||||
| 							ctx.canvas.height = 2028; |  | ||||||
| 							ctx.save(); //保存设置
 |  | ||||||
| 							ctx.translate(1248, 0) //重新定位右上角为基准
 |  | ||||||
| 							ctx.rotate(Math.PI / 2) //旋转90度
 |  | ||||||
| 						} else { |  | ||||||
| 							ctx.canvas.width = 2028; |  | ||||||
| 							ctx.canvas.height = 1248; |  | ||||||
| 						} |  | ||||||
| 						ctx.globalAlpha = 1 |  | ||||||
| 						if (img) { //绘制背景
 |  | ||||||
| 							ctx.drawImage(img, 0, 0, 2028, 1248) |  | ||||||
| 
 |  | ||||||
| 						} else { |  | ||||||
| 							core.fillRect(ctx, 0, 0, 2028, 1248) |  | ||||||
| 						} |  | ||||||
| 						globalAlpha-- |  | ||||||
| 						ctx.globalAlpha = globalAlpha / hidetime |  | ||||||
| 						core.setTextAlign(ctx, 'center'); |  | ||||||
| 						core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font) |  | ||||||
| 
 |  | ||||||
| 						ctx.restore(); |  | ||||||
| 						if (globalAlpha <= 0) { |  | ||||||
| 							over.style.display = 'none' |  | ||||||
| 							core.unregisterAnimationFrame("overhide") |  | ||||||
| 							core.unlockControl(); |  | ||||||
| 							core.doAction() |  | ||||||
| 						} |  | ||||||
| 					}) |  | ||||||
| 				}) |  | ||||||
| 			} else { | 			} else { | ||||||
| 				setTimeout(() => { | 				ctx.canvas.width = 2028; | ||||||
| 					core.registerAnimationFrame("overhide", true, () => { | 				ctx.canvas.height = 1248; | ||||||
| 
 |  | ||||||
| 						core.clearMap(ctx) |  | ||||||
| 						if (core.domStyle.isVertical) { |  | ||||||
| 							ctx.canvas.width = 1248; |  | ||||||
| 							ctx.canvas.height = 2028; |  | ||||||
| 							ctx.save(); //保存设置
 |  | ||||||
| 							ctx.translate(1248, 0) //重新定位右上角为基准
 |  | ||||||
| 							ctx.rotate(Math.PI / 2) //旋转90度
 |  | ||||||
| 						} else { |  | ||||||
| 							ctx.canvas.width = 2028; |  | ||||||
| 							ctx.canvas.height = 1248; |  | ||||||
| 						} |  | ||||||
| 						ctx.globalAlpha = 1 |  | ||||||
| 						if (img) { //绘制背景
 |  | ||||||
| 							ctx.drawImage(img, 0, 0, 2028, 1248) |  | ||||||
| 
 |  | ||||||
| 						} else { |  | ||||||
| 							core.fillRect(ctx, 0, 0, 2028, 1248) |  | ||||||
| 						} |  | ||||||
| 						globalAlpha-- |  | ||||||
| 						ctx.globalAlpha = globalAlpha / hidetime |  | ||||||
| 						core.setTextAlign(ctx, 'center'); |  | ||||||
| 						core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font) |  | ||||||
| 
 |  | ||||||
| 						ctx.restore(); |  | ||||||
| 
 |  | ||||||
| 						if (globalAlpha <= 0) { |  | ||||||
| 
 |  | ||||||
| 							over.style.display = 'none' |  | ||||||
| 							core.unregisterAnimationFrame("overhide") |  | ||||||
| 							core.unlockControl(); |  | ||||||
| 							core.doAction(); |  | ||||||
| 						} |  | ||||||
| 					}) |  | ||||||
| 				}, time) |  | ||||||
| 			} | 			} | ||||||
| 		} | 			ctx.globalAlpha = 1 | ||||||
| 	}) |  | ||||||
| 
 | 
 | ||||||
|  | 			if (img) { //绘制背景
 | ||||||
|  | 				ctx.drawImage(img, 0, 0, 2028, 1248) | ||||||
| 
 | 
 | ||||||
| } | 			} else { | ||||||
| }, | 				core.fillRect(ctx, 0, 0, 2028, 1248) | ||||||
| "属性映射": function () { | 			} | ||||||
| // 在此增加新插件
 | 			globalAlpha++ | ||||||
| this.statusEquip = function () { | 			ctx.globalAlpha = globalAlpha / hidetime | ||||||
| 	const hero = core.status.hero; |  | ||||||
| 	//装备具体效果在这里写,道具填写道具类型为equip并选择装备类型,道具的装备属性中装备类型遵循以下填写方式:
 |  | ||||||
| 	//固定装备孔的填写0/1/2/3,分别对应主手、副手、防具、饰品
 |  | ||||||
| 	//主副手同时可使用的,填写 武器
 |  | ||||||
| 	//具体的换装时装备切换操作写在新道具栏/物品栏插件
 |  | ||||||
| 	//当前仅完善法杖、单手剑、双手剑、匕首、盾牌的多孔切换操作
 |  | ||||||
| 	//主武器效果
 |  | ||||||
| 	if (core.getEquip[0]) { |  | ||||||
| 		switch (core.getEquip[0]) { |  | ||||||
| 		case "sword1": |  | ||||||
| 			hero.atk = hero.str + hero.agi; |  | ||||||
| 			hero.magic = false; |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	//副手效果
 |  | ||||||
| 	if (core.getEquip[1]) { |  | ||||||
| 		switch (core.getEquip[1]) { |  | ||||||
| 		case "sword1": |  | ||||||
| 			hero.atk += hero.agi; |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	//防具效果
 |  | ||||||
| 	if (core.getEquip[2]) { |  | ||||||
| 		switch (core.getEquip[2]) { |  | ||||||
| 		case "sword1": |  | ||||||
| 			hero.def = hero.con + hero.agi; |  | ||||||
| 			hero.hpmax = 2.5 * hero.con; |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	//饰品效果
 |  | ||||||
| 	if (core.getEquip[3]) { |  | ||||||
| 		switch (core.getEquip[3]) { |  | ||||||
| 		case "sword1": |  | ||||||
| 			hero.speed += 0.4 * hero.int + 0.6 * hero.agi; |  | ||||||
| 			break; |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| this.updateStatus = function () { |  | ||||||
| 	const hero = core.status.hero; |  | ||||||
| 	//默认映射关系
 |  | ||||||
| 	hero.hpmax = hero.str * 50 + hero.con * 50; |  | ||||||
| 	hero.atk = hero.str * 0.5 + hero.int * 0.5; |  | ||||||
| 	hero.manamax = hero.agi * 0.5 + hero.int * 0.5; |  | ||||||
| 	hero.def = hero.con * 0.5 + hero.agi * 0.5; |  | ||||||
| 	hero.mdef = hero.con * 0.5 + hero.int * 0.5; |  | ||||||
| 	hero.speed = hero.str * 0.5 + hero.agi * 0.5; |  | ||||||
| 	hero.magic = false; |  | ||||||
| 	this.statusEquip(); //处理装备效果
 |  | ||||||
| 	for (let v in hero) { //归整
 |  | ||||||
| 		if (typeof hero[v] === 'number') { |  | ||||||
| 			hero[v] = Math.floor(hero[v]) |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	hero.hp = Math.min(hero.hp, hero.hpmax) |  | ||||||
| 	hero.mana = Math.min(hero.mana, hero.manamax) |  | ||||||
| 	core.status.hero = hero |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| }, |  | ||||||
| "回合制boss战": function () { |  | ||||||
| // 在此增加新插件
 |  | ||||||
| const boss = document.createElement('canvas'); //boss战画布设置
 |  | ||||||
| boss.style.position = 'absolute'; |  | ||||||
| boss.style.zIndex = 300; |  | ||||||
| boss.style.display = "none" |  | ||||||
| boss.id = 'boss'; |  | ||||||
| main.dom.gameGroup.insertAdjacentElement('afterend', boss) |  | ||||||
| boss.style.top = "50%" |  | ||||||
| boss.style.left = "50%" |  | ||||||
| boss.style.transform = "translate(-50%,-50%)" |  | ||||||
| const ctx = boss.getContext("2d"); |  | ||||||
| main.dom.boss = boss; |  | ||||||
| boss.onclick = function (e) { |  | ||||||
| 	try { |  | ||||||
| 		e.preventDefault(); |  | ||||||
| 		if (core.isPlaying()) return false; |  | ||||||
| 		const left = core.dom.gameGroup.offsetLeft; |  | ||||||
| 		const top = core.dom.gameGroup.offsetTop; |  | ||||||
| 		const px = Math.floor((e.clientX - left) / core.domStyle.scale), |  | ||||||
| 			py = Math.floor((e.clientY - top) / core.domStyle.scale); |  | ||||||
| 		core.ui.boss.onclick(px * 3, py * 3); |  | ||||||
| 	} catch (ee) { |  | ||||||
| 		main.log(ee); |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| class boss1 { |  | ||||||
| 	constructor() { |  | ||||||
| 		this.bg = "" |  | ||||||
| 	} |  | ||||||
| 	cavans() { |  | ||||||
| 		if (core.domStyle.isVertical) { |  | ||||||
| 			ctx.canvas.width = 1248; |  | ||||||
| 			ctx.canvas.height = 2028; |  | ||||||
| 
 |  | ||||||
| 			core.setTextAlign(ctx, 'center'); | 			core.setTextAlign(ctx, 'center'); | ||||||
| 		} else { | 			core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font) | ||||||
| 			ctx.canvas.width = 2028; | 
 | ||||||
| 			ctx.canvas.height = 1248; | 			ctx.restore(); | ||||||
|  | 			if (globalAlpha >= hidetime) { | ||||||
|  | 				core.unregisterAnimationFrame("overshow") | ||||||
|  | 				if (sound && core.material.sounds[sound] && core.musicStatus.soundStatus) { | ||||||
|  | 					core.playSound(sound, null, () => { | ||||||
|  | 						core.registerAnimationFrame("overhide", true, () => { | ||||||
|  | 
 | ||||||
|  | 							core.clearMap(ctx) | ||||||
|  | 							if (core.domStyle.isVertical) { | ||||||
|  | 								ctx.canvas.width = 1248; | ||||||
|  | 								ctx.canvas.height = 2028; | ||||||
|  | 								ctx.save(); //保存设置
 | ||||||
|  | 								ctx.translate(1248, 0) //重新定位右上角为基准
 | ||||||
|  | 								ctx.rotate(Math.PI / 2) //旋转90度
 | ||||||
|  | 							} else { | ||||||
|  | 								ctx.canvas.width = 2028; | ||||||
|  | 								ctx.canvas.height = 1248; | ||||||
|  | 							} | ||||||
|  | 							ctx.globalAlpha = 1 | ||||||
|  | 							if (img) { //绘制背景
 | ||||||
|  | 								ctx.drawImage(img, 0, 0, 2028, 1248) | ||||||
|  | 
 | ||||||
|  | 							} else { | ||||||
|  | 								core.fillRect(ctx, 0, 0, 2028, 1248) | ||||||
|  | 							} | ||||||
|  | 							globalAlpha-- | ||||||
|  | 							ctx.globalAlpha = globalAlpha / hidetime | ||||||
|  | 							core.setTextAlign(ctx, 'center'); | ||||||
|  | 							core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font) | ||||||
|  | 
 | ||||||
|  | 							ctx.restore(); | ||||||
|  | 							if (globalAlpha <= 0) { | ||||||
|  | 								over.style.display = 'none' | ||||||
|  | 								core.unregisterAnimationFrame("overhide") | ||||||
|  | 								core.unlockControl(); | ||||||
|  | 								core.doAction() | ||||||
|  | 							} | ||||||
|  | 						}) | ||||||
|  | 					}) | ||||||
|  | 				} else { | ||||||
|  | 					setTimeout(() => { | ||||||
|  | 						core.registerAnimationFrame("overhide", true, () => { | ||||||
|  | 
 | ||||||
|  | 							core.clearMap(ctx) | ||||||
|  | 							if (core.domStyle.isVertical) { | ||||||
|  | 								ctx.canvas.width = 1248; | ||||||
|  | 								ctx.canvas.height = 2028; | ||||||
|  | 								ctx.save(); //保存设置
 | ||||||
|  | 								ctx.translate(1248, 0) //重新定位右上角为基准
 | ||||||
|  | 								ctx.rotate(Math.PI / 2) //旋转90度
 | ||||||
|  | 							} else { | ||||||
|  | 								ctx.canvas.width = 2028; | ||||||
|  | 								ctx.canvas.height = 1248; | ||||||
|  | 							} | ||||||
|  | 							ctx.globalAlpha = 1 | ||||||
|  | 							if (img) { //绘制背景
 | ||||||
|  | 								ctx.drawImage(img, 0, 0, 2028, 1248) | ||||||
|  | 
 | ||||||
|  | 							} else { | ||||||
|  | 								core.fillRect(ctx, 0, 0, 2028, 1248) | ||||||
|  | 							} | ||||||
|  | 							globalAlpha-- | ||||||
|  | 							ctx.globalAlpha = globalAlpha / hidetime | ||||||
|  | 							core.setTextAlign(ctx, 'center'); | ||||||
|  | 							core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font) | ||||||
|  | 
 | ||||||
|  | 							ctx.restore(); | ||||||
|  | 
 | ||||||
|  | 							if (globalAlpha <= 0) { | ||||||
|  | 
 | ||||||
|  | 								over.style.display = 'none' | ||||||
|  | 								core.unregisterAnimationFrame("overhide") | ||||||
|  | 								core.unlockControl(); | ||||||
|  | 								core.doAction(); | ||||||
|  | 							} | ||||||
|  | 						}) | ||||||
|  | 					}, time) | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		}) | ||||||
| 
 | 
 | ||||||
| 			core.setTextAlign(ctx, 'center'); |  | ||||||
| 		} |  | ||||||
| 
 | 
 | ||||||
| 	} | 	} | ||||||
| 	start() { |  | ||||||
| 
 |  | ||||||
| 	} |  | ||||||
| 	onclick(px, py) { |  | ||||||
| 
 |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| core.ui.boss = new boss1() |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user