Add the ability for lib.element.player.damage to detect lib.element.event.baseDamage and lib.element.event.extraDamage.

This commit is contained in:
Tipx-L 2023-09-20 04:21:51 -07:00
parent 7cee261cc7
commit dd5fb6d5af
7 changed files with 24 additions and 23 deletions

View File

@ -68,7 +68,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
content:function(){ content:function(){
if(typeof event.baseDamage!='number') event.baseDamage=1; if(typeof event.baseDamage!='number') event.baseDamage=1;
if(target.isDying()||event.getParent(2).type=='dying'){ if(target.isDying()||event.getParent(2).type=='dying'){
target.recover(event.baseDamage); target.recover();
if(_status.currentPhase==target){ if(_status.currentPhase==target){
target.getStat().card.jiu--; target.getStat().card.jiu--;
} }
@ -210,7 +210,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
game.delay(2); game.delay(2);
"step 2" "step 2"
if(result.bool){ if(result.bool){
target.damage('fire',event.baseDamage||1); target.damage('fire');
} }
else{ else{
target.addTempSkill('huogong2'); target.addTempSkill('huogong2');

View File

@ -462,13 +462,13 @@ game.import('card',function(lib,game,ui,get,ai,_status){
target.discard(target.getCards('e',function(card){ target.discard(target.getCards('e',function(card){
return lib.filter.cardDiscardable(card,target,'shuiyanqijunx'); return lib.filter.cardDiscardable(card,target,'shuiyanqijunx');
})); }));
target.damage('thunder',event.baseDamage||1); target.damage('thunder');
event.finish(); event.finish();
} }
else if(!target.countCards('e',function(card){ else if(!target.countCards('e',function(card){
return lib.filter.cardDiscardable(card,target,'shuiyanqijunx'); return lib.filter.cardDiscardable(card,target,'shuiyanqijunx');
})){ })){
var next=target.damage(event.baseDamage||1); var next=target.damage();
if(!get.is.single()) next.nature='thunder'; if(!get.is.single()) next.nature='thunder';
event.finish(); event.finish();
return; return;
@ -489,7 +489,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
})); }));
} }
else{ else{
var next=target.damage(event.baseDamage||1); var next=target.damage();
if(!get.is.single()) next.nature='thunder' if(!get.is.single()) next.nature='thunder'
} }
event.finish(); event.finish();
@ -861,7 +861,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
selectTarget:-1, selectTarget:-1,
modTarget:true, modTarget:true,
content:function(){ content:function(){
target.damage('fire',event.baseDamage||1); target.damage('fire');
}, },
ai:{ ai:{
order:5, order:5,

View File

@ -171,7 +171,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
} }
"step 3" "step 3"
if((!result||!result.bool||!result.result||result.result!='shaned')&&!event.unhurt){ if((!result||!result.bool||!result.result||result.result!='shaned')&&!event.unhurt){
target.damage(get.nature(event.card),event.baseDamage+event.extraDamage); target.damage(get.nature(event.card));
event.result={bool:true} event.result={bool:true}
event.trigger('shaDamage'); event.trigger('shaDamage');
} }
@ -193,7 +193,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}); });
"step 5" "step 5"
if((!result||!result.bool)&&!event.unhurt){ if((!result||!result.bool)&&!event.unhurt){
target.damage(get.nature(event.card),event.baseDamage+event.extraDamage); target.damage(get.nature(event.card));
event.result={bool:true} event.result={bool:true}
event.trigger('shaDamage'); event.trigger('shaDamage');
event.finish(); event.finish();
@ -203,7 +203,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
} }
"step 6" "step 6"
if((!result||!result.bool)&&!event.unhurt){ if((!result||!result.bool)&&!event.unhurt){
target.damage(get.nature(event.card),event.baseDamage+event.extraDamage); target.damage(get.nature(event.card));
event.result={bool:true} event.result={bool:true}
event.trigger('shaDamage'); event.trigger('shaDamage');
event.finish(); event.finish();
@ -388,7 +388,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
return target.hp<target.maxHp; return target.hp<target.maxHp;
}, },
content:function(){ content:function(){
target.recover(event.baseDamage||1); target.recover();
}, },
ai:{ ai:{
basic:{ basic:{
@ -846,7 +846,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
return target.isHealthy(); return target.isHealthy();
}, },
content:function(){ content:function(){
target.recover(event.baseDamage||1); target.recover();
}, },
ai:{ ai:{
basic:{ basic:{
@ -895,7 +895,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
} }
"step 1" "step 1"
if(result.bool==false){ if(result.bool==false){
target.damage(event.baseDamage); target.damage();
} }
}, },
ai:{ ai:{
@ -970,7 +970,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
} }
"step 1" "step 1"
if(result.bool==false){ if(result.bool==false){
target.damage(event.baseDamage); target.damage();
} }
}, },
ai:{ ai:{
@ -1147,10 +1147,10 @@ game.import('card',function(lib,game,ui,get,ai,_status){
} }
else{ else{
if(event.turn==target){ if(event.turn==target){
target.damage(event.baseDamage+event.extraDamage); target.damage();
} }
else{ else{
player.damage(target,event.baseDamage+event.extraDamage); player.damage(target);
} }
} }
} }

