Revert "Merge pull request #233 from universe-st/master"
This reverts commit8d2bb8cba3
, reversing changes made tof899d4c371
.
This commit is contained in:
parent
8d2bb8cba3
commit
5897375ac8
|
@ -128,59 +128,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
var source=player.storage.dcpandi_effect;
|
||||
return get.itemtype(source)!='player'||!source.isIn();
|
||||
},
|
||||
pandi_wrapKey:function(){
|
||||
var str = "";
|
||||
for(var arg of arguments){
|
||||
if(arg === null || arg === undefined){
|
||||
str += (arg + "-");
|
||||
continue;
|
||||
}
|
||||
switch(get.itemtype(arg)){
|
||||
case 'player':
|
||||
str+=("p:"+arg.playerid);
|
||||
break;
|
||||
case 'card':
|
||||
if(arg.cardid){
|
||||
str+=("c:"+arg.cardid);
|
||||
}else{
|
||||
str+=("c:"+arg.name);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
str+=("n:"+arg);
|
||||
break;
|
||||
}
|
||||
str+="-";
|
||||
}
|
||||
return str;
|
||||
},
|
||||
pandi_effect:function(target,card,player,viewer){
|
||||
if(!_status.event)return get.effect(target,card,player,viewer);
|
||||
var key = lib.skill.dcpandi.pandi_wrapKey.apply(null,arguments);
|
||||
var effect = _status.event.getTempCache('effect',key);
|
||||
if(effect !== undefined)return effect;
|
||||
effect = get.effect(target,card,player,viewer);
|
||||
_status.event.putTempCache('effect',key,effect);
|
||||
return effect;
|
||||
},
|
||||
pandi_canUse:function(player,card,target,arg1,arg2){
|
||||
if(!_status.event)return player.canUse(card,target,arg1,arg2);
|
||||
var key = lib.skill.dcpandi.pandi_wrapKey.apply(null,arguments);
|
||||
var effect = _status.event.getTempCache('canUse',key);
|
||||
if(effect !== undefined)return effect;
|
||||
effect = player.canUse(card,target,arg1,arg2);
|
||||
_status.event.putTempCache('canUse',key,effect);
|
||||
return effect;
|
||||
},
|
||||
pandi_effect_use:function(target,card,player,viewer){
|
||||
if(!_status.event)return get.effect_use(target,card,player,viewer);
|
||||
var key = lib.skill.dcpandi.pandi_wrapKey.apply(null,arguments);
|
||||
var effect = _status.event.getTempCache('effect_use',key);
|
||||
if(effect !== undefined)return effect;
|
||||
effect = get.effect_use(target,card,player,viewer);
|
||||
_status.event.putTempCache('effect_use',key,effect);
|
||||
return effect;
|
||||
},
|
||||
onChooseToUse:function(event){
|
||||
if(!game.online&&event.type=='phase'){
|
||||
var players=game.filterPlayer(function(current){
|
||||
|
@ -215,32 +162,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
if(typeof(card)=='string'){
|
||||
card={name:card,isCard:true};
|
||||
}
|
||||
var key = lib.skill.dcpandi.pandi_wrapKey(card,player,viewer);
|
||||
if(_status.event){
|
||||
var uv = _status.event.getTempCache('getUseValue',key);
|
||||
if(uv!==undefined){
|
||||
return uv;
|
||||
}
|
||||
}
|
||||
var targets=game.filterPlayer();
|
||||
var value=[];
|
||||
var min=0;
|
||||
var info=get.info(card);
|
||||
if(!info||info.notarget){
|
||||
if(_status.event){
|
||||
_status.event.putTempCache('getUseValue',key,0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if(!info||info.notarget) return 0;
|
||||
var range;
|
||||
var select=get.copy(info.selectTarget);
|
||||
if(select==undefined){
|
||||
if(info.filterTarget==undefined) {
|
||||
if(_status.event){
|
||||
_status.event.putTempCache('getUseValue',key,true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if(info.filterTarget==undefined) return true;
|
||||
range=[1,1];
|
||||
}
|
||||
else if(typeof select=='number') range=[select,select];
|
||||
|
@ -248,16 +178,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
else if(typeof select=='function') range=select(card,player);
|
||||
if(info.singleCard) range=[1,1];
|
||||
game.checkMod(card,player,range,'selectTarget',player);
|
||||
if(!range){
|
||||
if(_status.event){
|
||||
_status.event.putTempCache('getUseValue',key,0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if(!range) return 0;
|
||||
|
||||
for(var i=0;i<targets.length;i++){
|
||||
if(lib.skill.dcpandi.pandi_canUse(player,card,targets[i],null,true)){
|
||||
var eff=lib.skill.dcpandi.pandi_effect(targets[i],card,player,viewer);
|
||||
if(player.canUse(card,targets[i],null,true)){
|
||||
var eff=get.effect(targets[i],card,player,viewer);
|
||||
value.push(eff);
|
||||
}
|
||||
}
|
||||
|
@ -268,9 +193,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
if(i==range[1]||range[1]!=-1&&value[i]<=0) break;
|
||||
min+=value[i];
|
||||
}
|
||||
if(_status.event){
|
||||
_status.event.putTempCache('getUseValue',key,min);
|
||||
}
|
||||
return min;
|
||||
},
|
||||
subSkill:{
|
||||
|
@ -301,7 +223,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
if(typeof card!='object') return;
|
||||
var source=player.storage.dcpandi_effect;
|
||||
if(!source.isIn()||get.itemtype(source)!='player'||get.itemtype(source.storage.dcpandi_effect)=='player') return;
|
||||
return [0,lib.skill.dcpandi.pandi_effect_use(target,card,source,player),0,lib.skill.dcpandi.pandi_effect(target,card,source,target)]
|
||||
return [0,get.effect_use(target,card,source,player),0,get.effect(target,card,source,target)]
|
||||
},
|
||||
},
|
||||
mod:{
|
||||
|
|
19
game/game.js
19
game/game.js
|
@ -27333,25 +27333,6 @@
|
|||
this.trigger(this.name+'Cancelled');
|
||||
if(this.player&&lib.phaseName.contains(this.name)) this.player.getHistory('skipped').add(this.name)}
|
||||
},
|
||||
putTempCache:function(key1,key2,value){
|
||||
if(!this._tempCache){
|
||||
this._tempCache = {};
|
||||
}
|
||||
if(!this._tempCache[key1]){
|
||||
this._tempCache[key1] = {};
|
||||
}
|
||||
this._tempCache[key1][key2] = value;
|
||||
console.log("put:"+key1+" "+key2+" "+value);
|
||||
},
|
||||
getTempCache:function(key1,key2){
|
||||
if(!this._tempCache){
|
||||
return undefined;
|
||||
}
|
||||
if(!this._tempCache[key1]){
|
||||
return undefined;
|
||||
}
|
||||
return this._tempCache[key1][key2];
|
||||
},
|
||||
neutralize:function(event){
|
||||
this.untrigger.call(this,arguments);
|
||||
this.finish();
|
||||
|
|
Loading…
Reference in New Issue