canvas动画
This commit is contained in:
parent
e55ad39a76
commit
27c3e2203a
|
@ -353,7 +353,7 @@ card.hearth={
|
|||
content:function(){
|
||||
'step 0'
|
||||
for(var i=0;i<targets.length;i++){
|
||||
if(!targets[i].num('h')) target.splice(i--,1);
|
||||
if(!targets[i].num('h')) targets.splice(i--,1);
|
||||
}
|
||||
if(targets.contains(player)){
|
||||
event.current=player;
|
||||
|
@ -389,6 +389,7 @@ card.hearth={
|
|||
filterTarget:function(card,player,target){return player==target},
|
||||
content:function(){
|
||||
target.gainMaxHp();
|
||||
target.recover();
|
||||
target.discard(target.get('h'));
|
||||
},
|
||||
ai:{
|
||||
|
@ -400,8 +401,8 @@ card.hearth={
|
|||
result:{
|
||||
target:function(player,target){
|
||||
var nh=target.num('h');
|
||||
if(nh<=1) return 1;
|
||||
if(nh==2&&target.hp==target.maxHp) return 1;
|
||||
if(nh<=2) return 1;
|
||||
if(target.hp==1&&target.maxHp>2) return 1;
|
||||
return 0;
|
||||
},
|
||||
},
|
||||
|
@ -418,7 +419,7 @@ card.hearth={
|
|||
content:function(){
|
||||
var num=player.num('h')-target.num('h');
|
||||
if(num<1) num=1;
|
||||
if(num>4) num=4;
|
||||
if(num>3) num=3;
|
||||
target.draw(num);
|
||||
},
|
||||
ai:{
|
||||
|
@ -468,6 +469,8 @@ card.hearth={
|
|||
useful:[6,3],
|
||||
result:{
|
||||
target:function(player,target){
|
||||
var eff=ai.get.recoverEffect(target,player,target);
|
||||
if(eff<=0) return 0;
|
||||
var num=target.maxHp-target.hp;
|
||||
if(num<1) return 0;
|
||||
if(num==1) return 1;
|
||||
|
@ -550,13 +553,13 @@ card.hearth={
|
|||
},
|
||||
translate:{
|
||||
shenenshu:'神恩术',
|
||||
shenenshu_info:'对一名其他角色使用,令其摸X张牌,直到手牌数与你相等(X不小于1且不大于4)',
|
||||
shenenshu_info:'对一名其他角色使用,令其摸X张牌,直到手牌数与你相等(X不小于1且不大于3)',
|
||||
zhiliaobo:'治疗波',
|
||||
zhiliaobo_info:'对一名受伤角色使用,令其回复一点体力,若其仍处于受伤状态,则进行一次判定,若结果为红色则再回复一点体力',
|
||||
yuansuhuimie:'元素毁灭',
|
||||
yuansuhuimie_info:'对所有角色使用,令目标弃置1~2张牌,并受到2-X点雷电伤害,X为其弃置的手牌数',
|
||||
yuansuhuimie_info:'对所有角色使用,令目标弃置0~2张牌,并受到2-X点雷电伤害,X为其弃置的手牌数',
|
||||
xingjiegoutong:'星界沟通',
|
||||
xingjiegoutong_info:'增加一点体力上限,弃置你的所有手牌',
|
||||
xingjiegoutong_info:'增加一点体力上限并回复一点体力,弃置你的所有手牌',
|
||||
tanshezhiren:'弹射之刃',
|
||||
tanshezhiren_info:'弃置一名随机角色的手牌,重复此过程直到有一名角色失去最后一张手牌',
|
||||
chuansongmen:'传送门',
|
||||
|
|
|
@ -161,7 +161,6 @@ character.hearth={
|
|||
effect:{
|
||||
player:function(card,player,target,current){
|
||||
if(get.color(card)=='black'&&get.tag(card,'damage')){
|
||||
console.log(1);
|
||||
return [1,0,1,-2];
|
||||
}
|
||||
}
|
||||
|
@ -169,15 +168,25 @@ character.hearth={
|
|||
}
|
||||
},
|
||||
bingshi:{
|
||||
trigger:{player:'dieBegin'},
|
||||
global:'bingshi2'
|
||||
},
|
||||
bingshi2:{
|
||||
trigger:{global:'dieAfter'},
|
||||
forced:true,
|
||||
filter:function(event,player){
|
||||
return !event.player.storage.bingshi;
|
||||
},
|
||||
content:function(){
|
||||
'step 0'
|
||||
event.targets=get.players(player);
|
||||
event.targets.remove(player);
|
||||
event.targets=get.players(trigger.player);
|
||||
event.targets.remove(trigger.player);
|
||||
trigger.player.storage.bingshi=true;
|
||||
'step 1'
|
||||
if(event.targets.length){
|
||||
event.targets.shift().damage();
|
||||
var current=event.targets.shift();
|
||||
trigger.player.line(current,'thunder');
|
||||
current.damage('nosource').animate=false;
|
||||
current.$damage(trigger.player);
|
||||
event.redo();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -777,6 +777,7 @@ character.sp={
|
|||
trigger:{player:'phaseBegin'},
|
||||
forced:true,
|
||||
popup:false,
|
||||
silent:true,
|
||||
content:function(){
|
||||
player.unmarkSkill('wangzun');
|
||||
player.storage.wangzun=null;
|
||||
|
|
110
game/game.js
110
game/game.js
|
@ -1696,7 +1696,17 @@
|
|||
}
|
||||
}
|
||||
player.changeHp(-num,false);
|
||||
player.$damage(source);
|
||||
if(event.animate!==false){
|
||||
player.$damage(source);
|
||||
if(lib.config.animation){
|
||||
if(event.nature=='fire'){
|
||||
player.$fire();
|
||||
}
|
||||
else if(event.nature=='thunder'){
|
||||
player.$thunder();
|
||||
}
|
||||
}
|
||||
}
|
||||
player.popup(-num,event.nature);
|
||||
// if(source){
|
||||
// if(player._damagetimeout!=source){
|
||||
|
@ -3319,6 +3329,7 @@
|
|||
if(next.num==undefined) next.num=1;
|
||||
if(next.nature=='poison') delete next._triggered;
|
||||
next.content=lib.element.playerproto.damage;
|
||||
return next;
|
||||
},
|
||||
recover:function(){
|
||||
var next=game.createEvent('recover');
|
||||
|
@ -4237,6 +4248,14 @@
|
|||
}
|
||||
if(list.length) this.$draw(list);
|
||||
},
|
||||
$fire:function(){
|
||||
game.animate.flame(this.offsetLeft+this.offsetWidth/2,
|
||||
this.offsetTop+this.offsetHeight-20,700,'fire');
|
||||
},
|
||||
$thunder:function(){
|
||||
game.animate.flame(this.offsetLeft+this.offsetWidth/2,
|
||||
this.offsetTop+this.offsetHeight-20,700,'thunder');
|
||||
},
|
||||
$damage:function(source){
|
||||
if(source&&source!=this){
|
||||
var left,top;
|
||||
|
@ -5302,6 +5321,94 @@
|
|||
lib.status.canvas=true;
|
||||
game.update(lib.updateCanvas);
|
||||
}
|
||||
},
|
||||
animate:{
|
||||
flame:function(x,y,duration,type){
|
||||
var particles=[];
|
||||
var particle_count=50;
|
||||
if(type=='thunder'){
|
||||
particle_count=10;
|
||||
}
|
||||
for(var i = 0; i < particle_count; i++) {
|
||||
particles.push(new particle());
|
||||
}
|
||||
function particle() {
|
||||
this.speed = {x: -1+Math.random()*2, y: -5+Math.random()*5};
|
||||
this.location = {x: x, y: y};
|
||||
|
||||
this.radius = .5+Math.random()*1;
|
||||
|
||||
this.life = 10+Math.random()*10;
|
||||
this.death = this.life;
|
||||
|
||||
if(type=='thunder'){
|
||||
this.radius*=3;
|
||||
this.life*=1.2;
|
||||
this.death*=1.2;
|
||||
}
|
||||
|
||||
switch(type){
|
||||
case 'thunder':{
|
||||
this.b = 255;
|
||||
this.r = Math.round(Math.random()*255);
|
||||
this.g = Math.round(Math.random()*255);
|
||||
break;
|
||||
}
|
||||
case 'fire':{
|
||||
this.r = 255;
|
||||
this.g = Math.round(Math.random()*155);
|
||||
this.b = 0;
|
||||
break;
|
||||
}
|
||||
default:{
|
||||
this.r = 255;
|
||||
this.g = Math.round(Math.random()*155);
|
||||
this.b = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
game.draw(function(time,surface){
|
||||
surface.globalCompositeOperation = "source-over";
|
||||
surface.globalCompositeOperation = "lighter";
|
||||
|
||||
for(var i = 0; i < particles.length; i++)
|
||||
{
|
||||
var p = particles[i];
|
||||
|
||||
surface.beginPath();
|
||||
|
||||
p.opacity = Math.round(p.death/p.life*100)/100
|
||||
var gradient = surface.createRadialGradient(p.location.x, p.location.y, 0, p.location.x, p.location.y, p.radius);
|
||||
gradient.addColorStop(0, "rgba("+p.r+", "+p.g+", "+p.b+", "+p.opacity+")");
|
||||
gradient.addColorStop(0.5, "rgba("+p.r+", "+p.g+", "+p.b+", "+p.opacity+")");
|
||||
gradient.addColorStop(1, "rgba("+p.r+", "+p.g+", "+p.b+", 0)");
|
||||
surface.fillStyle = gradient;
|
||||
surface.arc(p.location.x, p.location.y, p.radius, Math.PI*2, false);
|
||||
surface.fill();
|
||||
p.death--;
|
||||
p.radius++;
|
||||
p.location.x += (p.speed.x);
|
||||
p.location.y += (p.speed.y);
|
||||
|
||||
if(p.death < 0 || p.radius < 0){
|
||||
if(typeof duration=='number'&&time+500>=duration){
|
||||
particles.splice(i--,1);
|
||||
}
|
||||
else{
|
||||
particles[i] = new particle();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(particles.length==0){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
animatex:function(){
|
||||
|
||||
|
||||
},
|
||||
linexy:function(path){
|
||||
var from=[path[0],path[1]];
|
||||
|
@ -7425,6 +7532,7 @@
|
|||
appearence.push(ui.create.switcher('threed_card',lib.config.threed_card,ui.click.sidebar.threed_card));
|
||||
appearence.push(ui.create.switcher('blur_ui',lib.config.blur_ui,ui.click.sidebar.blur_ui));
|
||||
appearence.push(ui.create.switcher('right_sidebar',lib.config.right_sidebar,ui.click.sidebar.right_sidebar));
|
||||
appearence.push(ui.create.switcher('animation',lib.config.animation,ui.click.sidebar.global));
|
||||
|
||||
// appearence.push(ui.create.div('.placeholder'));
|
||||
// appearence.push(ui.create.switcher('intro',['⦿','☯','●','❖','✻','i'],lib.config.intro,ui.click.sidebar.intro));
|
||||
|
|
Loading…
Reference in New Issue