View File

@ -154,7 +154,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
'step 1' 'step 1'
if(result.bool){ if(result.bool){
target.showCards(result.cards); target.showCards(result.cards);
if(get.suit(card)!=get.suit(result.cards[0])) target.damage(event.baseDamage||1); if(get.suit(card)!=get.suit(result.cards[0])) target.damage();
} }
}, },
ai:{ ai:{

View File

@ -30,7 +30,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}, },
content:function(){ content:function(){
'step 0' 'step 0'
target.recover(event.baseDamage||1); target.recover();
'step 1' 'step 1'
if(target.hasCard(function(card){ if(target.hasCard(function(card){
return _status.connectMode||get.name(card,target)=='du'; return _status.connectMode||get.name(card,target)=='du';
@ -56,6 +56,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
content:function(){ content:function(){
'step 0' 'step 0'
if(typeof event.baseDamage!='number') event.baseDamage=1; if(typeof event.baseDamage!='number') event.baseDamage=1;
if(typeof event.extraDamage!='number') event.extraDamage=0;
if(!target.countCards('h')||!player.isIn()) event.finish(); if(!target.countCards('h')||!player.isIn()) event.finish();
else player.choosePlayerCard(target,'h',true); else player.choosePlayerCard(target,'h',true);
'step 1' 'step 1'
@ -64,8 +65,8 @@ game.import('card',function(lib,game,ui,get,ai,_status){
var str=get.translation(player); var str=get.translation(player);
player.showCards(event.show_card); player.showCards(event.show_card);
target.chooseControl().set('choiceList',[ target.chooseControl().set('choiceList',[
'令'+str+'获得'+get.translation(event.show_card), `${str}获得${get.translation(event.show_card)}`,
'受到'+str+'造成的'+event.baseDamage+'点伤害', `受到${str}造成的${event.baseDamage+event.extraDamage}点伤害`,
]).set('ai',function(){ ]).set('ai',function(){
var evt=_status.event.getParent(),player=evt.target,source=evt.player,card=evt.show_card; var evt=_status.event.getParent(),player=evt.target,source=evt.player,card=evt.show_card;
if(get.damageEffect(player,source,player)>0) return 1; if(get.damageEffect(player,source,player)>0) return 1;

View File

@ -1080,7 +1080,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
game.delay(2); game.delay(2);
"step 2" "step 2"
if(result.bool){ if(result.bool){
target.damage('fire',event.baseDamage||1); target.damage('fire');
} }
else{ else{
target.addTempSkill('huogong2'); target.addTempSkill('huogong2');

View File

@ -23783,7 +23783,7 @@
if(next.source==undefined&&!nosource) next.source=event.customSource||event.player; if(next.source==undefined&&!nosource) next.source=event.customSource||event.player;
if(next.source&&next.source.isDead()) delete next.source; if(next.source&&next.source.isDead()) delete next.source;
if(next.unreal==undefined) next.unreal=false; if(next.unreal==undefined) next.unreal=false;
if(next.num==undefined) next.num=1; if(next.num==undefined) next.num=(event.baseDamage||1)+(event.extraDamage||0);
next.original_num=next.num; next.original_num=next.num;
next.change_history=[]; next.change_history=[];
if(next.nature=='poison') delete next._triggered; if(next.nature=='poison') delete next._triggered;
@ -23833,8 +23833,8 @@
} }
if(next.card==undefined&&!nocard) next.card=event.card; if(next.card==undefined&&!nocard) next.card=event.card;
if(next.cards==undefined&&!nocard) next.cards=event.cards; if(next.cards==undefined&&!nocard) next.cards=event.cards;
if(next.source==undefined&&!nosource) next.source=event.player; if(next.source==undefined&&!nosource) next.source=event.customSource||event.player;
if(next.num==undefined) next.num=1; if(next.num==undefined) next.num=(event.baseDamage||1)+(event.extraDamage||0);
if(next.num<=0) _status.event.next.remove(next); if(next.num<=0) _status.event.next.remove(next);
next.setContent('recover'); next.setContent('recover');
return next; return next;