package effect import ( "blazing/logic/service/fight/action" "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" ) // ----------------------------------------------------------- // 效果124:命中后,{0}%概率随机对方一个属性{1}个等级 // ----------------------------------------------------------- type Effect124 struct { node.EffectNode } func (e *Effect124) OnSkill() bool { chance := int(e.Args()[0].IntPart()) changeAmount := int(e.Args()[1].IntPart()) ok, _, _ := e.Input.Player.Roll(chance, 100) if !ok { return true } // 随机选择一个属性(0-5,包含攻击、防御、特攻、特防、速度、命中) propIndex := int(e.Input.FightC.GetRand().Int31n(6)) opType := info.AbilityOpType.ADD if changeAmount < 0 { opType = info.AbilityOpType.SUB } e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), opType) return true } // ----------------------------------------------------------- // 效果126:{0}回合内每回合自身攻击和速度提高{1}个等级 // ----------------------------------------------------------- type Effect126 struct { node.EffectNode } func (e *Effect126) SetArgs(t *input.Input, a ...int) { e.EffectNode.SetArgs(t, a...) e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) } func (e *Effect126) TurnStart(_, _ *action.SelectSkillAction) { changeAmount := int(e.Args()[1].IntPart()) // 攻击等级+1 (属性索引0) e.Ctx().Our.SetProp(e.Ctx().Our, 0, int8(changeAmount), info.AbilityOpType.ADD) // 速度等级+1 (属性索引4) e.Ctx().Our.SetProp(e.Ctx().Our, 4, int8(changeAmount), info.AbilityOpType.ADD) } // ----------------------------------------------------------- // 初始化 // ----------------------------------------------------------- func init() { input.InitEffect(input.EffectType.Skill, 124, &Effect124{}) input.InitEffect(input.EffectType.Skill, 126, &Effect126{}) }