@ -257,74 +257,74 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
return true ;
return true ;
} ,
} ,
"afterBattle" : function ( enemyId , x , y ) {
"afterBattle" : function ( enemyId , x , y ) {
// 战斗结束后触发的事件
// 战斗结束后触发的事件
var enemy = core . material . enemys [ enemyId ] ;
var enemy = core . material . enemys [ enemyId ] ;
var special = enemy . special ;
var special = enemy . special ;
// 播放战斗音效和动画
// 播放战斗音效和动画
// 默认播放的动画;你也可以使用
// 默认播放的动画;你也可以使用
var animate = 'hand '; // 默认动画
var animate = 'daji_bai '; // 默认动画
// 检查当前装备是否存在攻击动画
// 检查当前装备是否存在攻击动画
var equipId = core . getEquip ( 0 ) ;
var equipId = core . getEquip ( 0 ) ;
if ( equipId && ( core . material . items [ equipId ] . equip || { } ) . animate )
if ( equipId && ( core . material . items [ equipId ] . equip || { } ) . animate )
animate = core . material . items [ equipId ] . equip . animate ;
animate = core . material . items [ equipId ] . equip . animate ;
// 你也可以在这里根据自己的需要, 比如enemyId或special或flag来修改播放的动画效果
// 你也可以在这里根据自己的需要, 比如enemyId或special或flag来修改播放的动画效果
// if (enemyId == '...') animate = '...';
// if (enemyId == '...') animate = '...';
// 检查该动画是否存在SE, 如果不存在则使用默认音效
// 检查该动画是否存在SE, 如果不存在则使用默认音效
if ( ! ( core . material . animates [ animate ] || { } ) . se )
if ( ! ( core . material . animates [ animate ] || { } ) . se )
core . playSound ( 'attack.mp3' ) ;
core . playSound ( 'attack.mp3' ) ;
// 播放动画;如果不存在坐标(强制战斗)则播放到勇士自身
// 播放动画;如果不存在坐标(强制战斗)则播放到勇士自身
if ( x != null && y != null )
if ( x != null && y != null )
core . drawAnimate ( animate , x , y ) ;
core . drawAnimate ( animate , x , y ) ;
else
else
core . drawHeroAnimate ( animate ) ;
core . drawHeroAnimate ( animate ) ;
// 获得战斗伤害信息
// 获得战斗伤害信息
var damageInfo = core . getDamageInfo ( enemyId , null , x , y ) || { } ;
var damageInfo = core . getDamageInfo ( enemyId , null , x , y ) || { } ;
// 战斗伤害
// 战斗伤害
var damage = damageInfo . damage ;
var damage = damageInfo . damage ;
// 当前战斗回合数,可用于战后所需的判定
// 当前战斗回合数,可用于战后所需的判定
var turn = damageInfo . turn ;
var turn = damageInfo . turn ;
// 判定是否致死
// 判定是否致死
if ( damage == null || damage >= core . status . hero . hp ) {
if ( damage == null || damage >= core . status . hero . hp ) {
core . status . hero . hp = 0 ;
core . status . hero . hp = 0 ;
core . updateStatusBar ( false , true ) ;
core . updateStatusBar ( false , true ) ;
core . events . lose ( '战斗失败' ) ;
core . events . lose ( '战斗失败' ) ;
return ;
return ;
}
}
// 扣减体力值并记录统计数据
// 扣减体力值并记录统计数据
core . status . hero . hp -= damage ;
core . status . hero . hp -= damage ;
core . status . hero . statistics . battleDamage += damage ;
core . status . hero . statistics . battleDamage += damage ;
core . status . hero . statistics . battle ++ ;
core . status . hero . statistics . battle ++ ;
// 计算当前怪物的支援怪物
// 计算当前怪物的支援怪物
var guards = [ ] ;
var guards = [ ] ;
if ( x != null && y != null ) {
if ( x != null && y != null ) {
guards = core . getFlag ( "__guards__" + x + "_" + y , [ ] ) ;
guards = core . getFlag ( "__guards__" + x + "_" + y , [ ] ) ;
core . removeFlag ( "__guards__" + x + "_" + y ) ;
core . removeFlag ( "__guards__" + x + "_" + y ) ;
}
}
core . status . hero . mdef += [ 20 , 3 , 2 , 1 , 0 , 20 ] [ core . getFlag ( 'hard' , 0 ) ] ;
core . status . hero . mdef += [ 20 , 3 , 2 , 1 , 0 , 20 ] [ core . getFlag ( 'hard' , 0 ) ] ;
// 获得金币
// 获得金币
var money = guards . reduce ( function ( curr , g ) {
var money = guards . reduce ( function ( curr , g ) {
return curr + core . material . enemys [ g [ 2 ] ] . money ;
return curr + core . material . enemys [ g [ 2 ] ] . money ;
} , core . getEnemyValue ( enemy , "money" , x , y ) ) ;
} , core . getEnemyValue ( enemy , "money" , x , y ) ) ;
if ( core . hasItem ( 'coin' ) ) money *= 2 ; // 幸运金币:双倍
if ( core . hasItem ( 'coin' ) ) money *= 2 ; // 幸运金币:双倍
if ( core . hasFlag ( 'curse' ) ) money = 0 ; // 诅咒效果
if ( core . hasFlag ( 'curse' ) ) money = 0 ; // 诅咒效果
core . status . hero . money += money ;
core . status . hero . money += money ;
core . status . hero . statistics . money += money ;
core . status . hero . statistics . money += money ;
// 获得经验
// 获得经验
var exp = guards . reduce ( function ( curr , g ) {
var exp = guards . reduce ( function ( curr , g ) {
return curr + core . material . enemys [ g [ 2 ] ] . exp ;
return curr + core . material . enemys [ g [ 2 ] ] . exp ;
} , core . getEnemyValue ( enemy , "exp" , x , y ) ) ;
} , core . getEnemyValue ( enemy , "exp" , x , y ) ) ;
if ( core . hasFlag ( 'curse' ) ) exp = 0 ;
if ( core . hasFlag ( 'curse' ) ) exp = 0 ;
core . status . hero . exp += exp ;
core . status . hero . exp += exp ;
core . status . hero . statistics . exp += exp ;
core . status . hero . statistics . exp += exp ;
var hint = "打败 " + core . getEnemyValue ( enemy , "name" , x , y ) ;
var hint = "打败 " + core . getEnemyValue ( enemy , "name" , x , y ) ;
if ( core . flags . statusBarItems . indexOf ( 'enableMoney' ) >= 0 )
if ( core . flags . statusBarItems . indexOf ( 'enableMoney' ) >= 0 )
@ -333,101 +333,101 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
hint += ',' + core . getStatusLabel ( 'exp' ) + '+' + exp ; // hint += ",经验+" + exp;
hint += ',' + core . getStatusLabel ( 'exp' ) + '+' + exp ; // hint += ",经验+" + exp;
if ( ! core . getFlag ( "isNoTip" ) ) core . drawTip ( hint , enemy . id ) ;
if ( ! core . getFlag ( "isNoTip" ) ) core . drawTip ( hint , enemy . id ) ;
// 中毒
// 中毒
if ( core . enemys . hasSpecial ( special , 12 ) ) {
if ( core . enemys . hasSpecial ( special , 12 ) ) {
core . triggerDebuff ( 'get' , 'poison' ) ;
core . triggerDebuff ( 'get' , 'poison' ) ;
}
}
// 衰弱
// 衰弱
if ( core . enemys . hasSpecial ( special , 13 ) ) {
if ( core . enemys . hasSpecial ( special , 13 ) ) {
core . triggerDebuff ( 'get' , 'weak' ) ;
core . triggerDebuff ( 'get' , 'weak' ) ;
}
}
// 诅咒
// 诅咒
if ( core . enemys . hasSpecial ( special , 14 ) ) {
if ( core . enemys . hasSpecial ( special , 14 ) ) {
core . triggerDebuff ( 'get' , 'curse' ) ;
core . triggerDebuff ( 'get' , 'curse' ) ;
}
}
// 仇恨怪物将仇恨值减半
// 仇恨怪物将仇恨值减半
if ( core . enemys . hasSpecial ( special , 17 ) ) {
if ( core . enemys . hasSpecial ( special , 17 ) ) {
core . setFlag ( 'hatred' , Math . floor ( core . getFlag ( 'hatred' , 0 ) / 2 ) ) ;
core . setFlag ( 'hatred' , Math . floor ( core . getFlag ( 'hatred' , 0 ) / 2 ) ) ;
}
}
// 自爆
// 自爆
if ( core . enemys . hasSpecial ( special , 19 ) ) {
if ( core . enemys . hasSpecial ( special , 19 ) ) {
core . status . hero . statistics . battleDamage += core . status . hero . hp - 1 ;
core . status . hero . statistics . battleDamage += core . status . hero . hp - 1 ;
core . status . hero . hp = 1 ;
core . status . hero . hp = 1 ;
}
}
// 退化
// 退化
if ( core . enemys . hasSpecial ( special , 21 ) ) {
if ( core . enemys . hasSpecial ( special , 21 ) ) {
core . status . hero . atk -= ( enemy . atkValue || 0 ) ;
core . status . hero . atk -= ( enemy . atkValue || 0 ) ;
core . status . hero . def -= ( enemy . defValue || 0 ) ;
core . status . hero . def -= ( enemy . defValue || 0 ) ;
if ( core . status . hero . atk < 0 ) core . status . hero . atk = 0 ;
if ( core . status . hero . atk < 0 ) core . status . hero . atk = 0 ;
if ( core . status . hero . def < 0 ) core . status . hero . def = 0 ;
if ( core . status . hero . def < 0 ) core . status . hero . def = 0 ;
}
}
// 增加仇恨值
// 增加仇恨值
core . setFlag ( 'hatred' , core . getFlag ( 'hatred' , 0 ) + core . values . hatred ) ;
core . setFlag ( 'hatred' , core . getFlag ( 'hatred' , 0 ) + core . values . hatred ) ;
// 战后的技能处理,比如扣除魔力值
// 战后的技能处理,比如扣除魔力值
if ( core . flags . statusBarItems . indexOf ( 'enableSkill' ) >= 0 ) {
if ( core . flags . statusBarItems . indexOf ( 'enableSkill' ) >= 0 ) {
// 检测当前开启的技能类型
// 检测当前开启的技能类型
var skill = core . getFlag ( 'skill' , 0 ) ;
var skill = core . getFlag ( 'skill' , 0 ) ;
if ( skill == 1 ) { // 技能1: 二倍斩
if ( skill == 1 ) { // 技能1: 二倍斩
core . status . hero . mana -= 5 ; // 扣除5点魔力值
core . status . hero . mana -= 5 ; // 扣除5点魔力值
}
}
// 关闭技能
// 关闭技能
core . setFlag ( 'skill' , 0 ) ;
core . setFlag ( 'skill' , 0 ) ;
core . setFlag ( 'skillName' , '无' ) ;
core . setFlag ( 'skillName' , '无' ) ;
}
}
core . addPop ( x * 32 , y * 32 , core . getBlockId ( x , y ) ) ;
// 事件的处理
var todo = [ ] ;
// 事件的处理
// 加点事件
var todo = [ ] ;
var point = guards . reduce ( function ( curr , g ) {
return curr + core . material . enemys [ g [ 2 ] ] . point ;
} , core . getEnemyValue ( enemy , "point" , x , y ) ) || 0 ;
if ( core . flags . enableAddPoint && point > 0 ) {
core . push ( todo , [ { "type" : "insert" , "name" : "加点事件" , "args" : [ point ] } ] ) ;
}
// 加点事件
// 战后事件
var point = guards . reduce ( function ( curr , g ) {
if ( core . status . floorId != null ) {
return curr + core . material . enemys [ g [ 2 ] ] . point ;
core . push ( todo , core . floors [ core . status . floorId ] . afterBattle [ x + "," + y ] ) ;
} , core . getEnemyValue ( enemy , "point" , x , y ) ) || 0 ;
}
if ( core . flags . enableAddPoint && point > 0 ) {
core . push ( todo , enemy . afterBattle ) ;
core . push ( todo , [ { "type" : "insert" , "name" : "加点事件" , "args" : [ point ] } ] ) ;
}
// 战后事件
// 在这里增加其他的自定义事件需求
if ( core . status . floorId != null ) {
/ *
core . push ( todo , core . floors [ core . status . floorId ] . afterBattle [ x + "," + y ] ) ;
if ( enemyId == 'xxx' ) {
}
core . push ( todo , [
core . push ( todo , enemy . afterBattle ) ;
{ "type" : "..." , ... } ,
] ) ;
}
* /
// 在这里增加其他的自定义事件需求
// 如果事件不为空,将其插入
/ *
if ( todo . length > 0 ) core . insertAction ( todo , x , y ) ;
if ( enemyId == 'xxx' ) {
core . push ( todo , [
{ "type" : "..." , ... } ,
] ) ;
}
* /
// 如果事件不为空,将其插入
// 删除该点设置的怪物信息
if ( todo . length > 0 ) core . insertAction ( todo , x , y ) ;
delete ( ( flags . enemyOnPoint || { } ) [ core . status . floorId ] || { } ) [ x + "," + y ] ;
// 删除该点设置的怪物信息
// 因为removeBlock和hideBlock都会刷新状态栏, 因此将删除部分移动到这里并保证刷新只执行一次, 以提升效率
delete ( ( flags . enemyOnPoint || { } ) [ core . status . floorId ] || { } ) [ x + "," + y ] ;
if ( core . getBlock ( x , y ) != null ) {
// 检查是否是重生怪物;如果是则仅隐藏不删除
if ( core . hasSpecial ( enemy . special , 23 ) ) {
core . hideBlock ( x , y ) ;
} else {
core . removeBlock ( x , y ) ;
}
} else {
core . updateStatusBar ( ) ;
}
// 因为removeBlock和hideBlock都会刷新状态栏, 因此将删除部分移动到这里并保证刷新只执行一次, 以提升效率
// 如果已有事件正在处理中
if ( core . getBlock ( x , y ) != null ) {
if ( core . status . event . id == null )
// 检查是否是重生怪物;如果是则仅隐藏不删除
core . continueAutomaticRoute ( ) ;
if ( core . hasSpecial ( enemy . special , 23 ) ) {
else
core . hideBlock ( x , y ) ;
core . clearContinueAutomaticRoute ( ) ;
} else {
core . removeBlock ( x , y ) ;
}
} else {
core . updateStatusBar ( ) ;
}
// 如果已有事件正在处理中
} ,
if ( core . status . event . id == null )
core . continueAutomaticRoute ( ) ;
else
core . clearContinueAutomaticRoute ( ) ;
} ,
"afterOpenDoor" : function ( doorId , x , y ) {
"afterOpenDoor" : function ( doorId , x , y ) {
// 开一个门后触发的事件
// 开一个门后触发的事件
@ -450,27 +450,29 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core . clearContinueAutomaticRoute ( ) ;
core . clearContinueAutomaticRoute ( ) ;
} ,
} ,
"afterGetItem" : function ( itemId , x , y , isGentleClick ) {
"afterGetItem" : function ( itemId , x , y , isGentleClick ) {
// 获得一个道具后触发的事件
// 获得一个道具后触发的事件
// itemId: 获得的道具ID; x和y是该道具所在的坐标
// itemId: 获得的道具ID; x和y是该道具所在的坐标
// isGentleClick: 是否是轻按触发的
// isGentleClick: 是否是轻按触发的
if ( itemId . endsWith ( 'Potion' ) && core . material . items [ itemId ] . cls == 'items' )
if ( itemId . endsWith ( 'Potion' ) && core . material . items [ itemId ] . cls == 'items' )
core . playSound ( '回血' ) ;
core . playSound ( '回血' ) ;
else if ( itemId . endsWith ( 'Gem' ) && core . material . items [ itemId ] . cls == 'items' )
else if ( itemId . endsWith ( 'Gem' ) && core . material . items [ itemId ] . cls == 'items' )
core . playSound ( '宝石' )
core . playSound ( '宝石' )
else
else
core . playSound ( '获得道具' ) ;
core . playSound ( '获得道具' ) ;
var todo = [ ] ;
// 检查该点的获得道具后事件。
if ( core . status . floorId == null ) return ;
var event = core . floors [ core . status . floorId ] . afterGetItem [ x + "," + y ] ;
if ( event && ( event instanceof Array || ! isGentleClick || ! event . disableOnGentleClick ) ) {
if ( event . data ) event = event . data ;
core . unshift ( todo , event ) ;
}
if ( todo . length > 0 ) core . insertAction ( todo , x , y ) ;
} ,
var todo = [ ] ;
// 检查该点的获得道具后事件。
if ( core . status . floorId == null ) return ;
var event = core . floors [ core . status . floorId ] . afterGetItem [ x + "," + y ] ;
if ( event && ( event instanceof Array || ! isGentleClick || ! event . disableOnGentleClick ) ) {
if ( event . data ) event = event . data ;
core . unshift ( todo , event ) ;
}
if ( todo . length > 0 ) core . insertAction ( todo , x , y ) ;
} ,
"afterPushBox" : function ( ) {
"afterPushBox" : function ( ) {
// 推箱子后的事件
// 推箱子后的事件
if ( core . searchBlock ( 'box' ) . length == 0 ) {
if ( core . searchBlock ( 'box' ) . length == 0 ) {
@ -1653,7 +1655,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core . ui . fillText ( ctx , text , x , y , style ) ;
core . ui . fillText ( ctx , text , x , y , style ) ;
} ,
} ,
fill1 = function ( text , x , y , style ) {
fill1 = function ( text , x , y , style ) {
core . ui . setFont ( ctx , '1 0 px fzchyjw') ;
core . ui . setFont ( ctx , '1 4 px fzchyjw') ;
core . ui . fillText ( ctx , text , x , y , style ) ;
core . ui . fillText ( ctx , text , x , y , style ) ;
} ;
} ;
@ -1709,7 +1711,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
fill ( core . formatBigNumber ( core . status . hero . money ) , 107 , 91 + 35 + 36 + 34 + 32 , '#000000' ) ;
fill ( core . formatBigNumber ( core . status . hero . money ) , 107 , 91 + 35 + 36 + 34 + 32 , '#000000' ) ;
fill ( core . getFlag ( "juqing" , 0 ) , 107 , 91 + 35 + 36 + 34 + 32 + 32 , '#FF0000' ) ;
fill ( core . getFlag ( "juqing" , 0 ) , 107 , 91 + 35 + 36 + 34 + 32 + 32 , '#FF0000' ) ;
ctx . textAlign = 'left' ;
ctx . textAlign = 'left' ;
if ( flags . hard - 4 ) fill1 ( '[' + core . formatBigNumber ( core . getRealStatus ( 'mdef' ) ) + ']' , 7 6, 174 , '#FF1495 ') ;
if ( flags . hard - 4 ) fill1 ( '[' + core . formatBigNumber ( core . getRealStatus ( 'mdef' ) ) + ']' , 7 2, 176 , '#c800c8 ') ;
if ( core . status . event . id !== 'book' && core . status . event . id !== 'book-detail' && core . status . event . id !== 'toolbox' ) {
if ( core . status . event . id !== 'book' && core . status . event . id !== 'book-detail' && core . status . event . id !== 'toolbox' ) {
core . drawImage ( ctx , core . material . images . items , 0 , 0 , 32 , 128 , 13 , 300 , 28 , 112 ) ;
core . drawImage ( ctx , core . material . images . items , 0 , 0 , 32 , 128 , 13 , 300 , 28 , 112 ) ;
fill ( '黄钥匙' , 50 , 320 , '#FFFF80' ) ;
fill ( '黄钥匙' , 50 , 320 , '#FFFF80' ) ;
@ -1743,7 +1745,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
//else
//else
fill ( hour + ':' + minutes + ':' + seconds , 140 , 360 , "#ffffff" ) ;
fill ( hour + ':' + minutes + ':' + seconds , 140 , 360 , "#ffffff" ) ;
fill ( step , 140 , 455 , '#ffffff' ) ;
fill ( step , 140 , 455 , '#ffffff' ) ;
setTimeout ( function ( ) { core . ui . drawStatusBar ( ) ; } , 100 ) ;
setTimeout ( function ( ) { core . ui . drawStatusBar ( ) ; } , 100 ) ;
}
}
if ( core . status . floorId == "nandu" ) {
if ( core . status . floorId == "nandu" ) {
core . dom . statusCanvas . width *= 1 ;
core . dom . statusCanvas . width *= 1 ;