package effect

import (
	"blazing/common/utils"
	"blazing/logic/service/fight/info"
	"blazing/logic/service/fight/input"
	"blazing/logic/service/fight/node"
)

/**
 * 连续使用每次威力增加n，最高威力m
 */

func init() {
	input.InitEffect(input.EffectType.Skill, 9, &Effect9{
		EffectNode: node.EffectNode{},
	})

}

type Effect9 struct {
	node.EffectNode
	Skillid       int //记录使用的技能 ，如果技能变了就删除effect
	UseSkillCount int //技能使用了多少次，切换后置0
}

func (e *Effect9) BeforeSkill(opp *input.Input, skill *info.SkillEntity) {
	if e.Skillid != 0 && skill.ID != e.Skillid {
		e.NotALive()
		e.UseSkillCount = 0
		return

	}
	e.Skillid = skill.ID
	add := e.EffectNode.SideEffectArgs[0] * e.UseSkillCount

	skill.Power += utils.Min(add, e.EffectNode.SideEffectArgs[1])

	e.UseSkillCount++

}
