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