refactor(fight/effect): 统一效果索引从0开始,调整循环范围和伤害效果初始化

This commit is contained in:
1
2025-09-23 17:42:41 +00:00
parent d52a9a05fa
commit 82d4b4bb59
4 changed files with 7 additions and 22 deletions

View File

@@ -17,7 +17,7 @@ func init() {
},
}
for i := 1; i < 7; i++ {
for i := 0; i < 6; i++ {
input.InitPropEffect(i, prop)
}

View File

@@ -50,6 +50,6 @@ func (this *Effect0) IsCrit(opp *input.Input, skill *info.SkillEntity) {
}
func init() {
input.InitDamageEffect(1, &Effect0{})
input.InitDamageEffect(0, &Effect0{})
}

View File

@@ -437,7 +437,7 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *SelectSk
if attacker.AttackValue.AttackTime > 0 { //如果命中
f.parseskill(attacker, defender, a) //命中后解析effect
spower := a.Skill.CalculatePower(defender.CurrentPet)
damage := attacker.GetDamageEffect(1)
damage := attacker.GetDamageEffect(0)
damage.Stack(int(spower.IntPart()))
attacker.Exec(func(t input.Effect) bool { //计算暴击率加成
@@ -514,7 +514,7 @@ func (f *FightC) enterturn(fattack, sattack BattleActionI) {
skill.Skill.Info.PP-- //减少PP
}
fmt.Println(i,
"玩家技能伤害:", attacker.GetDamageEffect(1),
"玩家技能伤害:", attacker.GetDamageEffect(0),
"自身剩余血量:", attacker.CurrentPet.Info.Hp,
"对手剩余血量:", defender.CurrentPet.Info.Hp,
)
@@ -548,9 +548,9 @@ func (f *FightC) enterturn(fattack, sattack BattleActionI) {
}
ret.FAttack.RemainHp = int32(f.First.CurrentPet.Info.Hp)
ret.FAttack.LostHp = uint32(f.First.GetDamageEffect(1).Stack()) //先手方造成血量
ret.FAttack.LostHp = uint32(f.First.GetDamageEffect(0).Stack()) //先手方造成血量
ret.SAttack.RemainHp = int32(f.Second.CurrentPet.Info.Hp)
ret.SAttack.LostHp = uint32(f.Second.GetDamageEffect(1).Stack()) //后手方造成血量
ret.SAttack.LostHp = uint32(f.Second.GetDamageEffect(0).Stack()) //后手方造成血量
for i := 0; i < 6; i++ { //堆叠属性提升
ret.FAttack.Prop[i] = int8(attacker.GetProp(i, true))

View File

@@ -27,7 +27,7 @@ type Input struct {
func NewInput(c common.FightI, p common.PlayerI) *Input {
ret := &Input{FightC: c, Player: p}
t:= ret.GetDamageEffect(1)
t := ret.GetDamageEffect(0)
ret.AddEffect(deepcopy.Copy(t).(Effect)) //添加默认基类,实现继承
p.SetFightC(c) //给玩家设置战斗容器
return ret
@@ -95,21 +95,6 @@ func (i *Input) GetStatusBonus() float64 {
// ItemID int // 使用的道具ID
// Statuses [20]byte // 异常状态数组存在的状态对应位置为1
// OwnedCount int // 已拥有数量(-1=保底0=锁定≥1=衰减)
// }
// 胶囊配置ItemID -> Bonus
// var capsuleBonuses = map[int]float64{
// 300001: 1.0, // 普通精灵胶囊
// 300002: 1.5, // 中级精灵胶囊
// 300003: 2.0, // 高级精灵胶囊
// 300004: 3.0, // 超级精灵胶囊
// 300005: 4.0, // 特级精灵胶囊
// 300006: 256.0, // 无敌精灵胶囊
// 300007: 256.0, // 超能胶囊
// 300008: 2.0, // 赫星精灵胶囊
// 300009: 256.0, // 时空精灵胶囊
// 300010: 256.0, // 无敌精灵胶囊Ω
// }
//
// -1是保底模式0是锁定模式》0是衰减模式
// Capture 执行捕捉 ,捕捉精灵,使用的道具,模式