All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
``` docs(readme): 更新文档说明 - 添加了项目使用说明 - 补充了配置项解释 - 修正了错误的示例代码 ``` 注意:由于没有具体的代码差异信息,无法生成准确的commit
78 lines
1.6 KiB
Go
78 lines
1.6 KiB
Go
package effect
|
||
|
||
import (
|
||
"blazing/logic/service/fight/info"
|
||
"blazing/logic/service/fight/input"
|
||
"blazing/logic/service/fight/node"
|
||
"math"
|
||
|
||
"github.com/alpacahq/alpacadecimal"
|
||
)
|
||
|
||
/**
|
||
* n回合内没有击败,则对方死亡
|
||
*/
|
||
type Effect62 struct {
|
||
node.EffectNode
|
||
// Hide bool // 是否隐藏 正常是命中就可用,镇魂歌是回合数到才可用
|
||
// opp *input.Input
|
||
// e *Effect62_sub
|
||
//l sync.Once
|
||
}
|
||
type Effect62_sub struct {
|
||
node.EffectNode
|
||
duy int
|
||
//bindpet *info.BattlePetEntity
|
||
//bind *input.Input
|
||
|
||
// Hide bool // 是否隐藏 正常是命中就可用,镇魂歌是回合数到才可用
|
||
|
||
}
|
||
|
||
func (e *Effect62_sub) TurnEnd() {
|
||
|
||
e.duy--
|
||
|
||
}
|
||
|
||
// 这个实际上在对方回合执行的
|
||
func (e *Effect62_sub) OnSkill() bool {
|
||
//fmt.Println("镇魂歌剩余回合", e.duy)
|
||
//defer e.Alive(false)
|
||
if e.duy <= 0 { //说明对方没有切换精灵
|
||
//直接扣除所有血量OnSkill
|
||
//相当于对方给自己的伤害
|
||
e.Ctx().Our.Damage(e.Ctx().Opp, &info.DamageZone{
|
||
Type: info.DamageType.Fixed,
|
||
Damage: alpacadecimal.NewFromInt(int64(e.Ctx().Our.CurrentPet.Info.MaxHp)),
|
||
})
|
||
e.Alive(false)
|
||
}
|
||
return true
|
||
}
|
||
func init() {
|
||
t := &Effect62{
|
||
EffectNode: node.EffectNode{},
|
||
}
|
||
|
||
input.InitEffect(input.EffectType.Skill, 62, t)
|
||
|
||
}
|
||
|
||
// 魂印开局添加,然后切精灵不消失
|
||
func (e *Effect62) OnSkill() bool {
|
||
|
||
//e.Duration(1) //必须保持到下一回合,这样才会被复制
|
||
// e.opp = ctx.Input
|
||
ee := &Effect62_sub{
|
||
|
||
// bindpet: ctx.CurrentPet,
|
||
// bind: ctx.Input,
|
||
}
|
||
ee.duy = e.EffectNode.SideEffectArgs[0]
|
||
|
||
e.GenSub(ee, math.MaxInt)
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, ee)
|
||
return true
|
||
}
|