var gameConfig =require("gameConfig") var buffConfig = gameConfig.buffConfig var buffobj = function(bid){ var cfg = buffConfig[bid] this.duration_time = cfg.duration_time if(!this.duration_time){ this.duration_time = 0 } this.lasting_time = this.duration_time*1000 this.left_time = this.lasting_time this.buff_effect = cfg.buff_effect this.buff_id = bid this.cfg = cfg this.add = function(target){ this.target = target if(this.buff_effect==3){ target.shotadd.x = -22 target.shotadd.y = 22 target.addv(Number(this.cfg.buff_param1),Number(this.cfg.buff_param3),Number(this.cfg.buff_param2)) } else if(this.buff_effect==1){ target.addv(Number(this.cfg.buff_param1),Number(this.cfg.buff_param3),Number(this.cfg.buff_param2)) } else if(this.buff_effect==24){ target.tiaosan = true } } this.remove = function(){ if(this.buff_effect==1||this.buff_effect==3){ this.target.removev(Number(this.cfg.buff_param1),Number(this.cfg.buff_param3),Number(this.cfg.buff_param2)) } else if(this.buff_effect==24){ this.target.tiaosan = false this.target.luodi() } } this.update = function(dt){ this.duration_time-=dt this.left_time = this.duration_time*1000 if(this.duration_time<=0){ this.remove() return true } return false } } module.exports = buffobj;